summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD/FINISH.sh7
-rwxr-xr-xBUILD/SETUP.sh8
-rw-r--r--CMakeLists.txt2
-rw-r--r--VERSION2
-rw-r--r--client/mysql_upgrade.c9
-rw-r--r--client/mysqldump.c10
-rw-r--r--client/mysqltest.cc15
-rw-r--r--cmake/configure.pl15
-rw-r--r--cmake/cpack_rpm.cmake35
-rw-r--r--cmake/create_initial_db.cmake.in12
-rw-r--r--cmake/info_macros.cmake.in8
-rw-r--r--cmake/install_layout.cmake7
-rw-r--r--cmake/mysql_version.cmake2
-rw-r--r--cmake/package_name.cmake2
-rw-r--r--cmake/plugin.cmake1
-rw-r--r--debian/dist/Debian/mariadb-server-5.5.files1
-rwxr-xr-xdebian/dist/Debian/rules2
-rw-r--r--debian/dist/Ubuntu/mariadb-server-5.5.files1
-rwxr-xr-xdebian/dist/Ubuntu/rules2
-rwxr-xr-xdebian/patches/38_scripts__mysqld_safe.sh__signals.dpatch20
-rw-r--r--include/ma_dyncol.h2
-rw-r--r--include/my_pthread.h6
-rw-r--r--include/mysql/plugin.h19
-rw-r--r--include/mysql/plugin_audit.h.pp11
-rw-r--r--include/mysql/plugin_auth.h.pp11
-rw-r--r--include/mysql/plugin_ftparser.h.pp11
-rw-r--r--include/mysql/psi/mysql_thread.h17
-rw-r--r--include/mysql/service_kill_statement.h71
-rw-r--r--include/mysql/services.h1
-rw-r--r--include/mysql_com.h64
-rw-r--r--include/service_versions.h14
-rw-r--r--libmysql/CMakeLists.txt173
-rw-r--r--libmysql/libmysql_rpm_version.in48
-rw-r--r--libmysql/rpm_support.cc41
-rw-r--r--libmysqld/CMakeLists.txt15
-rw-r--r--libservices/CMakeLists.txt3
-rw-r--r--libservices/kill_statement_service.c18
-rw-r--r--mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc (renamed from mysql-test/include/mysqlbinlog_row_engine.inc)0
-rw-r--r--mysql-test/include/plugin.defs1
-rw-r--r--mysql-test/include/rpl_start_server.inc15
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl2
-rwxr-xr-xmysql-test/mysql-test-run.pl5
-rw-r--r--mysql-test/r/alias.result2
-rw-r--r--mysql-test/r/change_user_notembedded.result5
-rw-r--r--mysql-test/r/contributors.result2
-rw-r--r--mysql-test/r/create_delayed.result3
-rw-r--r--mysql-test/r/ctype_ucs.result26
-rw-r--r--mysql-test/r/ctype_utf16.result8
-rw-r--r--mysql-test/r/ctype_utf8.result8
-rw-r--r--mysql-test/r/datetime_456.result2
-rw-r--r--mysql-test/r/derived_view.result49
-rw-r--r--mysql-test/r/distinct.result32
-rw-r--r--mysql-test/r/failed_auth_3909.result21
-rw-r--r--mysql-test/r/func_gconcat.result5
-rw-r--r--mysql-test/r/func_misc.result33
-rw-r--r--mysql-test/r/func_time.result2
-rw-r--r--mysql-test/r/gis2.result14
-rw-r--r--mysql-test/r/grant_lowercase.result20
-rw-r--r--mysql-test/r/group_by.result86
-rw-r--r--mysql-test/r/group_by_innodb.result30
-rw-r--r--mysql-test/r/group_min_max.result7
-rw-r--r--mysql-test/r/handlersocket.result2
-rw-r--r--mysql-test/r/information_schema2.result8
-rw-r--r--mysql-test/r/innodb_mrr_cpk.result22
-rw-r--r--mysql-test/r/loaddata.result29
-rw-r--r--[-rwxr-xr-x]mysql-test/r/lowercase_table4.result0
-rw-r--r--mysql-test/r/mysql.result4
-rw-r--r--mysql-test/r/mysqltest.result6
-rw-r--r--mysql-test/r/partition_innodb.result20
-rw-r--r--mysql-test/r/plugin.result8
-rw-r--r--mysql-test/r/plugin_auth.result19
-rw-r--r--mysql-test/r/range.result46
-rw-r--r--mysql-test/r/range_mrr_icp.result46
-rw-r--r--mysql-test/r/show_check.result11
-rw-r--r--mysql-test/r/sp.result38
-rw-r--r--mysql-test/r/sp_notembedded.result5
-rw-r--r--mysql-test/r/subselect4.result47
-rw-r--r--mysql-test/r/subselect_innodb.result18
-rw-r--r--mysql-test/r/subselect_sj.result75
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result79
-rw-r--r--mysql-test/r/sum_distinct-big.result15
-rw-r--r--mysql-test/r/type_year.result1
-rw-r--r--mysql-test/r/update.result42
-rw-r--r--mysql-test/r/view.result41
-rw-r--r--mysql-test/suite/binlog/r/binlog_database.result6
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog-cp932.result (renamed from mysql-test/r/mysqlbinlog-cp932.result)0
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result (renamed from mysql-test/r/mysqlbinlog2.result)0
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_base64.result (renamed from mysql-test/r/mysqlbinlog_base64.result)0
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result (renamed from mysql-test/r/mysqlbinlog_row.result)382
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result (renamed from mysql-test/r/mysqlbinlog_row_innodb.result)202
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result (renamed from mysql-test/r/mysqlbinlog_row_myisam.result)202
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result (renamed from mysql-test/r/mysqlbinlog_row_trans.result)56
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_annotate.result192
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result56
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result56
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt (renamed from mysql-test/t/mysqlbinlog-cp932-master.opt)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test (renamed from mysql-test/t/mysqlbinlog-cp932.test)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog2-master.opt (renamed from mysql-test/t/mysqlbinlog2-master.opt)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test (renamed from mysql-test/t/mysqlbinlog2.test)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test (renamed from mysql-test/t/mysqlbinlog_base64.test)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row-master.opt (renamed from mysql-test/t/mysqlbinlog_row-master.opt)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test (renamed from mysql-test/t/mysqlbinlog_row.test)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb-master.opt (renamed from mysql-test/t/mysqlbinlog_row_innodb-master.opt)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test (renamed from mysql-test/t/mysqlbinlog_row_innodb.test)2
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam-master.opt (renamed from mysql-test/t/mysqlbinlog_row_myisam-master.opt)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test (renamed from mysql-test/t/mysqlbinlog_row_myisam.test)2
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans-master.opt (renamed from mysql-test/t/mysqlbinlog_row_trans-master.opt)0
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test (renamed from mysql-test/t/mysqlbinlog_row_trans.test)0
-rw-r--r--mysql-test/suite/innodb/r/auto_increment_dup.result2
-rw-r--r--mysql-test/suite/innodb/r/binlog_consistent.result16
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result40
-rw-r--r--mysql-test/suite/innodb/r/innodb-zip.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug14704286.result53
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug53591.result2
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/innodb/r/innodb_bug60196.result0
-rw-r--r--mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result2
-rw-r--r--mysql-test/suite/innodb/t/auto_increment_dup.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.opt (renamed from mysql-test/suite/innodb/t/innodb-autoinc-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test22
-rw-r--r--mysql-test/suite/innodb/t/innodb-zip.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14704286.test95
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug53591.test4
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/innodb/t/innodb_bug57904.test0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/innodb/t/innodb_bug60196-master.opt0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/innodb/t/innodb_bug60196.test0
-rw-r--r--mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test5
-rw-r--r--mysql-test/suite/maria/truncate.result12
-rw-r--r--mysql-test/suite/maria/truncate.test13
-rw-r--r--mysql-test/suite/perfschema/include/upgrade_check.inc2
-rw-r--r--mysql-test/suite/perfschema/r/func_file_io.result17
-rw-r--r--mysql-test/suite/perfschema/r/func_mutex.result25
-rw-r--r--mysql-test/suite/perfschema/r/pfs_upgrade.result180
-rw-r--r--mysql-test/suite/perfschema/t/func_file_io.test7
-rw-r--r--mysql-test/suite/perfschema/t/func_mutex.test13
-rw-r--r--mysql-test/suite/plugins/r/audit_null_debug.result12
-rw-r--r--mysql-test/suite/plugins/t/audit_null_debug.test27
-rw-r--r--mysql-test/suite/rpl/r/rpl_password_boundaries.result59
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync.result29
-rw-r--r--mysql-test/suite/rpl/t/rpl_password_boundaries.test112
-rw-r--r--mysql-test/suite/rpl/t/rpl_semi_sync.test13
-rw-r--r--mysql-test/suite/sphinx/sphinx.result13
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result3
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_locking_fake_changes_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_max_bitmap_file_size_basic.result1
-rw-r--r--mysql-test/suite/sys_vars/r/pseudo_thread_id_basic.result3
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test4
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_locking_fake_changes_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_max_bitmap_file_size_basic.test1
-rw-r--r--mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test3
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result11
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test19
-rw-r--r--mysql-test/t/alias.test11
-rw-r--r--mysql-test/t/change_user_notembedded.test24
-rw-r--r--mysql-test/t/create_delayed.test34
-rw-r--r--mysql-test/t/ctype_ucs.test32
-rw-r--r--mysql-test/t/ctype_utf16.test4
-rw-r--r--mysql-test/t/ctype_utf8.test5
-rw-r--r--mysql-test/t/derived_view.test61
-rw-r--r--mysql-test/t/distinct.test25
-rw-r--r--mysql-test/t/failed_auth_3909.test37
-rw-r--r--mysql-test/t/func_gconcat.test10
-rw-r--r--mysql-test/t/func_misc.test19
-rw-r--r--mysql-test/t/gis2.test17
-rw-r--r--mysql-test/t/grant_lowercase.opt1
-rw-r--r--mysql-test/t/grant_lowercase.test31
-rw-r--r--mysql-test/t/group_by.test78
-rw-r--r--mysql-test/t/group_by_innodb.test38
-rw-r--r--mysql-test/t/group_min_max.test9
-rw-r--r--mysql-test/t/information_schema2.test9
-rw-r--r--mysql-test/t/innodb_mrr_cpk.test26
-rw-r--r--mysql-test/t/loaddata.test62
-rw-r--r--[-rwxr-xr-x]mysql-test/t/lowercase_table4-master.opt0
-rw-r--r--[-rwxr-xr-x]mysql-test/t/lowercase_table4.test0
-rw-r--r--mysql-test/t/mysql.test12
-rw-r--r--mysql-test/t/mysqlshow.test2
-rw-r--r--mysql-test/t/partition_innodb.test15
-rw-r--r--mysql-test/t/plugin.test18
-rw-r--r--mysql-test/t/plugin_auth.test26
-rw-r--r--mysql-test/t/range.test55
-rw-r--r--[-rwxr-xr-x]mysql-test/t/range_vs_index_merge.test0
-rw-r--r--[-rwxr-xr-x]mysql-test/t/range_vs_index_merge_innodb.test0
-rw-r--r--mysql-test/t/show_check.test14
-rw-r--r--mysql-test/t/sp.test20
-rw-r--r--mysql-test/t/sp_notembedded.test21
-rw-r--r--mysql-test/t/subselect4.test51
-rw-r--r--mysql-test/t/subselect_innodb.test14
-rw-r--r--mysql-test/t/subselect_sj.test69
-rw-r--r--mysql-test/t/sum_distinct-big.test17
-rw-r--r--mysql-test/t/update.test41
-rw-r--r--mysql-test/t/view.test47
-rw-r--r--mysql-test/valgrind.supp8
-rw-r--r--mysys/my_redel.c10
-rw-r--r--packaging/rpm-uln/CMakeLists.txt38
-rw-r--r--packaging/rpm-uln/README-ULN15
-rw-r--r--packaging/rpm-uln/README.mysql-docs4
-rwxr-xr-xpackaging/rpm-uln/filter-requires-mysql.sh3
-rwxr-xr-xpackaging/rpm-uln/generate-tarball.sh15
-rw-r--r--packaging/rpm-uln/my.cnf10
-rw-r--r--packaging/rpm-uln/my_config.h29
-rw-r--r--packaging/rpm-uln/mysql-5.5-errno.patch21
-rw-r--r--packaging/rpm-uln/mysql-5.5-fix-tests.patch34
-rw-r--r--packaging/rpm-uln/mysql-5.5-libdir.patch28
-rw-r--r--packaging/rpm-uln/mysql-5.5-mtr1.patch25
-rw-r--r--packaging/rpm-uln/mysql-5.5-stack-guard.patch140
-rw-r--r--packaging/rpm-uln/mysql-5.5-testing.patch23
-rw-r--r--packaging/rpm-uln/mysql-chain-certs.patch45
-rw-r--r--packaging/rpm-uln/mysql-embedded-check.c26
-rw-r--r--packaging/rpm-uln/mysql-expired-certs.patch555
-rw-r--r--packaging/rpm-uln/mysql-install-test.patch33
-rw-r--r--packaging/rpm-uln/mysql-strmov.patch32
-rw-r--r--packaging/rpm-uln/mysql.init209
-rw-r--r--packaging/rpm-uln/mysql.spec.sh1959
-rw-r--r--packaging/rpm-uln/scriptstub.c32
-rw-r--r--plugin/feedback/utils.cc6
-rw-r--r--scripts/CMakeLists.txt8
-rw-r--r--scripts/mysql_install_db.pl.in17
-rw-r--r--scripts/mysql_install_db.sh7
-rw-r--r--scripts/mysql_performance_tables.sql402
-rw-r--r--scripts/mysql_system_tables.sql379
-rw-r--r--scripts/mysql_system_tables_fix.sql23
-rw-r--r--scripts/mysqlaccess.sh6
-rw-r--r--scripts/mysqld_multi.sh22
-rw-r--r--scripts/mysqld_safe.sh83
-rw-r--r--sql-common/client.c4
-rw-r--r--sql/CMakeLists.txt4
-rw-r--r--sql/event_db_repository.cc10
-rw-r--r--sql/field.cc15
-rw-r--r--sql/field.h1
-rw-r--r--sql/filesort.cc29
-rw-r--r--sql/ha_ndbcluster_binlog.cc1
-rw-r--r--sql/ha_partition.cc216
-rw-r--r--sql/ha_partition.h4
-rw-r--r--sql/handler.cc66
-rw-r--r--sql/handler.h9
-rw-r--r--sql/hostname.cc56
-rw-r--r--sql/item.cc20
-rw-r--r--sql/item.h43
-rw-r--r--sql/item_cmpfunc.cc24
-rw-r--r--sql/item_cmpfunc.h28
-rw-r--r--sql/item_func.cc43
-rw-r--r--sql/item_func.h73
-rw-r--r--sql/item_geofunc.cc4
-rw-r--r--sql/item_geofunc.h30
-rw-r--r--sql/item_row.cc5
-rw-r--r--sql/item_strfunc.cc38
-rw-r--r--sql/item_strfunc.h29
-rw-r--r--sql/item_subselect.cc31
-rw-r--r--sql/item_sum.cc56
-rw-r--r--sql/item_sum.h2
-rw-r--r--sql/item_timefunc.cc21
-rw-r--r--sql/item_timefunc.h42
-rw-r--r--sql/item_xmlfunc.cc1
-rw-r--r--sql/item_xmlfunc.h8
-rw-r--r--sql/log.cc59
-rw-r--r--sql/log_event.cc88
-rw-r--r--sql/log_event.h6
-rw-r--r--sql/log_event_old.cc7
-rw-r--r--sql/mdl.cc12
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/mysqld.h2
-rw-r--r--sql/opt_range.cc110
-rw-r--r--sql/opt_range.h2
-rw-r--r--sql/opt_range_mrr.cc1
-rw-r--r--sql/opt_subselect.cc4
-rw-r--r--sql/records.cc10
-rw-r--r--sql/rpl_mi.h6
-rw-r--r--sql/rpl_rli.cc3
-rw-r--r--sql/sp.cc16
-rw-r--r--sql/sp_head.cc50
-rw-r--r--sql/sp_rcontext.cc13
-rw-r--r--sql/sp_rcontext.h45
-rw-r--r--sql/sql_acl.cc240
-rw-r--r--sql/sql_audit.cc45
-rw-r--r--sql/sql_audit.h2
-rw-r--r--sql/sql_base.cc7
-rw-r--r--sql/sql_class.cc71
-rw-r--r--sql/sql_class.h20
-rw-r--r--sql/sql_connect.cc13
-rw-r--r--sql/sql_const.h4
-rw-r--r--sql/sql_db.cc5
-rw-r--r--sql/sql_handler.cc29
-rw-r--r--sql/sql_help.cc10
-rw-r--r--sql/sql_insert.cc50
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_list.h11
-rw-r--r--sql/sql_load.cc4
-rw-r--r--sql/sql_parse.cc46
-rw-r--r--sql/sql_plugin.cc42
-rw-r--r--sql/sql_plugin_services.h15
-rw-r--r--sql/sql_priv.h35
-rw-r--r--sql/sql_profile.cc29
-rw-r--r--sql/sql_profile.h6
-rw-r--r--sql/sql_repl.cc42
-rw-r--r--sql/sql_repl.h4
-rw-r--r--sql/sql_select.cc221
-rw-r--r--sql/sql_show.cc30
-rw-r--r--sql/sql_signal.cc12
-rw-r--r--sql/sql_statistics.cc2
-rw-r--r--sql/sql_time.cc4
-rw-r--r--sql/sql_truncate.cc3
-rw-r--r--sql/sql_union.cc2
-rw-r--r--sql/sql_update.cc25
-rw-r--r--sql/sql_yacc.yy8
-rw-r--r--sql/table.cc50
-rw-r--r--sql/table.h3
-rw-r--r--sql/tztime.cc32
-rw-r--r--sql/uniques.cc157
-rw-r--r--storage/innobase/btr/btr0btr.c32
-rw-r--r--storage/innobase/btr/btr0cur.c26
-rw-r--r--storage/innobase/buf/buf0buf.c7
-rw-r--r--storage/innobase/buf/buf0lru.c4
-rw-r--r--storage/innobase/dict/dict0dict.c45
-rw-r--r--storage/innobase/fil/fil0fil.c71
-rw-r--r--storage/innobase/handler/ha_innodb.cc74
-rw-r--r--storage/innobase/handler/ha_innodb.h9
-rw-r--r--storage/innobase/handler/handler0alter.cc8
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.c38
-rw-r--r--storage/innobase/include/btr0cur.h2
-rw-r--r--storage/innobase/include/dict0dict.h12
-rw-r--r--storage/innobase/include/dict0mem.h7
-rw-r--r--storage/innobase/include/page0zip.h8
-rw-r--r--storage/innobase/include/row0undo.h7
-rw-r--r--storage/innobase/include/row0upd.ic3
-rw-r--r--storage/innobase/include/univ.i18
-rw-r--r--storage/innobase/log/log0recv.c5
-rw-r--r--storage/innobase/os/os0file.c13
-rw-r--r--storage/innobase/page/page0cur.c6
-rw-r--r--storage/innobase/page/page0page.c14
-rw-r--r--storage/innobase/page/page0zip.c157
-rw-r--r--storage/innobase/row/row0mysql.c5
-rw-r--r--storage/innobase/row/row0sel.c27
-rw-r--r--storage/innobase/row/row0umod.c53
-rw-r--r--storage/innobase/row/row0undo.c19
-rw-r--r--storage/maria/ha_maria.cc3
-rw-r--r--storage/myisam/mi_open.c3
-rw-r--r--storage/myisam/myisamchk.c9
-rw-r--r--storage/perfschema/pfs.cc2
-rw-r--r--storage/sphinx/ha_sphinx.cc12
-rw-r--r--storage/xtradb/btr/btr0cur.c68
-rw-r--r--storage/xtradb/btr/btr0pcur.c1
-rw-r--r--storage/xtradb/buf/buf0lru.c40
-rw-r--r--storage/xtradb/buf/buf0rea.c4
-rw-r--r--storage/xtradb/fsp/fsp0fsp.c6
-rw-r--r--storage/xtradb/handler/ha_innodb.cc83
-rw-r--r--storage/xtradb/handler/ha_innodb.h1
-rw-r--r--storage/xtradb/handler/i_s.cc282
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.c2
-rw-r--r--storage/xtradb/include/btr0btr.h5
-rw-r--r--storage/xtradb/include/btr0cur.h5
-rw-r--r--storage/xtradb/include/log0online.h104
-rw-r--r--storage/xtradb/include/srv0srv.h7
-rw-r--r--storage/xtradb/include/univ.i2
-rw-r--r--storage/xtradb/include/ut0ut.h9
-rw-r--r--storage/xtradb/include/ut0ut.ic13
-rw-r--r--storage/xtradb/lock/lock0lock.c18
-rw-r--r--storage/xtradb/log/log0log.c4
-rw-r--r--storage/xtradb/log/log0online.c829
-rw-r--r--storage/xtradb/os/os0file.c6
-rw-r--r--storage/xtradb/row/row0ins.c7
-rw-r--r--storage/xtradb/row/row0mysql.c28
-rw-r--r--storage/xtradb/row/row0upd.c3
-rw-r--r--storage/xtradb/srv/srv0srv.c6
-rw-r--r--storage/xtradb/srv/srv0start.c35
-rw-r--r--strings/ctype-ucs2.c3
-rw-r--r--support-files/compiler_warnings.supp15
-rw-r--r--support-files/mysql.spec.sh41
-rw-r--r--tests/mysql_client_test.c180
-rw-r--r--win/create_def_file.js1
372 files changed, 11030 insertions, 2959 deletions
diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh
index b7ff195ccf6..e29b6936849 100644
--- a/BUILD/FINISH.sh
+++ b/BUILD/FINISH.sh
@@ -27,6 +27,11 @@ then
configure="$configure --print"
fi
+if test "$AM_EXTRA_MAKEFLAGS" = "VERBOSE=1" -o "$verbose_make" = "1"
+then
+ configure="$configure --verbose"
+fi
+
commands="\
/bin/rm -rf configure;
/bin/rm -rf CMakeCache.txt CMakeFiles/
@@ -45,7 +50,7 @@ if [ -z "$just_configure" -a -z "$just_clean" ]
then
commands="$commands
-$make $AM_MAKEFLAGS $AM_EXTRA_MAKEFLAGS $EXTRA_MAKEFLAGS"
+$make $AM_MAKEFLAGS $AM_EXTRA_MAKEFLAGS"
if [ "x$strip" = "xyes" ]
then
diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh
index 5154f64b98f..a4853c823ab 100755
--- a/BUILD/SETUP.sh
+++ b/BUILD/SETUP.sh
@@ -30,6 +30,11 @@ Usage: $0 [-h|-n] [configure-options]
-h, --help Show this help message.
-n, --just-print Don't actually run any commands; just print them.
-c, --just-configure Stop after running configure.
+ --extra-configs=xxx Add this to configure options
+ --extra-flags=xxx Add this C and CXX flags
+ --extra-cflags=xxx Add this to C flags
+ --extra-cxxflags=xxx Add this to CXX flags
+ --verbose Print out full compile lines
--with-debug=full Build with full debug(no optimizations, keep call stack).
--warning-mode=[old|pedantic|maintainer]
Influences the debug flags. Old is default.
@@ -64,6 +69,8 @@ parse_options()
just_configure=1;;
-n | --just-print | --print)
just_print=1;;
+ --verbose)
+ verbose_make=1;;
-h | --help)
usage
exit 0;;
@@ -89,6 +96,7 @@ just_configure=
warning_mode=
maintainer_mode=
full_debug=
+verbose_make=
parse_options "$@"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 84a2a1d625b..1b29c559415 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,7 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6)
CMAKE_POLICY(VERSION 2.8)
endif()
+MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
@@ -324,6 +325,7 @@ IF(NOT WITHOUT_SERVER)
IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt)
ADD_SUBDIRECTORY(internal)
ENDIF()
+ ADD_SUBDIRECTORY(packaging/rpm-uln)
ENDIF()
IF(UNIX)
diff --git a/VERSION b/VERSION
index 1bff368662b..2dacb98ef55 100644
--- a/VERSION
+++ b/VERSION
@@ -4,5 +4,5 @@
#
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=0
-MYSQL_VERSION_PATCH=0
+MYSQL_VERSION_PATCH=1
MYSQL_VERSION_EXTRA=
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index 71bc936cfe6..7aaad96e985 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -22,7 +22,7 @@
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
-#define VER "1.2"
+#define VER "1.3"
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
@@ -148,6 +148,8 @@ static struct my_option my_long_options[]=
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process.",
&opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+ {"version", 'V', "Output version information and exit.", 0, 0, 0,
+ GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG,
"All commands including mysqlcheck are binlogged. Enabled by default;"
"use --skip-write-binlog when commands should not be sent to replication slaves.",
@@ -298,6 +300,11 @@ get_one_option(int optid, const struct my_option *opt,
}
add_option= 0;
break;
+ case 'V':
+ printf("%s Ver %s Distrib %s, for %s (%s)\n",
+ my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+ die(0);
+ break;
case OPT_SILENT:
opt_verbose= 0;
add_option= 0;
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 2b94e65aa0b..a1789beae68 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -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
@@ -1182,13 +1182,13 @@ check_consistent_binlog_pos(char *binlog_pos_file, char *binlog_pos_offset)
found= 0;
while ((row= mysql_fetch_row(res)))
{
- if (0 == strcmp(row[0], "binlog_snapshot_file"))
+ if (0 == strcmp(row[0], "Binlog_snapshot_file"))
{
if (binlog_pos_file)
strmake(binlog_pos_file, row[1], FN_REFLEN-1);
found++;
}
- else if (0 == strcmp(row[0], "binlog_snapshot_position"))
+ else if (0 == strcmp(row[0], "Binlog_snapshot_position"))
{
if (binlog_pos_offset)
strmake(binlog_pos_offset, row[1], LONGLONG_LEN);
@@ -2549,7 +2549,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
verbose_msg("-- Retrieving table structure for table %s...\n", table);
len= my_snprintf(query_buff, sizeof(query_buff),
- "SET OPTION SQL_QUOTE_SHOW_CREATE=%d",
+ "SET SQL_QUOTE_SHOW_CREATE=%d",
(opt_quoted || opt_keywords));
if (!create_options)
strmov(query_buff+len,
@@ -5292,7 +5292,7 @@ static my_bool get_view_structure(char *table, char* db)
verbose_msg("-- Retrieving view structure for table %s...\n", table);
#ifdef NOT_REALLY_USED_YET
- sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d",
+ sprintf(insert_pat,"SET SQL_QUOTE_SHOW_CREATE=%d",
(opt_quoted || opt_keywords));
#endif
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 9082beed884..2cca53f4e74 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -1660,12 +1660,12 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename)
{
int fd;
size_t len;
- char buff[512];
+ char buff[16384];
if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0)
return 1;
while((len= my_read(fd, (uchar*)&buff,
- sizeof(buff), MYF(0))) > 0)
+ sizeof(buff)-1, MYF(0))) > 0)
{
char *p= buff, *start= buff;
while (p < buff+len)
@@ -1676,7 +1676,8 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename)
/* Add fake newline instead of cr and output the line */
*p= '\n';
p++; /* Step past the "fake" newline */
- dynstr_append_mem(ds, start, p-start);
+ *p= 0;
+ replace_dynstr_append_mem(ds, start, p-start);
p++; /* Step past the "fake" newline */
start= p;
}
@@ -1684,7 +1685,8 @@ int cat_file(DYNAMIC_STRING* ds, const char* filename)
p++;
}
/* Output any chars that migh be left */
- dynstr_append_mem(ds, start, p-start);
+ *p= 0;
+ replace_dynstr_append_mem(ds, start, p-start);
}
my_close(fd, MYF(0));
return 0;
@@ -4397,7 +4399,10 @@ void do_change_user(struct st_command *command)
cur_con->name, ds_user.str, ds_passwd.str, ds_db.str));
if (mysql_change_user(mysql, ds_user.str, ds_passwd.str, ds_db.str))
- die("change user failed: %s", mysql_error(mysql));
+ handle_error(command, mysql_errno(mysql), mysql_error(mysql),
+ mysql_sqlstate(mysql), &ds_res);
+ else
+ handle_no_error(command);
dynstr_free(&ds_user);
dynstr_free(&ds_passwd);
diff --git a/cmake/configure.pl b/cmake/configure.pl
index 3a7d187c0be..51e83c2815c 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -222,6 +222,21 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DENABLE_GCOV=ON";
next;
}
+ if ($option =~ /verbose/)
+ {
+ $cmakeargs = $cmakeargs." -DCMAKE_VERBOSE_MAKEFILE=1";
+ next;
+ }
+ if ($option =~ /with-client-ldflags/)
+ {
+ print("configure.pl : ignoring $option\n");
+ next;
+ }
+ if ($option =~ /with-mysqld-ldflags=/)
+ {
+ print("configure.pl : ignoring $option\n");
+ next;
+ }
$option = uc($option);
$option =~ s/-/_/g;
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index 94cac6526d9..40e71e68e5b 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -66,10 +66,31 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}
SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common")
SET(CPACK_RPM_CassandraSE_PACKAGE_REQUIRES "MariaDB-server")
-SET(CPACK_RPM_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d" "%config(noreplace) /etc/my.cnf.d/*")
-SET(CPACK_RPM_common_USER_FILELIST "%config(noreplace) /etc/my.cnf")
-SET(CPACK_RPM_shared_USER_FILELIST "%config(noreplace) /etc/my.cnf.d/*")
-SET(CPACK_RPM_client_USER_FILELIST "%config(noreplace) /etc/my.cnf.d/*")
+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*"
+ )
+
+SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
+SET(CPACK_RPM_common_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf")
+SET(CPACK_RPM_shared_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
+SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
+SET(CPACK_RPM_compat_USER_FILELIST ${ignored})
+SET(CPACK_RPM_devel_USER_FILELIST ${ignored})
+SET(CPACK_RPM_test_USER_FILELIST ${ignored})
SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MySQL-client MySQL-OurDelta-client")
SET(CPACK_RPM_client_PACKAGE_PROVIDES "MariaDB-client MySQL-client mysql-client")
@@ -90,8 +111,8 @@ SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files
SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh)
SET(CPACK_RPM_server_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postun.sh)
-SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MySQL-shared MySQL-OurDelta-shared")
-SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared libmysqlclient.so.18 libmysqlclient.so.18(libmysqlclient_16) libmysqlclient.so.18(libmysqlclient_18) libmysqlclient_r.so.18 libmysqlclient_r.so.18(libmysqlclient_18)")
+SET(CPACK_RPM_shared_PACKAGE_OBSOLETES "mysql-shared MySQL-shared-standard MySQL-shared-pro MySQL-shared-pro-cert MySQL-shared-pro-gpl MySQL-shared-pro-gpl-cert MySQL-shared MySQL-OurDelta-shared mysql-libs")
+SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared libmysqlclient.so.18 libmysqlclient.so.18(libmysqlclient_16) libmysqlclient.so.18(libmysqlclient_18) libmysqlclient_r.so.18 libmysqlclient_r.so.18(libmysqlclient_18) mysql-libs")
SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
@@ -99,7 +120,7 @@ SET(CPACK_RPM_test_PACKAGE_OBSOLETES "mysql-test MySQL-test MySQL-OurDelta-test"
SET(CPACK_RPM_test_PACKAGE_PROVIDES "MariaDB-test MySQL-test mysql-test")
# workaround for lots of perl dependencies added by rpmbuild
-SET(CPACK_RPM_test_PACKAGE_PROVIDES "${CPACK_RPM_test_PACKAGE_PROVIDES} perl(lib::mtr_gcov.pl) perl(lib::mtr_gprof.pl) perl(lib::mtr_io.pl) perl(lib::mtr_misc.pl) perl(lib::mtr_process.pl) perl(lib::v1/mtr_cases.pl) perl(lib::v1/mtr_gcov.pl) perl(lib::v1/mtr_gprof.pl) perl(lib::v1/mtr_im.pl) perl(lib::v1/mtr_io.pl) perl(lib::v1/mtr_match.pl) perl(lib::v1/mtr_misc.pl) perl(lib::v1/mtr_process.pl) perl(lib::v1/mtr_report.pl) perl(lib::v1/mtr_stress.pl) perl(lib::v1/mtr_timer.pl) perl(lib::v1/mtr_unique.pl) perl(mtr_misc.pl)")
+SET(CPACK_RPM_test_PACKAGE_PROVIDES "${CPACK_RPM_test_PACKAGE_PROVIDES} perl(lib::mtr_gcov.pl) perl(lib::mtr_gprof.pl) perl(lib::mtr_io.pl) perl(lib::mtr_misc.pl) perl(lib::mtr_process.pl) perl(lib::v1/mtr_cases.pl) perl(lib::v1/mtr_gcov.pl) perl(lib::v1/mtr_gprof.pl) perl(lib::v1/mtr_im.pl) perl(lib::v1/mtr_io.pl) perl(lib::v1/mtr_match.pl) perl(lib::v1/mtr_misc.pl) perl(lib::v1/mtr_process.pl) perl(lib::v1/mtr_report.pl) perl(lib::v1/mtr_stress.pl) perl(lib::v1/mtr_timer.pl) perl(lib::v1/mtr_unique.pl) perl(mtr_cases) perl(mtr_io.pl) perl(mtr_match) perl(mtr_misc.pl) perl(mtr_report) perl(mtr_results) perl(mtr_unique)")
# If we want to build build MariaDB-shared-compat,
# extract compat libraries from MariaDB-shared-5.3 rpm
diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake.in
index e37f41255e0..9888a7df7a2 100644
--- a/cmake/create_initial_db.cmake.in
+++ b/cmake/create_initial_db.cmake.in
@@ -31,7 +31,7 @@ ENDIF()
# Create bootstrapper SQL script
FILE(WRITE bootstrap.sql "use mysql;\n" )
-FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql)
+FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql mysql_performance_tables.sql)
FILE(STRINGS ${CMAKE_SOURCE_DIR}/scripts/${FILENAME} CONTENTS)
FOREACH(STR ${CONTENTS})
IF(NOT STR MATCHES "@current_hostname")
@@ -69,10 +69,13 @@ EXECUTE_PROCESS(
COMMAND "@CMAKE_COMMAND@" -E echo Executing ${BOOTSTRAP_COMMAND}
)
EXECUTE_PROCESS (
- COMMAND "@CMAKE_COMMAND@" -E echo input file bootstrap.sql, current directory ${CWD}
+ COMMAND "@CMAKE_COMMAND@" -E
+ echo input file bootstrap.sql, current directory ${CWD}
)
EXECUTE_PROCESS (
- COMMAND ${BOOTSTRAP_COMMAND} INPUT_FILE bootstrap.sql OUTPUT_VARIABLE OUT
+ COMMAND ${BOOTSTRAP_COMMAND}
+ INPUT_FILE bootstrap.sql
+ OUTPUT_VARIABLE OUT
ERROR_VARIABLE ERR
RESULT_VARIABLE RESULT
)
@@ -81,3 +84,6 @@ IF(NOT RESULT EQUAL 0)
MESSAGE(FATAL_ERROR "Could not create initial database \n ${OUT} \n ${ERR}")
ENDIF()
+EXECUTE_PROCESS (
+ COMMAND "@CMAKE_COMMAND@" -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
+)
diff --git a/cmake/info_macros.cmake.in b/cmake/info_macros.cmake.in
index 9e08cffb2bf..9f40a419c61 100644
--- a/cmake/info_macros.cmake.in
+++ b/cmake/info_macros.cmake.in
@@ -1,4 +1,4 @@
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -82,9 +82,11 @@ MACRO(CREATE_INFO_BIN)
FILE(WRITE ${INFO_BIN} "===== Information about the build process: =====\n")
IF (WIN32)
- EXECUTE_PROCESS(COMMAND cmd /c date /T OUTPUT_VARIABLE TMP_DATE)
+ EXECUTE_PROCESS(COMMAND cmd /c date /T
+ OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
ELSEIF(UNIX)
- EXECUTE_PROCESS(COMMAND date "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
+ EXECUTE_PROCESS(COMMAND date "+%Y-%m-%d %H:%M:%S"
+ OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
ELSE()
SET(TMP_DATE "(no date command known for this platform)")
ENDIF()
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake
index 3ad6da5d433..0542b8d2e21 100644
--- a/cmake/install_layout.cmake
+++ b/cmake/install_layout.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -100,7 +100,10 @@ ENDIF()
# just use if(INSTALL_PLUGINTESTDIR).
# The plugin must set its own install path for tests
#
-FILE(GLOB plugin_tests ${CMAKE_SOURCE_DIR}/plugin/*/tests)
+FILE(GLOB plugin_tests
+ ${CMAKE_SOURCE_DIR}/plugin/*/tests
+ ${CMAKE_SOURCE_DIR}/internal/plugin/*/tests
+)
#
# STANDALONE layout
diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake
index ce6ff994eda..9dd2dfed1e6 100644
--- a/cmake/mysql_version.cmake
+++ b/cmake/mysql_version.cmake
@@ -56,7 +56,7 @@ IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR
ENDIF()
SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}")
- MESSAGE("-- MariaDB ${VERSION}")
+ MESSAGE(STATUS "MariaDB ${VERSION}")
SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version")
SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}")
# Use NDBVERSION irregardless of whether this is Cluster or not, if not
diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake
index 5c99a110e7c..93e7d968b2a 100644
--- a/cmake/package_name.cmake
+++ b/cmake/package_name.cmake
@@ -130,7 +130,7 @@ IF(NOT VERSION)
SET(package_name "mariadb${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}")
ENDIF()
- MESSAGE("-- Packaging as: ${package_name}")
+ MESSAGE(STATUS "Packaging as: ${package_name}")
# Sometimes package suffix is added (something like "-icc-glibc23")
IF(PACKAGE_SUFFIX)
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 524f368c6d7..2978fb1a13c 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -39,6 +39,7 @@ MACRO(PLUGIN_APPEND_COLLECTIONS plugin)
GET_FILENAME_COMPONENT(fname ${cfile} NAME)
FILE(APPEND ${CMAKE_SOURCE_DIR}/mysql-test/collections/${fname} "${contents}")
FILE(APPEND ${fcopied} "${fname}\n")
+ MESSAGE(STATUS "Appended ${cfile}")
ENDFOREACH()
ENDIF()
ENDMACRO()
diff --git a/debian/dist/Debian/mariadb-server-5.5.files b/debian/dist/Debian/mariadb-server-5.5.files
index b236d19a2c5..ad2153fe28b 100644
--- a/debian/dist/Debian/mariadb-server-5.5.files
+++ b/debian/dist/Debian/mariadb-server-5.5.files
@@ -61,4 +61,5 @@ usr/share/mysql/errmsg-utf8.txt
usr/share/mysql/fill_help_tables.sql
usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql_system_tables.sql
+usr/share/mysql/mysql_performance_tables.sql
usr/share/mysql/mysql_test_data_timezone.sql
diff --git a/debian/dist/Debian/rules b/debian/dist/Debian/rules
index 96ad527542d..feef863c5eb 100755
--- a/debian/dist/Debian/rules
+++ b/debian/dist/Debian/rules
@@ -84,7 +84,7 @@ build-stamp: configure
@echo "RULES.$@"
dh_testdir
- cd $(builddir) && $(MAKE) $(MAKE_J)
+ cd $(builddir) && $(MAKE) $(MAKE_J) $(AM_EXTRA_MAKEFLAGS)
ifeq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),)
# Don't know why the following is necessary...
diff --git a/debian/dist/Ubuntu/mariadb-server-5.5.files b/debian/dist/Ubuntu/mariadb-server-5.5.files
index e88e52689ae..d201577f7cf 100644
--- a/debian/dist/Ubuntu/mariadb-server-5.5.files
+++ b/debian/dist/Ubuntu/mariadb-server-5.5.files
@@ -63,4 +63,5 @@ usr/share/mysql/errmsg-utf8.txt
usr/share/mysql/fill_help_tables.sql
usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql_system_tables.sql
+usr/share/mysql/mysql_performance_tables.sql
usr/share/mysql/mysql_test_data_timezone.sql
diff --git a/debian/dist/Ubuntu/rules b/debian/dist/Ubuntu/rules
index bb413ad83cc..2852864c5a0 100755
--- a/debian/dist/Ubuntu/rules
+++ b/debian/dist/Ubuntu/rules
@@ -84,7 +84,7 @@ build-stamp: configure
@echo "RULES.$@"
dh_testdir
- cd $(builddir) && $(MAKE) $(MAKE_J)
+ cd $(builddir) && $(MAKE) $(MAKE_J) $(AM_EXTRA_MAKEFLAGS)
ifeq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),)
# Don't know why the following is necessary...
diff --git a/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch b/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch
index 4a51eac8a45..81c1baf4375 100755
--- a/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch
+++ b/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch
@@ -7,18 +7,17 @@
@DPATCH@
---- old/scripts/mysqld_safe.sh 2006-07-29 13:12:34.000000000 +0200
-+++ old/scripts/mysqld_safe.sh 2006-07-29 13:14:08.000000000 +0200
-@@ -16,8 +16,6 @@
- # This command can be used as pipe to syslog. With "-s" it also logs to stderr.
- ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i"
+--- a/scripts/mysqld_safe.sh 2013-01-11 16:02:41 +0000
++++ b/scripts/mysqld_safe.sh 2013-01-11 16:03:14 +0000
+@@ -30,7 +30,6 @@
+ syslog_tag_mysqld=mysqld
+ syslog_tag_mysqld_safe=mysqld_safe
-trap '' 1 2 3 15 # we shouldn't let anyone kill us
--
- umask 007
- defaults=
-@@ -122,7 +122,7 @@
+ # MySQL-specific environment variable. First off, it's not really a umask,
+ # it's the desired mode. Second, it follows umask(2), not umask(3) in that
+@@ -156,7 +155,7 @@
# sed buffers output (only GNU sed supports a -u (unbuffered) option)
# which means that messages may not get sent to syslog until the
# mysqld process quits.
@@ -27,7 +26,7 @@
;;
*)
echo "Internal program error (non-fatal):" \
-@@ -352,6 +350,13 @@
+@@ -758,6 +757,13 @@
fi
#
@@ -41,3 +40,4 @@
# Uncomment the following lines if you want all tables to be automatically
# checked and repaired during startup. You should add sensible key_buffer
# and sort_buffer values to my.cnf to improve check performance or require
+
diff --git a/include/ma_dyncol.h b/include/ma_dyncol.h
index c57aad1f1be..ed5eb1e6bae 100644
--- a/include/ma_dyncol.h
+++ b/include/ma_dyncol.h
@@ -112,8 +112,6 @@ dynamic_column_update_many(DYNAMIC_COLUMN *str,
uint add_column_count,
uint *column_numbers,
DYNAMIC_COLUMN_VALUE *values);
-enum enum_dyncol_func_result
-dynamic_column_delete(DYNAMIC_COLUMN *org, uint column_nr);
enum enum_dyncol_func_result
dynamic_column_exists(DYNAMIC_COLUMN *org, uint column_nr);
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 404d5fb5258..5a921fe0f26 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -350,9 +350,9 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex);
#ifndef set_timespec_time_nsec
#define set_timespec_time_nsec(ABSTIME,NSEC) do { \
- ulonglong now= (NSEC); \
- (ABSTIME).MY_tv_sec= (now / 1000000000ULL); \
- (ABSTIME).MY_tv_nsec= (now % 1000000000ULL); \
+ ulonglong _now_= (NSEC); \
+ (ABSTIME).MY_tv_sec= (_now_ / 1000000000ULL); \
+ (ABSTIME).MY_tv_nsec= (_now_ % 1000000000ULL); \
} while(0)
#endif /* !set_timespec_time_nsec */
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index b8e90f764bd..38573180232 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -72,7 +72,7 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0103
/* MariaDB plugin interface version */
-#define MARIA_PLUGIN_INTERFACE_VERSION 0x0103
+#define MARIA_PLUGIN_INTERFACE_VERSION 0x0104
/*
The allowable types of plugins
@@ -626,23 +626,6 @@ void thd_inc_row_count(MYSQL_THD thd);
int mysql_tmpfile(const char *prefix);
/**
- Check the killed state of a connection
-
- @details
- In MySQL support for the KILL statement is cooperative. The KILL
- statement only sets a "killed" flag. This function returns the value
- of that flag. A thread should check it often, especially inside
- time-consuming loops, and gracefully abort the operation if it is
- non-zero.
-
- @param thd user thread connection handle
- @retval 0 the connection is active
- @retval 1 the connection has been killed
-*/
-int thd_killed(const MYSQL_THD thd);
-
-
-/**
Return the thread id of a user thread
@param thd user thread connection handle
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index dea2446ac9c..fbd4ec2dd3f 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
+#include <mysql/service_kill_statement.h>
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50,
+ THD_ABORT_ASAP=100,
+};
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const void*);
+} *thd_kill_statement_service;
+enum thd_kill_levels thd_kill_level(const void*);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -226,7 +236,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);
int mysql_tmpfile(const char *prefix);
-int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd);
void thd_get_xid(const void* thd, MYSQL_XID *xid);
void mysql_query_cache_invalidate4(void* thd,
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index f1213a73bc6..46811825142 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
+#include <mysql/service_kill_statement.h>
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50,
+ THD_ABORT_ASAP=100,
+};
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const void*);
+} *thd_kill_statement_service;
+enum thd_kill_levels thd_kill_level(const void*);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -226,7 +236,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);
int mysql_tmpfile(const char *prefix);
-int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd);
void thd_get_xid(const void* thd, MYSQL_XID *xid);
void mysql_query_cache_invalidate4(void* thd,
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index 74b298098dd..49cf7e5b931 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func,
const char *file, unsigned int line);
#include <mysql/service_debug_sync.h>
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
+#include <mysql/service_kill_statement.h>
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50,
+ THD_ABORT_ASAP=100,
+};
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const void*);
+} *thd_kill_statement_service;
+enum thd_kill_levels thd_kill_level(const void*);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -179,7 +189,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);
int mysql_tmpfile(const char *prefix);
-int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd);
void thd_get_xid(const void* thd, MYSQL_XID *xid);
void mysql_query_cache_invalidate4(void* thd,
diff --git a/include/mysql/psi/mysql_thread.h b/include/mysql/psi/mysql_thread.h
index 18b4fde8c5c..7615985ec24 100644
--- a/include/mysql/psi/mysql_thread.h
+++ b/include/mysql/psi/mysql_thread.h
@@ -477,7 +477,7 @@ typedef struct st_mysql_cond mysql_cond_t;
Instrumented cond_wait.
@c mysql_cond_wait is a drop-in replacement for @c pthread_cond_wait.
*/
-#ifdef HAVE_PSI_INTERFACE
+#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX)
#define mysql_cond_wait(C, M) \
inline_mysql_cond_wait(C, M, __FILE__, __LINE__)
#else
@@ -491,7 +491,7 @@ typedef struct st_mysql_cond mysql_cond_t;
@c mysql_cond_timedwait is a drop-in replacement
for @c pthread_cond_timedwait.
*/
-#ifdef HAVE_PSI_INTERFACE
+#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX)
#define mysql_cond_timedwait(C, M, W) \
inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__)
#else
@@ -963,7 +963,7 @@ static inline int inline_mysql_cond_destroy(
static inline int inline_mysql_cond_wait(
mysql_cond_t *that,
mysql_mutex_t *mutex
-#ifdef HAVE_PSI_INTERFACE
+#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX)
, const char *src_file, uint src_line
#endif
)
@@ -980,7 +980,11 @@ static inline int inline_mysql_cond_wait(
PSI_server->start_cond_wait(locker, src_file, src_line);
}
#endif
+#ifdef SAFE_MUTEX
+ result= safe_cond_wait(&that->m_cond, &mutex->m_mutex, src_file, src_line);
+#else
result= pthread_cond_wait(&that->m_cond, &mutex->m_mutex);
+#endif
#ifdef HAVE_PSI_INTERFACE
if (likely(locker != NULL))
PSI_server->end_cond_wait(locker, result);
@@ -992,7 +996,7 @@ static inline int inline_mysql_cond_timedwait(
mysql_cond_t *that,
mysql_mutex_t *mutex,
struct timespec *abstime
-#ifdef HAVE_PSI_INTERFACE
+#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX)
, const char *src_file, uint src_line
#endif
)
@@ -1009,7 +1013,12 @@ static inline int inline_mysql_cond_timedwait(
PSI_server->start_cond_wait(locker, src_file, src_line);
}
#endif
+#ifdef SAFE_MUTEX
+ result= safe_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime,
+ src_file, src_line);
+#else
result= pthread_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime);
+#endif
#ifdef HAVE_PSI_INTERFACE
if (likely(locker != NULL))
PSI_server->end_cond_wait(locker, result);
diff --git a/include/mysql/service_kill_statement.h b/include/mysql/service_kill_statement.h
new file mode 100644
index 00000000000..995b21f0a9f
--- /dev/null
+++ b/include/mysql/service_kill_statement.h
@@ -0,0 +1,71 @@
+/* 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 */
+
+#ifndef MYSQL_SERVICE_KILL_STATEMENT_INCLUDED
+#define MYSQL_SERVICE_KILL_STATEMENT_INCLUDED
+
+/**
+ @file
+ This service provides functions that allow plugins to support
+ the KILL statement.
+
+ In MySQL support for the KILL statement is cooperative. The KILL
+ statement only sets a "killed" flag. This function returns the value
+ of that flag. A thread should check it often, especially inside
+ time-consuming loops, and gracefully abort the operation if it is
+ non-zero.
+
+ thd_is_killed(thd)
+ @return 0 - no KILL statement was issued, continue normally
+ @return 1 - there was a KILL statement, abort the execution.
+
+ thd_kill_level(thd)
+ @return thd_kill_levels_enum values
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum thd_kill_levels {
+ THD_IS_NOT_KILLED=0,
+ THD_ABORT_SOFTLY=50, /**< abort when possible, don't leave tables corrupted */
+ THD_ABORT_ASAP=100, /**< abort asap */
+};
+
+extern struct kill_statement_service_st {
+ enum thd_kill_levels (*thd_kill_level_func)(const MYSQL_THD);
+} *thd_kill_statement_service;
+
+/* backward compatibility helper */
+#define thd_killed(THD) (thd_kill_level(THD) == THD_ABORT_ASAP)
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define thd_kill_level(THD) \
+ thd_kill_statement_service->thd_kill_level_func(THD)
+
+#else
+
+enum thd_kill_levels thd_kill_level(const MYSQL_THD);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/include/mysql/services.h b/include/mysql/services.h
index 8eb506e1c37..b5b331d4923 100644
--- a/include/mysql/services.h
+++ b/include/mysql/services.h
@@ -24,6 +24,7 @@ extern "C" {
#include <mysql/service_thread_scheduler.h>
#include <mysql/service_progress_report.h>
#include <mysql/service_debug_sync.h>
+#include <mysql/service_kill_statement.h>
#ifdef __cplusplus
}
diff --git a/include/mysql_com.h b/include/mysql_com.h
index dbcc7125302..5697fc952ce 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.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
@@ -128,39 +128,39 @@ enum enum_server_command
#define HAS_EXPLICIT_VALUE (1 << 26) /* An INSERT/UPDATE operation supplied
an explicit default value */
-#define REFRESH_GRANT 1 /* Refresh grant tables */
-#define REFRESH_LOG 2 /* Start on new log file */
-#define REFRESH_TABLES 4 /* close all tables */
-#define REFRESH_HOSTS 8 /* Flush host cache */
-#define REFRESH_STATUS 16 /* Flush status variables */
-#define REFRESH_THREADS 32 /* Flush thread cache */
-#define REFRESH_SLAVE 64 /* Reset master info and restart slave
- thread */
-#define REFRESH_MASTER 128 /* Remove all bin logs in the index
- and truncate the index */
+#define REFRESH_GRANT (1UL << 0) /* Refresh grant tables */
+#define REFRESH_LOG (1UL << 1) /* Start on new log file */
+#define REFRESH_TABLES (1UL << 2) /* close all tables */
+#define REFRESH_HOSTS (1UL << 3) /* Flush host cache */
+#define REFRESH_STATUS (1UL << 4) /* Flush status variables */
+#define REFRESH_THREADS (1UL << 5) /* Flush thread cache */
+#define REFRESH_SLAVE (1UL << 6) /* Reset master info and restart slave
+ thread */
+#define REFRESH_MASTER (1UL << 7) /* Remove all bin logs in the index
+ and truncate the index */
/* The following can't be set with mysql_refresh() */
-#define REFRESH_ERROR_LOG 256 /* Rotate only the erorr log */
-#define REFRESH_ENGINE_LOG 512 /* Flush all storage engine logs */
-#define REFRESH_BINARY_LOG 1024 /* Flush the binary log */
-#define REFRESH_RELAY_LOG 2048 /* Flush the relay log */
-#define REFRESH_GENERAL_LOG 4096 /* Flush the general log */
-#define REFRESH_SLOW_LOG 8192 /* Flush the slow query log */
-
-#define REFRESH_READ_LOCK 16384 /* Lock tables for read */
-#define REFRESH_FAST 32768 /* Intern flag */
-
-/* RESET (remove all queries) from query cache */
-#define REFRESH_QUERY_CACHE 65536
-#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */
-#define REFRESH_DES_KEY_FILE 0x40000L
-#define REFRESH_USER_RESOURCES 0x80000L
-#define REFRESH_CHECKPOINT 0x100000L /* Don't do checkpoints */
-
-#define REFRESH_TABLE_STATS (1L << 20) /* Refresh table stats hash table */
-#define REFRESH_INDEX_STATS (1L << 21) /* Refresh index stats hash table */
-#define REFRESH_USER_STATS (1L << 22) /* Refresh user stats hash table */
-#define REFRESH_CLIENT_STATS (1L << 23) /* Refresh client stats hash table */
+#define REFRESH_ERROR_LOG (1UL << 8) /* Rotate only the erorr log */
+#define REFRESH_ENGINE_LOG (1UL << 9) /* Flush all storage engine logs */
+#define REFRESH_BINARY_LOG (1UL << 10) /* Flush the binary log */
+#define REFRESH_RELAY_LOG (1UL << 11) /* Flush the relay log */
+#define REFRESH_GENERAL_LOG (1UL << 12) /* Flush the general log */
+#define REFRESH_SLOW_LOG (1UL << 13) /* Flush the slow query log */
+
+#define REFRESH_READ_LOCK (1UL << 14) /* Lock tables for read */
+#define REFRESH_CHECKPOINT (1UL << 15) /* With REFRESH_READ_LOCK: block checkpoints too */
+
+#define REFRESH_QUERY_CACHE (1UL << 16) /* clear the query cache */
+#define REFRESH_QUERY_CACHE_FREE (1UL << 17) /* pack query cache */
+#define REFRESH_DES_KEY_FILE (1UL << 18)
+#define REFRESH_USER_RESOURCES (1UL << 19)
+
+#define REFRESH_TABLE_STATS (1UL << 20) /* Refresh table stats hash table */
+#define REFRESH_INDEX_STATS (1UL << 21) /* Refresh index stats hash table */
+#define REFRESH_USER_STATS (1UL << 22) /* Refresh user stats hash table */
+#define REFRESH_CLIENT_STATS (1UL << 23) /* Refresh client stats hash table */
+
+#define REFRESH_FAST (1UL << 31) /* Intern flag */
#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
diff --git a/include/service_versions.h b/include/service_versions.h
index 436941643ec..9b41da7440e 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -19,9 +19,11 @@
#define SERVICE_VERSION void *
#endif
-#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_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/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index f67b3962c1a..29c8298a825 100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -23,7 +23,7 @@ INCLUDE_DIRECTORIES(
${ZLIB_INCLUDE_DIR})
ADD_DEFINITIONS(${SSL_DEFINES})
-SET(CLIENT_API_FUNCTIONS
+SET(CLIENT_API_FUNCTIONS_5_1
get_tty_password
handle_options
load_defaults
@@ -58,6 +58,7 @@ mysql_field_count
mysql_field_seek
mysql_field_tell
mysql_free_result
+mysql_get_parameters
mysql_get_client_info
mysql_get_host_info
mysql_get_proto_info
@@ -129,12 +130,173 @@ mysql_server_init
mysql_server_end
mysql_set_character_set
mysql_get_character_set_info
-mysql_stmt_next_result
+)
-CACHE INTERNAL "Functions exported by client API"
+SET(CLIENT_API_FUNCTIONS_5_5
+mysql_stmt_next_result
+# Client plugins
+mysql_client_find_plugin
+mysql_client_register_plugin
+mysql_load_plugin
+mysql_load_plugin_v
+mysql_plugin_options
+# Async API
+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
+mysql_fetch_row_cont
+mysql_fetch_row_start
+mysql_free_result_cont
+mysql_free_result_start
+mysql_kill_cont
+mysql_kill_start
+mysql_list_dbs_cont
+mysql_list_dbs_start
+mysql_list_fields_cont
+mysql_list_fields_start
+mysql_list_processes_cont
+mysql_list_processes_start
+mysql_list_tables_cont
+mysql_list_tables_start
+mysql_next_result_cont
+mysql_next_result_start
+mysql_ping_cont
+mysql_ping_start
+mysql_query_cont
+mysql_query_start
+mysql_read_query_result_cont
+mysql_read_query_result_start
+mysql_real_connect_cont
+mysql_real_connect_start
+mysql_real_query_cont
+mysql_real_query_start
+mysql_refresh_cont
+mysql_refresh_start
+mysql_rollback_cont
+mysql_rollback_start
+mysql_select_db_cont
+mysql_select_db_start
+mysql_send_query_cont
+mysql_send_query_start
+mysql_set_character_set_cont
+mysql_set_character_set_start
+mysql_set_server_option_cont
+mysql_set_server_option_start
+mysql_shutdown_cont
+mysql_shutdown_start
+mysql_stat_cont
+mysql_stat_start
+mysql_stmt_close_cont
+mysql_stmt_close_start
+mysql_stmt_execute_cont
+mysql_stmt_execute_start
+mysql_stmt_fetch_cont
+mysql_stmt_fetch_start
+mysql_stmt_free_result_cont
+mysql_stmt_free_result_start
+mysql_stmt_next_result_cont
+mysql_stmt_next_result_start
+mysql_stmt_prepare_cont
+mysql_stmt_prepare_start
+mysql_stmt_reset_cont
+mysql_stmt_reset_start
+mysql_stmt_send_long_data_cont
+mysql_stmt_send_long_data_start
+mysql_stmt_store_result_cont
+mysql_stmt_store_result_start
+mysql_store_result_cont
+mysql_store_result_start
+#dynamic columns api
+dynamic_column_create
+dynamic_column_create_many
+dynamic_column_update
+dynamic_column_update_many
+dynamic_column_exists
+dynamic_column_list
+dynamic_column_get
+dynamic_column_prepare_decimal
+)
+SET(CLIENT_API_FUNCTIONS
+ ${CLIENT_API_FUNCTIONS_5_1}
+ ${CLIENT_API_FUNCTIONS_5_5}
+ CACHE INTERNAL
+ "Client functions"
)
+IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ # When building RPM, or DEB package on Debian, use ELF symbol versioning
+ # for compatibility with distribution packages, so client shared library can
+ # painlessly replace the one supplied by the distribution.
+
+ # Also list of exported symbols in distributions may differ from what is considered
+ # official API. Define CLIENT_API_EXTRA for the set of symbols, that required to
+ # be exported on different platforms.
+
+ 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
+ )
+ # Add special script to fix symbols renames by Fedora
+ SET(CLIENT_SOURCES_EXTRA ${CLIENT_SOURCES} rpm_support.cc)
+ SET(VERSION_SCRIPT_TEMPLATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/libmysql_rpm_version.in)
+ ELSEIF(DEB)
+ # libmyodbc on Ubuntu is using functions below
+ # If we don't export them, linker would just remove
+ # them (they are not used inside libmysqlclient)
+ SET(CLIENT_API_EXTRA
+ strfill
+ init_dynamic_string
+ )
+ # MySQL supplied with Ubuntu does not have versioning, bug Debian does.
+ IF(DEB MATCHES "debian")
+ SET(VERSION_SCRIPT_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/libmysql.ver.in)
+ ENDIF()
+ ENDIF()
+
+ IF(VERSION_SCRIPT_TEMPLATE)
+ # Generate version script.
+ # Create semicolon separated lists of functions to export from
+ # Since RPM packages use separate versioning for 5.1 API
+ # and 5.5 API (libmysqlclient_16 vs libmysqlclient_18),
+ # we need 2 lists.
+ SET (CLIENT_API_5_1_LIST)
+ FOREACH (f ${CLIENT_API_FUNCTIONS_5_1})
+ SET(CLIENT_API_5_1_LIST "${CLIENT_API_5_1_LIST}\n${f};")
+ ENDFOREACH()
+
+ SET (CLIENT_API_5_5_LIST)
+ FOREACH (f ${CLIENT_API_FUNCTIONS_5_5})
+ SET(CLIENT_API_5_5_LIST "${CLIENT_API_5_5_LIST}\n${f};")
+ ENDFOREACH()
+
+ CONFIGURE_FILE(
+ ${VERSION_SCRIPT_TEMPLATE}
+ ${CMAKE_CURRENT_BINARY_DIR}/libmysql.version
+ @ONLY@
+ )
+ SET(VERSION_SCRIPT_LINK_FLAGS
+ "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/libmysql.version")
+ ENDIF()
+
+ENDIF()
+
+
SET(CLIENT_SOURCES
get_password.c
libmysql.c
@@ -146,6 +308,7 @@ SET(CLIENT_SOURCES
../sql/net_serv.cc
../sql-common/pack.c
../sql/password.c
+ ${CLIENT_SOURCES_EXTRA}
)
ADD_CONVENIENCE_LIBRARY(clientlib ${CLIENT_SOURCES})
DTRACE_INSTRUMENT(clientlib)
@@ -193,13 +356,13 @@ IF(NOT DISABLE_SHARED)
OUTPUT_NAME mysqlclient
VERSION "${OS_SHARED_LIB_VERSION}"
SOVERSION "${SHARED_LIB_MAJOR_VERSION}")
- IF(LINK_FLAG_NO_UNDEFINED)
+ IF(LINK_FLAG_NO_UNDEFINED OR VERSION_SCRIPT_LINK_FLAGS)
GET_TARGET_PROPERTY(libmysql_link_flags libmysql LINK_FLAGS)
IF(NOT libmysql_link_flag)
SET(libmysql_link_flags)
ENDIF()
SET_TARGET_PROPERTIES(libmysql PROPERTIES LINK_FLAGS
- "${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED}")
+ "${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED} ${VERSION_SCRIPT_LINK_FLAGS}")
ENDIF()
# clean direct output needs to be set several targets have the same name
#(mysqlclient in this case)
diff --git a/libmysql/libmysql_rpm_version.in b/libmysql/libmysql_rpm_version.in
new file mode 100644
index 00000000000..ad15c8aa2c8
--- /dev/null
+++ b/libmysql/libmysql_rpm_version.in
@@ -0,0 +1,48 @@
+# This version script is heavily inspired by Fedora's and Mageia's version scripts for
+# MySQL client shared library. It is used in MariaDB for building RPMs.
+
+libmysqlclient_16 {
+ global:
+@CLIENT_API_5_1_LIST@
+
+# some stuff from Mageia, I have no idea why it is there
+# But too afraid to throw anything away
+ _fini;
+ _init;
+ my_init;
+ my_progname;
+ myodbc_remove_escape;
+
+# These are documented in Paul DuBois' MySQL book, so we treat them as part
+# of the de-facto API.
+ free_defaults;
+ handle_options;
+ load_defaults;
+ my_print_help;
+# pure-ftpd requires this
+ my_make_scrambled_password;
+# hydra requires this
+ scramble;
+# DBD::mysql requires this
+ is_prefix;
+ local:
+ *;
+};
+
+libmysqlclient_18 {
+ global:
+ @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_
+# (see mysql-dubious-exports.patch), which means the symbols are not present
+# in libmysqlclient_16.
+#
+# mysql-connector-odbc requires these
+ mysql_default_charset_info;
+ mysql_get_charset;
+ mysql_get_charset_by_csname;
+ mysql_net_realloc;
+# PHP's mysqli.so requires this (via the ER() macro)
+ mysql_client_errors;
+};
diff --git a/libmysql/rpm_support.cc b/libmysql/rpm_support.cc
new file mode 100644
index 00000000000..8c9a1e8683d
--- /dev/null
+++ b/libmysql/rpm_support.cc
@@ -0,0 +1,41 @@
+/*
+ Provide aliases for several symbols, to support drop-in replacement for
+ MariaDB on Fedora and several derives distributions.
+
+ These distributions redefine several symbols (in a way that is no compatible
+ with either MySQL or MariaDB) and export it from the client library ( as seen
+ e.g from this patch)
+http://lists.fedoraproject.org/pipermail/scm-commits/2010-December/537257.html
+
+ MariaDB handles compatibility distribution by providing the same symbols from
+ the client library if it is built with -DRPM
+
+*/
+#include <errmsg.h>
+#include <my_sys.h>
+#include <mysql.h>
+extern "C" {
+
+CHARSET_INFO *mysql_default_charset_info = default_charset_info;
+
+CHARSET_INFO *mysql_get_charset(uint cs_number, myf flags)
+{
+ return get_charset(cs_number, flags);
+}
+
+CHARSET_INFO *mysql_get_charset_by_csname(const char *cs_name,
+ uint cs_flags, myf my_flags)
+{
+ return get_charset_by_csname(cs_name, cs_flags, my_flags);
+}
+
+
+my_bool mysql_net_realloc(NET *net, size_t length)
+{
+ return net_realloc(net,length);
+}
+
+const char **mysql_client_errors = client_errors;
+
+} /*extern "C" */
+
diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt
index 38d5b4d8fb3..0f08ecd76bb 100644
--- a/libmysqld/CMakeLists.txt
+++ b/libmysqld/CMakeLists.txt
@@ -149,8 +149,21 @@ IF(UNIX)
${CMAKE_STATIC_LIBRARY_PREFIX}mysqld-debug)
ENDIF()
+# List of exported functions in embedded (client api except client plugin or
+# async (*_start/*_cont functions)
+
+SET(EMBEDDED_API)
+
+FOREACH(f ${CLIENT_API_FUNCTIONS})
+ IF(f MATCHES "plugin|_start$|_cont$")
+ # Ignore functions, embedded does not export them
+ ELSE()
+ SET(EMBEDDED_API ${EMBEDDED_API} ${f})
+ ENDIF()
+ENDFOREACH()
+
IF(NOT DISABLE_SHARED)
- MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${CLIENT_API_FUNCTIONS}
+ MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${EMBEDDED_API}
COMPONENT Server)
IF(UNIX)
# Name the shared library, handle versioning (provides same api as client
diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt
index eb8ff7ffe09..1583d1ff792 100644
--- a/libservices/CMakeLists.txt
+++ b/libservices/CMakeLists.txt
@@ -21,7 +21,8 @@ SET(MYSQLSERVICES_SOURCES
thd_wait_service.c
my_thread_scheduler_service.c
progress_report_service.c
- debug_sync_service.c)
+ debug_sync_service.c
+ kill_statement_service.c)
ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
INSTALL(TARGETS mysqlservices DESTINATION ${INSTALL_LIBDIR} COMPONENT Development)
diff --git a/libservices/kill_statement_service.c b/libservices/kill_statement_service.c
new file mode 100644
index 00000000000..4c7cacb241d
--- /dev/null
+++ b/libservices/kill_statement_service.c
@@ -0,0 +1,18 @@
+/* Copyright (c) 2013, Monty Program Ab.
+ Use is subject to license terms.
+
+ 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 thd_kill_statement_service= (void*)VERSION_kill_statement;
diff --git a/mysql-test/include/mysqlbinlog_row_engine.inc b/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc
index 95440ab04a0..95440ab04a0 100644
--- a/mysql-test/include/mysqlbinlog_row_engine.inc
+++ b/mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc
diff --git a/mysql-test/include/plugin.defs b/mysql-test/include/plugin.defs
index 6fbe4f68328..45fdfdb9a41 100644
--- a/mysql-test/include/plugin.defs
+++ b/mysql-test/include/plugin.defs
@@ -40,3 +40,4 @@ ha_blackhole storage/blackhole BLACKHOLE_PLUGIN
ha_federated storage/federated FEDERATED_PLUGIN
mypluglib plugin/fulltext SIMPLE_PARSER
libdaemon_example plugin/daemon_example DAEMONEXAMPLE
+adt_null plugin/audit_null AUDIT_NULL
diff --git a/mysql-test/include/rpl_start_server.inc b/mysql-test/include/rpl_start_server.inc
index c59c7759910..932fc9da7ef 100644
--- a/mysql-test/include/rpl_start_server.inc
+++ b/mysql-test/include/rpl_start_server.inc
@@ -8,6 +8,7 @@
# --let $rpl_server_number= N
# [--let $rpl_server_parameters= --flag1 --flag2 ...]
# [--let $rpl_debug= 1]
+# [--let $rpl_server_error= 0]
# --source include/rpl_start_server.inc
#
# Parameters:
@@ -21,6 +22,9 @@
# If set, extra parameters given by this variable are passed to
# mysqld.
#
+# $rpl_server_error
+# If set, failure of the server startup is expected.
+#
# $rpl_debug
# See include/rpl_init.inc
#
@@ -47,8 +51,9 @@ if ($rpl_server_parameters)
# Write file to make mysql-test-run.pl start up the server again
--exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
---source include/rpl_reconnect.inc
-
-
---let $include_filename= rpl_start_server.inc $_rpl_start_server_args
---source include/end_include_file.inc
+if (!$rpl_server_error)
+{
+ --source include/rpl_reconnect.inc
+ --let $include_filename= rpl_start_server.inc $_rpl_start_server_args
+ --source include/end_include_file.inc
+}
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
index f20eab80ae9..4e1625db093 100755
--- a/mysql-test/lib/v1/mysql-test-run.pl
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -3229,6 +3229,8 @@ sub install_db ($$) {
# for a production system
mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql",
$bootstrap_sql_file);
+ mtr_appendfile_to_file("$path_sql_dir/mysql_performance_tables.sql",
+ $bootstrap_sql_file);
# Add the mysql system tables initial data
# for a production system
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 067d10e13ff..ac911c5e4e8 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -3523,6 +3523,11 @@ sub mysql_install_db {
mtr_appendfile_to_file("$sql_dir/mysql_system_tables.sql",
$bootstrap_sql_file);
+ # Add the performance tables
+ # for a production system
+ mtr_appendfile_to_file("$sql_dir/mysql_performance_tables.sql",
+ $bootstrap_sql_file);
+
# Add the mysql system tables initial data
# for a production system
mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql",
diff --git a/mysql-test/r/alias.result b/mysql-test/r/alias.result
index 9e4ce9f84a9..9d826dd9bd7 100644
--- a/mysql-test/r/alias.result
+++ b/mysql-test/r/alias.result
@@ -212,3 +212,5 @@ drop table t4;
create table t4 select t2.*, d as 'x', d as 'z' from t2;
drop table t4;
drop table t1,t2,t3;
+DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZROM t1 WHERE 1=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 't1 WHERE 1=1' at line 1
diff --git a/mysql-test/r/change_user_notembedded.result b/mysql-test/r/change_user_notembedded.result
new file mode 100644
index 00000000000..60579d15ec2
--- /dev/null
+++ b/mysql-test/r/change_user_notembedded.result
@@ -0,0 +1,5 @@
+ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
+ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO)
+ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
+ERROR 08S01: Unknown command
+ERROR 08S01: Unknown command
diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result
index 5739c2244c3..19fdd96b4fb 100644
--- a/mysql-test/r/contributors.result
+++ b/mysql-test/r/contributors.result
@@ -3,3 +3,5 @@ Name Location Comment
Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction
Sheeri Kritzer Boston, Mass. USA EFF contribution for UC2006 Auction
Mark Shuttleworth London, UK. EFF contribution for UC2006 Auction
+Warnings:
+Warning 1681 'SHOW CONTRIBUTORS' is deprecated and will be removed in a future release.
diff --git a/mysql-test/r/create_delayed.result b/mysql-test/r/create_delayed.result
new file mode 100644
index 00000000000..c36a8e60cbb
--- /dev/null
+++ b/mysql-test/r/create_delayed.result
@@ -0,0 +1,3 @@
+drop table if exists t1;
+Starting test
+# All done
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index d463ce87c92..cc43dd2d7dc 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -191,6 +191,32 @@ t1 CREATE TABLE `t1` (
`r` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+#
+# Bug #51876 : crash/memory underrun when loading data with ucs2
+# and reverse() function
+#
+# Problem # 1 (original report): wrong parsing of ucs2 data
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+# should return 2 zeroes (as the value is truncated)
+SELECT * FROM t1;
+a
+0
+1
+DROP TABLE t1;
+# Problem # 2 : if you write and read ucs2 data to a file they're lost
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+# should return 0 and 1 (10 reversed)
+SELECT * FROM t1;
+a
+0
+1
+DROP TABLE t1;
create table t2(f1 Char(30));
insert into t2 values ("103000"), ("22720000"), ("3401200"), ("78000");
select lpad(f1, 12, "-o-/") from t2;
diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result
index f0e6ea5f1ad..2eb0f8e9ba6 100644
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@ -1140,6 +1140,14 @@ id l
a 512
Warnings:
Warning 1260 Row 1 was cut by GROUP_CONCAT()
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
+id l
+a 512
+Warnings:
+Warning 1260 Row 1 was cut by GROUP_CONCAT()
#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 69e32977103..d25c454913d 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -5055,6 +5055,14 @@ id l
a 1024
Warnings:
Warning 1260 Row 2 was cut by GROUP_CONCAT()
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
+id l
+a 1024
+Warnings:
+Warning 1260 Row 2 was cut by GROUP_CONCAT()
#
# End of 5.5 tests
#
diff --git a/mysql-test/r/datetime_456.result b/mysql-test/r/datetime_456.result
index ba020a250b7..44351a821bc 100644
--- a/mysql-test/r/datetime_456.result
+++ b/mysql-test/r/datetime_456.result
@@ -4,5 +4,5 @@ insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')),
select * from t1;
d
NULL
-NULL
+0000-00-00 00:00:00
drop table t1;
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index ba01db4a66f..95ff464918c 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -2115,6 +2115,55 @@ a
4
drop table t1,t2;
#
+# MDEV-3873: Wrong result (extra rows) with NOT IN and
+# a subquery from a MERGE view
+#
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4),(7),(0);
+CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2);
+CREATE TABLE t3 (c INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4),(6),(3);
+CREATE TABLE t4 (d INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (4),(5),(3);
+CREATE TABLE tv (e INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO tv VALUES (1),(3);
+CREATE ALGORITHM=TEMPTABLE VIEW v_temptable AS SELECT * FROM tv;
+CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
+SELECT * FROM t1, t2
+WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_temptable ON (c = e) WHERE c <> b ) AND a < b;
+a b
+SELECT * FROM t1, t2
+WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_merge ON (c = e) WHERE c <> b ) AND a < b;
+a b
+SELECT * FROM t1, t2
+WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN (SELECT * FROM tv) as derived ON (c = e) WHERE c <> b ) AND a < b;
+a b
+drop view v_temptable, v_merge;
+drop table t1,t2,t3,t4,tv;
+#
+# MDEV-3912: Wrong result (extra rows) with FROM subquery inside
+# ALL subquery, LEFT JOIN, derived_merge.
+# (duplicate of MDEV-3873 (above))
+#
+SET @save3912_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4),(8);
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (7),(0);
+CREATE TABLE t3 (c INT, d INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (0,4),(8,6);
+SELECT * FROM t1
+WHERE a >= ALL (
+SELECT d FROM t2 LEFT JOIN ( SELECT * FROM t3 ) AS alias ON ( c = b )
+WHERE b >= a
+);
+a
+8
+set optimizer_switch=@save3912_optimizer_switch;
+drop table t1, t2, t3;
+#
# end of 5.3 tests
#
set optimizer_switch=@exit_optimizer_switch;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 75f054ecbbe..459ece978fd 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -847,6 +847,38 @@ time(f1)
00:00:00.000200
00:00:00.000300
drop table t1;
+create table t1(i int, g int);
+insert into t1 values (null, 1), (0, 2);
+select distinct i from t1 group by g;
+i
+NULL
+0
+drop table t1;
+create table t1(i int, g blob);
+insert into t1 values (null, 1), (0, 2);
+select distinct i from t1 group by g;
+i
+NULL
+0
+drop table t1;
+create table t1 (a int) engine=myisam;
+insert into t1 values (0),(7);
+create table t2 (b int) engine=myisam;
+insert into t2 values (7),(0),(3);
+create algorithm=temptable view v as
+select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
+select * from v;
+field1
+NULL
+0
+7
+select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
+field1
+NULL
+0
+7
+drop view v;
+drop table t1, t2;
#
# Bug #11744875: 4082: integer lengths cause truncation with distinct concat and innodb
#
diff --git a/mysql-test/r/failed_auth_3909.result b/mysql-test/r/failed_auth_3909.result
new file mode 100644
index 00000000000..0a757e2cee2
--- /dev/null
+++ b/mysql-test/r/failed_auth_3909.result
@@ -0,0 +1,21 @@
+optimize table mysql.user;
+Table Op Msg_type Msg_text
+mysql.user optimize status OK
+insert mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar');
+Warnings:
+Warning 1364 Field 'ssl_cipher' doesn't have a default value
+Warning 1364 Field 'x509_issuer' doesn't have a default value
+Warning 1364 Field 'x509_subject' doesn't have a default value
+Warning 1364 Field 'authentication_string' doesn't have a default value
+flush privileges;
+connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
+ERROR HY000: Plugin 'bar' is not loaded
+connect(localhost,u2,,test,MASTER_PORT,MASTER_SOCKET);
+ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
+connect(localhost,u2,password,test,MASTER_PORT,MASTER_SOCKET);
+ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES)
+ERROR HY000: Plugin 'bar' is not loaded
+ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
+ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES)
+delete from mysql.user where plugin = 'bar';
+flush privileges;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index bc72e04b5a0..b60deae1c80 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -1086,3 +1086,8 @@ ERROR HY000: Row 3 was cut by GROUP_CONCAT()
SET group_concat_max_len = DEFAULT;
SET @@sql_mode = @old_sql_mode;
DROP TABLE t1, t2;
+create table t1 (a char(1) character set utf8);
+insert into t1 values ('a'),('b');
+select 1 from t1 where a in (select group_concat(a) from t1);
+1
+drop table t1;
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 514994ed27c..55b0f9d3c57 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -305,6 +305,39 @@ SELECT 1 from t1 HAVING NAME_CONST('', a);
ERROR HY000: Incorrect arguments to NAME_CONST
DROP TABLE t1;
#
+# Test or correct maybe_null of last_value
+#
+CREATE TABLE t1 (a char(2) not null );
+INSERT INTO t1 VALUES (4),(7),(1);
+set @optimizer_switch_save= @@optimizer_switch;
+set optimizer_switch='materialization=off';
+CREATE TABLE tv (e char(2) not null ) engine=mysql;
+Warnings:
+Warning 1286 Unknown storage engine 'mysql'
+Warning 1266 Using storage engine MyISAM for table 'tv'
+INSERT INTO tv VALUES (1);
+CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
+CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv;
+explain extended
+select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm);
+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 tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(<expr_cache><last_value(NULL,`test`.`tv`.`e`)>(<in_optimizer>(last_value(NULL,`test`.`tv`.`e`),<exists>(select last_value(NULL,'1') from dual where trigcond((<cache>(last_value(NULL,`test`.`tv`.`e`)) = last_value(NULL,'1'))))))))
+explain extended
+select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm);
+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 tv ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join)
+2 DEPENDENT SUBQUERY tv system NULL NULL NULL NULL 1 100.00
+Warnings:
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` left join (`test`.`tv`) on((`test`.`tv`.`e` = `test`.`t1`.`a`)) where (not(<expr_cache><`test`.`tv`.`e`>(<in_optimizer>(`test`.`tv`.`e`,<exists>(select last_value(NULL,'1') from dual where trigcond((<cache>(`test`.`tv`.`e`) = last_value(NULL,'1'))))))))
+set optimizer_switch=@optimizer_switch_save;
+drop view v_merge, vm;
+drop table t1,tv;
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 98854db4812..dd4b73b0b05 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1423,7 +1423,7 @@ MAKEDATE(11111111,1)
NULL
SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1)
-NULL
+0
#
# Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0,
#
diff --git a/mysql-test/r/gis2.result b/mysql-test/r/gis2.result
new file mode 100644
index 00000000000..214431e1d2d
--- /dev/null
+++ b/mysql-test/r/gis2.result
@@ -0,0 +1,14 @@
+CREATE TABLE t1 (
+id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+point_data POINT NOT NULL,
+PRIMARY KEY (id),
+KEY idx_point_data(point_data)
+) ENGINE=MyISAM;
+INSERT t1 (point_data) VALUES
+(GeomFromText('Point(37.0248492 23.8512726)')),
+(GeomFromText('Point(38.0248492 23.8512726)'));
+SELECT id FROM t1
+WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
+id
+2
+DROP TABLE t1;
diff --git a/mysql-test/r/grant_lowercase.result b/mysql-test/r/grant_lowercase.result
new file mode 100644
index 00000000000..489f990daf1
--- /dev/null
+++ b/mysql-test/r/grant_lowercase.result
@@ -0,0 +1,20 @@
+grant file on *.* to user1@localhost with grant option;
+grant select on `a%`.* to user1@localhost with grant option;
+grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret';
+ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+drop user user1@localhost;
+call mtr.add_suppression("Incorrect database name");
+alter table mysql.host modify Db varchar(200);
+alter table mysql.db modify Db varchar(200);
+insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200));
+Warnings:
+Warning 1265 Data truncated for column 'Db' at row 1
+insert mysql.db set db=concat('=>', repeat(_utf8 'й', 200));
+Warnings:
+Warning 1265 Data truncated for column 'Db' at row 1
+flush privileges;
+delete from mysql.host where db like '=>%';
+delete from mysql.db where db like '=>%';
+alter table mysql.host modify Db char(64);
+alter table mysql.db modify Db char(64);
+flush privileges;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index ea4af4590e0..1f2bbc470dc 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -2130,6 +2130,47 @@ the value below *must* be 1
show status like 'Created_tmp_disk_tables';
Variable_name Value
Created_tmp_disk_tables 1
+#
+# Bug #1002146: Unneeded filesort if usage of join buffer is not allowed
+# (bug mdev-645)
+#
+CREATE TABLE t1 (pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t1 VALUES (3,2), (2,3), (5,3), (6,4);
+CREATE TABLE t2 (pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t2 VALUES (9,0), (10,3), (6,4), (1,6), (3,100), (5,200);
+set join_cache_level=0;
+EXPLAIN
+SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+GROUP BY t2.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range idx idx 5 NULL 5 Using where; Using index
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
+SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+GROUP BY t2.a;
+a
+3
+4
+100
+200
+set join_cache_level=default;
+set @save_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='outer_join_with_cache=off';
+EXPLAIN
+SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+GROUP BY t2.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range idx idx 5 NULL 5 Using where; Using index
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using where; Using index
+SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+GROUP BY t2.a;
+a
+0
+3
+4
+100
+200
+set optimizer_switch=@save_optimizer_switch;
+DROP TABLE t1,t2;
# End of 5.3 tests
#
# Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00
@@ -2161,6 +2202,51 @@ f1 MIN(f2) MAX(f2)
DROP TABLE t1;
#End of test#49771
#
+# Test of bug in GROUP_CONCAT with ROLLUP
+#
+CREATE TABLE t1 ( b VARCHAR(8) NOT NULL, a INT NOT NULL ) ENGINE=MyISAM;
+INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'v');
+CREATE TABLE t2 ( c VARCHAR(8), d INT, KEY (c, d) ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('v',6),('c',4),('v',3);
+SELECT b, GROUP_CONCAT( a, b ORDER BY a, b )
+FROM t1 JOIN t2 ON c = b GROUP BY b;
+b GROUP_CONCAT( a, b ORDER BY a, b )
+c 1c
+v 2v,2v
+SELECT b, GROUP_CONCAT( a, b ORDER BY a, b )
+FROM t1 JOIN t2 ON c = b GROUP BY b WITH ROLLUP;
+b GROUP_CONCAT( a, b ORDER BY a, b )
+c 1c
+v 2v,2v
+NULL 1c,2v,2v
+DROP TABLE t1,t2;
+#
+# Test of MDEV-4002
+#
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY,
+d1 DOUBLE,
+d2 DOUBLE,
+i INT NOT NULL DEFAULT '0',
+KEY (i)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2);
+PREPARE stmt FROM "
+SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
+FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP
+";
+EXECUTE stmt;
+i GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
+1 11.1
+2 22.2
+NULL 11.1,22.2
+EXECUTE stmt;
+i GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
+1 11.1
+2 22.2
+NULL 11.1,22.2
+DROP TABLE t1;
+#
# Bug #58782
# Missing rows with SELECT .. WHERE .. IN subquery
# with full GROUP BY and no aggr
diff --git a/mysql-test/r/group_by_innodb.result b/mysql-test/r/group_by_innodb.result
new file mode 100644
index 00000000000..d165834cbe3
--- /dev/null
+++ b/mysql-test/r/group_by_innodb.result
@@ -0,0 +1,30 @@
+#
+# MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering
+# on GROUP BY with indexes on InnoDB table
+#
+CREATE TABLE t1 (
+pk INT PRIMARY KEY,
+a VARCHAR(1) NOT NULL,
+KEY (pk)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1,'a'),(2,'b');
+EXPLAIN
+SELECT COUNT(*), pk field1, pk AS field2
+FROM t1 WHERE a = 'r' OR pk = 183
+GROUP BY field1, field2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY,pk pk 4 NULL 2 Using where
+SELECT COUNT(*), pk field1, pk AS field2
+FROM t1 WHERE a = 'r' OR pk = 183
+GROUP BY field1, field2;
+COUNT(*) field1 field2
+EXPLAIN
+SELECT COUNT(*), pk field1 FROM t1
+WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY,pk pk 4 NULL 2 Using where
+SELECT COUNT(*), pk field1 FROM t1
+WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
+COUNT(*) field1
+drop table t1;
+End of 5.5 tests
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index ce0793b70a6..d1faec7f758 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2933,6 +2933,13 @@ ORDER BY min_a;
min_a
NULL
DROP TABLE t1;
+create table t1 (a int, b varchar(1), key(b,a)) engine=myisam;
+insert t1 values (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(null,'i');
+select min(a), b from t1 where a=7 or b='z' group by b;
+min(a) b
+7 g
+flush tables;
+drop table t1;
#
# LP BUG#888456 Wrong result with DISTINCT , ANY , subquery_cache=off , NOT NULL
#
diff --git a/mysql-test/r/handlersocket.result b/mysql-test/r/handlersocket.result
index a415b12f92d..9e5d273cbb6 100644
--- a/mysql-test/r/handlersocket.result
+++ b/mysql-test/r/handlersocket.result
@@ -5,7 +5,7 @@ plugin_version 1.0
plugin_status ACTIVE
plugin_type DAEMON
plugin_library handlersocket.so
-plugin_library_version 1.3
+plugin_library_version 1.4
plugin_author higuchi dot akira at dena dot jp
plugin_description Direct access into InnoDB
plugin_license BSD
diff --git a/mysql-test/r/information_schema2.result b/mysql-test/r/information_schema2.result
new file mode 100644
index 00000000000..60a20944839
--- /dev/null
+++ b/mysql-test/r/information_schema2.result
@@ -0,0 +1,8 @@
+select variable_name from information_schema.session_status where variable_name =
+(select variable_name from information_schema.session_status where variable_name = 'uptime');
+variable_name
+UPTIME
+select variable_name from information_schema.session_variables where variable_name =
+(select variable_name from information_schema.session_variables where variable_name = 'basedir');
+variable_name
+BASEDIR
diff --git a/mysql-test/r/innodb_mrr_cpk.result b/mysql-test/r/innodb_mrr_cpk.result
index 90f59b96e61..15ef32447a8 100644
--- a/mysql-test/r/innodb_mrr_cpk.result
+++ b/mysql-test/r/innodb_mrr_cpk.result
@@ -149,3 +149,25 @@ set @@join_cache_level= @save_join_cache_level;
set storage_engine=@save_storage_engine;
set optimizer_switch=@innodb_mrr_cpk_tmp;
drop table t0;
+#
+# MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions
+#
+set @tmp_mdev3817=@@optimizer_switch;
+SET optimizer_switch='index_merge=on,index_merge_intersection=on';
+CREATE TABLE t1 (
+a INT PRIMARY KEY,
+b INT,
+c VARCHAR(1024) CHARACTER SET utf8,
+d INT,
+KEY (b)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1, 9, 'one', 11), (2, 6, 'two', 12), (3, 2, 'three', 13), (4, 5, 'four', 14);
+CREATE TABLE t2 (e INT, g INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,9), (2,6) ;
+SELECT * FROM t1, t2 WHERE g = b AND ( a < 7 OR a > e );
+a b c d e g
+1 9 one 11 1 9
+2 6 two 12 2 6
+DROP TABLE t1, t2;
+set optimizer_switch=@tmp_mdev3817;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index c4c8216c14a..932c1c76027 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -504,35 +504,6 @@ CREATE TABLE t1 (id INT NOT NULL);
LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
DROP TABLE t1;
#
-# Bug #51876 : crash/memory underrun when loading data with ucs2
-# and reverse() function
-#
-# Problem # 1 (original report): wrong parsing of ucs2 data
-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
-CREATE TABLE t1(a INT);
-LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
-(@b) SET a=REVERSE(@b);
-Warnings:
-Warning 1366 Incorrect integer value: '?' for column 'a' at row 1
-Warning 1366 Incorrect integer value: '?' for column 'a' at row 2
-# should return 2 zeroes (as the value is truncated)
-SELECT * FROM t1;
-a
-0
-0
-DROP TABLE t1;
-# Problem # 2 : if you write and read ucs2 data to a file they're lost
-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
-CREATE TABLE t1(a INT);
-LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
-(@b) SET a=REVERSE(@b);
-# should return 0 and 1 (10 reversed)
-SELECT * FROM t1;
-a
-0
-1
-DROP TABLE t1;
-#
# Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
#
CREATE TABLE t1(f1 INT);
diff --git a/mysql-test/r/lowercase_table4.result b/mysql-test/r/lowercase_table4.result
index f896b9008e3..f896b9008e3 100755..100644
--- a/mysql-test/r/lowercase_table4.result
+++ b/mysql-test/r/lowercase_table4.result
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 3fb190bf963..e0670f7d643 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -509,5 +509,9 @@ SHOW TABLES IN connected_db;
Tables_in_connected_db
table_in_connected_db
DROP DATABASE connected_db;
+create database `aa``bb````cc`;
+DATABASE()
+aa`bb``cc
+drop database `aa``bb````cc`;
End of tests
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index d08ffd96a04..811861a6d93 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -935,9 +935,9 @@ a int(11) YES NULL
b varchar(255) YES NULL
c datetime YES NULL
drop table t1;
-mysqltest: At line 1: change user failed: Unknown database 'inexistent'
-mysqltest: At line 1: change user failed: Access denied for user 'inexistent'@'localhost' (using password: NO)
-mysqltest: At line 1: change user failed: Access denied for user 'root'@'localhost' (using password: YES)
+mysqltest: At line 1: query 'change_user root,,inexistent' failed: 1049: Unknown database 'inexistent'
+mysqltest: At line 1: query 'change_user inexistent,,test' failed: 1045: Access denied for user 'inexistent'@'localhost' (using password: NO)
+mysqltest: At line 1: query 'change_user root,inexistent,test' failed: 1045: Access denied for user 'root'@'localhost' (using password: YES)
REPLACED_FILE1.txt
file1.txt
file2.txt
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index dd403f64b5c..a706ae2c671 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -574,4 +574,24 @@ a b
1 2
0 1
DROP TABLE t1;
+#
+# BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
+# SAVE_READ_SET
+#
+CREATE TABLE t1 (
+a INT,
+b INT,
+c INT,
+PRIMARY KEY (c,a), KEY (a),KEY (a)
+) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2;
+INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1);
+UPDATE t1 SET b = 0, c=1 WHERE a <=>0;
+SELECT * FROM t1;
+a b c
+1 5 1
+2 4 1
+3 3 1
+4 2 1
+5 1 1
+DROP TABLE t1;
set global default_storage_engine=default;
diff --git a/mysql-test/r/plugin.result b/mysql-test/r/plugin.result
index b5addf16147..62864d0f16d 100644
--- a/mysql-test/r/plugin.result
+++ b/mysql-test/r/plugin.result
@@ -15,7 +15,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.3
+PLUGIN_LIBRARY_VERSION 1.4
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
@@ -28,7 +28,7 @@ PLUGIN_STATUS ACTIVE
PLUGIN_TYPE DAEMON
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.3
+PLUGIN_LIBRARY_VERSION 1.4
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Unusable Daemon
PLUGIN_LICENSE GPL
@@ -57,7 +57,7 @@ PLUGIN_STATUS DELETED
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
-PLUGIN_LIBRARY_VERSION 1.3
+PLUGIN_LIBRARY_VERSION 1.4
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
@@ -69,6 +69,8 @@ UNINSTALL PLUGIN EXAMPLE;
ERROR 42000: PLUGIN EXAMPLE does not exist
UNINSTALL PLUGIN non_exist;
ERROR 42000: PLUGIN non_exist does not exist
+UNINSTALL SONAME 'non_exist';
+ERROR 42000: SONAME non_exist.so does not exist
#
# Bug#32034: check_func_enum() does not check correct values but set it
# to impossible int val
diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result
index de523b78625..f8ebf65c0c5 100644
--- a/mysql-test/r/plugin_auth.result
+++ b/mysql-test/r/plugin_auth.result
@@ -121,17 +121,20 @@ ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
this should fail : not the same user
GRANT PROXY ON grant_plug TO grant_plug_dest;
ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
-this should fail : same user, but on a different host
+This is a valid grant
GRANT PROXY ON grant_plug_dest TO grant_plug;
-ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
-this should work : same user
-GRANT PROXY ON grant_plug_dest@localhost TO grant_plug_dest2;
-REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug_dest2;
+REVOKE PROXY ON grant_plug_dest FROM grant_plug;
this should work : same user
+GRANT PROXY ON grant_plug_dest TO grant_plug_dest2;
+REVOKE PROXY ON grant_plug_dest FROM grant_plug_dest2;
+this should fail : not the same user
GRANT PROXY ON grant_plug_dest@localhost TO grant_plug WITH GRANT OPTION;
+ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
+this should fail : not the same user
REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug;
+ERROR 28000: Access denied for user 'grant_plug_dest'@'localhost'
this should fail : can't create users
-GRANT PROXY ON grant_plug_dest@localhost TO grant_plug@localhost;
+GRANT PROXY ON grant_plug_dest TO grant_plug@localhost;
ERROR 42000: You are not allowed to create a user with GRANT
in default connection
# test what root can grant
@@ -149,12 +152,12 @@ GRANT PROXY ON future_user TO grant_plug;
in default connection
SHOW GRANTS FOR grant_plug;
Grants for grant_plug@%
-GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' IDENTIFIED VIA test_plugin_server USING 'grant_plug_dest' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' IDENTIFIED VIA test_plugin_server USING 'grant_plug_dest'
GRANT PROXY ON 'future_user'@'%' TO 'grant_plug'@'%'
REVOKE PROXY ON future_user FROM grant_plug;
SHOW GRANTS FOR grant_plug;
Grants for grant_plug@%
-GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' IDENTIFIED VIA test_plugin_server USING 'grant_plug_dest' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON *.* TO 'grant_plug'@'%' IDENTIFIED VIA test_plugin_server USING 'grant_plug_dest'
## testing drop user
CREATE USER test_drop@localhost;
GRANT PROXY ON future_user TO test_drop@localhost;
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 3b7d07d525e..146d250d687 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -1953,3 +1953,49 @@ a b c d
14 1 1 q
9 7 1 s
DROP TABLE t1;
+#
+# BUG#13256446 - ASSERTION QUICK->HEAD->READ_SET ==
+# SAVE_READ_SET' FAILED IN OPT_RANGE.CC:1606
+#
+CREATE TABLE t1 (
+f1 INT AUTO_INCREMENT,
+f2 INT,
+f3 INT,
+f4 INT,
+PRIMARY KEY (f1),KEY(f2)
+) ENGINE=INNODB;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f2=103;
+INSERT INTO t1 VALUES (154,0,NULL,0),(0,NULL,9,0),
+(NULL,102,NULL,3),(0,3,NULL,0), (9,0,NULL,0),(0,9,NULL,157);
+SELECT * FROM v2;
+f1 f2 f3 f4
+UPDATE v2 SET f4=0, f2=NULL, f1=NULL WHERE f1 > 16 ORDER BY f1;
+SELECT * FROM v2;
+f1 f2 f3 f4
+DROP TABLE t1;
+DROP VIEW v2;
+CREATE TABLE t1 (
+f1 INT AUTO_INCREMENT,
+f2 INT,
+f3 INT,
+f4 INT,
+PRIMARY KEY (f1),KEY(f2)
+) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1,NULL,NULL,0), (2,2,0,3), (9,0,107,18),
+(10,0,0,0), (231,0,0,0), (232,0,8,0), (234,0,0,NULL), (235,8,0,3);
+CREATE ALGORITHM=MERGE VIEW v3 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f1<=85 ;
+SELECT * FROM v3;
+f1 f2 f3 f4
+1 NULL NULL 0
+2 2 0 3
+9 0 107 18
+10 0 0 0
+UPDATE v3 SET f3=0, f4=4 WHERE f2=68 ORDER BY f1;
+SELECT * FROM v3;
+f1 f2 f3 f4
+1 NULL NULL 0
+2 2 0 3
+9 0 107 18
+10 0 0 0
+DROP TABLE t1;
+DROP VIEW v3;
diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result
index 354a4758e7c..3769ceb9145 100644
--- a/mysql-test/r/range_mrr_icp.result
+++ b/mysql-test/r/range_mrr_icp.result
@@ -1955,4 +1955,50 @@ a b c d
9 7 1 s
14 1 1 q
DROP TABLE t1;
+#
+# BUG#13256446 - ASSERTION QUICK->HEAD->READ_SET ==
+# SAVE_READ_SET' FAILED IN OPT_RANGE.CC:1606
+#
+CREATE TABLE t1 (
+f1 INT AUTO_INCREMENT,
+f2 INT,
+f3 INT,
+f4 INT,
+PRIMARY KEY (f1),KEY(f2)
+) ENGINE=INNODB;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f2=103;
+INSERT INTO t1 VALUES (154,0,NULL,0),(0,NULL,9,0),
+(NULL,102,NULL,3),(0,3,NULL,0), (9,0,NULL,0),(0,9,NULL,157);
+SELECT * FROM v2;
+f1 f2 f3 f4
+UPDATE v2 SET f4=0, f2=NULL, f1=NULL WHERE f1 > 16 ORDER BY f1;
+SELECT * FROM v2;
+f1 f2 f3 f4
+DROP TABLE t1;
+DROP VIEW v2;
+CREATE TABLE t1 (
+f1 INT AUTO_INCREMENT,
+f2 INT,
+f3 INT,
+f4 INT,
+PRIMARY KEY (f1),KEY(f2)
+) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1,NULL,NULL,0), (2,2,0,3), (9,0,107,18),
+(10,0,0,0), (231,0,0,0), (232,0,8,0), (234,0,0,NULL), (235,8,0,3);
+CREATE ALGORITHM=MERGE VIEW v3 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f1<=85 ;
+SELECT * FROM v3;
+f1 f2 f3 f4
+1 NULL NULL 0
+2 2 0 3
+9 0 107 18
+10 0 0 0
+UPDATE v3 SET f3=0, f4=4 WHERE f2=68 ORDER BY f1;
+SELECT * FROM v3;
+f1 f2 f3 f4
+1 NULL NULL 0
+2 2 0 3
+9 0 107 18
+10 0 0 0
+DROP TABLE t1;
+DROP VIEW v3;
set optimizer_switch=@mrr_icp_extra_tmp;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index b0a812c7b18..1818713d443 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -1552,3 +1552,14 @@ RELEASE_LOCK('t')
óóóó
1
SET NAMES latin1;
+#
+# WL#6454: Deprecate SHOW AUTHORS and SHOW CONTRIBUTORS
+#
+SHOW AUTHORS;
+SHOW WARNINGS;
+Level Code Message
+Warning 1681 'SHOW AUTHORS' is deprecated and will be removed in a future release.
+SHOW CONTRIBUTORS;
+SHOW WARNINGS;
+Level Code Message
+Warning 1681 'SHOW CONTRIBUTORS' is deprecated and will be removed in a future release.
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 293400ece2f..c297ceda572 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -6530,16 +6530,16 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f1();
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref c1 c1 5 const 0 Using where; Using index
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM v1 WHERE c1=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using index
EXPLAIN SELECT * FROM v1 WHERE c1=f1();
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref c1 c1 5 const 0 Using where; Using index
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f2(10);
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref c1 c1 5 const 0 Using where; Using index
+1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index
@@ -7852,6 +7852,38 @@ c1 c2 count(c3)
2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1
DROP PROCEDURE p1;
+
+MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements
+
+CREATE FUNCTION tdn() RETURNS int(7) DETERMINISTIC RETURN to_days(now());
+CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, daynum INT, a CHAR(1), INDEX(daynum), INDEX(a)) ENGINE=MyISAM;
+INSERT INTO t1 (daynum) VALUES (1),(2),(3),(4),(5),(TO_DAYS(NOW())),(7),(8);
+INSERT INTO t1 (daynum) SELECT a1.daynum FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5;
+FLUSH TABLES;
+FLUSH STATUS;
+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 0
+UPDATE t1 SET a = '+' WHERE daynum=tdn();
+SHOW STATUS LIKE '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 2
+Handler_read_last 0
+Handler_read_next 4097
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 0
+drop function tdn;
+drop table t1;
#
# lp:1002157 : testing stored function
# bug#62125 result for null incorrectly yields 1292 warning.
diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result
index 0b4b1726e22..540a66e7508 100644
--- a/mysql-test/r/sp_notembedded.result
+++ b/mysql-test/r/sp_notembedded.result
@@ -259,7 +259,6 @@ SELECT `my.db`.f1(2);
# Switching to default connection.
DROP DATABASE `my.db`;
USE test;
-set @@global.concurrent_insert= @old_concurrent_insert;
#
# Bug#11763507 - 56224: FUNCTION NAME IS CASE-SENSITIVE
#
@@ -280,3 +279,7 @@ Event sql_mode time_zone Create Event character_set_client collation_connection
teste_bug11763507 SYSTEM # latin1 latin1_swedish_ci latin1_swedish_ci
DROP EVENT teste_bug11763507;
#END OF BUG#11763507 test.
+# ------------------------------------------------------------------
+# -- End of 5.1 tests
+# ------------------------------------------------------------------
+set @@global.concurrent_insert= @old_concurrent_insert;
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 697226c5740..2814e5a6dcd 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -2248,6 +2248,53 @@ NULL NULL
drop table t1, t2;
set optimizer_switch=@subselect4_tmp;
#
+# MDEV-3928 Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery
+#
+CREATE TABLE t1 (a1 INT, b1 TIME) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'21:22:34'),(6,'10:50:38');
+CREATE TABLE t2 (a2 INT, b2 TIME) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8, '06:17:39');
+CREATE TABLE t3 (a3 INT, b3 TIME) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (1,'00:00:01'),(7,'00:00:02');
+EXPLAIN
+SELECT * FROM t1 WHERE a1 IN (
+SELECT a2 FROM t2 WHERE a2 IN (
+SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3
+)
+);
+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 ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
+SELECT * FROM t1 WHERE a1 IN (
+SELECT a2 FROM t2 WHERE a2 IN (
+SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3
+)
+);
+a1 b1
+drop table t1, t2, t3;
+#
+# MDEV-4056:Server crashes in Item_func_trig_cond::val_int
+# with FROM and NOT IN subqueries, LEFT JOIN, derived_merge+in_to_exists
+#
+set @optimizer_switch_MDEV4056 = @@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
+CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('x'),('d');
+CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,2,'v'),(2,150,'v');
+SELECT * FROM t1 LEFT JOIN (
+SELECT * FROM t2 WHERE ( pk, pk ) NOT IN (
+SELECT MIN(b), SUM(pk) FROM t1
+)
+) AS alias1 ON (a = c)
+WHERE b IS NULL OR a < 'u';
+a pk b c
+x NULL NULL NULL
+d NULL NULL NULL
+drop table t1,t2;
+set @@optimizer_switch = @optimizer_switch_MDEV4056;
+#
# MDEV-3899 Valgrind warnings (blocks are definitely lost) in filesort on IN subquery with SUM and DISTINCT
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index 6c1e52a112e..8932acf8ffd 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -432,4 +432,22 @@ select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 gr
1
1
drop table t1;
+#
+# MDEV-3988 crash in create_tmp_table
+#
+drop table if exists `t1`,`t2`;
+Warnings:
+Note 1051 Unknown table 't1'
+Note 1051 Unknown table 't2'
+create table `t1`(`a` char(1) character set utf8)engine=innodb;
+create table `t2`(`b` char(1) character set utf8)engine=memory;
+select distinct (select 1 from `t2` where `a`) `d2` from `t1`;
+d2
+select distinct (select 1 from `t2` where `a`) `d2`, a from `t1`;
+d2 a
+select distinct a, (select 1 from `t2` where `a`) `d2` from `t1`;
+a d2
+select distinct (1 + (select 1 from `t2` where `a`)) `d2` from `t1`;
+d2
+drop table t1,t2;
set optimizer_switch=@subselect_innodb_tmp;
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index 660137affec..d9fa9853da5 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -2767,4 +2767,79 @@ GROUP BY b
HAVING t1sum <> 1;
t1sum b
DROP TABLE t1, t2;
+#
+# MDEV-3911: Assertion `fixed == 0' failed in Item_field::fix_fields
+# on 2nd execution of PS with semijoin=on and IN subquery
+#
+CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (0,4),(8,6);
+CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (7,1),(0,7);
+PREPARE stmt FROM ' SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) ';
+execute stmt;
+a b
+execute stmt;
+a b
+deallocate prepare stmt;
+drop table t1,t2;
+#
+# MySQL Bug#13340270: assertion table->sort.record_pointers == __null
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_key int DEFAULT NULL,
+col_varchar_key varchar(1) DEFAULT NULL,
+col_varchar_nokey varchar(1) DEFAULT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key, col_int_key)
+) ENGINE=InnoDB;
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1266 Using storage engine MyISAM for table 't1'
+INSERT INTO t1 VALUES
+(10,8,'x','x'),
+(11,7,'d','d'),
+(12,1,'r','r'),
+(13,7,'f','f'),
+(14,9,'y','y'),
+(15,NULL,'u','u'),
+(16,1,'m','m'),
+(17,9,NULL,NULL),
+(18,2,'o','o'),
+(19,9,'w','w'),
+(20,2,'m','m'),
+(21,4,'q','q');
+CREATE TABLE t2
+SELECT alias1.col_varchar_nokey AS field1
+FROM t1 AS alias1 JOIN t1 AS alias2
+ON alias2.col_int_key = alias1.pk OR
+alias2.col_int_key = alias1.col_int_key
+WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o'
+
+;
+EXPLAIN SELECT *
+FROM t2
+WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1
+FROM t1 AS alias1 JOIN t1 AS alias2
+ON alias2.col_int_key = alias1.pk OR
+alias2.col_int_key = alias1.col_int_key
+WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o'
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias1 index_merge PRIMARY,col_int_key,col_varchar_key PRIMARY,col_varchar_key 4,4 NULL 2 Using sort_union(PRIMARY,col_varchar_key); Using where
+1 PRIMARY alias2 ALL col_int_key NULL NULL NULL 12 Range checked for each record (index map: 0x2); FirstMatch(t2)
+SELECT *
+FROM t2
+WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1
+FROM t1 AS alias1 JOIN t1 AS alias2
+ON alias2.col_int_key = alias1.pk OR
+alias2.col_int_key = alias1.col_int_key
+WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o'
+);
+field1
+o
+o
+DROP TABLE t1, t2;
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index aa7ad59fda3..1ca8b44a0b8 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -2781,6 +2781,81 @@ GROUP BY b
HAVING t1sum <> 1;
t1sum b
DROP TABLE t1, t2;
+#
+# MDEV-3911: Assertion `fixed == 0' failed in Item_field::fix_fields
+# on 2nd execution of PS with semijoin=on and IN subquery
+#
+CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (0,4),(8,6);
+CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (7,1),(0,7);
+PREPARE stmt FROM ' SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) ';
+execute stmt;
+a b
+execute stmt;
+a b
+deallocate prepare stmt;
+drop table t1,t2;
+#
+# MySQL Bug#13340270: assertion table->sort.record_pointers == __null
+#
+CREATE TABLE t1 (
+pk int NOT NULL,
+col_int_key int DEFAULT NULL,
+col_varchar_key varchar(1) DEFAULT NULL,
+col_varchar_nokey varchar(1) DEFAULT NULL,
+PRIMARY KEY (pk),
+KEY col_int_key (col_int_key),
+KEY col_varchar_key (col_varchar_key, col_int_key)
+) ENGINE=InnoDB;
+Warnings:
+Warning 1286 Unknown storage engine 'InnoDB'
+Warning 1266 Using storage engine MyISAM for table 't1'
+INSERT INTO t1 VALUES
+(10,8,'x','x'),
+(11,7,'d','d'),
+(12,1,'r','r'),
+(13,7,'f','f'),
+(14,9,'y','y'),
+(15,NULL,'u','u'),
+(16,1,'m','m'),
+(17,9,NULL,NULL),
+(18,2,'o','o'),
+(19,9,'w','w'),
+(20,2,'m','m'),
+(21,4,'q','q');
+CREATE TABLE t2
+SELECT alias1.col_varchar_nokey AS field1
+FROM t1 AS alias1 JOIN t1 AS alias2
+ON alias2.col_int_key = alias1.pk OR
+alias2.col_int_key = alias1.col_int_key
+WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o'
+
+;
+EXPLAIN SELECT *
+FROM t2
+WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1
+FROM t1 AS alias1 JOIN t1 AS alias2
+ON alias2.col_int_key = alias1.pk OR
+alias2.col_int_key = alias1.col_int_key
+WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o'
+);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+1 PRIMARY alias1 index_merge PRIMARY,col_int_key,col_varchar_key PRIMARY,col_varchar_key 4,4 NULL 2 Using sort_union(PRIMARY,col_varchar_key); Using where
+1 PRIMARY alias2 ALL col_int_key NULL NULL NULL 12 Range checked for each record (index map: 0x2); FirstMatch(t2)
+SELECT *
+FROM t2
+WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1
+FROM t1 AS alias1 JOIN t1 AS alias2
+ON alias2.col_int_key = alias1.pk OR
+alias2.col_int_key = alias1.col_int_key
+WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o'
+);
+field1
+o
+o
+DROP TABLE t1, t2;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
@@ -2988,7 +3063,7 @@ EXPLAIN
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
GROUP BY a HAVING a != 'z';
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t index idx_a idx_a 4 NULL 3 Using index; Using temporary; Using filesort
+1 PRIMARY t index idx_a idx_a 4 NULL 3 Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where
2 MATERIALIZED t1 ref idx_a idx_a 4 test.t2.b 2 Using index
@@ -3002,7 +3077,7 @@ EXPLAIN
SELECT a FROM t1 t WHERE a IN (SELECT b FROM t1, t2 WHERE b = a)
GROUP BY a HAVING a != 'z';
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t index idx_a idx_a 4 NULL 3 Using index; Using temporary; Using filesort
+1 PRIMARY t index idx_a idx_a 4 NULL 3 Using index
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 Using where
2 MATERIALIZED t1 ref idx_a idx_a 4 test.t2.b 2 Using index
diff --git a/mysql-test/r/sum_distinct-big.result b/mysql-test/r/sum_distinct-big.result
index 9b55d59ab91..d4933b31f80 100644
--- a/mysql-test/r/sum_distinct-big.result
+++ b/mysql-test/r/sum_distinct-big.result
@@ -103,5 +103,20 @@ sm
10323810
10325070
10326330
+#
+# Bug mdev-4063: SUM(DISTINCT...) with small'max_heap_table_size
+# (bug #56927)
+#
+SET max_heap_table_size=default;
+INSERT INTO t1 SELECT id+16384 FROM t1;
+DELETE FROM t2;
+INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+SELECT SUM(DISTINCT id) sm FROM t2;
+sm
+536887296
+SET max_heap_table_size=16384;
+SELECT SUM(DISTINCT id) sm FROM t2;
+sm
+536887296
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
index 4b9bf6f433f..38bddd42cfa 100644
--- a/mysql-test/r/type_year.result
+++ b/mysql-test/r/type_year.result
@@ -389,6 +389,7 @@ select a from t1 where a=(select 2000 from dual where 1);
a
select a from t1 where a=y2k();
a
+00
select a from t1 where a=b;
a
drop table t1;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 427374fd995..3f3a3ac07df 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -561,3 +561,45 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
+#
+# Verify that UPDATE does the same number of handler_update
+# operations, no matter if there is ORDER BY or not.
+#
+CREATE TABLE t1 (i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES (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);
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2),
+INDEX idx (a,b(1),c)) ENGINE=INNODB;
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+FLUSH STATUS;
+START TRANSACTION;
+UPDATE t2 SET d = 10 WHERE b = 10 LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+Variable_name Value
+Handler_update 1
+ROLLBACK;
+FLUSH STATUS;
+START TRANSACTION;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+Variable_name Value
+Handler_update 1
+ROLLBACK;
+Same test with a different UPDATE.
+ALTER TABLE t2 DROP INDEX idx, ADD INDEX idx2 (a, b);
+FLUSH STATUS;
+START TRANSACTION;
+UPDATE t2 SET c = 10 LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+Variable_name Value
+Handler_update 5
+ROLLBACK;
+FLUSH STATUS;
+START TRANSACTION;
+UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+Variable_name Value
+Handler_update 5
+ROLLBACK;
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 8d2d1561456..8f32ca1f566 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -4780,6 +4780,30 @@ id id bbb iddqd val1
drop view v2;
drop table t1,t2;
#
+# MDEV-3914: Wrong result (NULLs instead of real values)
+# with INNER and RIGHT JOIN in a FROM subquery, derived_merge=on
+# (fix of above MDEV-486 fix)
+#
+SET @save_optimizer_switch_MDEV_3914=@@optimizer_switch;
+SET optimizer_switch = 'derived_merge=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);
+CREATE TABLE t3 (c INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6);
+SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias;
+c
+5
+6
+SET optimizer_switch = 'derived_merge=off';
+SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias;
+c
+5
+6
+SET optimizer_switch=@save_optimizer_switch_MDEV_3914;
+drop table t1,t2,t3;
+#
# MDEV-589 (LP BUG#1007647) :
# Assertion `vcol_table == 0 || vcol_table == table' failed in
# fill_record(THD*, List<Item>&, List<Item>&, bool)
@@ -4822,6 +4846,23 @@ f2 f1
7 NULL
8 NULL
drop tables t1,t2;
+#
+# MDEV-3876 Wrong result (extra rows) with ALL subquery
+# from a MERGE view (duplicate of MDEV-3873)
+#
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(3);
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t2;
+SELECT a FROM t1 AS alias
+WHERE a >= ALL (
+SELECT b FROM t1 LEFT JOIN v1 ON (a = b)
+WHERE a = alias.a );
+a
+1
+drop view v1;
+drop table t1,t2;
# -----------------------------------------------------------------
# -- End of 5.3 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/suite/binlog/r/binlog_database.result b/mysql-test/suite/binlog/r/binlog_database.result
index 0eaed3c97d7..99066d632ac 100644
--- a/mysql-test/suite/binlog/r/binlog_database.result
+++ b/mysql-test/suite/binlog/r/binlog_database.result
@@ -58,7 +58,7 @@ Tables_in_db1
t2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `db1`; drop table `t1`
+master-bin.000001 # Query # # use `db1`; DROP TABLE `t1`
DROP TABLE t3;
DROP DATABASE db1;
set binlog_format=mixed;
@@ -121,7 +121,7 @@ Tables_in_db1
t2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `db1`; drop table `t1`
+master-bin.000001 # Query # # use `db1`; DROP TABLE `t1`
DROP TABLE t3;
DROP DATABASE db1;
set binlog_format=row;
@@ -185,7 +185,7 @@ Tables_in_db1
t2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `db1`; drop table `t1`
+master-bin.000001 # Query # # use `db1`; DROP TABLE `t1`
DROP TABLE t3;
DROP DATABASE db1;
show databases;
diff --git a/mysql-test/r/mysqlbinlog-cp932.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog-cp932.result
index cbf6159516a..cbf6159516a 100644
--- a/mysql-test/r/mysqlbinlog-cp932.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog-cp932.result
diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result
index bf65bab602d..bf65bab602d 100644
--- a/mysql-test/r/mysqlbinlog2.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result
diff --git a/mysql-test/r/mysqlbinlog_base64.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_base64.result
index 72d49c16cc8..72d49c16cc8 100644
--- a/mysql-test/r/mysqlbinlog_base64.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_base64.result
diff --git a/mysql-test/r/mysqlbinlog_row.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
index 6361cdadb32..8f481b25251 100644
--- a/mysql-test/r/mysqlbinlog_row.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result
@@ -359,7 +359,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
# at #
@@ -376,7 +376,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
# at #
@@ -403,7 +403,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0000001' /* BIT(7) meta=7 nullable=1 is_null=0 */
# at #
@@ -420,7 +420,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0000010' /* BIT(7) meta=7 nullable=1 is_null=0 */
# at #
@@ -437,7 +437,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0000100' /* BIT(7) meta=7 nullable=1 is_null=0 */
# at #
@@ -454,7 +454,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0001000' /* BIT(7) meta=7 nullable=1 is_null=0 */
# at #
@@ -471,7 +471,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0010000' /* BIT(7) meta=7 nullable=1 is_null=0 */
# at #
@@ -488,7 +488,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0100000' /* BIT(7) meta=7 nullable=1 is_null=0 */
# at #
@@ -505,7 +505,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'1000000' /* BIT(7) meta=7 nullable=1 is_null=0 */
# at #
@@ -522,7 +522,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'1111111' /* BIT(7) meta=7 nullable=1 is_null=0 */
# at #
@@ -539,7 +539,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=b'1111111' /* BIT(7) meta=7 nullable=1 is_null=0 */
# at #
@@ -556,7 +556,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=b'0010000' /* BIT(7) meta=7 nullable=1 is_null=0 */
### SET
@@ -585,7 +585,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'00010010010010001001' /* BIT(20) meta=516 nullable=1 is_null=0 */
### @2='ab' /* STRING(2) meta=65026 nullable=1 is_null=0 */
@@ -613,7 +613,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0000000000000000000000000000000000000000000000000000000000000001' /* BIT(64) meta=2048 nullable=1 is_null=0 */
# at #
@@ -630,7 +630,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0000000000000000000000000000000000000000000000000000000000000010' /* BIT(64) meta=2048 nullable=1 is_null=0 */
# at #
@@ -647,7 +647,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0000000000000000000000000000000000000000000000000000000010000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
# at #
@@ -664,7 +664,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
# at #
@@ -691,13 +691,13 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=2 /* TINYINT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=3 /* TINYINT meta=0 nullable=1 is_null=0 */
# at #
@@ -714,7 +714,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
# at #
@@ -731,7 +731,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */
### SET
@@ -750,7 +750,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
# at #
@@ -777,10 +777,10 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
# at #
@@ -797,7 +797,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
# at #
@@ -824,7 +824,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */
# at #
@@ -841,7 +841,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=1 /* TINYINT meta=0 nullable=1 is_null=0 */
# at #
@@ -868,7 +868,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=1234 /* SHORTINT meta=0 nullable=1 is_null=0 */
# at #
@@ -885,7 +885,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=1234 /* SHORTINT meta=0 nullable=1 is_null=0 */
# at #
@@ -912,10 +912,10 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-32768 (32768) /* SHORTINT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-1 (65535) /* SHORTINT meta=0 nullable=1 is_null=0 */
# at #
@@ -932,7 +932,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=-32768 (32768) /* SHORTINT meta=0 nullable=1 is_null=0 */
### SET
@@ -951,7 +951,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=-1 (65535) /* SHORTINT meta=0 nullable=1 is_null=0 */
# at #
@@ -978,7 +978,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=12345 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
# at #
@@ -995,7 +995,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=12345 /* MEDIUMINT meta=0 nullable=1 is_null=0 */
# at #
@@ -1022,10 +1022,10 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-8388608 (8388608) /* MEDIUMINT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-1 (16777215) /* MEDIUMINT meta=0 nullable=1 is_null=0 */
# at #
@@ -1042,7 +1042,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=-8388608 (8388608) /* MEDIUMINT meta=0 nullable=1 is_null=0 */
### SET
@@ -1061,7 +1061,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=-1 (16777215) /* MEDIUMINT meta=0 nullable=1 is_null=0 */
# at #
@@ -1088,7 +1088,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=123456 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -1105,7 +1105,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=123456 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -1132,10 +1132,10 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-2147483648 (2147483648) /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-1 (4294967295) /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -1152,7 +1152,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=-2147483648 (2147483648) /* INT meta=0 nullable=1 is_null=0 */
### SET
@@ -1171,7 +1171,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=-1 (4294967295) /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -1198,7 +1198,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=1234567890 /* LONGINT meta=0 nullable=1 is_null=0 */
# at #
@@ -1215,7 +1215,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=1234567890 /* LONGINT meta=0 nullable=1 is_null=0 */
# at #
@@ -1242,10 +1242,10 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-9223372036854775808 (9223372036854775808) /* LONGINT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-1 (18446744073709551615) /* LONGINT meta=0 nullable=1 is_null=0 */
# at #
@@ -1262,7 +1262,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=-9223372036854775808 (9223372036854775808) /* LONGINT meta=0 nullable=1 is_null=0 */
### SET
@@ -1281,7 +1281,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=-1 (18446744073709551615) /* LONGINT meta=0 nullable=1 is_null=0 */
# at #
@@ -1308,7 +1308,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=123.223... /* FLOAT meta=4 nullable=1 is_null=0 */
# at #
@@ -1325,7 +1325,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=123.223... /* FLOAT meta=4 nullable=1 is_null=0 */
# at #
@@ -1352,7 +1352,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=123434.223... /* DOUBLE meta=8 nullable=1 is_null=0 */
# at #
@@ -1369,7 +1369,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=123434.223... /* DOUBLE meta=8 nullable=1 is_null=0 */
# at #
@@ -1396,7 +1396,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=000000124.450000000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */
# at #
@@ -1413,7 +1413,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=-000000543.210000000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */
# at #
@@ -1430,7 +1430,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=000000124.450000000 /* DECIMAL(10,5) meta=2565 nullable=1 is_null=0 */
# at #
@@ -1457,7 +1457,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2001:02:03' /* DATE meta=0 nullable=1 is_null=0 */
# at #
@@ -1474,7 +1474,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2001:02:03' /* DATE meta=0 nullable=1 is_null=0 */
# at #
@@ -1501,7 +1501,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=2001-02-03 10:20:30 /* DATETIME meta=0 nullable=1 is_null=0 */
# at #
@@ -1518,7 +1518,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=2001-02-03 10:20:30 /* DATETIME meta=0 nullable=1 is_null=0 */
# at #
@@ -1546,7 +1546,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=981184830 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
# at #
@@ -1563,7 +1563,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=981184830 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
# at #
@@ -1590,7 +1590,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='11:22:33' /* TIME meta=0 nullable=1 is_null=0 */
# at #
@@ -1607,7 +1607,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='11:22:33' /* TIME meta=0 nullable=1 is_null=0 */
# at #
@@ -1634,7 +1634,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=2001 /* YEAR meta=0 nullable=1 is_null=0 */
# at #
@@ -1651,7 +1651,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=2001 /* YEAR meta=0 nullable=1 is_null=0 */
# at #
@@ -1678,7 +1678,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -1695,7 +1695,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -1722,7 +1722,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */
# at #
@@ -1739,7 +1739,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */
# at #
@@ -1766,7 +1766,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='b' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -1783,7 +1783,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='b' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -1810,7 +1810,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' /* STRING(255) meta=65279 nullable=1 is_null=0 */
# at #
@@ -1827,7 +1827,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc' /* STRING(255) meta=65279 nullable=1 is_null=0 */
# at #
@@ -1854,7 +1854,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */
# at #
@@ -1871,7 +1871,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */
# at #
@@ -1898,7 +1898,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */
# at #
@@ -1915,7 +1915,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */
# at #
@@ -1942,7 +1942,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */
# at #
@@ -1959,7 +1959,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='a' /* STRING(3) meta=65027 nullable=1 is_null=0 */
# at #
@@ -1986,7 +1986,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* STRING(765) meta=57085 nullable=1 is_null=0 */
# at #
@@ -2003,7 +2003,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* STRING(765) meta=57085 nullable=1 is_null=0 */
# at #
@@ -2020,10 +2020,10 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* STRING(765) meta=57085 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* STRING(765) meta=57085 nullable=1 is_null=0 */
# at #
@@ -2050,7 +2050,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */
# at #
@@ -2067,7 +2067,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */
# at #
@@ -2094,7 +2094,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */
# at #
@@ -2111,7 +2111,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */
# at #
@@ -2138,7 +2138,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */
# at #
@@ -2155,7 +2155,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00a' /* STRING(2) meta=65026 nullable=1 is_null=0 */
# at #
@@ -2182,7 +2182,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a' /* STRING(510) meta=61182 nullable=1 is_null=0 */
# at #
@@ -2199,7 +2199,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß' /* STRING(510) meta=61182 nullable=1 is_null=0 */
# at #
@@ -2218,10 +2218,10 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a' /* STRING(510) meta=61182 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß\x00ß' /* STRING(510) meta=61182 nullable=1 is_null=0 */
# at #
@@ -2248,7 +2248,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */
# at #
@@ -2265,7 +2265,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */
# at #
@@ -2292,7 +2292,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='a' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */
# at #
@@ -2309,7 +2309,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='a' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */
# at #
@@ -2336,7 +2336,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
# at #
@@ -2353,7 +2353,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
# at #
@@ -2380,7 +2380,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(261) meta=261 nullable=1 is_null=0 */
# at #
@@ -2397,7 +2397,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(261) meta=261 nullable=1 is_null=0 */
# at #
@@ -2424,7 +2424,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */
# at #
@@ -2441,7 +2441,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */
# at #
@@ -2468,7 +2468,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='a' /* VARSTRING(3) meta=3 nullable=1 is_null=0 */
# at #
@@ -2485,7 +2485,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='a' /* VARSTRING(3) meta=3 nullable=1 is_null=0 */
# at #
@@ -2512,7 +2512,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */
# at #
@@ -2529,7 +2529,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */
# at #
@@ -2546,10 +2546,10 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(765) meta=765 nullable=1 is_null=0 */
# at #
@@ -2576,7 +2576,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */
# at #
@@ -2593,7 +2593,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */
# at #
@@ -2610,10 +2610,10 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß' /* VARSTRING(783) meta=783 nullable=1 is_null=0 */
# at #
@@ -2640,7 +2640,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */
# at #
@@ -2657,7 +2657,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */
# at #
@@ -2684,7 +2684,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00a' /* VARSTRING(2) meta=2 nullable=1 is_null=0 */
# at #
@@ -2701,7 +2701,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00a' /* VARSTRING(2) meta=2 nullable=1 is_null=0 */
# at #
@@ -2728,7 +2728,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(510) meta=510 nullable=1 is_null=0 */
# at #
@@ -2745,7 +2745,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(510) meta=510 nullable=1 is_null=0 */
# at #
@@ -2772,7 +2772,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(522) meta=522 nullable=1 is_null=0 */
# at #
@@ -2789,7 +2789,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b\x00a\x00b' /* VARSTRING(522) meta=522 nullable=1 is_null=0 */
# at #
@@ -2816,7 +2816,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -2833,7 +2833,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x02' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -2850,7 +2850,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -2867,7 +2867,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -2894,7 +2894,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */
# at #
@@ -2911,7 +2911,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='' /* STRING(0) meta=65024 nullable=1 is_null=0 */
# at #
@@ -2938,7 +2938,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -2955,7 +2955,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x02' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -2972,7 +2972,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -2989,7 +2989,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='a' /* STRING(1) meta=65025 nullable=1 is_null=0 */
# at #
@@ -3016,7 +3016,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* STRING(255) meta=65279 nullable=1 is_null=0 */
# at #
@@ -3033,7 +3033,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x02' /* STRING(255) meta=65279 nullable=1 is_null=0 */
# at #
@@ -3050,7 +3050,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a' /* STRING(255) meta=65279 nullable=1 is_null=0 */
# at #
@@ -3067,7 +3067,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='' /* STRING(255) meta=65279 nullable=1 is_null=0 */
# at #
@@ -3094,7 +3094,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */
# at #
@@ -3111,7 +3111,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='' /* VARSTRING(0) meta=0 nullable=1 is_null=0 */
# at #
@@ -3138,7 +3138,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */
# at #
@@ -3155,7 +3155,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x02' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */
# at #
@@ -3172,7 +3172,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='a' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */
# at #
@@ -3189,7 +3189,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x02' /* VARSTRING(1) meta=1 nullable=1 is_null=0 */
# at #
@@ -3216,7 +3216,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
# at #
@@ -3233,7 +3233,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
# at #
@@ -3250,7 +3250,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00a\x00' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
# at #
@@ -3267,7 +3267,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
# at #
@@ -3294,7 +3294,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='tinyblob1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */
# at #
@@ -3311,7 +3311,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='tinyblob1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */
# at #
@@ -3338,7 +3338,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='blob1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
# at #
@@ -3355,7 +3355,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='blob1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
# at #
@@ -3382,7 +3382,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='mediumblob1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */
# at #
@@ -3399,7 +3399,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='mediumblob1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */
# at #
@@ -3426,7 +3426,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='longblob1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */
# at #
@@ -3443,7 +3443,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='longblob1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */
# at #
@@ -3470,7 +3470,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='tinytext1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */
# at #
@@ -3487,7 +3487,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='tinytext1' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */
# at #
@@ -3514,7 +3514,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='text1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
# at #
@@ -3531,7 +3531,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='text1' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
# at #
@@ -3558,7 +3558,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='mediumtext1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */
# at #
@@ -3575,7 +3575,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='mediumtext1' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */
# at #
@@ -3602,7 +3602,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='longtext1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */
# at #
@@ -3619,7 +3619,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='longtext1' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */
# at #
@@ -3646,7 +3646,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00t\x00i\x00n\x00y\x00t\x00e\x00x\x00t\x001' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */
# at #
@@ -3663,7 +3663,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00t\x00i\x00n\x00y\x00t\x00e\x00x\x00t\x001' /* TINYBLOB/TINYTEXT meta=1 nullable=1 is_null=0 */
# at #
@@ -3690,7 +3690,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00t\x00e\x00x\x00t\x001' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
# at #
@@ -3707,7 +3707,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00t\x00e\x00x\x00t\x001' /* BLOB/TEXT meta=2 nullable=1 is_null=0 */
# at #
@@ -3734,7 +3734,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00m\x00e\x00d\x00i\x00u\x00m\x00t\x00e\x00x\x00t\x001' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */
# at #
@@ -3751,7 +3751,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00m\x00e\x00d\x00i\x00u\x00m\x00t\x00e\x00x\x00t\x001' /* MEDIUMBLOB/MEDIUMTEXT meta=3 nullable=1 is_null=0 */
# at #
@@ -3778,7 +3778,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='\x00l\x00o\x00n\x00g\x00t\x00e\x00x\x00t\x001' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */
# at #
@@ -3795,7 +3795,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='\x00l\x00o\x00n\x00g\x00t\x00e\x00x\x00t\x001' /* LONGBLOB/LONGTEXT meta=4 nullable=1 is_null=0 */
# at #
@@ -3822,7 +3822,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */
# at #
@@ -3839,7 +3839,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=2 /* ENUM(1 byte) meta=63233 nullable=1 is_null=0 */
# at #
@@ -3866,7 +3866,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'00000011' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
# at #
@@ -3883,7 +3883,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'00000101' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
# at #
@@ -3900,7 +3900,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
# at #
@@ -3917,7 +3917,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
# at #
@@ -3934,7 +3934,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'00001111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
# at #
@@ -3951,7 +3951,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'00011111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
# at #
@@ -3968,7 +3968,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'00111111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
# at #
@@ -3985,7 +3985,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=b'00000011' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
# at #
@@ -4017,7 +4017,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=0 is_null=0 */
### @2=0 /* INT meta=0 nullable=0 is_null=0 */
@@ -4035,7 +4035,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=0 /* INT meta=0 nullable=0 is_null=0 */
### @2=1 /* INT meta=0 nullable=0 is_null=0 */
@@ -4053,7 +4053,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=0 is_null=0 */
### @2=0 /* INT meta=0 nullable=0 is_null=0 */
@@ -4071,7 +4071,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1=0 /* INT meta=0 nullable=0 is_null=0 */
### @2=1 /* INT meta=0 nullable=0 is_null=0 */
@@ -4093,28 +4093,28 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=0 is_null=0 */
### @2=0 /* INT meta=0 nullable=0 is_null=0 */
### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
### @2=0 /* INT meta=0 nullable=0 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=0 /* INT meta=0 nullable=0 is_null=0 */
### @2=1 /* INT meta=0 nullable=0 is_null=0 */
### SET
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
### @2=1 /* INT meta=0 nullable=0 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=0 is_null=0 */
### @2=0 /* INT meta=0 nullable=0 is_null=0 */
### SET
### @1=20 /* INT meta=0 nullable=0 is_null=0 */
### @2=0 /* INT meta=0 nullable=0 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1=0 /* INT meta=0 nullable=0 is_null=0 */
### @2=1 /* INT meta=0 nullable=0 is_null=0 */
diff --git a/mysql-test/r/mysqlbinlog_row_innodb.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
index 4be266d586c..3227ad3d661 100644
--- a/mysql-test/r/mysqlbinlog_row_innodb.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result
@@ -2365,7 +2365,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -2458,7 +2458,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -2553,7 +2553,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
@@ -2634,7 +2634,7 @@ BEGIN
### @77=NULL /* TIMESTAMP meta=63233 nullable=1 is_null=1 */
### @78=NULL /* TIMESTAMP meta=63489 nullable=1 is_null=1 */
### @79=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -2727,7 +2727,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -2900,7 +2900,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -3073,7 +3073,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
@@ -3246,7 +3246,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -3419,7 +3419,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -3512,7 +3512,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -3605,7 +3605,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -3698,7 +3698,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
@@ -3905,47 +3905,47 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:01' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:08' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-08' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=8 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:09' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-09' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -3962,7 +3962,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:01' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -3971,7 +3971,7 @@ BEGIN
### @1='2008:08:11' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=1 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -3980,7 +3980,7 @@ BEGIN
### @1='2008:08:12' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -3989,7 +3989,7 @@ BEGIN
### @1='2008:08:13' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -3998,7 +3998,7 @@ BEGIN
### @1='2008:08:14' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4007,7 +4007,7 @@ BEGIN
### @1='2008:08:15' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4016,7 +4016,7 @@ BEGIN
### @1='2008:08:16' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4037,37 +4037,37 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:11' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:12' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:13' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:14' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:15' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:16' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:17' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4292,47 +4292,47 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:01' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=11 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:08' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=18 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:09' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4349,47 +4349,47 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:01' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=21 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:08' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=28 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:09' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4406,47 +4406,47 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t3` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:01' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=31 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:08' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=38 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:09' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4471,7 +4471,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4480,7 +4480,7 @@ BEGIN
### @1='2018:01:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4489,7 +4489,7 @@ BEGIN
### @1='2018:01:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4498,7 +4498,7 @@ BEGIN
### @1='2018:01:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4507,7 +4507,7 @@ BEGIN
### @1='2018:01:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4516,7 +4516,7 @@ BEGIN
### @1='2018:01:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4525,7 +4525,7 @@ BEGIN
### @1='2018:01:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4534,7 +4534,7 @@ BEGIN
### @1='2028:02:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4543,7 +4543,7 @@ BEGIN
### @1='2028:02:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4552,7 +4552,7 @@ BEGIN
### @1='2028:02:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4561,7 +4561,7 @@ BEGIN
### @1='2028:02:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4570,7 +4570,7 @@ BEGIN
### @1='2028:02:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4579,7 +4579,7 @@ BEGIN
### @1='2028:02:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4588,7 +4588,7 @@ BEGIN
### @1='2038:03:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4597,7 +4597,7 @@ BEGIN
### @1='2038:03:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4606,7 +4606,7 @@ BEGIN
### @1='2038:03:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4615,7 +4615,7 @@ BEGIN
### @1='2038:03:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4624,7 +4624,7 @@ BEGIN
### @1='2038:03:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4653,92 +4653,92 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4837,17 +4837,17 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2=2 /* INT meta=0 nullable=1 is_null=0 */
### @3='Wow' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2=4 /* INT meta=0 nullable=1 is_null=0 */
### @3='Wow' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=5 /* INT meta=0 nullable=1 is_null=0 */
### @2=6 /* INT meta=0 nullable=1 is_null=0 */
diff --git a/mysql-test/r/mysqlbinlog_row_myisam.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
index d4062565320..8338e48459a 100644
--- a/mysql-test/r/mysqlbinlog_row_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result
@@ -2365,7 +2365,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -2460,7 +2460,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -2557,7 +2557,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
@@ -2638,7 +2638,7 @@ BEGIN
### @77=NULL /* TIMESTAMP meta=63233 nullable=1 is_null=1 */
### @78=NULL /* TIMESTAMP meta=63489 nullable=1 is_null=1 */
### @79=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -2733,7 +2733,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -2908,7 +2908,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -3083,7 +3083,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
@@ -3258,7 +3258,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -3433,7 +3433,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -3528,7 +3528,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -3623,7 +3623,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
@@ -3718,7 +3718,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
@@ -3927,47 +3927,47 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:01' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:08' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-08' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=8 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:08:09' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-09' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -3986,7 +3986,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:01' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -3995,7 +3995,7 @@ BEGIN
### @1='2008:08:11' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=1 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4004,7 +4004,7 @@ BEGIN
### @1='2008:08:12' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4013,7 +4013,7 @@ BEGIN
### @1='2008:08:13' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4022,7 +4022,7 @@ BEGIN
### @1='2008:08:14' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4031,7 +4031,7 @@ BEGIN
### @1='2008:08:15' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4040,7 +4040,7 @@ BEGIN
### @1='2008:08:16' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:08:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4063,37 +4063,37 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:11' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:12' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:13' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:14' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-04' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:15' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-05' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:16' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-06' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2008:08:17' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-07' /* VARSTRING(24) meta=24 nullable=1 is_null=0 */
@@ -4320,47 +4320,47 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:01' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=11 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:08' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=18 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1='2008:01:09' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4379,47 +4379,47 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:01' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=21 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:08' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=28 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1='2008:02:09' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4438,47 +4438,47 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t3` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:01' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-01' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=31 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:08' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-08' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=38 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test.t3
+### INSERT INTO `test`.`t3`
### SET
### @1='2008:03:09' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-09' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4505,7 +4505,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4514,7 +4514,7 @@ BEGIN
### @1='2018:01:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4523,7 +4523,7 @@ BEGIN
### @1='2018:01:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4532,7 +4532,7 @@ BEGIN
### @1='2018:01:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4541,7 +4541,7 @@ BEGIN
### @1='2018:01:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4550,7 +4550,7 @@ BEGIN
### @1='2018:01:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1='2008:01:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4559,7 +4559,7 @@ BEGIN
### @1='2018:01:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4568,7 +4568,7 @@ BEGIN
### @1='2028:02:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4577,7 +4577,7 @@ BEGIN
### @1='2028:02:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4586,7 +4586,7 @@ BEGIN
### @1='2028:02:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4595,7 +4595,7 @@ BEGIN
### @1='2028:02:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4604,7 +4604,7 @@ BEGIN
### @1='2028:02:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1='2008:02:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4613,7 +4613,7 @@ BEGIN
### @1='2028:02:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4622,7 +4622,7 @@ BEGIN
### @1='2038:03:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4631,7 +4631,7 @@ BEGIN
### @1='2038:03:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4640,7 +4640,7 @@ BEGIN
### @1='2038:03:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4649,7 +4649,7 @@ BEGIN
### @1='2038:03:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4658,7 +4658,7 @@ BEGIN
### @1='2038:03:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### UPDATE test.t3
+### UPDATE `test`.`t3`
### WHERE
### @1='2008:03:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4689,92 +4689,92 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1='2018:01:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-01-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1='2028:02:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-02-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=7 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:02' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-02' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:03' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-03' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:04' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-04' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=4 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:05' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-05' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=5 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:06' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-06' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
### @3=6 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test.t3
+### DELETE FROM `test`.`t3`
### WHERE
### @1='2038:03:07' /* DATE meta=0 nullable=1 is_null=0 */
### @2='VARCHAR-03-07' /* VARSTRING(255) meta=255 nullable=1 is_null=0 */
@@ -4875,17 +4875,17 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2=2 /* INT meta=0 nullable=1 is_null=0 */
### @3='Wow' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2=4 /* INT meta=0 nullable=1 is_null=0 */
### @3='Wow' /* VARSTRING(60) meta=60 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=5 /* INT meta=0 nullable=1 is_null=0 */
### @2=6 /* INT meta=0 nullable=1 is_null=0 */
diff --git a/mysql-test/r/mysqlbinlog_row_trans.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result
index 85106ab9684..f2f1ed00431 100644
--- a/mysql-test/r/mysqlbinlog_row_trans.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result
@@ -166,15 +166,15 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -182,21 +182,21 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -207,7 +207,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -233,15 +233,15 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -259,21 +259,21 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -294,7 +294,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -312,15 +312,15 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### INSERT INTO test.t1
+### INSERT INTO `test`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -328,21 +328,21 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### UPDATE test.t1
+### UPDATE `test`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -353,7 +353,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t1
+### DELETE FROM `test`.`t1`
### WHERE
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -379,15 +379,15 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### INSERT INTO test.t2
+### INSERT INTO `test`.`t2`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -405,21 +405,21 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
-### UPDATE test.t2
+### UPDATE `test`.`t2`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
@@ -440,7 +440,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test.t2
+### DELETE FROM `test`.`t2`
### WHERE
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
diff --git a/mysql-test/suite/binlog/r/binlog_row_annotate.result b/mysql-test/suite/binlog/r/binlog_row_annotate.result
index 58cac276c95..8b9ccee7a93 100644
--- a/mysql-test/suite/binlog/r/binlog_row_annotate.result
+++ b/mysql-test/suite/binlog/r/binlog_row_annotate.result
@@ -116,13 +116,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -142,13 +142,13 @@ BEGIN
#Q> INSERT INTO test2.t2 VALUES (1), (2), (3)
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -168,13 +168,13 @@ BEGIN
#Q> INSERT INTO test3.t3 VALUES (1), (2), (3)
#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -200,22 +200,22 @@ BEGIN
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -235,13 +235,13 @@ BEGIN
#Q> INSERT INTO test2.v2 VALUES (1), (2), (3)
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -263,13 +263,13 @@ BEGIN
#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -328,13 +328,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -384,13 +384,13 @@ BEGIN
#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -490,13 +490,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -514,13 +514,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -538,13 +538,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -566,22 +566,22 @@ BEGIN
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -599,13 +599,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -623,13 +623,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -708,13 +708,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -734,13 +734,13 @@ BEGIN
#Q> INSERT INTO test2.t2 VALUES (1), (2), (3)
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -760,13 +760,13 @@ BEGIN
#Q> INSERT INTO test3.t3 VALUES (1), (2), (3)
#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -792,22 +792,22 @@ BEGIN
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -827,13 +827,13 @@ BEGIN
#Q> INSERT INTO test2.v2 VALUES (1), (2), (3)
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -855,13 +855,13 @@ BEGIN
#Q> WHERE xtest1.xt1.a=test2.t2.a AND test2.t2.a=test3.t3
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -920,13 +920,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -976,13 +976,13 @@ BEGIN
#Q> WHERE test1.t1.a=test2.t2.a AND test2.t2.a=test3.t3
#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -1082,13 +1082,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test1.t1
+### INSERT INTO `test1`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -1105,13 +1105,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -1128,13 +1128,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test3`.`t3` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test3.t3
+### INSERT INTO `test3`.`t3`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -1155,22 +1155,22 @@ BEGIN
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test1.t1
+### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -1187,13 +1187,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -1210,13 +1210,13 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
-### DELETE FROM test2.t2
+### DELETE FROM `test2`.`t2`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
# at #
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 55f4154574b..f2dedaa633a 100644
--- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
+++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_options.result
@@ -59,11 +59,11 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2=2 /* INT meta=0 nullable=1 is_null=0 */
@@ -87,10 +87,10 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -107,7 +107,7 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM new_test1.t1
+### DELETE FROM `new_test1`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2=1 /* INT meta=0 nullable=1 is_null=0 */
@@ -131,10 +131,10 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test3`.`t3` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO new_test3.t3
+### INSERT INTO `new_test3`.`t3`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test3.t3
+### INSERT INTO `new_test3`.`t3`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -151,7 +151,7 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2=3 /* INT meta=0 nullable=1 is_null=0 */
@@ -169,23 +169,23 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=4 /* INT meta=0 nullable=1 is_null=0 */
### @2=4 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=5 /* INT meta=0 nullable=1 is_null=0 */
### @2=5 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=6 /* INT meta=0 nullable=1 is_null=0 */
### @2=6 /* INT meta=0 nullable=1 is_null=0 */
@@ -203,7 +203,7 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test3`.`t3` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM new_test3.t3
+### DELETE FROM `new_test3`.`t3`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -255,11 +255,11 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2=2 /* INT meta=0 nullable=1 is_null=0 */
@@ -283,10 +283,10 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `test2`.`t2` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO test2.t2
+### INSERT INTO `test2`.`t2`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -303,7 +303,7 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM new_test1.t1
+### DELETE FROM `new_test1`.`t1`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2=1 /* INT meta=0 nullable=1 is_null=0 */
@@ -327,10 +327,10 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test3`.`t3` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO new_test3.t3
+### INSERT INTO `new_test3`.`t3`
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test3.t3
+### INSERT INTO `new_test3`.`t3`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
# at #
@@ -347,7 +347,7 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2=3 /* INT meta=0 nullable=1 is_null=0 */
@@ -365,23 +365,23 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test1`.`t1` mapped to number #
#010909 4:46:40 server id # end_log_pos # Write_rows: table id # flags: STMT_END_F
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2=2 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2=3 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=4 /* INT meta=0 nullable=1 is_null=0 */
### @2=4 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=5 /* INT meta=0 nullable=1 is_null=0 */
### @2=5 /* INT meta=0 nullable=1 is_null=0 */
-### INSERT INTO new_test1.t1
+### INSERT INTO `new_test1`.`t1`
### SET
### @1=6 /* INT meta=0 nullable=1 is_null=0 */
### @2=6 /* INT meta=0 nullable=1 is_null=0 */
@@ -399,7 +399,7 @@ BEGIN
# at #
#010909 4:46:40 server id # end_log_pos # Table_map: `new_test3`.`t3` mapped to number #
#010909 4:46:40 server id # end_log_pos # Delete_rows: table id # flags: STMT_END_F
-### DELETE FROM new_test3.t3
+### DELETE FROM `new_test3`.`t3`
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
# at #
diff --git a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result
index 2687b21213a..cbb739a9c48 100644
--- a/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result
+++ b/mysql-test/suite/binlog/r/binlog_row_mysqlbinlog_verbose.result
@@ -1,152 +1,152 @@
Verbose statements from : write-partial-row.binlog
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
stmt
-### INSERT INTO mysql.ndb_apply_status
+### INSERT INTO `mysql`.`ndb_apply_status`
### SET
### @1=1
### @2=25769803786
### @3=''
### @4=0
### @5=0
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=3
### @2=3
### @3=3
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=1
### @2=1
### @3=1
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=2
### @2=2
### @3=2
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=4
### @2=4
### @3=4
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=4
### @3=40
-### DELETE FROM test.ba
+### DELETE FROM `test`.`ba`
### WHERE
### @1=2
drop table raw_binlog_rows;
Verbose statements from : write-full-row.binlog
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
stmt
-### INSERT INTO mysql.ndb_apply_status
+### INSERT INTO `mysql`.`ndb_apply_status`
### SET
### @1=2
### @2=25769803786
### @3=''
### @4=0
### @5=0
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=3
### @2=3
### @3=3
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=1
### @2=1
### @3=1
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=2
### @2=2
### @3=2
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=4
### @2=4
### @3=4
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=4
### @2=4
### @3=40
-### DELETE FROM test.ba
+### DELETE FROM `test`.`ba`
### WHERE
### @1=2
drop table raw_binlog_rows;
Verbose statements from : update-partial-row.binlog
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
stmt
-### INSERT INTO mysql.ndb_apply_status
+### INSERT INTO `mysql`.`ndb_apply_status`
### SET
### @1=3
### @2=25769803786
### @3=''
### @4=0
### @5=0
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=3
### @2=3
### @3=3
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=1
### @2=1
### @3=1
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=2
### @2=2
### @3=2
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=4
### @2=4
### @3=4
-### UPDATE test.ba
+### UPDATE `test`.`ba`
### WHERE
### @1=4
### @3=4
### SET
### @1=4
### @3=40
-### DELETE FROM test.ba
+### DELETE FROM `test`.`ba`
### WHERE
### @1=2
drop table raw_binlog_rows;
Verbose statements from : update-full-row.binlog
select replace(txt,'\r', '') as stmt from raw_binlog_rows where txt like '###%';
stmt
-### INSERT INTO mysql.ndb_apply_status
+### INSERT INTO `mysql`.`ndb_apply_status`
### SET
### @1=4
### @2=25769803786
### @3=''
### @4=0
### @5=0
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=3
### @2=3
### @3=3
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=1
### @2=1
### @3=1
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=2
### @2=2
### @3=2
-### INSERT INTO test.ba
+### INSERT INTO `test`.`ba`
### SET
### @1=4
### @2=4
### @3=4
-### UPDATE test.ba
+### UPDATE `test`.`ba`
### WHERE
### @1=4
### @2=4
@@ -155,7 +155,7 @@ stmt
### @1=4
### @2=4
### @3=40
-### DELETE FROM test.ba
+### DELETE FROM `test`.`ba`
### WHERE
### @1=2
drop table raw_binlog_rows;
diff --git a/mysql-test/t/mysqlbinlog-cp932-master.opt b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt
index bb0cda4519a..bb0cda4519a 100644
--- a/mysql-test/t/mysqlbinlog-cp932-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt
diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test
index 2a210bea0e0..2a210bea0e0 100644
--- a/mysql-test/t/mysqlbinlog-cp932.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test
diff --git a/mysql-test/t/mysqlbinlog2-master.opt b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2-master.opt
index 4d69f3359db..4d69f3359db 100644
--- a/mysql-test/t/mysqlbinlog2-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2-master.opt
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test
index 986e180db13..986e180db13 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test
diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test
index 3d3444cea1c..3d3444cea1c 100644
--- a/mysql-test/t/mysqlbinlog_base64.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test
diff --git a/mysql-test/t/mysqlbinlog_row-master.opt b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row-master.opt
index 4d69f3359db..4d69f3359db 100644
--- a/mysql-test/t/mysqlbinlog_row-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row-master.opt
diff --git a/mysql-test/t/mysqlbinlog_row.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
index 9b41c63d195..9b41c63d195 100644
--- a/mysql-test/t/mysqlbinlog_row.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test
diff --git a/mysql-test/t/mysqlbinlog_row_innodb-master.opt b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb-master.opt
index 4d69f3359db..4d69f3359db 100644
--- a/mysql-test/t/mysqlbinlog_row_innodb-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb-master.opt
diff --git a/mysql-test/t/mysqlbinlog_row_innodb.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test
index cef1a712f7d..e8ba283807b 100644
--- a/mysql-test/t/mysqlbinlog_row_innodb.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test
@@ -20,5 +20,5 @@ let $engine_type=InnoDB;
--source include/have_binlog_format_row.inc
--source include/have_ucs2.inc
---source include/mysqlbinlog_row_engine.inc
+--source extra/binlog_tests/mysqlbinlog_row_engine.inc
diff --git a/mysql-test/t/mysqlbinlog_row_myisam-master.opt b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam-master.opt
index 4d69f3359db..4d69f3359db 100644
--- a/mysql-test/t/mysqlbinlog_row_myisam-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam-master.opt
diff --git a/mysql-test/t/mysqlbinlog_row_myisam.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test
index e7b0335812a..9b941282399 100644
--- a/mysql-test/t/mysqlbinlog_row_myisam.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test
@@ -20,4 +20,4 @@ let $engine_type=MyISAM;
--source include/have_binlog_format_row.inc
--source include/have_ucs2.inc
---source include/mysqlbinlog_row_engine.inc
+--source extra/binlog_tests/mysqlbinlog_row_engine.inc
diff --git a/mysql-test/t/mysqlbinlog_row_trans-master.opt b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans-master.opt
index 4d69f3359db..4d69f3359db 100644
--- a/mysql-test/t/mysqlbinlog_row_trans-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans-master.opt
diff --git a/mysql-test/t/mysqlbinlog_row_trans.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test
index 24abc441c4c..24abc441c4c 100644
--- a/mysql-test/t/mysqlbinlog_row_trans.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test
diff --git a/mysql-test/suite/innodb/r/auto_increment_dup.result b/mysql-test/suite/innodb/r/auto_increment_dup.result
index 5bf901cb212..def975af6dd 100644
--- a/mysql-test/suite/innodb/r/auto_increment_dup.result
+++ b/mysql-test/suite/innodb/r/auto_increment_dup.result
@@ -13,7 +13,7 @@ INSERT INTO t1(k) VALUES (1), (2), (3) ON DUPLICATE KEY UPDATE c='1';
#
# Connection 2
#
-SET DEBUG_SYNC='start_ha_write_row WAIT_FOR continue2';
+SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2';
affected rows: 0
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
affected rows: 0
diff --git a/mysql-test/suite/innodb/r/binlog_consistent.result b/mysql-test/suite/innodb/r/binlog_consistent.result
index f0b665b5ac9..df22d634339 100644
--- a/mysql-test/suite/innodb/r/binlog_consistent.result
+++ b/mysql-test/suite/innodb/r/binlog_consistent.result
@@ -6,8 +6,8 @@ File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 421
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
-binlog_snapshot_file master-bin.000001
-binlog_snapshot_position 421
+Binlog_snapshot_file master-bin.000001
+Binlog_snapshot_position 421
BEGIN;
INSERT INTO t1 VALUES (0, "");
# Connection con1
@@ -37,8 +37,8 @@ a b
0
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
-binlog_snapshot_file master-bin.000001
-binlog_snapshot_position 945
+Binlog_snapshot_file master-bin.000001
+Binlog_snapshot_position 945
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 1357
@@ -59,16 +59,16 @@ a b
0
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
-binlog_snapshot_file master-bin.000001
-binlog_snapshot_position 945
+Binlog_snapshot_file master-bin.000001
+Binlog_snapshot_position 945
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 326
COMMIT;
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
-binlog_snapshot_file master-bin.000002
-binlog_snapshot_position 326
+Binlog_snapshot_file master-bin.000002
+Binlog_snapshot_position 326
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 326
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index 8c4c1c20590..c4504f6d348 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -1269,3 +1269,43 @@ SELECT * FROM t1;
c1 c2
1 NULL
DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2147483648, 'a');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=2147483649 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+2147483648 a
+ALTER TABLE t1 CHANGE c1 c1 INT;
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL DEFAULT '0',
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1(c2) VALUES('b');
+SELECT * FROM t1;
+c1 c2
+0 b
+2147483647 a
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL DEFAULT '0',
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-zip.result b/mysql-test/suite/innodb/r/innodb-zip.result
index b84f04c8cf0..f794ae7470f 100644
--- a/mysql-test/suite/innodb/r/innodb-zip.result
+++ b/mysql-test/suite/innodb/r/innodb-zip.result
@@ -126,12 +126,12 @@ CREATE TABLE t1(
c TEXT NOT NULL, d TEXT NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
+ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1(
c TEXT NOT NULL, d TEXT NOT NULL,
PRIMARY KEY (c(767),d(767)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
+ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1(
c TEXT NOT NULL, d TEXT NOT NULL,
PRIMARY KEY (c(767),d(767)))
@@ -139,7 +139,7 @@ ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
drop table t1;
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
+ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
index 2af2a7b80bf..7307ce9dc24 100644
--- a/mysql-test/suite/innodb/r/innodb.result
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -3026,7 +3026,7 @@ c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255),
c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
) ENGINE = InnoDB;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
+ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
diff --git a/mysql-test/suite/innodb/r/innodb_bug14704286.result b/mysql-test/suite/innodb/r/innodb_bug14704286.result
new file mode 100644
index 00000000000..9de42cb01c8
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug14704286.result
@@ -0,0 +1,53 @@
+use test;
+drop table if exists t1;
+create table t1 (id int primary key, value int, value2 int,
+value3 int, index(value,value2)) engine=innodb;
+insert into t1 values
+(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14),
+(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19),
+(20,20,20,20);
+use test;
+start transaction with consistent snapshot;
+use test;
+CREATE PROCEDURE update_t1()
+BEGIN
+DECLARE i INT DEFAULT 1;
+while (i <= 5000) DO
+update test.t1 set value2=value2+1, value3=value3+1 where id=12;
+SET i = i + 1;
+END WHILE;
+END|
+set autocommit=0;
+CALL update_t1();
+select * from t1;
+id value value2 value3
+10 10 10 10
+11 11 11 11
+12 12 5012 5012
+13 13 13 13
+14 14 14 14
+15 15 15 15
+16 16 16 16
+17 17 17 17
+18 18 18 18
+19 19 19 19
+20 20 20 20
+set autocommit=1;
+select * from t1;
+id value value2 value3
+10 10 10 10
+11 11 11 11
+12 12 5012 5012
+13 13 13 13
+14 14 14 14
+15 15 15 15
+16 16 16 16
+17 17 17 17
+18 18 18 18
+19 19 19 19
+20 20 20 20
+select * from t1 force index(value) where value=12;
+kill query @id;
+ERROR 70100: Query execution was interrupted
+drop procedure if exists update_t1;
+drop table if exists t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bug53591.result b/mysql-test/suite/innodb/r/innodb_bug53591.result
index 993497e0579..b0196318801 100644
--- a/mysql-test/suite/innodb/r/innodb_bug53591.result
+++ b/mysql-test/suite/innodb/r/innodb_bug53591.result
@@ -8,7 +8,7 @@ ERROR HY000: Too big row
SHOW WARNINGS;
Level Code Message
Error 139 Too big row
-Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
+Error 1118 Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
DROP TABLE bug53591;
SET GLOBAL innodb_file_format=Antelope;
SET GLOBAL innodb_file_per_table=0;
diff --git a/mysql-test/suite/innodb/r/innodb_bug60196.result b/mysql-test/suite/innodb/r/innodb_bug60196.result
index 411950b49dd..411950b49dd 100755..100644
--- a/mysql-test/suite/innodb/r/innodb_bug60196.result
+++ b/mysql-test/suite/innodb/r/innodb_bug60196.result
diff --git a/mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result b/mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result
index 507d8e66117..0c68c8a6975 100644
--- a/mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result
+++ b/mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result
@@ -649,7 +649,7 @@ CREATE TABLE worklog5743 (col_1_varchar VARCHAR (4000) CHARACTER SET 'utf8',
col_2_varchar VARCHAR (4000) CHARACTER SET 'utf8' ,
PRIMARY KEY (col_1_varchar(1024))
) ROW_FORMAT=DYNAMIC, engine = innodb;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
+ERROR 42000: Row size too large (> max_row_size). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
CREATE TABLE worklog5743 (
col_1_varbinary VARBINARY (4000) ,
col_2_varchar VARCHAR (4000) CHARACTER SET 'utf8',
diff --git a/mysql-test/suite/innodb/t/auto_increment_dup.test b/mysql-test/suite/innodb/t/auto_increment_dup.test
index ad439024f65..abbff46075a 100644
--- a/mysql-test/suite/innodb/t/auto_increment_dup.test
+++ b/mysql-test/suite/innodb/t/auto_increment_dup.test
@@ -33,7 +33,7 @@ SET DEBUG_SYNC='ha_write_row_end SIGNAL continue2 WAIT_FOR continue1';
--echo #
--echo # Connection 2
--echo #
-SET DEBUG_SYNC='start_ha_write_row WAIT_FOR continue2';
+SET DEBUG_SYNC='ha_write_row_start WAIT_FOR continue2';
SET DEBUG_SYNC='after_mysql_insert SIGNAL continue1';
INSERT INTO t1(k) VALUES (2), (4), (5) ON DUPLICATE KEY UPDATE c='2';
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc-master.opt b/mysql-test/suite/innodb/t/innodb-autoinc.opt
index 303ec1be1d0..303ec1be1d0 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc-master.opt
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.opt
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index 888c73bacdf..17df8877ad4 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -139,7 +139,7 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL, 1);
DELETE FROM t1 WHERE c1 = 1;
-INSERT INTO t1 VALUES (2,1);
+INSERT INTO t1 VALUES (2,1);
INSERT INTO t1 VALUES (NULL,8);
SELECT * FROM t1;
DROP TABLE t1;
@@ -639,7 +639,7 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
-# Check if we handl offset > column max value properly
+# Check if we handle offset > column max value properly
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=256;
SHOW VARIABLES LIKE "%auto_inc%";
# TINYINT
@@ -648,3 +648,21 @@ INSERT INTO t1 VALUES (1, NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
+
+# Check if we handle the case where a current value is greater than the max
+# of the column. IMO, this should not be allowed and the assertion that fails
+# is actually an invariant.
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+# TINYINT
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2147483648, 'a');
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+ALTER TABLE t1 CHANGE c1 c1 INT;
+SHOW CREATE TABLE t1;
+INSERT INTO t1(c2) VALUES('b');
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
diff --git a/mysql-test/suite/innodb/t/innodb-zip.test b/mysql-test/suite/innodb/t/innodb-zip.test
index e0ddfab38b0..7e2e2d1d3c9 100644
--- a/mysql-test/suite/innodb/t/innodb-zip.test
+++ b/mysql-test/suite/innodb/t/innodb-zip.test
@@ -1,5 +1,10 @@
-- 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`;
let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
diff --git a/mysql-test/suite/innodb/t/innodb.test b/mysql-test/suite/innodb/t/innodb.test
index d57a52a2362..db38b48facf 100644
--- a/mysql-test/suite/innodb/t/innodb.test
+++ b/mysql-test/suite/innodb/t/innodb.test
@@ -4,6 +4,11 @@
# .\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_bug14704286.test b/mysql-test/suite/innodb/t/innodb_bug14704286.test
new file mode 100644
index 00000000000..fb5e6b829a1
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug14704286.test
@@ -0,0 +1,95 @@
+--source include/have_innodb.inc
+
+#
+# create test-bed to run test
+#
+use test;
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (id int primary key, value int, value2 int,
+value3 int, index(value,value2)) engine=innodb;
+
+insert into t1 values
+(10,10,10,10),(11,11,11,11),(12,12,12,12),(13,13,13,13),(14,14,14,14),
+(15,15,15,15),(16,16,16,16),(17,17,17,17),(18,18,18,18),(19,19,19,19),
+(20,20,20,20);
+let $ID= `SELECT @id := CONNECTION_ID()`;
+
+#
+# we need multiple connections as we need to keep one connection
+# active with trx requesting consistent read.
+#
+connect (conn1, localhost, root,,);
+connect (conn2, localhost, root,,);
+connect (conn3, localhost, root,,);
+
+#
+# start trx with consistent read
+#
+connection conn1;
+use test;
+
+start transaction with consistent snapshot;
+
+#
+# update table such that secondary index is updated.
+#
+connection conn2;
+use test;
+delimiter |;
+CREATE PROCEDURE update_t1()
+BEGIN
+ DECLARE i INT DEFAULT 1;
+ while (i <= 5000) DO
+ update test.t1 set value2=value2+1, value3=value3+1 where id=12;
+ SET i = i + 1;
+ END WHILE;
+END|
+
+delimiter ;|
+set autocommit=0;
+CALL update_t1();
+select * from t1;
+set autocommit=1;
+select * from t1;
+
+#
+# Now try to fire select query from connection-1 enforcing
+# use of secondary index.
+#
+connection conn1;
+let $ID= `SELECT @id := CONNECTION_ID()`;
+#--error ER_QUERY_INTERRUPTED
+--send
+select * from t1 force index(value) where value=12;
+
+#
+# select is going to take good time so let's kill query.
+#
+connection conn3;
+let $wait_condition=
+ select * from information_schema.processlist where state = 'Sending data' and
+ info = 'select * from t1 force index(value) where value=12';
+--source include/wait_condition.inc
+let $ignore= `SELECT @id := $ID`;
+kill query @id;
+
+#
+# reap the value of connection-1
+#
+connection conn1;
+--error ER_QUERY_INTERRUPTED
+reap;
+
+#
+# clean test-bed.
+#
+connection default;
+disconnect conn1;
+disconnect conn2;
+disconnect conn3;
+drop procedure if exists update_t1;
+drop table if exists t1;
+
+
diff --git a/mysql-test/suite/innodb/t/innodb_bug53591.test b/mysql-test/suite/innodb/t/innodb_bug53591.test
index 9a1c2afbccb..f0ed4b93c32 100644
--- a/mysql-test/suite/innodb/t/innodb_bug53591.test
+++ b/mysql-test/suite/innodb/t/innodb_bug53591.test
@@ -1,5 +1,9 @@
--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_bug57904.test b/mysql-test/suite/innodb/t/innodb_bug57904.test
index 48dc5254b26..48dc5254b26 100755..100644
--- a/mysql-test/suite/innodb/t/innodb_bug57904.test
+++ b/mysql-test/suite/innodb/t/innodb_bug57904.test
diff --git a/mysql-test/suite/innodb/t/innodb_bug60196-master.opt b/mysql-test/suite/innodb/t/innodb_bug60196-master.opt
index c0a1981fa7c..c0a1981fa7c 100755..100644
--- a/mysql-test/suite/innodb/t/innodb_bug60196-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_bug60196-master.opt
diff --git a/mysql-test/suite/innodb/t/innodb_bug60196.test b/mysql-test/suite/innodb/t/innodb_bug60196.test
index e479b8d6b82..e479b8d6b82 100755..100644
--- a/mysql-test/suite/innodb/t/innodb_bug60196.test
+++ b/mysql-test/suite/innodb/t/innodb_bug60196.test
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 ecd34d00c4d..776f5dae517 100644
--- a/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test
+++ b/mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test
@@ -14,6 +14,10 @@
# #
######################################################################
+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`;
@@ -601,6 +605,7 @@ DROP TABLE worklog5743;
# Prefix index with utf8 charset + varchar.
# For varchar we also log the column itself as oppose of TEXT so it error
# with limit 1024 due to overhead.
+--replace_regex /> [0-9]*/> max_row_size/
-- error 1118
CREATE TABLE worklog5743 (col_1_varchar VARCHAR (4000) CHARACTER SET 'utf8',
col_2_varchar VARCHAR (4000) CHARACTER SET 'utf8' ,
diff --git a/mysql-test/suite/maria/truncate.result b/mysql-test/suite/maria/truncate.result
index 467e0f915dd..a9adcb9ae87 100644
--- a/mysql-test/suite/maria/truncate.result
+++ b/mysql-test/suite/maria/truncate.result
@@ -35,3 +35,15 @@ select count(*) from t1;
count(*)
0
drop table t1,t2;
+CREATE TEMPORARY TABLE t1 ( i int) ENGINE=aria;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TEMPORARY TABLE `t1` (
+ `i` int(11) DEFAULT NULL
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0
+TRUNCATE TABLE t1;
+INSERT INTO t1 (i) VALUES (1);
+lock table t1 write;
+truncate table t1;
+unlock tables;
+drop table t1;
diff --git a/mysql-test/suite/maria/truncate.test b/mysql-test/suite/maria/truncate.test
index 3d6e70d9db6..11d42dc3879 100644
--- a/mysql-test/suite/maria/truncate.test
+++ b/mysql-test/suite/maria/truncate.test
@@ -45,3 +45,16 @@ select * from t1;
truncate t1;
select count(*) from t1;
drop table t1,t2;
+
+#
+# MDEV-3890
+# Server crash inserting record on a temporary table after truncating it
+#
+CREATE TEMPORARY TABLE t1 ( i int) ENGINE=aria;
+SHOW CREATE TABLE t1;
+TRUNCATE TABLE t1;
+INSERT INTO t1 (i) VALUES (1);
+lock table t1 write;
+truncate table t1;
+unlock tables;
+drop table t1;
diff --git a/mysql-test/suite/perfschema/include/upgrade_check.inc b/mysql-test/suite/perfschema/include/upgrade_check.inc
index 440eb8f7123..52d4cfd1e63 100644
--- a/mysql-test/suite/perfschema/include/upgrade_check.inc
+++ b/mysql-test/suite/perfschema/include/upgrade_check.inc
@@ -8,6 +8,8 @@
--source include/wait_until_count_sessions.inc
# Verify that mysql_upgrade complained about the performance_schema
+
+--replace_regex /at line [0-9]+/at line ###/
--cat_file $err_file
--error 0,1
--remove_file $out_file
diff --git a/mysql-test/suite/perfschema/r/func_file_io.result b/mysql-test/suite/perfschema/r/func_file_io.result
index c95fae94803..7849b97f0ed 100644
--- a/mysql-test/suite/perfschema/r/func_file_io.result
+++ b/mysql-test/suite/perfschema/r/func_file_io.result
@@ -1,6 +1,7 @@
UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/io/file/%';
+flush status;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value')
ENGINE=MyISAM;
@@ -113,3 +114,19 @@ WHERE p.PROCESSLIST_ID = 1
GROUP BY h.EVENT_NAME
HAVING TOTAL_WAIT > 0;
UPDATE performance_schema.setup_instruments SET enabled = 'YES';
+show status like "performance_schema%";
+Variable_name Value
+Performance_schema_cond_classes_lost 0
+Performance_schema_cond_instances_lost 0
+Performance_schema_file_classes_lost 0
+Performance_schema_file_handles_lost 0
+Performance_schema_file_instances_lost 0
+Performance_schema_locker_lost 0
+Performance_schema_mutex_classes_lost 0
+Performance_schema_mutex_instances_lost 0
+Performance_schema_rwlock_classes_lost 0
+Performance_schema_rwlock_instances_lost 0
+Performance_schema_table_handles_lost 0
+Performance_schema_table_instances_lost 0
+Performance_schema_thread_classes_lost 0
+Performance_schema_thread_instances_lost 0
diff --git a/mysql-test/suite/perfschema/r/func_mutex.result b/mysql-test/suite/perfschema/r/func_mutex.result
index 93a8ae5d218..2cb1d3da80d 100644
--- a/mysql-test/suite/perfschema/r/func_mutex.result
+++ b/mysql-test/suite/perfschema/r/func_mutex.result
@@ -2,6 +2,15 @@ UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/synch/mutex/%'
OR name LIKE 'wait/synch/rwlock/%';
+flush status;
+select NAME from performance_schema.mutex_instances
+where NAME = 'wait/synch/mutex/sql/LOCK_open';
+NAME
+wait/synch/mutex/sql/LOCK_open
+select NAME from performance_schema.rwlock_instances
+where NAME = 'wait/synch/rwlock/sql/LOCK_grant';
+NAME
+wait/synch/rwlock/sql/LOCK_grant
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value')
ENGINE=MyISAM;
@@ -112,3 +121,19 @@ test_fm2_rw_timed
Success
UPDATE performance_schema.setup_instruments SET enabled = 'YES';
DROP TABLE t1;
+show status like "performance_schema%";
+Variable_name Value
+Performance_schema_cond_classes_lost 0
+Performance_schema_cond_instances_lost 0
+Performance_schema_file_classes_lost 0
+Performance_schema_file_handles_lost 0
+Performance_schema_file_instances_lost 0
+Performance_schema_locker_lost 0
+Performance_schema_mutex_classes_lost 0
+Performance_schema_mutex_instances_lost 0
+Performance_schema_rwlock_classes_lost 0
+Performance_schema_rwlock_instances_lost 0
+Performance_schema_table_handles_lost 0
+Performance_schema_table_instances_lost 0
+Performance_schema_thread_classes_lost 0
+Performance_schema_thread_instances_lost 0
diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade.result b/mysql-test/suite/perfschema/r/pfs_upgrade.result
index b15fb1ad7fa..97c67e45ad3 100644
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result
@@ -8,24 +8,24 @@ use performance_schema;
show tables like "user_table";
Tables_in_performance_schema (user_table)
user_table
-ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 478: Table 'threads' already exists
-ERROR 1644 (HY000) at line 1132: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line ###: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line ###: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line ###: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line ###: Table 'threads' already exists
+ERROR 1644 (HY000) at line ###: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_table";
Tables_in_performance_schema (user_table)
@@ -38,24 +38,24 @@ use performance_schema;
show tables like "user_view";
Tables_in_performance_schema (user_view)
user_view
-ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 478: Table 'threads' already exists
-ERROR 1644 (HY000) at line 1132: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line ###: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line ###: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line ###: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line ###: Table 'threads' already exists
+ERROR 1644 (HY000) at line ###: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_view";
Tables_in_performance_schema (user_view)
@@ -66,24 +66,24 @@ drop view test.user_view;
create procedure test.user_proc()
select "Not supposed to be here";
update mysql.proc set db='performance_schema' where name='user_proc';
-ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 478: Table 'threads' already exists
-ERROR 1644 (HY000) at line 1132: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line ###: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line ###: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line ###: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line ###: Table 'threads' already exists
+ERROR 1644 (HY000) at line ###: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
@@ -94,24 +94,24 @@ drop procedure test.user_proc;
create function test.user_func() returns integer
return 0;
update mysql.proc set db='performance_schema' where name='user_func';
-ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 478: Table 'threads' already exists
-ERROR 1644 (HY000) at line 1132: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line ###: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line ###: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line ###: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line ###: Table 'threads' already exists
+ERROR 1644 (HY000) at line ###: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
@@ -122,24 +122,24 @@ drop function test.user_func;
create event test.user_event on schedule every 1 day do
select "not supposed to be here";
update mysql.event set db='performance_schema' where name='user_event';
-ERROR 1050 (42S01) at line 183: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 213: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 227: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 241: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 262: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 283: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 303: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 320: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 339: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 359: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 376: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 394: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 412: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 428: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 445: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 461: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 478: Table 'threads' already exists
-ERROR 1644 (HY000) at line 1132: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line ###: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line ###: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line ###: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line ###: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line ###: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line ###: Table 'threads' already exists
+ERROR 1644 (HY000) at line ###: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.event where db='performance_schema';
name
diff --git a/mysql-test/suite/perfschema/t/func_file_io.test b/mysql-test/suite/perfschema/t/func_file_io.test
index e8b01a10bd1..3de26cfcb8e 100644
--- a/mysql-test/suite/perfschema/t/func_file_io.test
+++ b/mysql-test/suite/perfschema/t/func_file_io.test
@@ -12,6 +12,9 @@ UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES';
UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/io/file/%';
+# reset lost counters
+flush status;
+
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -182,3 +185,7 @@ HAVING TOTAL_WAIT > 0;
# Clean-up.
UPDATE performance_schema.setup_instruments SET enabled = 'YES';
+
+# In case of failure, will indicate the root cause
+show status like "performance_schema%";
+
diff --git a/mysql-test/suite/perfschema/t/func_mutex.test b/mysql-test/suite/perfschema/t/func_mutex.test
index c0af600077e..a96b497ffec 100644
--- a/mysql-test/suite/perfschema/t/func_mutex.test
+++ b/mysql-test/suite/perfschema/t/func_mutex.test
@@ -13,6 +13,15 @@ UPDATE performance_schema.setup_instruments SET enabled = 'YES'
WHERE name LIKE 'wait/synch/mutex/%'
OR name LIKE 'wait/synch/rwlock/%';
+# reset lost counters
+flush status;
+
+# Make sure objects are instrumented
+select NAME from performance_schema.mutex_instances
+ where NAME = 'wait/synch/mutex/sql/LOCK_open';
+select NAME from performance_schema.rwlock_instances
+ where NAME = 'wait/synch/rwlock/sql/LOCK_grant';
+
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -116,3 +125,7 @@ SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success
# Clean-up.
UPDATE performance_schema.setup_instruments SET enabled = 'YES';
DROP TABLE t1;
+
+# In case of failure, will indicate the root cause
+show status like "performance_schema%";
+
diff --git a/mysql-test/suite/plugins/r/audit_null_debug.result b/mysql-test/suite/plugins/r/audit_null_debug.result
new file mode 100644
index 00000000000..2b5fa291f24
--- /dev/null
+++ b/mysql-test/suite/plugins/r/audit_null_debug.result
@@ -0,0 +1,12 @@
+call mtr.add_suppression("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
+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';
+uninstall plugin audit_null;
+ERROR HY000: Incorrect key file for table './mysql/plugin.MYI'; try to repair it
+SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage';
+uninstall plugin audit_null;
+ERROR 42000: PLUGIN audit_null does not exist
diff --git a/mysql-test/suite/plugins/t/audit_null_debug.test b/mysql-test/suite/plugins/t/audit_null_debug.test
new file mode 100644
index 00000000000..d9e6cad5524
--- /dev/null
+++ b/mysql-test/suite/plugins/t/audit_null_debug.test
@@ -0,0 +1,27 @@
+--source include/have_debug.inc
+--source include/not_embedded.inc
+
+if (!$ADT_NULL_SO) {
+ skip No NULL_AUDIT plugin;
+}
+
+call mtr.add_suppression("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';
+--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';
+--error 126
+uninstall plugin audit_null;
+SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage';
+
+--error 1305
+uninstall plugin audit_null;
+
diff --git a/mysql-test/suite/rpl/r/rpl_password_boundaries.result b/mysql-test/suite/rpl/r/rpl_password_boundaries.result
new file mode 100644
index 00000000000..71f32f492a2
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_password_boundaries.result
@@ -0,0 +1,59 @@
+include/master-slave.inc
+[connection master]
+include/rpl_reset.inc
+[ on master ]
+set sql_log_bin=0;
+grant replication slave on *.* to rpl32@127.0.0.1 identified by '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
+set sql_log_bin=1;
+[ on slave ]
+include/stop_slave.inc
+change master to master_user='rpl32',master_password='0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
+include/start_slave.inc
+[ on master ]
+drop table if exists t1;
+Warnings:
+Note 1051 Unknown table 't1'
+create table t1 (i int);
+insert into t1 values (1);
+[ on slave: synchronized ]
+[ on master ]
+set sql_log_bin=0;
+grant replication slave on *.* to rpl33@127.0.0.1 identified by '0123456789abcdef0123456789abcdef!';
+set sql_log_bin=1;
+[ on slave ]
+include/stop_slave.inc
+change master to master_user='rpl33',master_password='0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef!';
+ERROR HY000: String '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef012345' is too long for MASTER_PASSWORD (should be no longer than 96)
+change master to master_user='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
+ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long for MASTER_USER (should be no longer than 47)
+change master to master_host='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
+ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbb' is too long for MASTER_HOST (should be no longer than 180)
+[ on master ]
+set sql_log_bin=0;
+grant replication slave on *.* to rpl16cyr@127.0.0.1 identified by 'воттакойужпарольвоттакойужпарольвоттакойужпароль';
+set sql_log_bin=1;
+[ on slave ]
+SET NAMES utf8;
+change master to master_user='rpl16cyr',master_password='воттакойужпарольвоттакойужпарольвоттакойужпароль';
+include/start_slave.inc
+[ on master ]
+drop table if exists t1;
+create table t1 (i int);
+insert into t1 values (1);
+[ on slave: synchronized ]
+[ on master ]
+set sql_log_bin=0;
+grant replication slave on *.* to rpl17mix@127.0.0.1 identified by 'воттакойужпарольвоттакойужпарольвоттакойужпароль!';
+set sql_log_bin=1;
+[ on slave ]
+include/stop_slave.inc
+change master to master_user='rpl17mix',master_password='воттакойужпарольвоттакойужпарольвоттакойужпароль!';
+ERROR HY000: String 'воттакойужпарольвоттакойужпарольвот' is too long for MASTER_PASSWORD (should be no longer than 96)
+[ on master ]
+set sql_log_bin=0;
+drop user rpl32@127.0.0.1, rpl33@127.0.0.1, rpl16cyr@127.0.0.1, rpl17mix@127.0.0.1;
+set sql_log_bin=1;
+change master to master_user='root',master_password='';
+include/start_slave.inc
+drop table if exists t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result
index bb037de4e6d..51859b5b49b 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result
@@ -93,7 +93,7 @@ Variable_name Value
Rpl_semi_sync_master_no_tx 0
show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
-Rpl_semi_sync_master_yes_tx 301
+Rpl_semi_sync_master_yes_tx 11
[ on slave ]
[ slave status after replicated inserts ]
show status like 'Rpl_semi_sync_slave_status';
@@ -101,13 +101,13 @@ Variable_name Value
Rpl_semi_sync_slave_status ON
select count(distinct a) from t1;
count(distinct a)
-300
+10
select min(a) from t1;
min(a)
1
select max(a) from t1;
max(a)
-300
+10
# BUG#50157
# semi-sync replication crashes when replicating a transaction which
@@ -133,6 +133,7 @@ SET SESSION AUTOCOMMIT= 1;
#
include/stop_slave.inc
[ on master ]
+set global rpl_semi_sync_master_timeout= 5000;
[ master status should be ON ]
show status like 'Rpl_semi_sync_master_status';
Variable_name Value
@@ -142,7 +143,7 @@ Variable_name Value
Rpl_semi_sync_master_no_tx 0
show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
-Rpl_semi_sync_master_yes_tx 304
+Rpl_semi_sync_master_yes_tx 14
show status like 'Rpl_semi_sync_master_clients';
Variable_name Value
Rpl_semi_sync_master_clients 1
@@ -157,7 +158,7 @@ Variable_name Value
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 304
+Rpl_semi_sync_master_yes_tx 14
insert into t1 values (100);
[ master status should be OFF ]
show status like 'Rpl_semi_sync_master_status';
@@ -165,10 +166,10 @@ Variable_name Value
Rpl_semi_sync_master_status OFF
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
-Rpl_semi_sync_master_no_tx 302
+Rpl_semi_sync_master_no_tx 12
show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
-Rpl_semi_sync_master_yes_tx 304
+Rpl_semi_sync_master_yes_tx 14
#
# Test semi-sync status on master will be ON again when slave catches up
#
@@ -198,10 +199,10 @@ Variable_name Value
Rpl_semi_sync_master_status ON
show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value
-Rpl_semi_sync_master_no_tx 302
+Rpl_semi_sync_master_no_tx 12
show status like 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
-Rpl_semi_sync_master_yes_tx 304
+Rpl_semi_sync_master_yes_tx 14
show status like 'Rpl_semi_sync_master_clients';
Variable_name Value
Rpl_semi_sync_master_clients 1
@@ -217,10 +218,10 @@ include/stop_slave.inc
[ Semi-sync master status variables before FLUSH STATUS ]
SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
Variable_name Value
-Rpl_semi_sync_master_no_tx 302
+Rpl_semi_sync_master_no_tx 12
SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx';
Variable_name Value
-Rpl_semi_sync_master_yes_tx 305
+Rpl_semi_sync_master_yes_tx 15
FLUSH NO_WRITE_TO_BINLOG STATUS;
[ Semi-sync master status variables after FLUSH STATUS ]
SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx';
@@ -307,13 +308,13 @@ reset slave;
[ on master ]
reset master;
set sql_log_bin=0;
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
flush privileges;
set sql_log_bin=1;
[ on slave ]
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
flush privileges;
-change master to master_user='rpl',master_password='rpl';
+change master to master_user='rpl',master_password='rpl_password';
include/start_slave.inc
show status like 'Rpl_semi_sync_slave_status';
Variable_name Value
diff --git a/mysql-test/suite/rpl/t/rpl_password_boundaries.test b/mysql-test/suite/rpl/t/rpl_password_boundaries.test
new file mode 100644
index 00000000000..cf8abfbda11
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_password_boundaries.test
@@ -0,0 +1,112 @@
+source include/not_embedded.inc;
+source include/master-slave.inc;
+source include/rpl_reset.inc;
+
+# Suppress warnings that might be generated during the test
+disable_query_log;
+connection master;
+call mtr.add_suppression("Timeout waiting for reply of binlog");
+connection slave;
+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;
+echo [ on master ];
+
+# wait for dying connections (if any) to disappear
+let $wait_condition= select count(*) = 0 from information_schema.processlist where command='killed';
+--source include/wait_condition.inc
+
+# 32*3-character ASCII password should work all right
+
+set sql_log_bin=0;
+grant replication slave on *.* to rpl32@127.0.0.1 identified by '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
+set sql_log_bin=1;
+
+connection slave;
+echo [ on slave ];
+source include/stop_slave.inc;
+change master to master_user='rpl32',master_password='0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
+source include/start_slave.inc;
+
+connection master;
+echo [ on master ];
+drop table if exists t1;
+create table t1 (i int);
+insert into t1 values (1);
+sync_slave_with_master;
+echo [ on slave: synchronized ];
+
+connection master;
+echo [ on master ];
+
+# 32*3+1 -character ASCII password expected to fail
+set sql_log_bin=0;
+grant replication slave on *.* to rpl33@127.0.0.1 identified by '0123456789abcdef0123456789abcdef!';
+set sql_log_bin=1;
+
+connection slave;
+echo [ on slave ];
+source include/stop_slave.inc;
+--error ER_WRONG_STRING_LENGTH
+change master to master_user='rpl33',master_password='0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef!';
+
+# Check also master_user and master_host
+--error ER_WRONG_STRING_LENGTH
+change master to master_user='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
+--error ER_WRONG_STRING_LENGTH
+change master to master_host='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
+
+# 48-character cyrillic password should work all right
+connection master;
+echo [ on master ];
+set sql_log_bin=0;
+grant replication slave on *.* to rpl16cyr@127.0.0.1 identified by 'воттакойужпарольвоттакойужпарольвоттакойужпароль';
+set sql_log_bin=1;
+
+connection slave;
+echo [ on slave ];
+SET NAMES utf8;
+change master to master_user='rpl16cyr',master_password='воттакойужпарольвоттакойужпарольвоттакойужпароль';
+source include/start_slave.inc;
+
+connection master;
+echo [ on master ];
+drop table if exists t1;
+create table t1 (i int);
+insert into t1 values (1);
+sync_slave_with_master;
+echo [ on slave: synchronized ];
+
+# 48+1-character cyrillic password should fail
+
+connection master;
+echo [ on master ];
+set sql_log_bin=0;
+grant replication slave on *.* to rpl17mix@127.0.0.1 identified by 'воттакойужпарольвоттакойужпарольвоттакойужпароль!';
+set sql_log_bin=1;
+
+connection slave;
+echo [ on slave ];
+source include/stop_slave.inc;
+--error ER_WRONG_STRING_LENGTH
+change master to master_user='rpl17mix',master_password='воттакойужпарольвоттакойужпарольвоттакойужпароль!';
+
+# Cleanup
+
+connection master;
+echo [ on master ];
+set sql_log_bin=0;
+drop user rpl32@127.0.0.1, rpl33@127.0.0.1, rpl16cyr@127.0.0.1, rpl17mix@127.0.0.1;
+set sql_log_bin=1;
+
+connection slave;
+change master to master_user='root',master_password='';
+source include/start_slave.inc;
+
+connection master;
+drop table if exists t1;
+sync_slave_with_master;
+
+connection master;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test
index 61ba6714095..ac5511e28a3 100644
--- a/mysql-test/suite/rpl/t/rpl_semi_sync.test
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test
@@ -67,7 +67,7 @@ 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= 5000; /* 5s */
+ set global rpl_semi_sync_master_timeout= 60000; /* 60s */
set sql_log_bin=1;
}
enable_query_log;
@@ -177,7 +177,7 @@ 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=300;
+let $i=10;
echo [ insert records to table ];
disable_query_log;
while ($i)
@@ -242,6 +242,7 @@ source include/stop_slave.inc;
connection master;
echo [ on master ];
+set global rpl_semi_sync_master_timeout= 5000;
# The first semi-sync check should be on because after slave stop,
# there are no transactions on the master.
@@ -270,7 +271,7 @@ 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=300;
+let $i=10;
disable_query_log;
while ($i)
{
@@ -475,14 +476,14 @@ if ($_tid)
# Do not binlog the following statement because it will generate
# different events for ROW and STATEMENT format
set sql_log_bin=0;
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
flush privileges;
set sql_log_bin=1;
connection slave;
echo [ on slave ];
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl_password';
flush privileges;
-change master to master_user='rpl',master_password='rpl';
+change master to master_user='rpl',master_password='rpl_password';
source include/start_slave.inc;
show status like 'Rpl_semi_sync_slave_status';
connection master;
diff --git a/mysql-test/suite/sphinx/sphinx.result b/mysql-test/suite/sphinx/sphinx.result
index a671028bbe2..82c76335e0b 100644
--- a/mysql-test/suite/sphinx/sphinx.result
+++ b/mysql-test/suite/sphinx/sphinx.result
@@ -48,15 +48,12 @@ SET optimizer_switch=@save_optimizer_switch;
drop table ts;
show status like "sphinx_error%";
Variable_name Value
-sphinx_error_commits 0
-sphinx_error_group_commits 0
-sphinx_error_snapshot_file
-sphinx_error_snapshot_position 0
+Sphinx_error OFF
show status like "sphinx_total%";
Variable_name Value
-sphinx_total 2
-sphinx_total_found 2
+Sphinx_total 2
+Sphinx_total_found 2
show status like "sphinx_word%";
Variable_name Value
-sphinx_word_count 0
-sphinx_words
+Sphinx_word_count 0
+Sphinx_words
diff --git a/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result b/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result
index 2b74f891050..fc0078581fb 100644
--- a/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result
@@ -55,9 +55,6 @@ Warnings:
Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '-2'
set global innodb_change_buffering_debug=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug'
-set global innodb_change_buffering_debug=2;
-Warnings:
-Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '2'
SET @@global.innodb_change_buffering_debug = @start_global_value;
SELECT @@global.innodb_change_buffering_debug;
@@global.innodb_change_buffering_debug
diff --git a/mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result b/mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result
index e69de29bb2d..d9d067c2cf9 100644
--- a/mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_locking_fake_changes_basic.result b/mysql-test/suite/sys_vars/r/innodb_locking_fake_changes_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_locking_fake_changes_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/innodb_max_bitmap_file_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_max_bitmap_file_size_basic.result
new file mode 100644
index 00000000000..d9d067c2cf9
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_max_bitmap_file_size_basic.result
@@ -0,0 +1 @@
+XtraDB extension
diff --git a/mysql-test/suite/sys_vars/r/pseudo_thread_id_basic.result b/mysql-test/suite/sys_vars/r/pseudo_thread_id_basic.result
index ee6169a9e35..4192f6b2444 100644
--- a/mysql-test/suite/sys_vars/r/pseudo_thread_id_basic.result
+++ b/mysql-test/suite/sys_vars/r/pseudo_thread_id_basic.result
@@ -1,8 +1,5 @@
select @@global.pseudo_thread_id;
ERROR HY000: Variable 'pseudo_thread_id' is a SESSION variable
-select @@session.pseudo_thread_id between 1 and 10000;
-@@session.pseudo_thread_id between 1 and 10000
-1
should be empty
show global variables like 'pseudo_thread_id';
Variable_name Value
diff --git a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test
index ec1065a538e..893d1cb42e3 100644
--- a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test
@@ -42,7 +42,9 @@ set global innodb_change_buffering_debug='foo';
set global innodb_change_buffering_debug=-2;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_change_buffering_debug=1e1;
-set global innodb_change_buffering_debug=2;
+# The value 2 is supposed to kill the server if there are unmerged changes.
+# Do not try to set the value to 2 or anything that can be clamped to 2.
+#set global innodb_change_buffering_debug=2;
#
# Cleanup
diff --git a/mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test b/mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test
index e69de29bb2d..00aa476e8d2 100644
--- a/mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_locking_fake_changes_basic.test b/mysql-test/suite/sys_vars/t/innodb_locking_fake_changes_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_locking_fake_changes_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/innodb_max_bitmap_file_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_max_bitmap_file_size_basic.test
new file mode 100644
index 00000000000..00aa476e8d2
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_max_bitmap_file_size_basic.test
@@ -0,0 +1 @@
+--echo XtraDB extension
diff --git a/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test b/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test
index fef3e906869..aaf87912213 100644
--- a/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test
+++ b/mysql-test/suite/sys_vars/t/pseudo_thread_id_basic.test
@@ -9,9 +9,6 @@
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@global.pseudo_thread_id;
-# Check the variable has a valid numeric value (assumed to be less then 10000)
-select @@session.pseudo_thread_id between 1 and 10000;
-
--echo should be empty
show global variables like 'pseudo_thread_id';
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
index 17b38b7d7af..14467b2d630 100644
--- a/mysql-test/suite/vcol/r/vcol_misc.result
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -182,6 +182,17 @@ a b c
2 3 y
0 1 y,n
drop table t1,t2;
+CREATE TABLE t1 (
+ts TIMESTAMP,
+tsv TIMESTAMP AS (ADDDATE(ts, INTERVAL 1 DAY)) VIRTUAL
+) ENGINE=MyISAM;
+INSERT INTO t1 (tsv) VALUES (DEFAULT);
+INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT);
+FLUSH TABLES;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+2
+DROP TABLE t1;
create table t1 (a int, b int);
insert into t1 values (3, 30), (4, 20), (1, 20);
create table t2 (c int, d int, v int as (d+1), index idx(c));
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
index 01404046cde..3c51ee4b685 100644
--- a/mysql-test/suite/vcol/t/vcol_misc.test
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -179,6 +179,25 @@ select * from t2;
drop table t1,t2;
#
+# Bug mdev-3938: INSERT DELAYED for a table with virtual columns
+#
+
+CREATE TABLE t1 (
+ ts TIMESTAMP,
+ tsv TIMESTAMP AS (ADDDATE(ts, INTERVAL 1 DAY)) VIRTUAL
+) ENGINE=MyISAM;
+
+INSERT INTO t1 (tsv) VALUES (DEFAULT);
+
+INSERT DELAYED INTO t1 (tsv) VALUES (DEFAULT);
+
+FLUSH TABLES;
+
+SELECT COUNT(*) FROM t1;
+
+DROP TABLE t1;
+
+#
# SELECT that uses a virtual column and executed with BKA
#
diff --git a/mysql-test/t/alias.test b/mysql-test/t/alias.test
index 0e2d57598e2..c02ebe2f5ff 100644
--- a/mysql-test/t/alias.test
+++ b/mysql-test/t/alias.test
@@ -215,3 +215,14 @@ drop table t4;
drop table t1,t2,t3;
# End of 5.2 tests
+
+#
+# MDEV-3908 crash in multi-table delete and mdl
+#
+connect (c1,localhost,root,,);
+connection c1;
+# this used to crash on disconnect
+--error ER_PARSE_ERROR
+DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZROM t1 WHERE 1=1;
+connection default;
+disconnect c1;
diff --git a/mysql-test/t/change_user_notembedded.test b/mysql-test/t/change_user_notembedded.test
new file mode 100644
index 00000000000..bf5d1956cd5
--- /dev/null
+++ b/mysql-test/t/change_user_notembedded.test
@@ -0,0 +1,24 @@
+source include/not_embedded.inc;
+
+#
+# MDEV-3915 COM_CHANGE_USER allows fast password brute-forcing
+#
+# only three failed change_user per connection.
+# successful change_user do NOT reset the counter
+#
+connect (test,localhost,root,,);
+connection test;
+--error 1045
+change_user foo,bar;
+--error 1045
+change_user foo;
+change_user;
+--error 1045
+change_user foo,bar;
+--error 1047
+change_user foo,bar;
+--error 1047
+change_user;
+disconnect test;
+connection default;
+
diff --git a/mysql-test/t/create_delayed.test b/mysql-test/t/create_delayed.test
new file mode 100644
index 00000000000..e99886d97d1
--- /dev/null
+++ b/mysql-test/t/create_delayed.test
@@ -0,0 +1,34 @@
+#
+# Ensure that INSERT DELAYED works with CREATE TABLE on existing table
+#
+
+-- source include/big_test.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+--disable_query_log
+--disable_result_log
+
+--let $run=1000
+
+--echo Starting test
+
+while ($run)
+{
+# --echo # $run attempts left...
+ CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1)) ENGINE=MyISAM;
+ INSERT DELAYED t1 VALUES (4);
+--error ER_TABLE_EXISTS_ERROR
+ CREATE TABLE t1 AS SELECT 1 AS f1;
+
+ REPLACE DELAYED t1 VALUES (5);
+ DROP TABLE t1;
+--dec $run
+}
+
+--enable_query_log
+--enable_result_log
+
+--echo # All done
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index f3557e36a58..9f5b4153bce 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -68,6 +68,38 @@ RPAD(_ucs2 X'0420',10,_ucs2 X'0421') r;
SHOW CREATE TABLE t1;
DROP TABLE t1;
+--echo #
+--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
+--echo # and reverse() function
+--echo #
+
+--echo # Problem # 1 (original report): wrong parsing of ucs2 data
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+--echo # should return 2 zeroes (as the value is truncated)
+SELECT * FROM t1;
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/tmpp.txt;
+
+
+--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+--echo # should return 0 and 1 (10 reversed)
+SELECT * FROM t1;
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
+
+
+
#
# BUG3946
#
diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test
index 847e302e615..f42d30e1f00 100644
--- a/mysql-test/t/ctype_utf16.test
+++ b/mysql-test/t/ctype_utf16.test
@@ -777,6 +777,10 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
GROUP BY id
ORDER BY l DESC;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
#
## TODO: add tests for all engines
diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test
index 210589adc81..0b90f222593 100644
--- a/mysql-test/t/ctype_utf8.test
+++ b/mysql-test/t/ctype_utf8.test
@@ -1590,6 +1590,11 @@ SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1
GROUP BY id
ORDER BY l DESC;
+SELECT id, CHAR_LENGTH(GROUP_CONCAT(body)) AS l
+FROM (SELECT 'a' AS id, REPEAT('foo bar', 100) AS body
+UNION ALL
+SELECT 'a' AS id, REPEAT('bla bla', 100) AS body) t1;
+
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 30811be2934..c7705294ef2 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1451,6 +1451,67 @@ select * from t1;
drop table t1,t2;
--echo #
+--echo # MDEV-3873: Wrong result (extra rows) with NOT IN and
+--echo # a subquery from a MERGE view
+--echo #
+
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4),(7),(0);
+
+CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2);
+
+CREATE TABLE t3 (c INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (4),(6),(3);
+
+CREATE TABLE t4 (d INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (4),(5),(3);
+
+CREATE TABLE tv (e INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO tv VALUES (1),(3);
+
+CREATE ALGORITHM=TEMPTABLE VIEW v_temptable AS SELECT * FROM tv;
+CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
+
+SELECT * FROM t1, t2
+WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_temptable ON (c = e) WHERE c <> b ) AND a < b;
+
+SELECT * FROM t1, t2
+WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN v_merge ON (c = e) WHERE c <> b ) AND a < b;
+
+SELECT * FROM t1, t2
+WHERE a NOT IN ( SELECT e FROM t3 LEFT JOIN (SELECT * FROM tv) as derived ON (c = e) WHERE c <> b ) AND a < b;
+
+drop view v_temptable, v_merge;
+drop table t1,t2,t3,t4,tv;
+
+--echo #
+--echo # MDEV-3912: Wrong result (extra rows) with FROM subquery inside
+--echo # ALL subquery, LEFT JOIN, derived_merge.
+--echo # (duplicate of MDEV-3873 (above))
+--echo #
+
+SET @save3912_optimizer_switch=@@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4),(8);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (7),(0);
+
+CREATE TABLE t3 (c INT, d INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (0,4),(8,6);
+
+SELECT * FROM t1
+WHERE a >= ALL (
+SELECT d FROM t2 LEFT JOIN ( SELECT * FROM t3 ) AS alias ON ( c = b )
+WHERE b >= a
+);
+set optimizer_switch=@save3912_optimizer_switch;
+drop table t1, t2, t3;
+
+--echo #
--echo # end of 5.3 tests
--echo #
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 051499f465b..f1c120a313d 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -658,6 +658,31 @@ select time(f1) from t1 ;
select distinct time(f1) from t1 ;
drop table t1;
+#
+# MDEV-3875 Wrong result (missing row) on a DISTINCT query with the same subquery in the SELECT list and GROUP BY
+# MySQL Bug#66896 Distinct not distinguishing 0 from NULL when GROUP BY is used
+#
+create table t1(i int, g int); # remove_dup_with_hash_index
+insert into t1 values (null, 1), (0, 2);
+select distinct i from t1 group by g;
+drop table t1;
+
+create table t1(i int, g blob); # remove_dup_with_compare
+insert into t1 values (null, 1), (0, 2);
+select distinct i from t1 group by g;
+drop table t1;
+
+create table t1 (a int) engine=myisam;
+insert into t1 values (0),(7);
+create table t2 (b int) engine=myisam;
+insert into t2 values (7),(0),(3);
+create algorithm=temptable view v as
+select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
+select * from v;
+select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
+drop view v;
+drop table t1, t2;
+
--echo #
--echo # Bug #11744875: 4082: integer lengths cause truncation with distinct concat and innodb
--echo #
diff --git a/mysql-test/t/failed_auth_3909.test b/mysql-test/t/failed_auth_3909.test
new file mode 100644
index 00000000000..3179794d155
--- /dev/null
+++ b/mysql-test/t/failed_auth_3909.test
@@ -0,0 +1,37 @@
+source include/not_embedded.inc;
+
+#
+# MDEV-3909 remote user enumeration
+#
+# verify that for some failed login attemps (with wrong user names)
+# the server requests a plugin
+#
+optimize table mysql.user;
+insert mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar');
+flush privileges;
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_PLUGIN_IS_NOT_LOADED
+connect (fail,localhost,u1);
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (fail,localhost,u2);
+
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (fail,localhost,u2,password);
+
+--error ER_PLUGIN_IS_NOT_LOADED
+change_user u1;
+
+--error ER_ACCESS_DENIED_ERROR
+change_user u2;
+
+--error ER_ACCESS_DENIED_ERROR
+change_user u2,password;
+
+delete from mysql.user where plugin = 'bar';
+flush privileges;
+
+
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index e4a1206fa9c..936b93b49c9 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -375,7 +375,7 @@ select group_concat('x') UNION ALL select 1;
drop table t1;
#
-# Bug #12863 : missing separators after first empty cancatanated elements
+# Bug #12863 : missing separators after first empty concatenated elements
#
CREATE TABLE t1 (id int, a varchar(9));
@@ -795,3 +795,11 @@ INSERT INTO t2 SELECT GROUP_CONCAT(a), b FROM t1 GROUP BY b;
SET group_concat_max_len = DEFAULT;
SET @@sql_mode = @old_sql_mode;
DROP TABLE t1, t2;
+
+#
+# MDEV-3987 uninitialized read in Item_cond::fix_fields leads to crash: select .. where .. in ( select ... )
+#
+create table t1 (a char(1) character set utf8);
+insert into t1 values ('a'),('b');
+select 1 from t1 where a in (select group_concat(a) from t1);
+drop table t1;
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 1f221ce9878..292db69a6e3 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -348,6 +348,25 @@ SELECT 1 from t1 HAVING NAME_CONST('', a);
DROP TABLE t1;
+--echo #
+--echo # Test or correct maybe_null of last_value
+--echo #
+CREATE TABLE t1 (a char(2) not null );
+INSERT INTO t1 VALUES (4),(7),(1);
+set @optimizer_switch_save= @@optimizer_switch;
+set optimizer_switch='materialization=off';
+CREATE TABLE tv (e char(2) not null ) engine=mysql;
+INSERT INTO tv VALUES (1);
+CREATE ALGORITHM=MERGE VIEW v_merge AS SELECT * FROM tv;
+CREATE ALGORITHM=MERGE VIEW vm AS SELECT * FROM tv;
+explain extended
+select a from t1 left join v_merge on (a=e) where last_value(NULL,e) not in (select last_value(NULL,e) from vm);
+explain extended
+select a from t1 left join v_merge on (a=e) where e not in (select last_value(NULL,e) from vm);
+set optimizer_switch=@optimizer_switch_save;
+drop view v_merge, vm;
+drop table t1,tv;
+
--echo #
--echo # End of 5.5 tests
diff --git a/mysql-test/t/gis2.test b/mysql-test/t/gis2.test
new file mode 100644
index 00000000000..b734ab19ecd
--- /dev/null
+++ b/mysql-test/t/gis2.test
@@ -0,0 +1,17 @@
+#
+# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column
+#
+
+CREATE TABLE t1 (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT,
+ point_data POINT NOT NULL,
+ PRIMARY KEY (id),
+ KEY idx_point_data(point_data)
+) ENGINE=MyISAM;
+INSERT t1 (point_data) VALUES
+ (GeomFromText('Point(37.0248492 23.8512726)')),
+ (GeomFromText('Point(38.0248492 23.8512726)'));
+SELECT id FROM t1
+WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
+DROP TABLE t1;
+
diff --git a/mysql-test/t/grant_lowercase.opt b/mysql-test/t/grant_lowercase.opt
new file mode 100644
index 00000000000..5b0a3d41b41
--- /dev/null
+++ b/mysql-test/t/grant_lowercase.opt
@@ -0,0 +1 @@
+--lower-case-table-names=1
diff --git a/mysql-test/t/grant_lowercase.test b/mysql-test/t/grant_lowercase.test
new file mode 100644
index 00000000000..b07cb88afd6
--- /dev/null
+++ b/mysql-test/t/grant_lowercase.test
@@ -0,0 +1,31 @@
+# test cases for strmov(tmp_db, db) -> strnmov replacement in sql_acl.cc
+--source include/not_embedded.inc
+
+#
+# http://seclists.org/fulldisclosure/2012/Dec/4
+#
+
+# in acl_get(), check_grant_db(), mysql_grant()
+grant file on *.* to user1@localhost with grant option;
+grant select on `a%`.* to user1@localhost with grant option;
+connect (conn1,localhost,user1,,);
+connection conn1;
+--error ER_WRONG_DB_NAME
+grant file on aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.* to 'user'@'%' identified by 'secret';
+connection default;
+disconnect conn1;
+drop user user1@localhost;
+
+# in acl_load()
+call mtr.add_suppression("Incorrect database name");
+alter table mysql.host modify Db varchar(200);
+alter table mysql.db modify Db varchar(200);
+insert mysql.host set db=concat('=>', repeat(_utf8 'й', 200));
+insert mysql.db set db=concat('=>', repeat(_utf8 'й', 200));
+flush privileges; # shouldn't crash here
+delete from mysql.host where db like '=>%';
+delete from mysql.db where db like '=>%';
+alter table mysql.host modify Db char(64);
+alter table mysql.db modify Db char(64);
+flush privileges;
+
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 6a2d0a1c030..3c6f997f28e 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
# Initialise
--disable_warnings
@@ -1483,6 +1484,41 @@ DROP TABLE t1;
--echo the value below *must* be 1
show status like 'Created_tmp_disk_tables';
+--echo #
+--echo # Bug #1002146: Unneeded filesort if usage of join buffer is not allowed
+--echo # (bug mdev-645)
+--echo #
+
+CREATE TABLE t1 (pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t1 VALUES (3,2), (2,3), (5,3), (6,4);
+
+CREATE TABLE t2 (pk int PRIMARY KEY, a int, INDEX idx(a));
+INSERT INTO t2 VALUES (9,0), (10,3), (6,4), (1,6), (3,100), (5,200);
+
+set join_cache_level=0;
+
+EXPLAIN
+SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+ GROUP BY t2.a;
+SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+ GROUP BY t2.a;
+
+set join_cache_level=default;
+
+set @save_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='outer_join_with_cache=off';
+
+EXPLAIN
+SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+ GROUP BY t2.a;
+SELECT t2.a FROM t2 LEFT JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6
+ GROUP BY t2.a;
+
+set optimizer_switch=@save_optimizer_switch;
+
+
+DROP TABLE t1,t2;
+
--echo # End of 5.3 tests
--echo #
@@ -1509,6 +1545,48 @@ DROP TABLE t1;
--echo #End of test#49771
--echo #
+--echo # Test of bug in GROUP_CONCAT with ROLLUP
+--echo #
+
+CREATE TABLE t1 ( b VARCHAR(8) NOT NULL, a INT NOT NULL ) ENGINE=MyISAM;
+INSERT INTO t1 (a,b) VALUES (1,'c'),(2,'v');
+
+CREATE TABLE t2 ( c VARCHAR(8), d INT, KEY (c, d) ) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('v',6),('c',4),('v',3);
+
+SELECT b, GROUP_CONCAT( a, b ORDER BY a, b )
+FROM t1 JOIN t2 ON c = b GROUP BY b;
+
+SELECT b, GROUP_CONCAT( a, b ORDER BY a, b )
+FROM t1 JOIN t2 ON c = b GROUP BY b WITH ROLLUP;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Test of MDEV-4002
+--echo #
+
+CREATE TABLE t1 (
+ pk INT NOT NULL PRIMARY KEY,
+ d1 DOUBLE,
+ d2 DOUBLE,
+ i INT NOT NULL DEFAULT '0',
+ KEY (i)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2);
+
+PREPARE stmt FROM "
+SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
+FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP
+";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DROP TABLE t1;
+
+--echo #
--echo # Bug #58782
--echo # Missing rows with SELECT .. WHERE .. IN subquery
--echo # with full GROUP BY and no aggr
diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test
new file mode 100644
index 00000000000..0d5e5e9ae30
--- /dev/null
+++ b/mysql-test/t/group_by_innodb.test
@@ -0,0 +1,38 @@
+#
+# Test GROUP BY queries that utilize InnoDB extended keys
+#
+
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering
+--echo # on GROUP BY with indexes on InnoDB table
+--echo #
+
+CREATE TABLE t1 (
+ pk INT PRIMARY KEY,
+ a VARCHAR(1) NOT NULL,
+ KEY (pk)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1,'a'),(2,'b');
+
+EXPLAIN
+SELECT COUNT(*), pk field1, pk AS field2
+FROM t1 WHERE a = 'r' OR pk = 183
+GROUP BY field1, field2;
+
+SELECT COUNT(*), pk field1, pk AS field2
+FROM t1 WHERE a = 'r' OR pk = 183
+GROUP BY field1, field2;
+
+EXPLAIN
+SELECT COUNT(*), pk field1 FROM t1
+WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
+
+SELECT COUNT(*), pk field1 FROM t1
+WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
+
+drop table t1;
+
+--echo End of 5.5 tests
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index b984acc78ea..19f7cbe40a1 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -1155,6 +1155,15 @@ ORDER BY min_a;
DROP TABLE t1;
+#
+# MDEV-729 lp:998028 - Server crashes on normal shutdown in closefrm after executing a query from MyISAM table
+#
+create table t1 (a int, b varchar(1), key(b,a)) engine=myisam;
+insert t1 values (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'f'),(7,'g'),(8,'h'),(null,'i');
+select min(a), b from t1 where a=7 or b='z' group by b;
+flush tables;
+drop table t1;
+
--echo #
--echo # LP BUG#888456 Wrong result with DISTINCT , ANY , subquery_cache=off , NOT NULL
--echo #
diff --git a/mysql-test/t/information_schema2.test b/mysql-test/t/information_schema2.test
new file mode 100644
index 00000000000..c2479087f47
--- /dev/null
+++ b/mysql-test/t/information_schema2.test
@@ -0,0 +1,9 @@
+
+#
+# MDEV-4029 SELECT on information_schema using a subquery locks up the information_schema table due to incorrect mutexes handling
+#
+select variable_name from information_schema.session_status where variable_name =
+(select variable_name from information_schema.session_status where variable_name = 'uptime');
+select variable_name from information_schema.session_variables where variable_name =
+(select variable_name from information_schema.session_variables where variable_name = 'basedir');
+
diff --git a/mysql-test/t/innodb_mrr_cpk.test b/mysql-test/t/innodb_mrr_cpk.test
index a157ddd792f..a7b2d9c0ddd 100644
--- a/mysql-test/t/innodb_mrr_cpk.test
+++ b/mysql-test/t/innodb_mrr_cpk.test
@@ -139,3 +139,29 @@ set storage_engine=@save_storage_engine;
set optimizer_switch=@innodb_mrr_cpk_tmp;
drop table t0;
+--echo #
+--echo # MDEV-3817: Wrong result with index_merge+index_merge_intersection, InnoDB table, join, AND and OR conditions
+--echo #
+
+set @tmp_mdev3817=@@optimizer_switch;
+SET optimizer_switch='index_merge=on,index_merge_intersection=on';
+
+CREATE TABLE t1 (
+ a INT PRIMARY KEY,
+ b INT,
+ c VARCHAR(1024) CHARACTER SET utf8,
+ d INT,
+ KEY (b)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(1, 9, 'one', 11), (2, 6, 'two', 12), (3, 2, 'three', 13), (4, 5, 'four', 14);
+
+CREATE TABLE t2 (e INT, g INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1,9), (2,6) ;
+
+SELECT * FROM t1, t2 WHERE g = b AND ( a < 7 OR a > e );
+
+DROP TABLE t1, t2;
+set optimizer_switch=@tmp_mdev3817;
+
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index f9181f91a89..bf84bdf9194 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -572,36 +572,40 @@ DROP TABLE t1;
connection default;
disconnect con1;
+#############################################################################
+# The below protion is moved to ctype_ucs.test #
+#############################################################################
+#--echo #
+#--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
+#--echo # and reverse() function
+#--echo #
+
+#--echo # Problem # 1 (original report): wrong parsing of ucs2 data
+#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
+#CREATE TABLE t1(a INT);
+#LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
+#(@b) SET a=REVERSE(@b);
+#--echo # should return 2 zeroes (as the value is truncated)
+#SELECT * FROM t1;
+
+#DROP TABLE t1;
+#let $MYSQLD_DATADIR= `select @@datadir`;
+#remove_file $MYSQLD_DATADIR/test/tmpp.txt;
+
+
+#--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
+#SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
+#CREATE TABLE t1(a INT);
+#LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
+#(@b) SET a=REVERSE(@b);
+#--echo # should return 0 and 1 (10 reversed)
+#SELECT * FROM t1;
+
+#DROP TABLE t1;
+#let $MYSQLD_DATADIR= `select @@datadir`;
+#remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
+######################################################################################
---echo #
---echo # Bug #51876 : crash/memory underrun when loading data with ucs2
---echo # and reverse() function
---echo #
-
---echo # Problem # 1 (original report): wrong parsing of ucs2 data
-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
-CREATE TABLE t1(a INT);
-LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
-(@b) SET a=REVERSE(@b);
---echo # should return 2 zeroes (as the value is truncated)
-SELECT * FROM t1;
-
-DROP TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/tmpp.txt;
-
-
---echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
-SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
-CREATE TABLE t1(a INT);
-LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
-(@b) SET a=REVERSE(@b);
---echo # should return 0 and 1 (10 reversed)
-SELECT * FROM t1;
-
-DROP TABLE t1;
-let $MYSQLD_DATADIR= `select @@datadir`;
-remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
--echo #
--echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U
diff --git a/mysql-test/t/lowercase_table4-master.opt b/mysql-test/t/lowercase_table4-master.opt
index c0a1981fa7c..c0a1981fa7c 100755..100644
--- a/mysql-test/t/lowercase_table4-master.opt
+++ b/mysql-test/t/lowercase_table4-master.opt
diff --git a/mysql-test/t/lowercase_table4.test b/mysql-test/t/lowercase_table4.test
index 783a4fcae51..783a4fcae51 100755..100644
--- a/mysql-test/t/lowercase_table4.test
+++ b/mysql-test/t/lowercase_table4.test
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 3269b88ca04..71a985654ef 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -582,5 +582,17 @@ DROP DATABASE connected_db;
--remove_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql
+#
+# USE and names with backticks
+#
+--write_file $MYSQLTEST_VARDIR/tmp/backticks.sql
+USE aa`bb``cc
+SELECT DATABASE();
+EOF
+create database `aa``bb````cc`;
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/backticks.sql
+drop database `aa``bb````cc`;
+
+
--echo
--echo End of tests
diff --git a/mysql-test/t/mysqlshow.test b/mysql-test/t/mysqlshow.test
index 5dba7fa5b85..fc5d4d982e5 100644
--- a/mysql-test/t/mysqlshow.test
+++ b/mysql-test/t/mysqlshow.test
@@ -29,7 +29,7 @@ select "---- -v -v -t ------" as "";
DROP TABLE t1, t2;
-if (`select count(*) from information_schema.plugins where plugin_name='innodb' and plugin_auth_version > "1.1.8-29.1"`)
+if (`select count(*) from information_schema.plugins where plugin_name='innodb' and plugin_auth_version > "1.1.8-29.3"`)
{
# because of lp:1066512 this test shows xtradb I_S plugins, even when
# xtradb is supposed to be disabled
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index 2756f7d1ebb..3aa78e74828 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -663,4 +663,19 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
+--echo # SAVE_READ_SET
+--echo #
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ c INT,
+ PRIMARY KEY (c,a), KEY (a),KEY (a)
+) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2;
+INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1);
+UPDATE t1 SET b = 0, c=1 WHERE a <=>0;
+SELECT * FROM t1;
+DROP TABLE t1;
+
set global default_storage_engine=default;
diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test
index 2b234b64047..4412383f837 100644
--- a/mysql-test/t/plugin.test
+++ b/mysql-test/t/plugin.test
@@ -4,14 +4,14 @@
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
DROP TABLE t1;
-eval INSTALL PLUGIN example SONAME 'ha_example';
+INSTALL PLUGIN example SONAME 'ha_example';
--replace_regex /\.dll/.so/
--error 1125
-eval INSTALL PLUGIN EXAMPLE SONAME 'ha_example';
+INSTALL PLUGIN EXAMPLE SONAME 'ha_example';
UNINSTALL PLUGIN example;
-eval INSTALL SONAME 'ha_example';
+INSTALL SONAME 'ha_example';
--replace_column 5 #
--replace_regex /\.dll/.so/
--query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%'
@@ -28,7 +28,7 @@ set global example_enum_var= e1;
show status like 'example%';
show variables like 'example%';
-eval UNINSTALL SONAME 'ha_example';
+UNINSTALL SONAME 'ha_example';
--replace_column 5 #
--replace_regex /\.dll/.so/
--query_vertical select * from information_schema.plugins where plugin_library like 'ha_example%'
@@ -41,12 +41,18 @@ UNINSTALL PLUGIN EXAMPLE;
--error 1305
UNINSTALL PLUGIN non_exist;
+#
+# MDEV-3985 crash: uninstall soname 'a'
+#
+--replace_regex /\.dll/.so/
+--error 1305
+UNINSTALL SONAME 'non_exist';
--echo #
--echo # Bug#32034: check_func_enum() does not check correct values but set it
--echo # to impossible int val
--echo #
-eval INSTALL PLUGIN example SONAME 'ha_example';
+INSTALL PLUGIN example SONAME 'ha_example';
SET GLOBAL example_enum_var= e1;
SET GLOBAL example_enum_var= e2;
@@ -60,7 +66,7 @@ UNINSTALL PLUGIN example;
#
# Bug #32757 hang with sql_mode set when setting some global variables
#
-eval INSTALL PLUGIN example SONAME 'ha_example';
+INSTALL PLUGIN example SONAME 'ha_example';
select @@session.sql_mode into @old_sql_mode;
diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test
index e1de1cc8153..4a3187a33eb 100644
--- a/mysql-test/t/plugin_auth.test
+++ b/mysql-test/t/plugin_auth.test
@@ -174,21 +174,35 @@ GRANT PROXY ON ''@'' TO grant_plug;
--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
GRANT PROXY ON grant_plug TO grant_plug_dest;
---echo this should fail : same user, but on a different host
---error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
+# Security context in THD contains two pairs of (user,host)
+# 1. (user,host) pair referring to inbound connection
+# 2. (priv_user,priv_host) pair obtained from mysql.user table after doing
+# authnetication of incoming connection.
+# Granting/revoking proxy privileges, privileges should be checked wrt
+# (priv_user, priv_host) tuple that is obtained from mysql.user table
+# Following is a valid grant because effective user of connection is
+# grant_plug_dest@% and statement is trying to grant proxy on the same
+# user.
+--echo This is a valid grant
GRANT PROXY ON grant_plug_dest TO grant_plug;
+REVOKE PROXY ON grant_plug_dest FROM grant_plug;
--echo this should work : same user
-GRANT PROXY ON grant_plug_dest@localhost TO grant_plug_dest2;
-REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug_dest2;
+GRANT PROXY ON grant_plug_dest TO grant_plug_dest2;
+REVOKE PROXY ON grant_plug_dest FROM grant_plug_dest2;
---echo this should work : same user
+# grant_plug_dest@localhost is not the same as grant_plug_dest@%
+# so following grant/revoke should fail
+--echo this should fail : not the same user
+--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
GRANT PROXY ON grant_plug_dest@localhost TO grant_plug WITH GRANT OPTION;
+--echo this should fail : not the same user
+--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug;
--echo this should fail : can't create users
--error ER_CANT_CREATE_USER_WITH_GRANT
-GRANT PROXY ON grant_plug_dest@localhost TO grant_plug@localhost;
+GRANT PROXY ON grant_plug_dest TO grant_plug@localhost;
connection default;
--echo in default connection
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 6ac883ffcc1..a5ff9cc0096 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -1,6 +1,7 @@
#
# Problem with range optimizer
#
+--source include/have_innodb.inc
--disable_warnings
drop table if exists t1, t2, t3, t10, t100;
@@ -1549,3 +1550,57 @@ SELECT * FROM t1 ignore index(d) WHERE d = 'q' OR d >= 'q' OR (d IN ( 'j' , 's'
SELECT * FROM t1 force index(d) WHERE d = 'q' OR d >= 'q' OR (d IN ( 'j' , 's' , 'i' ) AND ( b = 102 ));
DROP TABLE t1;
+
+--disable_parsing
+# MariaDB: Moved the following to partition.test
+--echo #
+--echo # BUG#12912171 - ASSERTION FAILED: QUICK->HEAD->READ_SET ==
+--echo # SAVE_READ_SET
+--echo #
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ c INT,
+ PRIMARY KEY (c,a), KEY (a),KEY (a)
+) ENGINE=INNODB PARTITION BY KEY () PARTITIONS 2;
+INSERT INTO t1 VALUES (1,5,1),(2,4,1),(3,3,1),(4,2,1),(5,1,1);
+UPDATE t1 SET b = 0, c=1 WHERE a <=>0;
+SELECT * FROM t1;
+DROP TABLE t1;
+--enable_parsing
+
+--echo #
+--echo # BUG#13256446 - ASSERTION QUICK->HEAD->READ_SET ==
+--echo # SAVE_READ_SET' FAILED IN OPT_RANGE.CC:1606
+--echo #
+CREATE TABLE t1 (
+ f1 INT AUTO_INCREMENT,
+ f2 INT,
+ f3 INT,
+ f4 INT,
+ PRIMARY KEY (f1),KEY(f2)
+) ENGINE=INNODB;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f2=103;
+INSERT INTO t1 VALUES (154,0,NULL,0),(0,NULL,9,0),
+ (NULL,102,NULL,3),(0,3,NULL,0), (9,0,NULL,0),(0,9,NULL,157);
+SELECT * FROM v2;
+UPDATE v2 SET f4=0, f2=NULL, f1=NULL WHERE f1 > 16 ORDER BY f1;
+SELECT * FROM v2;
+DROP TABLE t1;
+DROP VIEW v2;
+
+CREATE TABLE t1 (
+ f1 INT AUTO_INCREMENT,
+ f2 INT,
+ f3 INT,
+ f4 INT,
+ PRIMARY KEY (f1),KEY(f2)
+) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1,NULL,NULL,0), (2,2,0,3), (9,0,107,18),
+ (10,0,0,0), (231,0,0,0), (232,0,8,0), (234,0,0,NULL), (235,8,0,3);
+CREATE ALGORITHM=MERGE VIEW v3 AS SELECT f1,f2,f3,f4 FROM t1 WHERE f1<=85 ;
+SELECT * FROM v3;
+UPDATE v3 SET f3=0, f4=4 WHERE f2=68 ORDER BY f1;
+SELECT * FROM v3;
+DROP TABLE t1;
+DROP VIEW v3;
diff --git a/mysql-test/t/range_vs_index_merge.test b/mysql-test/t/range_vs_index_merge.test
index fb8fd778559..fb8fd778559 100755..100644
--- a/mysql-test/t/range_vs_index_merge.test
+++ b/mysql-test/t/range_vs_index_merge.test
diff --git a/mysql-test/t/range_vs_index_merge_innodb.test b/mysql-test/t/range_vs_index_merge_innodb.test
index e85cd044ece..e85cd044ece 100755..100644
--- a/mysql-test/t/range_vs_index_merge_innodb.test
+++ b/mysql-test/t/range_vs_index_merge_innodb.test
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 3a38b85f1ae..c2edef87d41 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -1371,3 +1371,17 @@ SELECT RELEASE_LOCK('t');
--connection default
SET NAMES latin1;
+
+--echo #
+--echo # WL#6454: Deprecate SHOW AUTHORS and SHOW CONTRIBUTORS
+--echo #
+
+--disable_result_log
+SHOW AUTHORS;
+--enable_result_log
+SHOW WARNINGS;
+
+--disable_result_log
+SHOW CONTRIBUTORS;
+--enable_result_log
+SHOW WARNINGS;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 7fc8dad3bb9..9db6709a8d2 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9151,6 +9151,26 @@ CALL p1(1);
DROP PROCEDURE p1;
+--echo
+--echo MDEV-3900 Optimizer difference between MySQL and MariaDB with stored functions in WHERE clause of UPDATE or DELETE statements
+--echo
+
+CREATE FUNCTION tdn() RETURNS int(7) DETERMINISTIC RETURN to_days(now());
+
+CREATE TABLE t1 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, daynum INT, a CHAR(1), INDEX(daynum), INDEX(a)) ENGINE=MyISAM;
+INSERT INTO t1 (daynum) VALUES (1),(2),(3),(4),(5),(TO_DAYS(NOW())),(7),(8);
+INSERT INTO t1 (daynum) SELECT a1.daynum FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5;
+
+FLUSH TABLES;
+FLUSH STATUS;
+
+SHOW STATUS LIKE '%Handler_read%';
+UPDATE t1 SET a = '+' WHERE daynum=tdn();
+SHOW STATUS LIKE '%Handler_read%';
+
+drop function tdn;
+drop table t1;
+
--echo #
--echo # lp:1002157 : testing stored function
--echo # bug#62125 result for null incorrectly yields 1292 warning.
diff --git a/mysql-test/t/sp_notembedded.test b/mysql-test/t/sp_notembedded.test
index 39e7102079c..447a1db762e 100644
--- a/mysql-test/t/sp_notembedded.test
+++ b/mysql-test/t/sp_notembedded.test
@@ -429,14 +429,6 @@ disconnect addcon;
DROP DATABASE `my.db`;
USE test;
-#
-# Restore global concurrent_insert value. Keep in the end of the test file.
-#
-
-set @@global.concurrent_insert= @old_concurrent_insert;
-
-# Wait till all disconnects are completed
---source include/wait_until_count_sessions.inc
--echo #
--echo # Bug#11763507 - 56224: FUNCTION NAME IS CASE-SENSITIVE
@@ -461,3 +453,16 @@ SHOW CREATE EVENT TESTE_bug11763507;
DROP EVENT teste_bug11763507;
--echo #END OF BUG#11763507 test.
+
+--echo # ------------------------------------------------------------------
+--echo # -- End of 5.1 tests
+--echo # ------------------------------------------------------------------
+
+#
+# Restore global concurrent_insert value. Keep in the end of the test file.
+#
+
+set @@global.concurrent_insert= @old_concurrent_insert;
+
+# Wait till all disconnects are completed
+--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index 14b62bfd2f7..37f660d6682 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -1778,6 +1778,57 @@ drop table t1, t2;
set optimizer_switch=@subselect4_tmp;
--echo #
+--echo # MDEV-3928 Assertion `example' failed in Item_cache::is_expensive_processor with a 2-level IN subquery
+--echo #
+
+CREATE TABLE t1 (a1 INT, b1 TIME) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'21:22:34'),(6,'10:50:38');
+
+CREATE TABLE t2 (a2 INT, b2 TIME) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8, '06:17:39');
+
+CREATE TABLE t3 (a3 INT, b3 TIME) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (1,'00:00:01'),(7,'00:00:02');
+
+EXPLAIN
+SELECT * FROM t1 WHERE a1 IN (
+ SELECT a2 FROM t2 WHERE a2 IN (
+ SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3
+ )
+);
+
+SELECT * FROM t1 WHERE a1 IN (
+ SELECT a2 FROM t2 WHERE a2 IN (
+ SELECT a3 FROM t3 WHERE b2 = b1 AND b2 <= b1 ORDER BY b3
+ )
+);
+drop table t1, t2, t3;
+
+--echo #
+--echo # MDEV-4056:Server crashes in Item_func_trig_cond::val_int
+--echo # with FROM and NOT IN subqueries, LEFT JOIN, derived_merge+in_to_exists
+--echo #
+
+set @optimizer_switch_MDEV4056 = @@optimizer_switch;
+SET optimizer_switch = 'derived_merge=on,in_to_exists=on';
+
+CREATE TABLE t1 (a VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('x'),('d');
+
+CREATE TABLE t2 (pk INT PRIMARY KEY, b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,2,'v'),(2,150,'v');
+
+SELECT * FROM t1 LEFT JOIN (
+ SELECT * FROM t2 WHERE ( pk, pk ) NOT IN (
+ SELECT MIN(b), SUM(pk) FROM t1
+ )
+) AS alias1 ON (a = c)
+WHERE b IS NULL OR a < 'u';
+
+drop table t1,t2;
+set @@optimizer_switch = @optimizer_switch_MDEV4056;
+
+--echo #
--echo # MDEV-3899 Valgrind warnings (blocks are definitely lost) in filesort on IN subquery with SUM and DISTINCT
--echo #
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index 523e1774a9c..fc07a088a15 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -425,4 +425,18 @@ select 1 from t1 where 1 like (select 1 from t1 where 1 <=> (select 1 from t1 gr
drop table t1;
+--echo #
+--echo # MDEV-3988 crash in create_tmp_table
+--echo #
+
+drop table if exists `t1`,`t2`;
+create table `t1`(`a` char(1) character set utf8)engine=innodb;
+create table `t2`(`b` char(1) character set utf8)engine=memory;
+select distinct (select 1 from `t2` where `a`) `d2` from `t1`;
+select distinct (select 1 from `t2` where `a`) `d2`, a from `t1`;
+select distinct a, (select 1 from `t2` where `a`) `d2` from `t1`;
+select distinct (1 + (select 1 from `t2` where `a`)) `d2` from `t1`;
+
+drop table t1,t2;
+
set optimizer_switch=@subselect_innodb_tmp;
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index 2facb089718..efbd2b00f24 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2462,5 +2462,74 @@ HAVING t1sum <> 1;
DROP TABLE t1, t2;
+--echo #
+--echo # MDEV-3911: Assertion `fixed == 0' failed in Item_field::fix_fields
+--echo # on 2nd execution of PS with semijoin=on and IN subquery
+--echo #
+
+CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (0,4),(8,6);
+
+CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (7,1),(0,7);
+
+eval PREPARE stmt FROM ' SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) ';
+
+execute stmt;
+execute stmt;
+
+deallocate prepare stmt;
+drop table t1,t2;
+
+--echo #
+--echo # MySQL Bug#13340270: assertion table->sort.record_pointers == __null
+--echo #
+
+CREATE TABLE t1 (
+ pk int NOT NULL,
+ col_int_key int DEFAULT NULL,
+ col_varchar_key varchar(1) DEFAULT NULL,
+ col_varchar_nokey varchar(1) DEFAULT NULL,
+ PRIMARY KEY (pk),
+ KEY col_int_key (col_int_key),
+ KEY col_varchar_key (col_varchar_key, col_int_key)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(10,8,'x','x'),
+(11,7,'d','d'),
+(12,1,'r','r'),
+(13,7,'f','f'),
+(14,9,'y','y'),
+(15,NULL,'u','u'),
+(16,1,'m','m'),
+(17,9,NULL,NULL),
+(18,2,'o','o'),
+(19,9,'w','w'),
+(20,2,'m','m'),
+(21,4,'q','q');
+
+let $query=
+ SELECT alias1.col_varchar_nokey AS field1
+ FROM t1 AS alias1 JOIN t1 AS alias2
+ ON alias2.col_int_key = alias1.pk OR
+ alias2.col_int_key = alias1.col_int_key
+ WHERE alias1.pk = 58 OR alias1.col_varchar_key = 'o'
+;
+
+eval CREATE TABLE t2
+ $query
+;
+
+eval EXPLAIN SELECT *
+FROM t2
+WHERE (field1) IN ($query);
+
+eval SELECT *
+FROM t2
+WHERE (field1) IN ($query);
+
+DROP TABLE t1, t2;
+
# The following command must be the last one the file
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/t/sum_distinct-big.test b/mysql-test/t/sum_distinct-big.test
index 0859f4b3d89..d3710056c9a 100644
--- a/mysql-test/t/sum_distinct-big.test
+++ b/mysql-test/t/sum_distinct-big.test
@@ -63,5 +63,22 @@ SELECT SUM(DISTINCT id) sm FROM t1;
SELECT SUM(DISTINCT id) sm FROM t2;
SELECT SUM(DISTINCT id) sm FROM t1 GROUP BY id % 13;
+--echo #
+--echo # Bug mdev-4063: SUM(DISTINCT...) with small'max_heap_table_size
+--echo # (bug #56927)
+--echo #
+
+SET max_heap_table_size=default;
+
+INSERT INTO t1 SELECT id+16384 FROM t1;
+DELETE FROM t2;
+INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+
+SELECT SUM(DISTINCT id) sm FROM t2;
+
+SET max_heap_table_size=16384;
+
+SELECT SUM(DISTINCT id) sm FROM t2;
+
DROP TABLE t1;
DROP TABLE t2;
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index c515f8873d8..daa20509ab6 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -2,6 +2,8 @@
# test of updating of keys
#
+-- source include/have_innodb.inc
+
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
@@ -503,3 +505,42 @@ UPDATE v1 SET pk = 7 WHERE pk > 0;
DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
+
+--echo #
+--echo # Verify that UPDATE does the same number of handler_update
+--echo # operations, no matter if there is ORDER BY or not.
+--echo #
+
+CREATE TABLE t1 (i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES (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);
+CREATE TABLE t2 (a CHAR(2), b CHAR(2), c CHAR(2), d CHAR(2),
+ INDEX idx (a,b(1),c)) ENGINE=INNODB;
+INSERT INTO t2 SELECT i, i, i, i FROM t1;
+FLUSH STATUS; # FLUSH is autocommit, so we put it outside of transaction
+START TRANSACTION;
+UPDATE t2 SET d = 10 WHERE b = 10 LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+ROLLBACK;
+FLUSH STATUS;
+START TRANSACTION;
+UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+ROLLBACK;
+
+--echo Same test with a different UPDATE.
+
+ALTER TABLE t2 DROP INDEX idx, ADD INDEX idx2 (a, b);
+FLUSH STATUS;
+START TRANSACTION;
+UPDATE t2 SET c = 10 LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+ROLLBACK;
+FLUSH STATUS;
+START TRANSACTION;
+UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5;
+SHOW STATUS LIKE 'HANDLER_UPDATE';
+ROLLBACK;
+DROP TABLE t1, t2;
+
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index d299718b54a..8b10e53f06d 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4703,6 +4703,32 @@ drop view v2;
drop table t1,t2;
--echo #
+--echo # MDEV-3914: Wrong result (NULLs instead of real values)
+--echo # with INNER and RIGHT JOIN in a FROM subquery, derived_merge=on
+--echo # (fix of above MDEV-486 fix)
+--echo #
+SET @save_optimizer_switch_MDEV_3914=@@optimizer_switch;
+SET optimizer_switch = 'derived_merge=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);
+
+CREATE TABLE t3 (c INT) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6);
+
+SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias;
+
+SET optimizer_switch = 'derived_merge=off';
+
+SELECT * FROM ( SELECT c FROM ( t1 INNER JOIN t2 ) RIGHT JOIN t3 ON a = c ) AS alias;
+
+SET optimizer_switch=@save_optimizer_switch_MDEV_3914;
+drop table t1,t2,t3;
+
+--echo #
--echo # MDEV-589 (LP BUG#1007647) :
--echo # Assertion `vcol_table == 0 || vcol_table == table' failed in
--echo # fill_record(THD*, List<Item>&, List<Item>&, bool)
@@ -4747,6 +4773,27 @@ SELECT * FROM (
drop tables t1,t2;
+--echo #
+--echo # MDEV-3876 Wrong result (extra rows) with ALL subquery
+--echo # from a MERGE view (duplicate of MDEV-3873)
+--echo #
+
+CREATE TABLE t1 (a INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (b INT NOT NULL) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(3);
+
+CREATE OR REPLACE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t2;
+
+SELECT a FROM t1 AS alias
+WHERE a >= ALL (
+SELECT b FROM t1 LEFT JOIN v1 ON (a = b)
+WHERE a = alias.a );
+
+drop view v1;
+drop table t1,t2;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index 800a5a90b39..39748edd476 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -637,6 +637,14 @@
fun:kill_server
}
+{
+ Aria checkpoint background thread not dying fast enough
+ Memcheck:Leak
+ fun:calloc
+ fun:my_thread_init
+ fun:ma_checkpoint_background
+}
+
#
# Warning caused by small memory leak in threaded dlopen
#
diff --git a/mysys/my_redel.c b/mysys/my_redel.c
index e4d88b70f38..3c68e69b46a 100644
--- a/mysys/my_redel.c
+++ b/mysys/my_redel.c
@@ -88,15 +88,11 @@ end:
int my_copystat(const char *from, const char *to, int MyFlags)
{
- struct stat statbuf;
+ MY_STAT statbuf;
- if (stat(from, &statbuf))
- {
- my_errno=errno;
- if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),from,errno);
+ if (my_stat(from, &statbuf, MyFlags) == NULL)
return -1; /* Can't get stat on input file */
- }
+
if ((statbuf.st_mode & S_IFMT) != S_IFREG)
return 1;
diff --git a/packaging/rpm-uln/CMakeLists.txt b/packaging/rpm-uln/CMakeLists.txt
new file mode 100644
index 00000000000..c8f13379697
--- /dev/null
+++ b/packaging/rpm-uln/CMakeLists.txt
@@ -0,0 +1,38 @@
+# Copyright (c) 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 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
+
+
+IF(UNIX)
+ SET(prefix ${CMAKE_INSTALL_PREFIX})
+
+ SET(SPECFILENAME "mysql.${VERSION}.spec")
+ IF("${VERSION}" MATCHES "-ndb-")
+ STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}")
+ SET(SPECFILENAME "mysql-cluster-${NDBVERSION}.spec")
+ ENDIF()
+
+ # Left in current directory, to be taken during build
+ CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/${SPECFILENAME} @ONLY)
+
+ FOREACH(ulnfile filter-requires-mysql.sh generate-tarball.sh my.cnf my_config.h
+ mysql-5.5-errno.patch mysql-5.5-fix-tests.patch mysql-5.5-libdir.patch
+ mysql-5.5-mtr1.patch mysql-5.5-stack-guard.patch mysql-5.5-testing.patch
+ mysql-chain-certs.patch mysql-embedded-check.c mysql-expired-certs.patch
+ mysql.init mysql-install-test.patch mysql-strmov.patch scriptstub.c
+ README.mysql-docs)
+ CONFIGURE_FILE(${ulnfile} ${CMAKE_CURRENT_BINARY_DIR}/${ulnfile} COPYONLY)
+ ENDFOREACH()
+ENDIF()
+
diff --git a/packaging/rpm-uln/README-ULN b/packaging/rpm-uln/README-ULN
new file mode 100644
index 00000000000..8ae44a18605
--- /dev/null
+++ b/packaging/rpm-uln/README-ULN
@@ -0,0 +1,15 @@
+In order to have RPMs of MySQL which are distributed via ULN for Oracle Linux
+to be as closely compatible to such RPMs built and distributed by RedHat,
+this directory contains additional files which originated at RedHat
+and are used only for such RPMs intended for distribution via ULN.
+
+Especially, this directory contains the spec file used to build these RPMs,
+named "mysql.spec". Please regard the following note:
+
+ You are receiving a copy of the Red Hat spec file.
+ The terms of the Oracle license do NOT apply to the Red Hat spec file;
+ it is licensed under the
+ GNU GENERAL PUBLIC LICENSE Version 2, June 1991
+ separately from the Oracle programs you receive.
+
+
diff --git a/packaging/rpm-uln/README.mysql-docs b/packaging/rpm-uln/README.mysql-docs
new file mode 100644
index 00000000000..dd894a7b9c0
--- /dev/null
+++ b/packaging/rpm-uln/README.mysql-docs
@@ -0,0 +1,4 @@
+The official MySQL documentation is not freely redistributable, so we cannot
+include it in RHEL or Fedora. You can find it on-line at
+
+http://dev.mysql.com/doc/
diff --git a/packaging/rpm-uln/filter-requires-mysql.sh b/packaging/rpm-uln/filter-requires-mysql.sh
new file mode 100755
index 00000000000..d435062b8dc
--- /dev/null
+++ b/packaging/rpm-uln/filter-requires-mysql.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/usr/lib/rpm/perl.req $* | grep -v -e "perl(th" -e "perl(lib::mtr" -e "perl(mtr"
diff --git a/packaging/rpm-uln/generate-tarball.sh b/packaging/rpm-uln/generate-tarball.sh
new file mode 100755
index 00000000000..2ff4bff2349
--- /dev/null
+++ b/packaging/rpm-uln/generate-tarball.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+VERSION=$1
+
+rm -rf mysql-$VERSION
+
+tar xfz mysql-$VERSION.tar.gz || exit 1
+
+rm mysql-$VERSION/Docs/mysql.info
+
+tar cfz mysql-$VERSION-nodocs.tar.gz mysql-$VERSION || exit 1
+
+rm -rf mysql-$VERSION
+
+exit 0
diff --git a/packaging/rpm-uln/my.cnf b/packaging/rpm-uln/my.cnf
new file mode 100644
index 00000000000..fae0fa276e1
--- /dev/null
+++ b/packaging/rpm-uln/my.cnf
@@ -0,0 +1,10 @@
+[mysqld]
+datadir=/var/lib/mysql
+socket=/var/lib/mysql/mysql.sock
+user=mysql
+# Disabling symbolic-links is recommended to prevent assorted security risks
+symbolic-links=0
+
+[mysqld_safe]
+log-error=/var/log/mysqld.log
+pid-file=/var/run/mysqld/mysqld.pid
diff --git a/packaging/rpm-uln/my_config.h b/packaging/rpm-uln/my_config.h
new file mode 100644
index 00000000000..435a126ac97
--- /dev/null
+++ b/packaging/rpm-uln/my_config.h
@@ -0,0 +1,29 @@
+/*
+ * Kluge to support multilib installation of both 32- and 64-bit RPMS:
+ * we need to arrange that header files that appear in both RPMs are
+ * identical. Hence, this file is architecture-independent and calls
+ * in an arch-dependent file that will appear in just one RPM.
+ *
+ * To avoid breaking arches not explicitly supported by Red Hat, we
+ * use this indirection file *only* on known multilib arches.
+ *
+ * Note: this may well fail if user tries to use gcc's -I- option.
+ * But that option is deprecated anyway.
+ */
+#if defined(__x86_64__)
+#include "my_config_x86_64.h"
+#elif defined(__i386__)
+#include "my_config_i386.h"
+#elif defined(__ppc64__) || defined(__powerpc64__)
+#include "my_config_ppc64.h"
+#elif defined(__ppc__) || defined(__powerpc__)
+#include "my_config_ppc.h"
+#elif defined(__s390x__)
+#include "my_config_s390x.h"
+#elif defined(__s390__)
+#include "my_config_s390.h"
+#elif defined(__sparc__) && defined(__arch64__)
+#include "my_config_sparc64.h"
+#elif defined(__sparc__)
+#include "my_config_sparc.h"
+#endif
diff --git a/packaging/rpm-uln/mysql-5.5-errno.patch b/packaging/rpm-uln/mysql-5.5-errno.patch
new file mode 100644
index 00000000000..033e5195973
--- /dev/null
+++ b/packaging/rpm-uln/mysql-5.5-errno.patch
@@ -0,0 +1,21 @@
+"extern int errno" is just a really bad idea.
+
+
+diff -Naur mysql-5.1.32.orig/include/my_sys.h mysql-5.1.32/include/my_sys.h
+--- mysql-5.1.32.orig/include/my_sys.h 2009-02-13 19:52:19.000000000 -0500
++++ mysql-5.1.32/include/my_sys.h 2009-03-04 18:08:40.000000000 -0500
+@@ -199,13 +199,8 @@
+ #define my_afree(PTR) my_free(PTR)
+ #endif /* HAVE_ALLOCA */
+
+-#ifndef errno /* did we already get it? */
+-#ifdef HAVE_ERRNO_AS_DEFINE
+ #include <errno.h> /* errno is a define */
+-#else
+-extern int errno; /* declare errno */
+-#endif
+-#endif /* #ifndef errno */
++
+ extern char *home_dir; /* Home directory for user */
+ extern const char *my_progname; /* program-name (printed in errors) */
+ extern char curr_dir[]; /* Current directory for user */
diff --git a/packaging/rpm-uln/mysql-5.5-fix-tests.patch b/packaging/rpm-uln/mysql-5.5-fix-tests.patch
new file mode 100644
index 00000000000..a1ab7a82210
--- /dev/null
+++ b/packaging/rpm-uln/mysql-5.5-fix-tests.patch
@@ -0,0 +1,34 @@
+Adapt tests (where needed) to RedHat conventions.
+
+1) The RedHat convention uses the package name "mysql*" whereas upstream uses "MySQL*".
+ Test "file_contents" constructs path names and needs to be adapted.
+
+=== modified file 'mysql-test/t/file_contents.test'
+--- mysql-5.5.17-orig/mysql-test/t/file_contents.test 2011-10-10 12:03:29 +0000
++++ mysql-5.5.17/mysql-test/t/file_contents.test 2011-11-16 18:07:55 +0000
+@@ -17,20 +17,20 @@ if ($dir_bin =~ m|/usr/|) {
+ $dir_docs =~ s|/lib|/share/doc|;
+ if(-d "$dir_docs/packages") {
+ # SuSE: "packages/" in the documentation path
+- $dir_docs = glob "$dir_docs/packages/MySQL-server*";
++ $dir_docs = glob "$dir_docs/packages/mysql-server*";
+ } else {
+ # RedHat: version number in directory name
+- $dir_docs = glob "$dir_docs/MySQL-server*";
++ $dir_docs = glob "$dir_docs/mysql-server*";
+ }
+ } elsif ($dir_bin =~ m|/usr$|) {
+ # RPM build during development
+ $dir_docs = "$dir_bin/share/doc";
+ if(-d "$dir_docs/packages") {
+ # SuSE: "packages/" in the documentation path
+- $dir_docs = glob "$dir_docs/packages/MySQL-server*";
++ $dir_docs = glob "$dir_docs/packages/mysql-server*";
+ } else {
+ # RedHat: version number in directory name
+- $dir_docs = glob "$dir_docs/MySQL-server*";
++ $dir_docs = glob "$dir_docs/mysql-server*";
+ }
+ } else {
+ # tar.gz package, Windows, or developer work (in BZR)
+
diff --git a/packaging/rpm-uln/mysql-5.5-libdir.patch b/packaging/rpm-uln/mysql-5.5-libdir.patch
new file mode 100644
index 00000000000..2ab3e9eec27
--- /dev/null
+++ b/packaging/rpm-uln/mysql-5.5-libdir.patch
@@ -0,0 +1,28 @@
+The RPMs built by MySQL AB (-> Sun -> Oracle) put the libraries into "/usr/lib".
+Those built by RedHat put them into "/usr/lib/mysql".
+This patch is to modify the cmake files to follow the RedHat convention.
+Similar, the server is now in "/usr/libexec" (formerly "/usr/sbin").
+
+
+diff -Naur mysql-5.5.17.orig/cmake/install_layout.cmake mysql-5.5.17/cmake/install_layout.cmake
+--- mysql-5.5.17.orig/cmake/install_layout.cmake 2011-06-30 15:46:53 +0000
++++ mysql-5.5.17/cmake/install_layout.cmake 2011-10-27 16:40:10 +0000
+@@ -140,14 +140,14 @@ SET(INSTALL_SBINDIR_RPM
+ # be applied at build time via "rpmbuild".
+ #
+ SET(INSTALL_BINDIR_RPM "bin")
+-SET(INSTALL_SBINDIR_RPM "sbin")
++SET(INSTALL_SBINDIR_RPM "libexec")
+ SET(INSTALL_SCRIPTDIR_RPM "bin")
+ #
+ IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+- SET(INSTALL_LIBDIR_RPM "lib64")
++ SET(INSTALL_LIBDIR_RPM "lib64/mysql")
+ SET(INSTALL_PLUGINDIR_RPM "lib64/mysql/plugin")
+ ELSE()
+- SET(INSTALL_LIBDIR_RPM "lib")
++ SET(INSTALL_LIBDIR_RPM "lib/mysql")
+ SET(INSTALL_PLUGINDIR_RPM "lib/mysql/plugin")
+ ENDIF()
+ #
+
diff --git a/packaging/rpm-uln/mysql-5.5-mtr1.patch b/packaging/rpm-uln/mysql-5.5-mtr1.patch
new file mode 100644
index 00000000000..7a7dc85f16c
--- /dev/null
+++ b/packaging/rpm-uln/mysql-5.5-mtr1.patch
@@ -0,0 +1,25 @@
+Drop support for version 1 of "mysql-test-run.pl" from the RPMs:
+
+1) The auto-generation of Perl dependencies will mishandle that code,
+ probably because its run directory differs from its storage location.
+2) It does not provide several variables which are used in tests of MySQL 5.5
+
+If you really need it, take it from the source tarball.
+
+=== modified file 'mysql-test/mysql-test-run.pl'
+--- mysql-5.5.17-orig/mysql-test/mysql-test-run.pl 2011-10-03 11:16:40 +0000
++++ mysql-5.5.17/mysql-test/mysql-test-run.pl 2011-11-16 19:06:38 +0000
+@@ -58,10 +58,9 @@ BEGIN {
+ if ( $version == 1 )
+ {
+ print "=======================================================\n";
+- print " WARNING: Using mysql-test-run.pl version 1! \n";
++ print " ERROR: Support for version 1 is dropped in this distribution! \n";
+ print "=======================================================\n";
+- # Should use exec() here on *nix but this appears not to work on Windows
+- exit(system($^X, "lib/v1/mysql-test-run.pl", @ARGV) >> 8);
++ exit(1);
+ }
+ elsif ( $version == 2 )
+ {
+
diff --git a/packaging/rpm-uln/mysql-5.5-stack-guard.patch b/packaging/rpm-uln/mysql-5.5-stack-guard.patch
new file mode 100644
index 00000000000..b2624d982de
--- /dev/null
+++ b/packaging/rpm-uln/mysql-5.5-stack-guard.patch
@@ -0,0 +1,140 @@
+mysql is not accounting for the "guard page" when setting thread stack size
+requests. This is fatal on PPC systems, which may use guard pages as large
+as 64K. This patch also documents the IA64 situation a bit better.
+
+Note: there are quite a few other setstacksize calls besides the two in
+mysqld.cc; is it important to fix any of the others?
+
+Filed upstream at http://bugs.mysql.com/bug.php?id=35019
+
+
+diff -Naur mysql-5.1.30.orig/sql/mysqld.cc mysql-5.1.30/sql/mysqld.cc
+--- mysql-5.1.30.orig/sql/mysqld.cc 2008-11-14 11:37:13.000000000 -0500
++++ mysql-5.1.30/sql/mysqld.cc 2009-01-13 12:08:35.000000000 -0500
+@@ -2653,6 +2653,70 @@
+ }
+
+
++/* pthread_attr_setstacksize without so much platform-dependency */
++/* returns the actual stack size if possible */
++static size_t my_setstacksize(pthread_attr_t *attr, size_t stacksize)
++{
++ size_t guard_size = 0;
++
++#if defined(__ia64__) || defined(__ia64)
++ /*
++ On IA64, half of the requested stack size is used for "normal stack"
++ and half for "register stack". The space measured by check_stack_overrun
++ is the "normal stack", so double the request to make sure we have the
++ caller-expected amount of normal stack.
++
++ NOTE: there is no guarantee that the register stack can't grow faster
++ than normal stack, so it's very unclear that we won't dump core due to
++ stack overrun despite check_stack_overrun's efforts. Experimentation
++ shows that in the execution_constants test, the register stack grows
++ less than half as fast as normal stack, but perhaps other scenarios are
++ less forgiving. If it turns out that more space is needed for the
++ register stack, that could be forced (rather inefficiently) by using a
++ multiplier higher than 2 here.
++ */
++ stacksize *= 2;
++#endif
++
++ /*
++ On many machines, the "guard space" is subtracted from the requested
++ stack size, and that space is quite large on some platforms. So add
++ it to our request, if we can find out what it is.
++
++ FIXME: autoconfiscate use of pthread_attr_getguardsize
++ */
++ if (pthread_attr_getguardsize(attr, &guard_size))
++ guard_size = 0; /* if can't find it out, treat as 0 */
++
++ pthread_attr_setstacksize(attr, stacksize + guard_size);
++
++ /* Retrieve actual stack size if possible */
++#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
++ {
++ size_t real_stack_size= 0;
++ /* We must ignore real_stack_size = 0 as Solaris 2.9 can return 0 here */
++ if (pthread_attr_getstacksize(attr, &real_stack_size) == 0 &&
++ real_stack_size > guard_size)
++ {
++ real_stack_size -= guard_size;
++ if (real_stack_size < stacksize)
++ {
++ if (global_system_variables.log_warnings)
++ sql_print_warning("Asked for %ld thread stack, but got %ld",
++ (long) stacksize, (long) real_stack_size);
++ stacksize= real_stack_size;
++ }
++ }
++ }
++#endif
++
++#if defined(__ia64__) || defined(__ia64)
++ stacksize /= 2;
++#endif
++ return stacksize;
++}
++
++
+ static void start_signal_handler(void)
+ {
+ int error;
+@@ -2663,15 +2727,7 @@
+ #if !defined(HAVE_DEC_3_2_THREADS)
+ pthread_attr_setscope(&thr_attr,PTHREAD_SCOPE_SYSTEM);
+ (void) pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED);
+-#if defined(__ia64__) || defined(__ia64)
+- /*
+- Peculiar things with ia64 platforms - it seems we only have half the
+- stack size in reality, so we have to double it here
+- */
+- pthread_attr_setstacksize(&thr_attr,my_thread_stack_size*2);
+-#else
+- pthread_attr_setstacksize(&thr_attr,my_thread_stack_size);
+-#endif
++ (void) my_setstacksize(&thr_attr,my_thread_stack_size);
+ #endif
+
+ mysql_mutex_lock(&LOCK_thread_count);
+@@ -4445,37 +4501,7 @@
+ unireg_abort(1); // Will do exit
+
+ init_signals();
+-#if defined(__ia64__) || defined(__ia64)
+- /*
+- Peculiar things with ia64 platforms - it seems we only have half the
+- stack size in reality, so we have to double it here
+- */
+- pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size*2);
+-#else
+- pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size);
+-#endif
+-#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
+- {
+- /* Retrieve used stack size; Needed for checking stack overflows */
+- size_t stack_size= 0;
+- pthread_attr_getstacksize(&connection_attrib, &stack_size);
+-#if defined(__ia64__) || defined(__ia64)
+- stack_size/= 2;
+-#endif
+- /* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */
+- if (stack_size && stack_size < my_thread_stack_size)
+- {
+- if (global_system_variables.log_warnings)
+- sql_print_warning("Asked for %lu thread stack, but got %ld",
+- my_thread_stack_size, (long) stack_size);
+-#if defined(__ia64__) || defined(__ia64)
+- my_thread_stack_size= stack_size*2;
+-#else
+- my_thread_stack_size= stack_size;
+-#endif
+- }
+- }
+-#endif
++ my_thread_stack_size = my_setstacksize(&connection_attrib,my_thread_stack_size);
+
+ (void) thr_setconcurrency(concurrency); // 10 by default
+
diff --git a/packaging/rpm-uln/mysql-5.5-testing.patch b/packaging/rpm-uln/mysql-5.5-testing.patch
new file mode 100644
index 00000000000..74387135346
--- /dev/null
+++ b/packaging/rpm-uln/mysql-5.5-testing.patch
@@ -0,0 +1,23 @@
+Hack the top-level Makefile to enable the openssl regression tests.
+(Why doesn't this happen automatically given the configure option??)
+
+Also, increase the overall timeout for the regression tests to 12 hours,
+because on a slow or heavily-loaded build machine sometimes the default of
+5 hours isn't enough. (This has been demonstrated to fail in mass-rebuild
+scenarios, which aren't that uncommon for Fedora.) Similarly increase the
+per-testcase timeout to 30 minutes, since the default of 15 hasn't got a
+great deal of headroom either.
+
+
+diff -Naur mysql-5.1.32.orig/Makefile.am mysql-5.1.32/Makefile.am
+--- mysql-5.1.32.orig/Makefile.am 2009-02-13 19:51:56.000000000 -0500
++++ mysql-5.1.32/Makefile.am 2009-03-04 18:12:36.000000000 -0500
+@@ -98,7 +98,7 @@
+
+ test-ns:
+ cd mysql-test ; \
+- @PERL@ ./mysql-test-run.pl $(force) $(mem) --mysqld=--binlog-format=mixed
++ @PERL@ ./mysql-test-run.pl $(force) $(mem) --ssl --mysqld=--binlog-format=mixed --suite-timeout=720 --testcase-timeout=30
+
+ test-binlog-statement:
+ cd mysql-test ; \
diff --git a/packaging/rpm-uln/mysql-chain-certs.patch b/packaging/rpm-uln/mysql-chain-certs.patch
new file mode 100644
index 00000000000..4e26af16cb0
--- /dev/null
+++ b/packaging/rpm-uln/mysql-chain-certs.patch
@@ -0,0 +1,45 @@
+Fix things so that chains of certificates work in the server and client
+certificate files.
+
+This only really works for OpenSSL-based builds, as yassl is unable to read
+multiple certificates from a file. The patch below to yassl/src/ssl.cpp
+doesn't fix that, but just arranges that the viosslfactories.c patch won't
+have any ill effects in a yassl build. Since we don't use yassl in Red Hat/
+Fedora builds, I'm not feeling motivated to try to fix yassl for this.
+
+See RH bug #598656. Filed upstream at http://bugs.mysql.com/bug.php?id=54158
+
+ ===
+
+Joerg Bruehe, MySQL Build Team at Oracle: First patch adapted to code changes in MySQL 5.5
+
+
+diff -Naur mysql-5.5.29.orig/vio/viosslfactories.c mysql-5.5.29/vio/viosslfactories.c
+--- mysql-5.5.29.orig/vio/viosslfactories.c 2010-05-06 11:28:07.000000000 -0400
++++ mysql-5.5.29/vio/viosslfactories.c 2010-05-26 23:23:46.000000000 -0400
+@@ -106,7 +106,7 @@
+ key_file= cert_file;
+
+ if (cert_file &&
+- SSL_CTX_use_certificate_file(ctx, cert_file, SSL_FILETYPE_PEM) <= 0)
++ SSL_CTX_use_certificate_chain_file(ctx, cert_file) <= 0)
+ {
+ *error= SSL_INITERR_CERT;
+ DBUG_PRINT("error",("%s from file '%s'", sslGetErrString(*error), cert_file));
+diff -Naur mysql-5.1.47.orig/extra/yassl/src/ssl.cpp mysql-5.1.47/extra/yassl/src/ssl.cpp
+--- mysql-5.1.47.orig/extra/yassl/src/ssl.cpp 2010-05-06 11:24:26.000000000 -0400
++++ mysql-5.1.47/extra/yassl/src/ssl.cpp 2010-05-26 23:29:13.000000000 -0400
+@@ -1606,10 +1606,10 @@
+ }
+
+
+- int SSL_CTX_use_certificate_chain_file(SSL_CTX*, const char*)
++ int SSL_CTX_use_certificate_chain_file(SSL_CTX* ctx, const char* file)
+ {
+- // TDOD:
+- return SSL_SUCCESS;
++ // For the moment, treat like use_certificate_file
++ return read_file(ctx, file, SSL_FILETYPE_PEM, Cert);
+ }
+
+
diff --git a/packaging/rpm-uln/mysql-embedded-check.c b/packaging/rpm-uln/mysql-embedded-check.c
new file mode 100644
index 00000000000..8bf8ca53dad
--- /dev/null
+++ b/packaging/rpm-uln/mysql-embedded-check.c
@@ -0,0 +1,26 @@
+/* simple test program to see if we can link the embedded server library */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include "mysql.h"
+
+MYSQL *mysql;
+
+static char *server_options[] = \
+ { "mysql_test", "--defaults-file=my.cnf", NULL };
+int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
+
+static char *server_groups[] = { "libmysqld_server",
+ "libmysqld_client", NULL };
+
+int main(int argc, char **argv)
+{
+ mysql_library_init(num_elements, server_options, server_groups);
+ mysql = mysql_init(NULL);
+ mysql_close(mysql);
+ mysql_library_end();
+
+ return 0;
+}
diff --git a/packaging/rpm-uln/mysql-expired-certs.patch b/packaging/rpm-uln/mysql-expired-certs.patch
new file mode 100644
index 00000000000..acd3a78cce7
--- /dev/null
+++ b/packaging/rpm-uln/mysql-expired-certs.patch
@@ -0,0 +1,555 @@
+Upstream insists on generating SSL testing certificates with relatively short
+lifespan, which has repeatedly caused problems (ie, one day the regression
+tests suddenly stop working). Replace them with certificates with 20-year
+lifespan. We should periodically regenerate these, too, but at least not
+very often.
+
+
+diff -Naur mysql-5.1.50.orig/mysql-test/std_data/cacert.pem mysql-5.1.50/mysql-test/std_data/cacert.pem
+--- mysql-5.1.50.orig/mysql-test/std_data/cacert.pem 2010-08-03 13:55:04.000000000 -0400
++++ mysql-5.1.50/mysql-test/std_data/cacert.pem 2010-08-27 23:42:05.751428144 -0400
+@@ -1,17 +1,22 @@
+ -----BEGIN CERTIFICATE-----
+-MIICrTCCAhagAwIBAgIJAMI7xZKjhrDbMA0GCSqGSIb3DQEBBAUAMEQxCzAJBgNV
++MIIDsjCCApqgAwIBAgIJAL5YrUwfPSWVMA0GCSqGSIb3DQEBBQUAMEQxCzAJBgNV
+ BAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxhMREwDwYD
+-VQQKEwhNeVNRTCBBQjAeFw0xMDAxMjkxMTQ3MTBaFw0xNTAxMjgxMTQ3MTBaMEQx
++VQQKEwhNeVNRTCBBQjAeFw0xMDAxMjkwNTU5NTNaFw0xNTAxMjgwNTU5NTNaMEQx
+ CzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBzYWxh
+-MREwDwYDVQQKEwhNeVNRTCBBQjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
+-wQYsOEfrN4ESP3FjsI8cghE+tZVuyK2gck61lwieVxjgFMtBd65mI5a1y9pmlOI1
+-yM4SB2Ppqcuw7/e1CdV1y7lvHrGNt5yqEHbN4QX1gvsN8TQauP/2WILturk4R4Hq
+-rKg0ZySu7f1Xhl0ed9a48LpaEHD17IcxWEGMMJwAxF0CAwEAAaOBpjCBozAMBgNV
+-HRMEBTADAQH/MB0GA1UdDgQWBBSvktYQ0ahLnyxyVKqty+WpBbBrDTB0BgNVHSME
+-bTBrgBSvktYQ0ahLnyxyVKqty+WpBbBrDaFIpEYwRDELMAkGA1UEBhMCU0UxEDAO
+-BgNVBAgTB1VwcHNhbGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FM
+-IEFCggkAwjvFkqOGsNswDQYJKoZIhvcNAQEEBQADgYEAdKN1PjwMHAKG2Ww1145g
+-JQGBnKxSFOUaoSvkBi/4ntTM+ysnViWh7WvxyWjR9zU9arfr7aqsDeQxm0XDOqzj
+-AQ/cQIla2/Li8tXyfc06bisH/IHRaSc2zWqioTKbEwMdVOdrvq4a8V8ic3xYyIWn
+-7F4WeS07J8LKardSvM0+hOA=
++MREwDwYDVQQKEwhNeVNRTCBBQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
++ggEBAL6kNN4peX7uhK9rb06W/QbPEpVuejmdWdl2PqMshP/eSuXXw7kwVgfpxx9R
++vC000CKQQSG9MCoZjtqPnFRsetmWLZgApRpEalGXTXJqq9sEbCfoFizg94U8G7d2
++u5XJjLVmcG34ru36KoBgVx1zeH1puBAf8dOzrE4L7Y+ZQBFzFohjh8C2LqWC4nM5
++qsLmOkDWMipGqYU5DvkKjIbTbwTyRNRgZHWSPfVDDPUIUOsY4BGUp2DpgeGY9aEv
++lIs57Ev9JqlIUCV65lOhhDkG+xwmkHKHA+ECEU9cALI8+uXbh48MB9XpMOuk408X
++/lX89aZwD0/G9kmObVGnE2G+H5UCAwEAAaOBpjCBozAdBgNVHQ4EFgQUsft+d7VA
++jWgRftkR5cPG2k2sUbAwdAYDVR0jBG0wa4AUsft+d7VAjWgRftkR5cPG2k2sUbCh
++SKRGMEQxCzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdV
++cHBzYWxhMREwDwYDVQQKEwhNeVNRTCBBQoIJAL5YrUwfPSWVMAwGA1UdEwQFMAMB
++Af8wDQYJKoZIhvcNAQEFBQADggEBALRUOAmdL8R8sl1y8kiEiFgDatdXK5RDqWai
++8yZChfmwTIToHhmQsOEshJe2e8hky3huUj+33VyXjINoMbebIwMuXPwEkbJal8RZ
++nSJmF0jN1Qz7J/jFffwK9xmejWZJx49Kt2+Qwrwp6kDeq9TLFqQOoVczgyJPYsTL
++NAOib5WqTud3XWvCwxrhqmWu7JZq6sp1fomP/uunprb8y2miWfLESZN2mKAhm44Q
++Lws867LT8v2lskEjq2dT1LutD5+R66XcdjgSr0uDziDs64jZwCD6ea94hVFM7ej0
++ZOXYeSEZJ56FjUxu632e9fY8NyMh30yKjjmQf1mM9PuGJvdvsWU=
+ -----END CERTIFICATE-----
+diff -Naur mysql-5.1.50.orig/mysql-test/std_data/client-cert.pem mysql-5.1.50/mysql-test/std_data/client-cert.pem
+--- mysql-5.1.50.orig/mysql-test/std_data/client-cert.pem 2010-08-03 13:55:04.000000000 -0400
++++ mysql-5.1.50/mysql-test/std_data/client-cert.pem 2010-08-27 23:42:05.752428395 -0400
+@@ -1,46 +1,69 @@
+ Certificate:
+ Data:
+- Version: 1 (0x0)
+- Serial Number: 1048577 (0x100001)
+- Signature Algorithm: md5WithRSAEncryption
++ Version: 3 (0x2)
++ Serial Number: 6 (0x6)
++ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
+ Validity
+- Not Before: Jan 29 11:50:22 2010 GMT
+- Not After : Jan 28 11:50:22 2015 GMT
++ Not Before: Feb 20 03:03:26 2010 GMT
++ Not After : Sep 3 03:03:26 2030 GMT
+ Subject: C=SE, ST=Uppsala, O=MySQL AB
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+- Public-Key: (1024 bit)
+- Modulus:
+- 00:cc:9a:37:49:13:66:dc:cf:e3:0b:13:a1:23:ed:
+- 78:db:4e:bd:11:f6:8c:0d:76:f9:a3:32:56:9a:f8:
+- a1:21:6a:55:4e:4d:3f:e6:67:9d:26:99:b2:cd:a4:
+- 9a:d2:2b:59:5c:d7:8a:d3:60:68:f8:18:bd:c5:be:
+- 15:e1:2a:3c:a3:d4:61:cb:f5:11:94:17:81:81:f7:
+- 87:8c:f6:6a:d2:ee:d8:e6:77:f6:62:66:4d:2e:16:
+- 8d:08:81:4a:c9:c6:4b:31:e5:b9:c7:8a:84:96:48:
+- a7:47:8c:0d:26:90:56:4e:e6:a5:6e:8c:b3:f2:9f:
+- fc:3d:78:9b:49:6e:86:83:77
++ RSA Public Key: (1024 bit)
++ Modulus (1024 bit):
++ 00:c2:e7:20:cf:89:59:2f:67:cb:4c:9f:e8:11:f2:
++ 23:e5:f1:b1:ee:3f:66:5f:c3:f5:fd:1e:31:ee:8f:
++ 4c:2a:bd:c0:4a:a5:9f:c8:44:d5:77:8f:15:1b:4d:
++ 78:6e:b2:a2:48:a5:24:33:05:40:02:b3:c1:87:8d:
++ 59:3c:1a:07:aa:86:f0:04:e1:9c:20:4b:22:32:c4:
++ 51:9e:40:e4:31:c3:57:f5:98:bf:2e:b1:fd:2c:56:
++ bf:49:d9:9b:e7:17:cc:95:5f:b5:08:19:5e:9d:df:
++ 65:22:39:2c:48:fb:69:96:31:7a:35:4d:de:60:b4:
++ c1:60:19:5f:96:56:7e:55:19
+ Exponent: 65537 (0x10001)
+- Signature Algorithm: md5WithRSAEncryption
+- 5e:1f:a3:53:5f:24:13:1c:f8:28:32:b0:7f:69:69:f3:0e:c0:
+- 34:87:10:03:7d:da:15:8b:bd:19:b8:1a:56:31:e7:85:49:81:
+- c9:7f:45:20:74:3e:89:c0:e0:26:84:51:cc:04:16:ce:69:99:
+- 01:e1:26:99:b3:e3:f5:bd:ec:5f:a0:84:e4:38:da:75:78:7b:
+- 89:9c:d2:cd:60:95:20:ba:8e:e3:7c:e6:df:76:3a:7c:89:77:
+- 02:94:86:11:3a:c4:61:7d:6f:71:83:21:8a:17:fb:17:e2:ee:
+- 02:6b:61:c1:b4:52:63:d7:d8:46:b2:c5:9c:6f:38:91:8a:35:
+- 32:0b
++ X509v3 extensions:
++ X509v3 Basic Constraints:
++ CA:FALSE
++ X509v3 Subject Key Identifier:
++ 8D:10:67:91:33:76:9C:02:E5:78:5D:D8:C5:EF:25:96:B2:D7:FA:1F
++ X509v3 Authority Key Identifier:
++ keyid:B1:FB:7E:77:B5:40:8D:68:11:7E:D9:11:E5:C3:C6:DA:4D:AC:51:B0
++ DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB
++ serial:BE:58:AD:4C:1F:3D:25:95
++
++ Signature Algorithm: sha1WithRSAEncryption
++ a9:88:10:3e:5d:2a:47:29:c8:03:27:7a:31:5a:8e:10:03:bc:
++ b5:4e:37:1d:12:7b:eb:5f:50:71:70:b1:a3:8e:93:0e:77:17:
++ 6c:47:b6:c9:a4:4d:2a:c4:38:f0:61:55:b2:7f:28:ba:06:79:
++ ee:67:11:7d:d4:c9:7f:0a:18:c8:c1:cb:d0:2c:f9:63:0f:bb:
++ 45:ca:de:ea:bb:ac:00:01:52:48:36:2b:07:2b:c8:46:c7:b1:
++ 21:81:bd:77:39:e7:4c:39:aa:bd:ac:60:d8:a7:bf:cf:14:98:
++ 4a:0b:a1:40:55:06:8d:6f:35:a9:39:a0:71:a9:97:ba:7c:73:
++ 3c:41:ba:c5:1c:11:4b:2b:43:1d:2d:ba:7b:5f:14:b5:3d:64:
++ 62:15:36:b4:16:bd:78:c8:43:8d:f9:1c:a5:d2:ac:a1:58:74:
++ e1:99:de:ad:04:19:43:a8:bd:0a:fd:19:9b:50:44:46:6d:18:
++ 55:4d:bf:b4:5b:a4:93:62:c7:64:91:6c:54:34:d1:f8:f3:ff:
++ 12:6d:5f:85:e7:35:9e:5c:42:81:5e:fb:c8:bb:44:51:98:b2:
++ ef:1b:9f:5a:22:77:28:7d:da:fb:08:c2:94:9a:0f:42:08:93:
++ 54:10:1e:ad:f2:4f:fc:62:98:51:e9:9b:b9:3a:93:d9:e4:1f:
++ 1d:c4:76:d0
+ -----BEGIN CERTIFICATE-----
+-MIIB5zCCAVACAxAAATANBgkqhkiG9w0BAQQFADBEMQswCQYDVQQGEwJTRTEQMA4G
+-A1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwg
+-QUIwHhcNMTAwMTI5MTE1MDIyWhcNMTUwMTI4MTE1MDIyWjAyMQswCQYDVQQGEwJT
+-RTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIwgZ8wDQYJKoZI
+-hvcNAQEBBQADgY0AMIGJAoGBAMyaN0kTZtzP4wsToSPteNtOvRH2jA12+aMyVpr4
+-oSFqVU5NP+ZnnSaZss2kmtIrWVzXitNgaPgYvcW+FeEqPKPUYcv1EZQXgYH3h4z2
+-atLu2OZ39mJmTS4WjQiBSsnGSzHluceKhJZIp0eMDSaQVk7mpW6Ms/Kf/D14m0lu
+-hoN3AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAXh+jU18kExz4KDKwf2lp8w7ANIcQ
+-A33aFYu9GbgaVjHnhUmByX9FIHQ+icDgJoRRzAQWzmmZAeEmmbPj9b3sX6CE5Dja
+-dXh7iZzSzWCVILqO43zm33Y6fIl3ApSGETrEYX1vcYMhihf7F+LuAmthwbRSY9fY
+-RrLFnG84kYo1Mgs=
++MIIDETCCAfmgAwIBAgIBBjANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ
++MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT
++UUwgQUIwHhcNMTAwMjIwMDMwMzI2WhcNMzAwOTAzMDMwMzI2WjAyMQswCQYDVQQG
++EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIwgZ8wDQYJ
++KoZIhvcNAQEBBQADgY0AMIGJAoGBAMLnIM+JWS9ny0yf6BHyI+Xxse4/Zl/D9f0e
++Me6PTCq9wEqln8hE1XePFRtNeG6yokilJDMFQAKzwYeNWTwaB6qG8AThnCBLIjLE
++UZ5A5DHDV/WYvy6x/SxWv0nZm+cXzJVftQgZXp3fZSI5LEj7aZYxejVN3mC0wWAZ
++X5ZWflUZAgMBAAGjgaMwgaAwCQYDVR0TBAIwADAdBgNVHQ4EFgQUjRBnkTN2nALl
++eF3Yxe8llrLX+h8wdAYDVR0jBG0wa4AUsft+d7VAjWgRftkR5cPG2k2sUbChSKRG
++MEQxCzAJBgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMRAwDgYDVQQHEwdVcHBz
++YWxhMREwDwYDVQQKEwhNeVNRTCBBQoIJAL5YrUwfPSWVMA0GCSqGSIb3DQEBBQUA
++A4IBAQCpiBA+XSpHKcgDJ3oxWo4QA7y1TjcdEnvrX1BxcLGjjpMOdxdsR7bJpE0q
++xDjwYVWyfyi6BnnuZxF91Ml/ChjIwcvQLPljD7tFyt7qu6wAAVJINisHK8hGx7Eh
++gb13OedMOaq9rGDYp7/PFJhKC6FAVQaNbzWpOaBxqZe6fHM8QbrFHBFLK0MdLbp7
++XxS1PWRiFTa0Fr14yEON+Ryl0qyhWHThmd6tBBlDqL0K/RmbUERGbRhVTb+0W6ST
++YsdkkWxUNNH48/8SbV+F5zWeXEKBXvvIu0RRmLLvG59aIncofdr7CMKUmg9CCJNU
++EB6t8k/8YphR6Zu5OpPZ5B8dxHbQ
+ -----END CERTIFICATE-----
+diff -Naur mysql-5.1.50.orig/mysql-test/std_data/client-key.pem mysql-5.1.50/mysql-test/std_data/client-key.pem
+--- mysql-5.1.50.orig/mysql-test/std_data/client-key.pem 2010-08-03 13:55:05.000000000 -0400
++++ mysql-5.1.50/mysql-test/std_data/client-key.pem 2010-08-27 23:42:05.752428395 -0400
+@@ -1,15 +1,15 @@
+ -----BEGIN RSA PRIVATE KEY-----
+-MIICXQIBAAKBgQDMmjdJE2bcz+MLE6Ej7XjbTr0R9owNdvmjMlaa+KEhalVOTT/m
+-Z50mmbLNpJrSK1lc14rTYGj4GL3FvhXhKjyj1GHL9RGUF4GB94eM9mrS7tjmd/Zi
+-Zk0uFo0IgUrJxksx5bnHioSWSKdHjA0mkFZO5qVujLPyn/w9eJtJboaDdwIDAQAB
+-AoGASqk/4We2En+93y3jkIO4pXafIe3w/3zZ7caRue1ehx4RUQh5d+95djuB9u7J
+-HEZ7TpjM7QNyao5EueL6gvbxt0LXFvqAMni7yM9tt/HUYtHHPqYiRtUny9bKYFTm
+-l8szCCMal/wD9GZU9ByHDNHm7tHUMyMhARNTYSgx+SERFmECQQD/6jJocC4SXf6f
+-T3LqimWR02lbJ7qCoDgRglsUXh0zjrG+IIiAyE+QOCCx1GMe3Uw6bsIuYwdHT6as
+-WcdPs04xAkEAzKulvEvLVvN5zfa/DTYRTV7jh6aDleOxjsD5oN/oJXoACnPzVuUL
+-qQQMNtuAXm6Q1QItrRxpQsSKbY0UQka6JwJBAOSgoNoG5lIIYTKIMvzwGV+XBLeo
+-HYsXgh+6Wo4uql3mLErUG78ZtWL9kc/tE4R+ZdyKGLaCR/1gXmH5bwN4B/ECQEBb
+-uUH8k3REG4kojesZlVc+/00ojzgS4UKCa/yqa9VdB6ZBz8MDQydinnShkTwgiGpy
+-xOoqhO753o2UT0qH8wECQQC99IEJWUnwvExVMkLaZH5NjAFJkb22sjkmuT11tAgU
+-RQgOMoDOm6driojnOnDWOkx1r1Gy9NgMLooduja4v6cx
++MIICWwIBAAKBgQDC5yDPiVkvZ8tMn+gR8iPl8bHuP2Zfw/X9HjHuj0wqvcBKpZ/I
++RNV3jxUbTXhusqJIpSQzBUACs8GHjVk8GgeqhvAE4ZwgSyIyxFGeQOQxw1f1mL8u
++sf0sVr9J2ZvnF8yVX7UIGV6d32UiOSxI+2mWMXo1Td5gtMFgGV+WVn5VGQIDAQAB
++AoGARXcXLKDpVooJ3W+IyQyiWsw//IhANpWjUOm4JiyQmxMyO+i4ACr4Yjpu7WI5
++MEseqAGj20NdwxjKO0PXsCIe5LmrGZ+SI8+CSERFOWXWRtCWz7y7SG30i1k6suvM
++mwqWom0tJLwn93uA1lm/WSwKQwUrJRahRQd3EaZqrl7DP5kCQQD/8gbuYAT5pxQe
++ULLGM0RvEsXxDYbEDxNbY5wrBazfklBwpumxZpFl6jEAT++7Kh2Ns3A7kB1oUNlA
++FPYr+dYPAkEAwvHEwRtoyUr8jqoqVVJWI76CDmBjEOzVeMKW97ztqbs2LxZW8dYI
++iOh/myFGpdoUwgu0U8w9MmXcj3ZeZCYKVwJALyQ+AJPw9qa+fuLwOq9gsHCtwrty
++EhSQxSlwrz/pWniRll439vPkXfgntF4E0t1r+hiN2Hqv3/HcQgBaYzkuIwJAG023
++bACFxaOuCeFFepvEms8E8jSHy4gQQhCnCl24v8wLw76SQN7kZSCDNtwLRBFuVNtE
++z3PMonFn2eQPRmGZkwJAP1c1BHprMQx/ruafdscROILv3JrH40C1bR6KVVBKt1dK
++Qpnpgi7hK5rUQjDF8k3bn9ugTt06jyeHe/QhAml0kg==
+ -----END RSA PRIVATE KEY-----
+diff -Naur mysql-5.1.50.orig/mysql-test/std_data/server-cert.pem mysql-5.1.50/mysql-test/std_data/server-cert.pem
+--- mysql-5.1.50.orig/mysql-test/std_data/server-cert.pem 2010-08-03 13:55:08.000000000 -0400
++++ mysql-5.1.50/mysql-test/std_data/server-cert.pem 2010-08-27 23:42:05.753428361 -0400
+@@ -1,41 +1,69 @@
+ Certificate:
+ Data:
+- Version: 1 (0x0)
+- Serial Number: 1048578 (0x100002)
+- Signature Algorithm: md5WithRSAEncryption
++ Version: 3 (0x2)
++ Serial Number: 4 (0x4)
++ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
+ Validity
+- Not Before: Jan 29 11:56:49 2010 GMT
+- Not After : Jan 28 11:56:49 2015 GMT
++ Not Before: Feb 20 02:55:06 2010 GMT
++ Not After : Sep 3 02:55:06 2030 GMT
+ Subject: C=SE, ST=Uppsala, O=MySQL AB, CN=localhost
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+- Public-Key: (512 bit)
+- Modulus:
+- 00:cd:e4:87:51:9d:72:11:a0:d1:fa:f3:92:8b:13:
+- 1c:eb:f7:e2:9a:2f:72:a8:d6:65:48:d1:69:af:1b:
+- c0:4c:13:e5:60:60:51:41:e9:ab:a6:bc:13:bb:0c:
+- 5e:32:7c:d9:6c:9e:cd:05:24:84:78:db:80:91:2e:
+- d8:88:2b:c2:ed
++ RSA Public Key: (1024 bit)
++ Modulus (1024 bit):
++ 00:e3:7d:4f:c2:23:77:a9:3a:2c:d2:69:59:a0:2f:
++ 4e:d1:51:4c:ae:8d:f5:17:cc:ce:58:9c:83:4f:0b:
++ a3:bb:29:a2:b8:1d:3e:1b:04:f9:a9:3e:e2:61:d0:
++ e6:7b:b9:7c:12:d8:1f:86:c9:53:b5:04:dd:df:26:
++ e9:c0:2b:de:4a:96:2e:f3:23:6f:79:6d:a9:d2:4e:
++ 17:af:2f:de:8b:68:44:ae:de:a3:e2:c4:37:1c:04:
++ ad:73:4b:85:f9:83:ac:fe:b7:c1:54:47:2e:96:d4:
++ 31:96:85:94:69:d6:5a:63:24:04:99:89:19:1d:56:
++ 8a:d1:77:aa:87:fb:38:cd:b7
+ Exponent: 65537 (0x10001)
+- Signature Algorithm: md5WithRSAEncryption
+- 73:ce:9c:6e:39:46:b4:14:be:da:3f:f3:1b:ba:90:bc:23:43:
+- d7:82:2a:70:4e:a6:d9:5a:65:5c:b7:df:71:df:75:77:c5:80:
+- a4:af:fa:d2:59:e2:fd:c9:9c:f0:98:95:8e:69:a9:8c:7c:d8:
+- 6f:48:d2:e3:36:e0:cd:ff:3f:d1:a5:e6:ab:75:09:c4:50:10:
+- c4:96:dd:bf:3b:de:32:46:da:ca:4a:f1:d6:52:8a:33:2f:ab:
+- f5:2e:70:3f:d4:9c:be:00:c8:03:f9:39:8a:df:5b:70:3c:40:
+- ef:03:be:7c:3d:1d:32:32:f3:51:81:e2:83:30:6e:3d:38:9b:
+- fb:3c
++ X509v3 extensions:
++ X509v3 Basic Constraints:
++ CA:FALSE
++ X509v3 Subject Key Identifier:
++ CC:8C:71:40:D0:0F:BF:D1:99:79:3F:1B:E9:10:76:19:67:36:0F:A3
++ X509v3 Authority Key Identifier:
++ keyid:B1:FB:7E:77:B5:40:8D:68:11:7E:D9:11:E5:C3:C6:DA:4D:AC:51:B0
++ DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB
++ serial:BE:58:AD:4C:1F:3D:25:95
++
++ Signature Algorithm: sha1WithRSAEncryption
++ 6f:ad:5e:59:fa:84:3a:be:e2:72:b1:e8:66:2a:4e:f8:73:19:
++ 11:06:11:92:78:56:3e:d6:e8:68:29:90:8b:59:d2:fe:aa:ae:
++ 25:59:c7:e9:99:bb:4a:06:43:dd:40:bd:cb:f4:ae:79:95:7d:
++ 8e:90:ef:58:d2:a8:fc:bf:07:f3:37:b2:9b:bd:da:e6:8c:56:
++ dd:5e:c6:4a:70:7c:3e:3d:a1:e8:35:06:b8:a7:7b:ac:26:85:
++ 54:5d:09:a2:7b:77:b4:17:7f:72:31:cb:ff:cc:67:6d:e6:3e:
++ c6:dc:96:eb:4a:0a:ae:e9:48:ae:8a:e0:d6:73:57:6e:32:4c:
++ 00:dc:28:da:55:b3:9f:9f:d8:98:cc:d9:f1:b6:b3:14:67:2e:
++ a1:47:1e:51:11:cf:70:9f:31:8f:ba:59:29:f2:d0:88:0b:e2:
++ 51:6b:f8:31:ed:6d:ac:00:5e:d3:78:4c:95:97:02:cc:74:2b:
++ 3b:c6:28:e6:2a:c3:30:99:35:b4:4d:31:46:d4:90:f2:47:ed:
++ 64:85:1a:75:2a:72:0a:2f:c6:3a:2f:d2:ac:6b:31:cc:e5:a8:
++ 07:c2:d6:22:f3:c6:0f:bf:67:d9:d6:b2:79:cd:48:b5:c3:e0:
++ e3:18:7f:b5:74:c9:43:19:fb:c4:93:29:ca:cc:90:2b:1b:6f:
++ 45:f6:25:f9
+ -----BEGIN CERTIFICATE-----
+-MIIBtzCCASACAxAAAjANBgkqhkiG9w0BAQQFADBEMQswCQYDVQQGEwJTRTEQMA4G
+-A1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwg
+-QUIwHhcNMTAwMTI5MTE1NjQ5WhcNMTUwMTI4MTE1NjQ5WjBGMQswCQYDVQQGEwJT
+-RTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxEjAQBgNVBAMT
+-CWxvY2FsaG9zdDBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDN5IdRnXIRoNH685KL
+-Exzr9+KaL3Ko1mVI0WmvG8BME+VgYFFB6aumvBO7DF4yfNlsns0FJIR424CRLtiI
+-K8LtAgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAc86cbjlGtBS+2j/zG7qQvCND14Iq
+-cE6m2VplXLffcd91d8WApK/60lni/cmc8JiVjmmpjHzYb0jS4zbgzf8/0aXmq3UJ
+-xFAQxJbdvzveMkbaykrx1lKKMy+r9S5wP9ScvgDIA/k5it9bcDxA7wO+fD0dMjLz
+-UYHigzBuPTib+zw=
++MIIDJTCCAg2gAwIBAgIBBDANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ
++MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT
++UUwgQUIwHhcNMTAwMjIwMDI1NTA2WhcNMzAwOTAzMDI1NTA2WjBGMQswCQYDVQQG
++EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxEjAQBgNV
++BAMTCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA431PwiN3
++qTos0mlZoC9O0VFMro31F8zOWJyDTwujuymiuB0+GwT5qT7iYdDme7l8EtgfhslT
++tQTd3ybpwCveSpYu8yNveW2p0k4Xry/ei2hErt6j4sQ3HAStc0uF+YOs/rfBVEcu
++ltQxloWUadZaYyQEmYkZHVaK0Xeqh/s4zbcCAwEAAaOBozCBoDAJBgNVHRMEAjAA
++MB0GA1UdDgQWBBTMjHFA0A+/0Zl5PxvpEHYZZzYPozB0BgNVHSMEbTBrgBSx+353
++tUCNaBF+2RHlw8baTaxRsKFIpEYwRDELMAkGA1UEBhMCU0UxEDAOBgNVBAgTB1Vw
++cHNhbGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCggkAvlit
++TB89JZUwDQYJKoZIhvcNAQEFBQADggEBAG+tXln6hDq+4nKx6GYqTvhzGREGEZJ4
++Vj7W6GgpkItZ0v6qriVZx+mZu0oGQ91Avcv0rnmVfY6Q71jSqPy/B/M3spu92uaM
++Vt1exkpwfD49oeg1Brine6wmhVRdCaJ7d7QXf3Ixy//MZ23mPsbclutKCq7pSK6K
++4NZzV24yTADcKNpVs5+f2JjM2fG2sxRnLqFHHlERz3CfMY+6WSny0IgL4lFr+DHt
++bawAXtN4TJWXAsx0KzvGKOYqwzCZNbRNMUbUkPJH7WSFGnUqcgovxjov0qxrMczl
++qAfC1iLzxg+/Z9nWsnnNSLXD4OMYf7V0yUMZ+8STKcrMkCsbb0X2Jfk=
+ -----END CERTIFICATE-----
+diff -Naur mysql-5.1.50.orig/mysql-test/std_data/server-key.pem mysql-5.1.50/mysql-test/std_data/server-key.pem
+--- mysql-5.1.50.orig/mysql-test/std_data/server-key.pem 2010-08-03 13:55:08.000000000 -0400
++++ mysql-5.1.50/mysql-test/std_data/server-key.pem 2010-08-27 23:42:05.754428433 -0400
+@@ -1,9 +1,15 @@
+ -----BEGIN RSA PRIVATE KEY-----
+-MIIBOwIBAAJBAM3kh1GdchGg0frzkosTHOv34povcqjWZUjRaa8bwEwT5WBgUUHp
+-q6a8E7sMXjJ82WyezQUkhHjbgJEu2Igrwu0CAwEAAQJBAJuwhFbF3NzRpBbEmnqJ
+-4GPa1UJMQMLFJF+04tqj/HxJcAIVhOJhGmmtYNw1yjz/ZsPnfJCMz4eFOtdjvGtf
+-peECIQDmFFg2WLvYo+2m9w9V7z4ZIkg7ixYkI/ObUUctfZkPOQIhAOUWnrvjFrAX
+-bIvYT/YR50+3ZDLEc51XxNgJnWqWYl1VAiEAnTOFWgyivFC1DgF8PvDp8u5TgCt2
+-A1d1GMgd490O+TECIC/WMl0/hTxOF9930vKqOGf//o9PUGkZq8QE9fcM4gtlAiAE
+-iOcFpnLjtWj57jrhuw214ucnB5rklkQQe+AtcARNkg==
++MIICXgIBAAKBgQDjfU/CI3epOizSaVmgL07RUUyujfUXzM5YnINPC6O7KaK4HT4b
++BPmpPuJh0OZ7uXwS2B+GyVO1BN3fJunAK95Kli7zI295banSThevL96LaESu3qPi
++xDccBK1zS4X5g6z+t8FURy6W1DGWhZRp1lpjJASZiRkdVorRd6qH+zjNtwIDAQAB
++AoGAUb0o91y/FjMs/72S0pes/lDz+JRRSGfyjKxQEgrgndNsADOhqRu0iTdrKDJj
++XnlbN3ooecnFJfnFrvTQcJhSmlS30j6VrBw6LXpCBK3dvjYgJ9LOne7WK+dF1+vS
++FMQtsP04C56Sxy6HJDpMyWJ6oS3Bu169ygG2AxKo+Fk+E6ECQQD38w/MzmrARz2Z
++AGeEPDUnVZPYgtmXkmks95S0/2jSoLhmgpvJimzxwpYwVG/BG8dSDVuTDu5kp05D
++3bZIp3EzAkEA6uAwJsCZPtHXlWU3wYZJsA697rUNjPaCQOIaZ/lnh5RUHTmUiw1h
++Oj/VORqKB0kXqcDfawwLjZEvh1Xli+H5bQJBANTmhw2TvEPnp/OFTl1UGUvyBmXl
++TRMB639qAu07VfVtfYi/4ya1zn/0VmOfTOoigQ5qW9Q1AOu6YNCTQl62L9MCQQDc
++YfEsW2kvNYxYJHoVfuBjbuGuOnn1e1Oqd70ZND59S6NFLMMBWlORaVWzWACNZ3rp
++kAzSj6HDeqgjD2jsQONdAkEAt7S1YHUn8F760bRn4AnAto2TVOYdArtTP/wYjd4o
++9rJREO/d8AYkYJ96APLvF0SZ4n3t1pLwQRsKKN8ZGTmzLA==
+ -----END RSA PRIVATE KEY-----
+diff -Naur mysql-5.1.50.orig/mysql-test/std_data/server8k-cert.pem mysql-5.1.50/mysql-test/std_data/server8k-cert.pem
+--- mysql-5.1.50.orig/mysql-test/std_data/server8k-cert.pem 2010-08-03 13:55:08.000000000 -0400
++++ mysql-5.1.50/mysql-test/std_data/server8k-cert.pem 2010-08-27 23:43:00.005366270 -0400
+@@ -1,51 +1,69 @@
++Certificate:
++ Data:
++ Version: 3 (0x2)
++ Serial Number: 5 (0x5)
++ Signature Algorithm: sha1WithRSAEncryption
++ Issuer: C=SE, ST=Uppsala, L=Uppsala, O=MySQL AB
++ Validity
++ Not Before: Feb 20 03:00:54 2010 GMT
++ Not After : Sep 3 03:00:54 2030 GMT
++ Subject: C=SE, ST=Uppsala, O=MySQL AB, CN=server
++ Subject Public Key Info:
++ Public Key Algorithm: rsaEncryption
++ RSA Public Key: (1024 bit)
++ Modulus (1024 bit):
++ 00:c5:da:44:95:06:77:16:21:af:a0:c4:3c:e9:f8:
++ 1d:2d:95:f9:63:90:8c:3f:86:ba:77:76:4a:52:4b:
++ 6b:af:29:f5:1c:aa:d4:3f:3e:42:9f:6d:46:ba:86:
++ 90:b1:2d:cc:db:c6:33:15:a3:f4:af:53:33:4f:a1:
++ 56:d1:aa:3b:26:10:f7:64:b5:f9:bf:1b:b1:47:8e:
++ cc:a6:d6:0d:aa:4a:77:e3:a3:63:9d:2a:dc:65:f4:
++ 7f:91:17:38:2d:d6:cd:4e:8d:53:52:97:6e:87:fc:
++ 64:60:a6:a1:00:ac:96:6c:e4:42:94:75:17:46:6f:
++ 91:b5:dd:06:47:ed:05:e3:db
++ Exponent: 65537 (0x10001)
++ X509v3 extensions:
++ X509v3 Basic Constraints:
++ CA:FALSE
++ X509v3 Subject Key Identifier:
++ 6E:60:3F:29:13:60:99:ED:0C:F7:15:B5:DB:7B:1C:FB:6F:60:19:ED
++ X509v3 Authority Key Identifier:
++ keyid:B1:FB:7E:77:B5:40:8D:68:11:7E:D9:11:E5:C3:C6:DA:4D:AC:51:B0
++ DirName:/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB
++ serial:BE:58:AD:4C:1F:3D:25:95
++
++ Signature Algorithm: sha1WithRSAEncryption
++ 63:2e:0f:07:14:06:cf:74:90:3d:37:42:f2:48:70:60:21:bc:
++ 34:52:31:f1:87:70:d2:b2:fb:ff:13:38:dc:f0:5e:43:d7:ee:
++ a7:c7:1f:ac:aa:d2:8c:4f:fa:3c:4c:73:f6:b6:c2:0c:a0:ea:
++ a2:c9:e2:73:61:c3:2e:78:40:0f:2a:d3:63:50:9b:b8:f9:89:
++ 40:ed:98:08:97:c3:07:24:17:34:b5:78:89:0a:bb:83:4c:e2:
++ 5c:2e:13:d6:21:30:ad:30:48:b5:70:12:ff:4a:6f:42:f0:f8:
++ 9f:b1:4b:bd:89:2b:f0:9d:e2:49:2b:35:69:18:1f:76:40:b4:
++ 76:bd:cb:dd:27:2f:c0:c1:e2:33:3e:6e:df:68:54:19:92:8a:
++ bb:13:9c:cf:d6:17:56:da:bf:0d:64:70:3a:45:b7:aa:5f:e3:
++ f5:96:ae:34:f2:17:37:27:d0:4b:e8:30:4a:c0:02:42:e2:d2:
++ 30:eb:eb:c7:d7:ec:d8:df:5c:43:58:e2:6f:b7:58:54:0d:c4:
++ 01:71:2d:59:8f:44:c7:a1:6c:0b:41:28:fa:b7:63:a7:68:d3:
++ 4f:c3:0f:17:9e:b2:32:50:e6:0b:87:3d:e2:39:47:c0:d8:0a:
++ 3b:f6:af:50:68:0f:9d:ef:6e:34:0d:3a:07:94:f8:a4:d7:24:
++ 86:32:d3:b4
+ -----BEGIN CERTIFICATE-----
+-MIIJFDCCBPwCAQEwDQYJKoZIhvcNAQEEBQAwTjELMAkGA1UEBhMCU0UxEDAOBgNV
+-BAgTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCMQ0wCwYDVQQLEwRUZXN0MQsw
+-CQYDVQQDEwJDQTAeFw0xMDA3MjgxNDA3MjhaFw0xODEwMTQxNDA3MjhaMFIxCzAJ
+-BgNVBAYTAlNFMRAwDgYDVQQIEwdVcHBzYWxhMREwDwYDVQQKEwhNeVNRTCBBQjEN
+-MAsGA1UECxMEVGVzdDEPMA0GA1UEAxMGc2VydmVyMIIEIjANBgkqhkiG9w0BAQEF
+-AAOCBA8AMIIECgKCBAEA6h3v1OWb9I9U/Z8diBu/xYGS8NCTD3ZESboHxVI2qSEC
+-PgxNNcG8Lh0ktQdgYcOe64MnDTZX0Bibm47hoDldrAlTSffFxQhylqBBoXxDF+Lr
+-hXIqCz7K0PsK+bYusL9ezJ7PETDnCT7oy95q4GXbKsutbNsm9if4ZE41gs2KnoU2
+-DA7kvMmkKojrMIL4+BqTXA20LLo0iSbgvUTvpSJw4u96BeyzMNnxK2wP5vvTtUo5
+-hACbfU87YjaSKs+q2VXCzfyYGZk1L1xk5GUI0bP+jutf1dDzNttW2/q2Nf5rxx09
+-Gh/GwmOnEk1O7cOZ8VQCsOHirIM39NuSARsY6Y3G5XM4k2W4nxyR/RtdG9bvs/33
+-aGsZ5V5yp7WSs8s9HHwaCPSsUiLKckQ7uA0TTRgbeweMrrLKovG57jsbBBB8pQD4
+-PRd31qgxCdstWXHiWwRyI8vOLWENPXPFqA/rJwwqNdWTogy38aqVXxGYR8PIwjA2
+-OaIwFjwGZcsPNLqw6bgAN8O2UBqZHWiMF8mi7brvioDvAIufZuqa2SqT/At45H83
+-psQ6R4FsxZt6SAK7EsdPo8OYTrY1i4iPZd/eKhnEu2srEZgsKRwY5H1mvDH5fWCc
+-HSFu07sWmlmK6Or65Fsa0IaKLJiQDVVETd6xrI0wkM4AOcbKDrS7aywJ426dopbs
+-+LFdt4N0cdII4gBgJAfLuuA2yrDXRq4P6cgpVMy0R+0dEYE8zzm8zf1a+Ud273LS
+-9+LB+LJKwqbW8nOPBoiekimIKfJYoOA4+C/mAjsYl1sVjjEhXJAs9S9L2UvnUk1P
+-sZi4UKHI6eAIEl7VM1sQ4GbdZ0px2dF2Ax7pGkhD+DLpYyYkCprharKZdmuUNLUd
+-NhXxi/HSEiE+Uy+o8RIzmH7LuROl/ZgnfHjJEiBLt2qPvwrwYd4c3XuXWs4YsWfV
+-JTt8Mx2ihgVcdGy9//shCSmgJwR1oWrhgC10AEL2fKeRnYUal1i+IxFPp7nb8uwx
+-UADgR0cY4A3qR/JP489QFIcxBTVs65De+Bq3ecnujk6yeGpD9iptonq4Y8uNZMc1
+-kOE7GiFGwR4EufT5SEMh+tUkjth2r+842vmZZuxrVQaohDiATmIJA07W51zKH+nQ
+-uw4qVKnAhPaDLCLc7YMIH9JcmkeQX0nf8/S2O2WYDH8glVDi5hfW08tCmV647vRY
+-nTIywUTO0lFpz7M+VyMNaJ6yXU6biBV5hLAI8C5ldr/SWI789W2+ebBaJ9gfK+PT
+-trohFSK37GcoSH4V6qSLJHCBASEsiddqHIHMLJZRYD+B6J3tLhjVUM43u+MEGbFT
+-d33ZDke/WzLTExWkaOv36e67gDBmgDuj9yroq3wGfwIDAQABMA0GCSqGSIb3DQEB
+-BAUAA4IEAQCc9RBhRbuWlmRZPZkqIdi5/+enyjoMmOa6ryJPxFSP8D2jrlHgQsk1
+-+GsJmPFT3rwWfoGAQu/aeSX4sp8OhKVJtqNA6MJrGYnZIMolgYa1wZPbkjJsdEfi
+-UsZdIB0n2+KA0xwEdGPdkGCfNPBtOg557DkcyEvsIZ9ELp4Pp2XzWRhyFGasJZc4
+-YwgD/3K2rpOPZoMkBKeKqV19j41OfLKGBVyuaqzitbu9+KT4RU1ibr2a+UuFCwdT
+-oqyN7bfWXjcjXOMkxCsOmLfKmqQxs7TEOVrYPTdYjamDxLy/e5g5FgoCxGY8iil0
+-+YFLZyH6eEx/Os9DlG/M3O1MeRD9U97CdsphbDVZIDyWw5xeX8qQHJe0KSprAgiG
+-TLhTZHeyrKujQCQS1oFFmNy4gSqXt0j1/6/9T80j6HeyjiiYEaEQK9YLTAjRoA7W
+-VN8wtHI5F3RlNOVQEJks/bjdlpLL3VhaWtfewGh/mXRGcow84cgcsejMexmhreHm
+-JfTUl9+X1IFFxGq2/606A9ROQ7kN/s4rXu7/TiMODXI/kZijoWd2SCc7Z0YWoNo7
+-IRKkmZtrsflJbObEuK2Jk59uqzSxyQOBId8qtbPo8qJJyHGV5GCp34g4x67BxJBo
+-h1iyVMamBAS5Ip1ejghuROrB8Hit8NhAZApXju62btJeXLX+mQayXb/wC/IXNJJD
+-83tXiLfZgs6GzLAq7+KW/64sZSvj87CPiNtxkvjchAvyr+fhbBXCrf4rlOjJE6SH
+-Je2/Jon7uqijncARGLBeYUT0Aa6k1slpXuSKxDNt7EIkP21kDZ5/OJ0Y1u587KVB
+-dEhuDgNf2/8ij7gAQBwBoZMe1DrwddrxgLLBlyHpAZetNYFZNT+Cs/OlpqI0Jm59
+-kK9pX0BY4AGOd23XM3K/uLawdmf67kkftim7aVaqXFHPiWsJVtlzmidKvNSmbmZe
+-dOmMXp6PBoqcdusFVUS7vjd3KAes5wUX/CaTyOOPRu0LMSnpwEnaL76IC9x4Jd6d
+-7QqY/OFTjpPH8nP57LwouiT6MgSUCWGaOkPuBJ9w9sENSbbINpgJJ42iAe2kE+R7
+-qEIvf/2ETCTseeQUqm2nWiSPLkNagEh6kojmEoKrGyrv3YjrSXSOY1a70tDVy43+
+-ueQDQzNZm3Q7inpke2ZKvWyY0LQmLzP2te+tnNBcdLyKJx7emPRTuMUlEdK7cLbt
+-V3Sy9IKtyAXqqd66fPFj4NhJygyncj8M6CSqhG5L0GhDbkA8UJ8yK/gfKm3h5xe2
+-utULK5VMtAhQt6cVahO59A9t/OI17y45bmlIgdlEQISzVFe9ZbIUJW44zBfPx74k
+-/w8pMRr8gEuRqpL2WdJiKGG6lhMHLVFo
++MIIDIjCCAgqgAwIBAgIBBTANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJTRTEQ
++MA4GA1UECBMHVXBwc2FsYTEQMA4GA1UEBxMHVXBwc2FsYTERMA8GA1UEChMITXlT
++UUwgQUIwHhcNMTAwMjIwMDMwMDU0WhcNMzAwOTAzMDMwMDU0WjBDMQswCQYDVQQG
++EwJTRTEQMA4GA1UECBMHVXBwc2FsYTERMA8GA1UEChMITXlTUUwgQUIxDzANBgNV
++BAMTBnNlcnZlcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxdpElQZ3FiGv
++oMQ86fgdLZX5Y5CMP4a6d3ZKUktrryn1HKrUPz5Cn21GuoaQsS3M28YzFaP0r1Mz
++T6FW0ao7JhD3ZLX5vxuxR47MptYNqkp346NjnSrcZfR/kRc4LdbNTo1TUpduh/xk
++YKahAKyWbORClHUXRm+Rtd0GR+0F49sCAwEAAaOBozCBoDAJBgNVHRMEAjAAMB0G
++A1UdDgQWBBRuYD8pE2CZ7Qz3FbXbexz7b2AZ7TB0BgNVHSMEbTBrgBSx+353tUCN
++aBF+2RHlw8baTaxRsKFIpEYwRDELMAkGA1UEBhMCU0UxEDAOBgNVBAgTB1VwcHNh
++bGExEDAOBgNVBAcTB1VwcHNhbGExETAPBgNVBAoTCE15U1FMIEFCggkAvlitTB89
++JZUwDQYJKoZIhvcNAQEFBQADggEBAGMuDwcUBs90kD03QvJIcGAhvDRSMfGHcNKy
+++/8TONzwXkPX7qfHH6yq0oxP+jxMc/a2wgyg6qLJ4nNhwy54QA8q02NQm7j5iUDt
++mAiXwwckFzS1eIkKu4NM4lwuE9YhMK0wSLVwEv9Kb0Lw+J+xS72JK/Cd4kkrNWkY
++H3ZAtHa9y90nL8DB4jM+bt9oVBmSirsTnM/WF1bavw1kcDpFt6pf4/WWrjTyFzcn
++0EvoMErAAkLi0jDr68fX7NjfXENY4m+3WFQNxAFxLVmPRMehbAtBKPq3Y6do00/D
++DxeesjJQ5guHPeI5R8DYCjv2r1BoD53vbjQNOgeU+KTXJIYy07Q=
+ -----END CERTIFICATE-----
+diff -Naur mysql-5.1.50.orig/mysql-test/std_data/server8k-key.pem mysql-5.1.50/mysql-test/std_data/server8k-key.pem
+--- mysql-5.1.50.orig/mysql-test/std_data/server8k-key.pem 2010-08-03 13:55:08.000000000 -0400
++++ mysql-5.1.50/mysql-test/std_data/server8k-key.pem 2010-08-27 23:43:10.165365998 -0400
+@@ -1,99 +1,15 @@
+ -----BEGIN RSA PRIVATE KEY-----
+-MIISKQIBAAKCBAEA6h3v1OWb9I9U/Z8diBu/xYGS8NCTD3ZESboHxVI2qSECPgxN
+-NcG8Lh0ktQdgYcOe64MnDTZX0Bibm47hoDldrAlTSffFxQhylqBBoXxDF+LrhXIq
+-Cz7K0PsK+bYusL9ezJ7PETDnCT7oy95q4GXbKsutbNsm9if4ZE41gs2KnoU2DA7k
+-vMmkKojrMIL4+BqTXA20LLo0iSbgvUTvpSJw4u96BeyzMNnxK2wP5vvTtUo5hACb
+-fU87YjaSKs+q2VXCzfyYGZk1L1xk5GUI0bP+jutf1dDzNttW2/q2Nf5rxx09Gh/G
+-wmOnEk1O7cOZ8VQCsOHirIM39NuSARsY6Y3G5XM4k2W4nxyR/RtdG9bvs/33aGsZ
+-5V5yp7WSs8s9HHwaCPSsUiLKckQ7uA0TTRgbeweMrrLKovG57jsbBBB8pQD4PRd3
+-1qgxCdstWXHiWwRyI8vOLWENPXPFqA/rJwwqNdWTogy38aqVXxGYR8PIwjA2OaIw
+-FjwGZcsPNLqw6bgAN8O2UBqZHWiMF8mi7brvioDvAIufZuqa2SqT/At45H83psQ6
+-R4FsxZt6SAK7EsdPo8OYTrY1i4iPZd/eKhnEu2srEZgsKRwY5H1mvDH5fWCcHSFu
+-07sWmlmK6Or65Fsa0IaKLJiQDVVETd6xrI0wkM4AOcbKDrS7aywJ426dopbs+LFd
+-t4N0cdII4gBgJAfLuuA2yrDXRq4P6cgpVMy0R+0dEYE8zzm8zf1a+Ud273LS9+LB
+-+LJKwqbW8nOPBoiekimIKfJYoOA4+C/mAjsYl1sVjjEhXJAs9S9L2UvnUk1PsZi4
+-UKHI6eAIEl7VM1sQ4GbdZ0px2dF2Ax7pGkhD+DLpYyYkCprharKZdmuUNLUdNhXx
+-i/HSEiE+Uy+o8RIzmH7LuROl/ZgnfHjJEiBLt2qPvwrwYd4c3XuXWs4YsWfVJTt8
+-Mx2ihgVcdGy9//shCSmgJwR1oWrhgC10AEL2fKeRnYUal1i+IxFPp7nb8uwxUADg
+-R0cY4A3qR/JP489QFIcxBTVs65De+Bq3ecnujk6yeGpD9iptonq4Y8uNZMc1kOE7
+-GiFGwR4EufT5SEMh+tUkjth2r+842vmZZuxrVQaohDiATmIJA07W51zKH+nQuw4q
+-VKnAhPaDLCLc7YMIH9JcmkeQX0nf8/S2O2WYDH8glVDi5hfW08tCmV647vRYnTIy
+-wUTO0lFpz7M+VyMNaJ6yXU6biBV5hLAI8C5ldr/SWI789W2+ebBaJ9gfK+PTtroh
+-FSK37GcoSH4V6qSLJHCBASEsiddqHIHMLJZRYD+B6J3tLhjVUM43u+MEGbFTd33Z
+-Dke/WzLTExWkaOv36e67gDBmgDuj9yroq3wGfwIDAQABAoIEAQCSt6YoZqigz/50
+-XvYT6Uf6T6S1lBDFXNmY1qOuDkLBJTWRiwYMDViQEaWCaZgGTKDYeT3M8uR/Phyu
+-lRFi5vCEMufmcAeZ3hxptw7KU+R8ILJ207/zgit6YglTys9h5txTIack39+6FJmx
+-wbZ64HpETJZnpMO6+fuZaMXyLjuT8mmXjvHcOgXOvjWeFkZOveDhjJkAesUXuqyX
+-EI+ajoXuQiPXeKonkD2qd7NTjzfy4gw/ZF4NXs0ZVJeviqtIPo2xp33udOw2vRFh
+-bMvlF4cNLAbIKYVyOG0ruOfd2I7Unsc/CvD1u5vlRVuUd8OO0JZLIZR7hlRX+A58
+-8O1g2H/wJZAsF1BnLnFzDGYCX2WjCCK3Zn85FkKGRa0lTdYDduad/C/N3Y2/pHFE
+-e7U/2D7IkEei59tD2HcsDBB3MJnckkn/hyiL9qWcxqWZ61vurE+XjU6tc6fnfhk9
+-pJQ6yU3epPU7Vfsk0UGA7bbgKpsyzyH8Zl76YC2mN2ZVJjZekfhY+ibT9odEPdOl
+-yLB5iXA6/WhKkDWaOqZGOH+7MblWgT9wHINlcn+nKzOr00JHl26ac6aMlXXi9vbe
+-4jgJbFK1HYlFIndyX/BdqRTsFemDoDrVqrEYsaONoVYDd9c5qrqYOeh34DhOksQW
+-hNwWBfmMlfzgOGtCYhMeK+AajqTtUbMYQA6qp47KJd/Oa5Dvi3ZCpvZh3Ll5iIau
+-rqCtmojsWCqmpWSu7P+Wu4+O3XkUMPdQUuQ5rJFESEBB3yEJcxqk/RItTcKNElNC
+-PASrPrMD9cli7S/pJ+frbhu1Gna1ArXzXQE9pMozPaBpjCig7+15R0lL3pmOKO6e
+-WK3dgSwrnW6TQdLPlSD4lbRoiIdTHVBczztDeUqVvFiV3/cuaEi1nvaVdAYLqjuL
+-ogK4HwE/FQ54S0ijAsP52n25usoH6OTU3bSd/7NTp0vZCy3yf10x7HUdsh2DvhRO
+-3+TSK5t0yz0Nt7hNwcI6pLmWUIYcZgpFc/WsiiGscTfhy8rh3kRHI8ylGq53KNF+
+-yCVmjqnBRWs91ArxmeF1ctX2t3w5p7gf65hJWqoX/2DiSi5FBsr6HLxa5sUi4wRZ
+-136aCNt5Wu7w+AzPDbQW6qKUGSyfHJAw4JZasZcaZLise5IWb1ks0DtFbWWdT3ux
+-8r2AM7IO1WopnekrYCnx/aBvBAv4NjWozVA517ztVttPERt3AGb4nm387nYt5R2U
+-NO2GBWcDyT8JQLKmffE1AkWolCR1GsvcNLQfLCbnNppgsnsLE/viTG4mq1wjnd8O
+-2Q8nH1SVTuyGFREMp/zsiAEaGfdd0hI2r1J7OdNPBBCtmhITsy9ZYHqm5vrGvy3s
+-vi2GuB2RAoICAQD/oWUsg4eTJxHifTJLz/tVSTXnw7DhfbFVa1K1rUV63/MRQAFW
+-pabN4T6Yfp3CpdRkljCA8KPJZj7euwhm4OEg1ulpOouA+cfWlE9RFE8wyOK5SYwM
+-k+nk31P9MUC866pZg/ghzBGDub91OW1+ZGEtqnLI/n/LhiAIWt0hJvgZclTc1cAL
+-xffHVlFwoSyNl/nc3ueZCC95nOLst2XcuxZLLbOFtZCmDYsp49q/Jn6EFjn4Ge2o
+-qp38z6eZgDMP1F4lb9nDqXPHfUSt2jxKlmpfXS+IPKdba67+EjhbtmUYzaR4EoPI
+-zh+o6SrVWT6Yve7KGiYv06fuRz1m/lLQO/Arbd9ntSjgn+ZEXGOkbhnHUX3DJ4ny
+-/6XEGB9NLQjern4uNTn0AaV+uvhncapFMaIBnVfq0Cw8eog0136PBYRaVX7T44j5
+-HwIyGXWtYGA/SzDEQoksD0Y/T61BEGnLZaKeavNd82WwFvcYHZtE0J4aQGjCEE7N
+-+nijzCy+j5ETmme9KJvQHpEyXP3N4RBko1eWvyTwFZDdIXtoa6TTEI51lm+FXJ/b
+-Y+BzMr6KRo29FB+7//1ptUoMvn5hzL0PwOv2ZSTQuoG5hLDEbxWXLNhd1VHcfznF
+-3EZHwfD2F8aGQ3kz+fkMTNfK955KorDrmLgvmV9eZZ5yQxGZrs5H5YfKpwKCAgEA
+-6nSUbzfSdVFUH89NM5FmEJgkD06vqCgHl2mpyF+VmDGcay4K06eA4QbRO5kns13+
+-n6PcBl/YVW/rNE8iFi+WxfqUpAjdR1HlShvTuTRVqtFTfuN8XhbYU6VMjKyuE0kd
+-LKe3KRdwubjVNhXRZLBknU+3Y/4hnIR7mcE3/M5Zv5hjb7XnwWg/SzxV9WojCKiu
+-vQ7cXhH5/o7EuKcl1d6vueGhWsRylCG9RimwgViR2H7zD9kpkOc0nNym9cSpb0Gv
+-Lui4cf/fVwIt2HfNEGBjbM/83e2MH6b8Xp1fFAy0aXCdRtOo4LVOzJVAxn5dERMX
+-4JJ4d5cSFbssDN1bITOKzuytfBqRIQGNkOfizgQNWUiaFI0MhEN/icymjm1ybOIh
+-Gc9tzqKI4wP2X9g+u3+Oof1QaBcZ4UbZEU9ITN87Pa6XVJmpNx7A81BafWoEPFeE
+-ahoO4XDwlHZazDuSlOseEShxXcVwaIiqySy7OBEPBVuYdEd2Qw/z3JTx9Kw8MKnf
+-hu+ar5tz5dPnJIsvLeYCcJDe/K6loiZuHTtPbWEy9p6It7qubQNPBvTSBN5eVDKc
+-Q2bTQNCx8SAAA9C5gJiwWoQKsXJzbRFRY77P9JjuGpua3YJ2nYBHEJmF+fp1R33c
+-uHIyMphPMkKC4GC3/43kkMr6tck8kZbXGSYsLsBr2GkCggIBAJvvrjILQianzKcm
+-zAmnI6AQ+ssYesvyyrxaraeZvSqJdlLtgmOCxVANuQt5IW9djUSWwZvGL4Np1aw0
+-15k6UNqhftzsE7FnrVneOsww4WXXBUcV8FKz4Bf3i9qFswILmGzmrfSf8YczRfGS
+-SJKzVPxwX3jwlrBmbx/pnb7dcLbFIbNcyLvl1ZJJu4BDMVRmgssTRp/5eExtQZg4
+-//A4SA8wH7TO3yAMXvn8vrGgH8kfbdlEp88d1SYk3g4rP/rGB3A63NIYikIEzmJn
+-ICQ3wUfPJnGq3kRMWgEuyCZaCy2oNE3yrWVPJ8z3/2MJ/79ZDVNHxEeki2o1FuW+
+-+nGAPq+fZIp03iy4HdVRro7dgugtc9QaSHJtNId8V4vSjviX5Oz3FxUb9AJst58S
+-nVV8Q2FMxBa/SlzSOkhRtCg2q1gXkzhaMnIVUleRZFGQ2uWBToxKMjcoUifIyN1J
+-z999bkfI4hBLq5pRSAXz+YVu5SMKa10GaawIwJLat+i+1zboF6QyI2o/Wz8nrsNq
+-KX/ajFGu5C94WFgsVoWKNI90KBLe48Ssje9c68waBlV/WHMg1YLvU3yqVDOV+K5c
+-IHB9tPMnG+AgBYZPxSzuvnLrrkj/GeKx0WI7TrvzOLRGKJo6irMEJ8IzFegASRUq
+-TVZKYQDYRG7m+lKlSxU+pyMAh2c9AoICAE4kavCip1eIssQjYLTGSkFPo/0iGbOv
+-G9CgXAE3snFWX67tWphupKrbjdMSWcQTmPD2OTg6q6zWL4twsIi6dcMooHAHsFC7
+-//LyUV/SDJdxSyXohiQJ8zH1zwy35RDydnHSuF5OvLh53T44iWDI1dAEqLgAFI3J
+-LjTxzEpLMGiGTuYFt+ejai0WQAQayvBw4ESM9m+4CB2K0hBFTXv5y5HlnNTW0uWC
+-VUZUUMrbjUieDz8B/zOXi9aYSGFzmZFGUDAPSqJcSMEELemPDF7f8WNr8vi42tIV
+-4tlaFD1nep4F9bWMiCXU6B2RxVQi+7vcJEIqL1KUnGd3ydfD00K+ng4Xnj7Vz/cz
+-QE7CqrpFaXmPlCMzW6+dm51/AyhHXDLkL2od05hiXcNkJ7KMLWRqwExHVIxM3shR
+-x7lYNl3ArUsCrNd6m4aOjnrKFk7kjeLavHxskPccoGKrC9o0JMfTkWLgmuBJFQ0S
+-N/HzIbcvIFWF0Ms4ojb50yp6ziXhXfJOO/0KUQEki71XIhvw89mVZszDzD5lqzjf
+-HCZMBU4MbmL6NdEevFIDH0zPPkx3HPNtJt3kIJbit9wI8VhUMe+ldGnGxpWb8tKw
+-SfM3vrHkYr+lizk26XfXMFhdAuVtT7dzQKSNEyP/1a2Hs307Xzgiv8JulJ8QIkrX
+-/nsYWPOAGLG5AoICABmdW9Ppkvuhb1AEcjTWb+XCyopoBc6vit/uQWD9uO+CeX7a
+-cfzq+iH01CAjyVMc4E1JDc5Lpi106U+GRGcAAaPJB2Sp5NznoxaOVrb71blu4Q4x
+-bNjtKM/P/DXpO+yJYoOPdKtaSDhtnfNDM7H/jztJ3XIrOltKA7CcRDohbBWIx8Q0
+-0uEpvfFpZZBco3yVmjP0RLgIVYn/ZDj9wGhSvFWIJ5vv6GXmtDrcHGMLxcfv7t76
+-UVcMW/Yy4mYJRCzGOrWagyVijJ6MTVNciqadWcH1KcbB3EGoMFYMn61or2qJABPM
+-xz89IlhnROU1Re3X/QRx5t86cw6oa+FqrWMOhSs31I0dNWSuS/xDympG27YIYSDd
+-mv5seT78GjFmMJC5pPOLoXsbTPB0HpsX2/UL/w/eRAfilTOef/Cf9VE5MP/C2YR7
+-NBxUU7/+21D6WvdtBTcZbrXWGroAo8zPP+PwX0+c6WoAvqDJvCPndp8xZhSgEJN/
+-0kScptezi8n3ZHI95EA9U5mAHxHz0IhDDVzWw/z1f1SBPxKVX3+By3zaa3lrD2ch
+-cHq7nBkX72veEevnHUY8Z2rHE2G2jdmRfOtwm4sjL0VBV9fRRoxzJWRduKyeOtDL
+-EhhBhUoTrT48UnfW9hxnbNLB9P/hh+UJu9HrS2uAwHoGE1+8gcyundupGDBn
++MIICXgIBAAKBgQDF2kSVBncWIa+gxDzp+B0tlfljkIw/hrp3dkpSS2uvKfUcqtQ/
++PkKfbUa6hpCxLczbxjMVo/SvUzNPoVbRqjsmEPdktfm/G7FHjsym1g2qSnfjo2Od
++Ktxl9H+RFzgt1s1OjVNSl26H/GRgpqEArJZs5EKUdRdGb5G13QZH7QXj2wIDAQAB
++AoGBAJLCjh7Q9eLnx+QDzH9s+Q/IcH4nSbERmh1lFEopAc6j29qQ6PGkmDy0DUPs
++70VOCOh5A4mo3aZzm9sUfVb24/nRtmyTP/AtMuIVGCsUqzI28dJRGvRlY0aSQG/C
++ILqMP69kiMNGBvuyEIiJhisOmMvDFEp7HrrXHJM9qcc217DpAkEA4nzJ9yyy2e4O
++r6/D711hdfcU/F+ktXw+pL77kSSdTABUap92Uv2RL36UA4q5h8RNvq/GrzMNm6Ye
++u2IMvBCiTQJBAN+iRbiMJCSitTg5YVMluVbT87co7jbTqk7LN1ujyIFEklm4xlHG
++DLJNgEoDR7QJtAkL++FyogC4zsQsey5voscCQQCp54trTbDuI9QIoAaQrrDKWgz4
++NpfNPeOQm2UFQT5vIWAyjGWrZGViB8bp0UvVOcJI5nxaOiZfOYOcdrWu75uRAkAn
++67zMc9/j1lPJRJz2Dc7nDBD+ikTz7pcBV897AWLCiK4jbBOi91q+3YzgKXO8VNsZ
++nlUJasA2psbqSBJ5OJ5zAkEA2UxoMju54hASjT54Z92IzraVw4Vo8CYwOcw5fr7z
+++m5xg1mmWdLBclmZ+WjARzDuTHIW6u/WCxNGg42AykWzfw==
+ -----END RSA PRIVATE KEY-----
diff --git a/packaging/rpm-uln/mysql-install-test.patch b/packaging/rpm-uln/mysql-install-test.patch
new file mode 100644
index 00000000000..5980aea6a9f
--- /dev/null
+++ b/packaging/rpm-uln/mysql-install-test.patch
@@ -0,0 +1,33 @@
+Improve the documentation that will be installed in the mysql-test RPM.
+
+
+diff -Naur mysql-5.1.43.orig/mysql-test/README mysql-5.1.43/mysql-test/README
+--- mysql-5.1.43.orig/mysql-test/README 2010-01-15 12:14:43.000000000 -0500
++++ mysql-5.1.43/mysql-test/README 2010-02-13 21:18:06.000000000 -0500
+@@ -6,6 +6,16 @@
+ actually have a co-existing MySQL installation. The tests will not
+ conflict with it.
+
++For use in Red Hat distributions, you should run the script as user mysql,
++so the best bet is something like
++ cd /usr/share/mysql-test
++ sudo -u mysql ./mysql-test-run
++This will use the installed mysql executables, but will run a private copy
++of the server process (using data files within /usr/share/mysql-test),
++so you need not start the mysqld service beforehand.
++To clean up afterwards, remove the created "var" subdirectory, eg
++ sudo -u mysql rm -rf /usr/share/mysql-test/var
++
+ All tests must pass. If one or more of them fail on your system, please
+ read the following manual section for instructions on how to report the
+ problem:
+@@ -25,7 +35,8 @@
+
+ With no test cases named on the command line, mysql-test-run falls back
+ to the normal "non-extern" behavior. The reason for this is that some
+-tests cannot run with an external server.
++tests cannot run with an external server (because they need to control the
++options with which the server is started).
+
+
+ You can create your own test cases. To create a test case, create a new
diff --git a/packaging/rpm-uln/mysql-strmov.patch b/packaging/rpm-uln/mysql-strmov.patch
new file mode 100644
index 00000000000..a144d0936e4
--- /dev/null
+++ b/packaging/rpm-uln/mysql-strmov.patch
@@ -0,0 +1,32 @@
+Remove overly optimistic definition of strmov() as stpcpy().
+
+mysql uses this macro with overlapping source and destination strings,
+which is verboten per spec, and fails on some Red Hat platforms.
+Deleting the definition is sufficient to make it fall back to a
+byte-at-a-time copy loop, which should consistently give the
+expected behavior.
+
+Note: the particular case that prompted this patch is reported and fixed
+at http://bugs.mysql.com/bug.php?id=48864. However, my faith in upstream's
+ability to detect this type of error is low, and I also see little evidence
+of any real performance gain from optimizing these calls. So I'm keeping
+this patch.
+
+
+diff -Naur mysql-5.1.37.orig/include/m_string.h mysql-5.1.37/include/m_string.h
+--- mysql-5.1.37.orig/include/m_string.h 2009-07-13 19:08:50.000000000 -0400
++++ mysql-5.1.37/include/m_string.h 2009-08-31 21:49:49.000000000 -0400
+@@ -81,13 +81,6 @@
+ extern void *(*my_str_malloc)(size_t);
+ extern void (*my_str_free)(void *);
+
+-#if defined(HAVE_STPCPY)
+-#define strmov(A,B) stpcpy((A),(B))
+-#ifndef stpcpy
+-extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
+-#endif
+-#endif
+-
+ /* Declared in int2str() */
+ extern char NEAR _dig_vec_upper[];
+ extern char NEAR _dig_vec_lower[];
diff --git a/packaging/rpm-uln/mysql.init b/packaging/rpm-uln/mysql.init
new file mode 100644
index 00000000000..310e8cfa023
--- /dev/null
+++ b/packaging/rpm-uln/mysql.init
@@ -0,0 +1,209 @@
+#!/bin/sh
+#
+# mysqld This shell script takes care of starting and stopping
+# the MySQL subsystem (mysqld).
+#
+# chkconfig: - 64 36
+# description: MySQL database server.
+# processname: mysqld
+# config: /etc/my.cnf
+# pidfile: /var/run/mysqld/mysqld.pid
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+
+exec="/usr/bin/mysqld_safe"
+prog="mysqld"
+
+# Set timeouts here so they can be overridden from /etc/sysconfig/mysqld
+STARTTIMEOUT=120
+STOPTIMEOUT=60
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+lockfile=/var/lock/subsys/$prog
+
+
+# extract value of a MySQL option from config files
+# Usage: get_mysql_option SECTION VARNAME DEFAULT
+# result is returned in $result
+# We use my_print_defaults which prints all options from multiple files,
+# with the more specific ones later; hence take the last match.
+get_mysql_option(){
+ result=`/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1`
+ if [ -z "$result" ]; then
+ # not found, use default
+ result="$3"
+ fi
+}
+
+get_mysql_option mysqld datadir "/var/lib/mysql"
+datadir="$result"
+get_mysql_option mysqld socket "$datadir/mysql.sock"
+socketfile="$result"
+get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
+errlogfile="$result"
+get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
+mypidfile="$result"
+
+
+start(){
+ [ -x $exec ] || exit 5
+ # check to see if it's already running
+ RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1`
+ if [ $? = 0 ]; then
+ # already running, do nothing
+ action $"Starting $prog: " /bin/true
+ ret=0
+ elif echo "$RESPONSE" | grep -q "Access denied for user"
+ then
+ # already running, do nothing
+ action $"Starting $prog: " /bin/true
+ ret=0
+ else
+ # prepare for start
+ touch "$errlogfile"
+ chown mysql:mysql "$errlogfile"
+ chmod 0640 "$errlogfile"
+ [ -x /sbin/restorecon ] && /sbin/restorecon "$errlogfile"
+ if [ ! -d "$datadir/mysql" ] ; then
+ # First, make sure $datadir is there with correct permissions
+ if [ ! -e "$datadir" -a ! -h "$datadir" ]
+ then
+ mkdir -p "$datadir" || exit 1
+ fi
+ chown mysql:mysql "$datadir"
+ chmod 0755 "$datadir"
+ [ -x /sbin/restorecon ] && /sbin/restorecon "$datadir"
+ # Now create the database
+ action $"Initializing MySQL database: " /usr/bin/mysql_install_db --datadir="$datadir" --user=mysql
+ ret=$?
+ chown -R mysql:mysql "$datadir"
+ if [ $ret -ne 0 ] ; then
+ return $ret
+ fi
+ fi
+ chown mysql:mysql "$datadir"
+ chmod 0755 "$datadir"
+ # Pass all the options determined above, to ensure consistent behavior.
+ # In many cases mysqld_safe would arrive at the same conclusions anyway
+ # but we need to be sure. (An exception is that we don't force the
+ # log-error setting, since this script doesn't really depend on that,
+ # and some users might prefer to configure logging to syslog.)
+ # Note: set --basedir to prevent probes that might trigger SELinux
+ # alarms, per bug #547485
+ $exec --datadir="$datadir" --socket="$socketfile" \
+ --pid-file="$mypidfile" \
+ --basedir=/usr --user=mysql >/dev/null 2>&1 &
+ safe_pid=$!
+ # Spin for a maximum of N seconds waiting for the server to come up;
+ # exit the loop immediately if mysqld_safe process disappears.
+ # Rather than assuming we know a valid username, accept an "access
+ # denied" response as meaning the server is functioning.
+ ret=0
+ TIMEOUT="$STARTTIMEOUT"
+ while [ $TIMEOUT -gt 0 ]; do
+ RESPONSE=`/usr/bin/mysqladmin --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping 2>&1` && break
+ echo "$RESPONSE" | grep -q "Access denied for user" && break
+ if ! /bin/kill -0 $safe_pid 2>/dev/null; then
+ echo "MySQL Daemon failed to start."
+ ret=1
+ break
+ fi
+ sleep 1
+ let TIMEOUT=${TIMEOUT}-1
+ done
+ if [ $TIMEOUT -eq 0 ]; then
+ echo "Timeout error occurred trying to start MySQL Daemon."
+ ret=1
+ fi
+ if [ $ret -eq 0 ]; then
+ action $"Starting $prog: " /bin/true
+ touch $lockfile
+ else
+ action $"Starting $prog: " /bin/false
+ fi
+ fi
+ return $ret
+}
+
+stop(){
+ if [ ! -f "$mypidfile" ]; then
+ # not running; per LSB standards this is "ok"
+ action $"Stopping $prog: " /bin/true
+ return 0
+ fi
+ MYSQLPID=`cat "$mypidfile"`
+ if [ -n "$MYSQLPID" ]; then
+ /bin/kill "$MYSQLPID" >/dev/null 2>&1
+ ret=$?
+ if [ $ret -eq 0 ]; then
+ TIMEOUT="$STOPTIMEOUT"
+ while [ $TIMEOUT -gt 0 ]; do
+ /bin/kill -0 "$MYSQLPID" >/dev/null 2>&1 || break
+ sleep 1
+ let TIMEOUT=${TIMEOUT}-1
+ done
+ if [ $TIMEOUT -eq 0 ]; then
+ echo "Timeout error occurred trying to stop MySQL Daemon."
+ ret=1
+ action $"Stopping $prog: " /bin/false
+ else
+ rm -f $lockfile
+ rm -f "$socketfile"
+ action $"Stopping $prog: " /bin/true
+ fi
+ else
+ action $"Stopping $prog: " /bin/false
+ fi
+ else
+ # failed to read pidfile, probably insufficient permissions
+ action $"Stopping $prog: " /bin/false
+ ret=4
+ fi
+ return $ret
+}
+
+restart(){
+ stop
+ start
+}
+
+condrestart(){
+ [ -e $lockfile ] && restart || :
+}
+
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status -p "$mypidfile" $prog
+ ;;
+ restart)
+ restart
+ ;;
+ condrestart|try-restart)
+ condrestart
+ ;;
+ reload)
+ exit 3
+ ;;
+ force-reload)
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+ exit 2
+esac
+
+exit $?
diff --git a/packaging/rpm-uln/mysql.spec.sh b/packaging/rpm-uln/mysql.spec.sh
new file mode 100644
index 00000000000..8b25b160be1
--- /dev/null
+++ b/packaging/rpm-uln/mysql.spec.sh
@@ -0,0 +1,1959 @@
+#
+# This file was modified by Oracle in 2011 and later.
+# Details of the modifications are described in the "changelog" section.
+#
+# Modifications copyright (c) 2011, 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 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; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston
+# MA 02110-1301 USA.
+
+##############################################################################
+# Some common macro definitions
+##############################################################################
+
+# NOTE: "vendor" is used in upgrade/downgrade check, so you can't
+# change these, has to be exactly as is.
+# %define mysql_old_vendor MySQL AB # Applies to traditional MySQL RPMs only.
+# %define mysql_vendor_2 Sun Microsystems, Inc.
+%define mysql_vendor Oracle and/or its affiliates
+
+%define mysql_version @VERSION@
+
+%define mysqldatadir /var/lib/mysql
+
+%define release 1
+
+##############################################################################
+# Command line handling
+##############################################################################
+#
+# To set options:
+#
+# $ rpmbuild --define="option <x>" ...
+#
+
+# ----------------------------------------------------------------------------
+# Commercial builds
+# ----------------------------------------------------------------------------
+%if %{undefined commercial}
+%define commercial 0
+%endif
+
+# ----------------------------------------------------------------------------
+# Source name
+# ----------------------------------------------------------------------------
+%if %{undefined src_base}
+%define src_base mysql
+%endif
+%define src_dir %{src_base}-%{mysql_version}
+
+# ----------------------------------------------------------------------------
+# Feature set (storage engines, options). Default to community (everything)
+# ----------------------------------------------------------------------------
+%if %{undefined feature_set}
+%define feature_set community
+%endif
+
+# ----------------------------------------------------------------------------
+# Server comment strings
+# ----------------------------------------------------------------------------
+%if %{undefined compilation_comment_debug}
+%define compilation_comment_debug MySQL Community Server - Debug (GPL)
+%endif
+%if %{undefined compilation_comment_release}
+%define compilation_comment_release MySQL Community Server (GPL)
+%endif
+
+# ----------------------------------------------------------------------------
+# Product and server suffixes
+# ----------------------------------------------------------------------------
+%if %{undefined product_suffix}
+ %if %{defined short_product_tag}
+ %define product_suffix -%{short_product_tag}
+ %else
+ %define product_suffix %{nil}
+ %endif
+%endif
+
+%if %{undefined server_suffix}
+%define server_suffix %{nil}
+%endif
+
+# ----------------------------------------------------------------------------
+# Distribution support
+# ----------------------------------------------------------------------------
+%if %{undefined distro_specific}
+%define distro_specific 0
+%endif
+%if %{distro_specific}
+ %if %(test -f /etc/oracle-release && echo 1 || echo 0)
+ %define elver %(rpm -qf --qf '%%{version}\\n' /etc/oracle-release | sed -e 's/^\\([0-9]*\\).*/\\1/g')
+ %if "%elver" == "6"
+ %define distro_description Oracle Linux 6
+ %define distro_releasetag el6
+ %define distro_buildreq gcc-c++ ncurses-devel perl readline-devel time zlib-devel
+ %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
+ %else
+ %{error:Oracle Linux %{elver} is unsupported}
+ %endif
+ %else
+ %if %(test -f /etc/redhat-release && echo 1 || echo 0)
+ %define rhelver %(rpm -qf --qf '%%{version}\\n' /etc/redhat-release | sed -e 's/^\\([0-9]*\\).*/\\1/g')
+ %if "%rhelver" == "5"
+ %define distro_description Red Hat Enterprise Linux 5
+ %define distro_releasetag rhel5
+ %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
+ %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
+ %else
+ %if "%rhelver" == "6"
+ %define distro_description Red Hat Enterprise Linux 6
+ %define distro_releasetag rhel6
+ %define distro_buildreq gcc-c++ ncurses-devel perl readline-devel time zlib-devel
+ %define distro_requires chkconfig coreutils grep procps shadow-utils net-tools
+ %else
+ %{error:Red Hat Enterprise Linux %{rhelver} is unsupported}
+ %endif
+ %endif
+ %else
+ %if %(test -f /etc/SuSE-release && echo 1 || echo 0)
+ %define susever %(rpm -qf --qf '%%{version}\\n' /etc/SuSE-release | cut -d. -f1)
+ %if "%susever" == "10"
+ %define distro_description SUSE Linux Enterprise Server 10
+ %define distro_releasetag sles10
+ %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client readline-devel zlib-devel
+ %define distro_requires aaa_base coreutils grep procps pwdutils
+ %else
+ %if "%susever" == "11"
+ %define distro_description SUSE Linux Enterprise Server 11
+ %define distro_releasetag sles11
+ %define distro_buildreq gcc-c++ gdbm-devel gperf ncurses-devel openldap2-client procps pwdutils readline-devel zlib-devel
+ %define distro_requires aaa_base coreutils grep procps pwdutils
+ %else
+ %{error:SuSE %{susever} is unsupported}
+ %endif
+ %endif
+ %else
+ %{error:Unsupported distribution}
+ %endif
+ %endif
+ %endif
+%else
+ %define generic_kernel %(uname -r | cut -d. -f1-2)
+ %define distro_description Generic Linux (kernel %{generic_kernel})
+ %define distro_releasetag linux%{generic_kernel}
+ %define distro_buildreq gcc-c++ gperf ncurses-devel perl readline-devel time zlib-devel
+ %define distro_requires coreutils grep procps /sbin/chkconfig /usr/sbin/useradd /usr/sbin/groupadd
+%endif
+
+# Avoid debuginfo RPMs, leaves binaries unstripped
+%define debug_package %{nil}
+
+# Hack to work around bug in RHEL5 __os_install_post macro, wrong inverted
+# test for __debug_package
+%define __strip /bin/true
+
+# ----------------------------------------------------------------------------
+# Support optional "tcmalloc" library (experimental)
+# ----------------------------------------------------------------------------
+%if %{defined malloc_lib_target}
+%define WITH_TCMALLOC 1
+%else
+%define WITH_TCMALLOC 0
+%endif
+
+##############################################################################
+# Configuration based upon above user input, not to be set directly
+##############################################################################
+
+%if %{commercial}
+%define license_files_server %{src_dir}/LICENSE.mysql
+%define license_type Commercial
+%else
+%define license_files_server %{src_dir}/COPYING %{src_dir}/README
+%define license_type GPL
+%endif
+
+##############################################################################
+# Main spec file section
+##############################################################################
+
+Name: mysql%{product_suffix}
+Summary: MySQL client programs and shared libraries
+Group: Applications/Databases
+Version: @MYSQL_RPM_VERSION@
+Release: %{release}%{?distro_releasetag:.%{distro_releasetag}}
+# exceptions allow client libraries to be linked with most open source SW,
+# not only GPL code.
+License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All rights reserved. Under %{license_type} license as shown in the Description field.
+URL: http://www.mysql.com/
+Packager: MySQL Release Engineering <mysql-build@oss.oracle.com>
+Vendor: %{mysql_vendor}
+
+# Regression tests may take a long time, override the default to skip them
+%{!?runselftest:%global runselftest 1}
+
+# Upstream has a mirror redirector for downloads, so the URL is hard to
+# represent statically. You can get the tarball by following a link from
+# http://dev.mysql.com/downloads/mysql/
+Source0: %{src_dir}.tar.gz
+# The upstream tarball includes non-free documentation that only the
+# copyright holder (MySQL -> Sun -> Oracle) may ship.
+# To remove the non-free documentation, run this script after downloading
+# the tarball into the current directory:
+# ./generate-tarball.sh $VERSION
+# Then, source name changes:
+# Source0: mysql-%{version}-nodocs.tar.gz
+%if %{commercial}
+NoSource: 0
+%endif
+Source1: generate-tarball.sh
+Source2: mysql.init
+Source3: my.cnf
+Source4: scriptstub.c
+Source5: my_config.h
+# The below is only needed for packages built outside MySQL -> Sun -> Oracle:
+Source6: README.mysql-docs
+Source9: mysql-embedded-check.c
+# Working around perl dependency checking bug in rpm FTTB. Remove later.
+Source999: filter-requires-mysql.sh
+
+# Patch1: mysql-ssl-multilib.patch Not needed by MySQL (yaSSL), will not work in 5.5 (cmake)
+Patch2: mysql-5.5-errno.patch
+Patch4: mysql-5.5-testing.patch
+Patch5: mysql-install-test.patch
+Patch6: mysql-5.5-stack-guard.patch
+# Patch7: mysql-disable-test.patch Already fixed in current 5.1
+# Patch8: mysql-setschedparam.patch Will not work in 5.5 (cmake)
+# Patch9: mysql-no-docs.patch Will not work in 5.5 (cmake)
+Patch10: mysql-strmov.patch
+ # Not used by MySQL
+# Patch12: mysql-cve-2008-7247.patch Already fixed in 5.5
+Patch13: mysql-expired-certs.patch
+ # Will not be used by MySQL
+# Patch14: mysql-missing-string-code.patch Undecided, will not work in 5.5 (cmake)
+# Patch15: mysql-lowercase-bug.patch Fixed in MySQL 5.1.54 and 5.5.9
+Patch16: mysql-chain-certs.patch
+Patch17: mysql-5.5-libdir.patch
+Patch18: mysql-5.5-fix-tests.patch
+Patch19: mysql-5.5-mtr1.patch
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+BuildRequires: %{distro_buildreq}
+BuildRequires: gawk
+# make test requires time and ps
+BuildRequires: procps
+# Socket and Time::HiRes are needed to run regression tests
+BuildRequires: perl(Socket), perl(Time::HiRes)
+
+Requires: %{distro_requires}
+Requires: fileutils
+Requires: mysql-libs%{product_suffix} = %{version}-%{release}
+Requires: bash
+
+# If %%{product_suffix} is non-empty, the auto-generated capability is insufficient:
+# We want all dependency handling to use the generic name only.
+# Similar in other sub-packages
+Provides: mysql
+
+# MySQL (with caps) is upstream's spelling of their own RPMs for mysql
+Conflicts: MySQL
+# mysql-cluster used to be built from this SRPM, but no more
+Obsoletes: mysql-cluster < 5.1.44
+# We need cross-product "Obsoletes:" to allow cross-product upgrades:
+Obsoletes: mysql mysql-advanced
+
+# Working around perl dependency checking bug in rpm FTTB. Remove later.
+%global __perl_requires %{SOURCE999}
+
+%description -n mysql%{product_suffix}
+MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
+client/server implementation consisting of a server daemon (mysqld)
+and many different client programs and libraries. The base package
+contains the standard MySQL client programs and generic MySQL files.
+
+The MySQL software has Dual Licensing, which means you can use the MySQL
+software free of charge under the GNU General Public License
+(http://www.gnu.org/licenses/). You can also purchase commercial MySQL
+licenses from %{mysql_vendor} if you do not wish to be bound by the terms of
+the GPL. See the chapter "Licensing and Support" in the manual for
+further info.
+
+%package -n mysql-libs%{product_suffix}
+
+Summary: The shared libraries required for MySQL clients
+Group: Applications/Databases
+Requires: /sbin/ldconfig
+Provides: mysql-libs
+Obsoletes: mysql-libs mysql-libs-advanced
+
+%description -n mysql-libs%{product_suffix}
+The mysql-libs package provides the essential shared libraries for any
+MySQL client program or interface. You will need to install this package
+to use any other MySQL package or any clients that need to connect to a
+MySQL server.
+
+%package -n mysql-server%{product_suffix}
+
+Summary: The MySQL server and related files
+Group: Applications/Databases
+Requires: mysql%{product_suffix} = %{version}-%{release}
+Requires: sh-utils
+Requires(pre): /usr/sbin/useradd
+Requires(post): chkconfig
+Requires(preun): chkconfig
+# This is for /sbin/service
+Requires(preun): initscripts
+Requires(postun): initscripts
+# mysqlhotcopy needs DBI/DBD support
+Requires: perl-DBI, perl-DBD-MySQL
+Provides: mysql-server
+Conflicts: MySQL-server
+Obsoletes: mysql-server mysql-server-advanced
+
+%description -n mysql-server%{product_suffix}
+MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
+client/server implementation consisting of a server daemon (mysqld)
+and many different client programs and libraries. This package contains
+the MySQL server and some accompanying files and directories.
+
+%package -n mysql-devel%{product_suffix}
+
+Summary: Files for development of MySQL applications
+Group: Applications/Databases
+Requires: mysql%{product_suffix} = %{version}-%{release}
+Requires: openssl-devel
+Provides: mysql-devel
+Conflicts: MySQL-devel
+Obsoletes: mysql-devel mysql-devel-advanced
+
+%description -n mysql-devel%{product_suffix}
+MySQL is a multi-user, multi-threaded SQL database server. This
+package contains the libraries and header files that are needed for
+developing MySQL client applications.
+
+%package -n mysql-embedded%{product_suffix}
+
+Summary: MySQL as an embeddable library
+Group: Applications/Databases
+Provides: mysql-embedded
+Obsoletes: mysql-embedded mysql-embedded-advanced
+
+%description -n mysql-embedded%{product_suffix}
+MySQL is a multi-user, multi-threaded SQL database server. This
+package contains a version of the MySQL server that can be embedded
+into a client application instead of running as a separate process,
+as well as a command line client with such an embedded server.
+
+%package -n mysql-embedded-devel%{product_suffix}
+
+Summary: Development files for MySQL as an embeddable library
+Group: Applications/Databases
+Requires: mysql-embedded%{product_suffix} = %{version}-%{release}
+Requires: mysql-devel%{product_suffix} = %{version}-%{release}
+Provides: mysql-embedded-devel
+Obsoletes: mysql-embedded-devel mysql-embedded-devel-advanced
+
+%description -n mysql-embedded-devel%{product_suffix}
+MySQL is a multi-user, multi-threaded SQL database server. This
+package contains files needed for developing and testing with
+the embedded version of the MySQL server.
+
+%package -n mysql-test%{product_suffix}
+
+Summary: The test suite distributed with MySQL
+Group: Applications/Databases
+Requires: mysql%{product_suffix} = %{version}-%{release}
+Requires: mysql-server%{product_suffix} = %{version}-%{release}
+Provides: mysql-test
+Conflicts: MySQL-test
+Obsoletes: mysql-test mysql-test-advanced
+
+%description -n mysql-test%{product_suffix}
+MySQL is a multi-user, multi-threaded SQL database server. This
+package contains the regression test suite distributed with
+the MySQL sources.
+
+%prep
+%setup -T -a 0 -c -n %{src_dir}
+
+cd %{src_dir} # read about "%setup -n"
+# %patch1 -p1
+%patch2 -p1
+# %patch4 -p1 TODO / FIXME: if wanted, needs to be adapted to new mysql-test-run setup
+%patch5 -p1
+%patch6 -p1
+# %patch8 -p1
+# %patch9 -p1
+# %patch10 -p1
+# %patch13 -p1
+# %patch14 -p1
+%patch16 -p1
+%patch17 -p1
+%patch18 -p1
+%patch19 -p1
+
+# workaround for upstream bug #56342
+rm -f mysql-test/t/ssl_8k_key-master.opt
+
+%build
+
+# Fail quickly and obviously if user tries to build as root
+%if %runselftest
+ if [ x"`id -u`" = x0 ]; then
+ echo "The MySQL regression tests may fail if run as root."
+ echo "If you really need to build the RPM as root, use"
+ echo "--define='runselftest 0' to skip the regression tests."
+ exit 1
+ fi
+%endif
+
+# Be strict about variables, bail at earliest opportunity, etc.
+set -eu
+
+# Optional package files
+touch optional-files-devel
+
+#
+# Set environment in order of preference, MYSQL_BUILD_* first, then variable
+# name, finally a default. RPM_OPT_FLAGS is assumed to be a part of the
+# default RPM build environment.
+#
+# We set CXX=gcc by default to support so-called 'generic' binaries, where we
+# do not have a dependancy on libgcc/libstdc++. This only works while we do
+# not require C++ features such as exceptions, and may need to be removed at
+# a later date.
+#
+
+# This is a hack, $RPM_OPT_FLAGS on ia64 hosts contains flags which break
+# the compile in cmd-line-utils/readline - needs investigation, but for now
+# we simply unset it and use those specified directly in cmake.
+%if "%{_arch}" == "ia64"
+RPM_OPT_FLAGS=
+%endif
+
+# This goes in sync with Patch19. "rm" is faster than "patch" for this.
+rm -rf %{src_dir}/mysql-test/lib/v1
+
+export PATH=${MYSQL_BUILD_PATH:-$PATH}
+export CC=${MYSQL_BUILD_CC:-${CC:-gcc}}
+export CXX=${MYSQL_BUILD_CXX:-${CXX:-gcc}}
+export CFLAGS=${MYSQL_BUILD_CFLAGS:-${CFLAGS:-$RPM_OPT_FLAGS}}
+# Following "%ifarch" developed by RedHat, MySQL/Oracle does not support/maintain Linux/Sparc:
+# gcc seems to have some bugs on sparc as of 4.4.1, back off optimization
+# submitted as bz #529298
+%ifarch sparc sparcv9 sparc64
+CFLAGS=`echo $CFLAGS| sed -e "s|-O2|-O1|g" `
+%endif
+export CXXFLAGS=${MYSQL_BUILD_CXXFLAGS:-${CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti}}
+export LDFLAGS=${MYSQL_BUILD_LDFLAGS:-${LDFLAGS:-}}
+export CMAKE=${MYSQL_BUILD_CMAKE:-${CMAKE:-cmake}}
+export MAKE_JFLAG=${MYSQL_BUILD_MAKE_JFLAG:-%{?_smp_mflags}}
+
+# Build debug mysqld and libmysqld.a
+mkdir debug
+(
+ cd debug
+ # Attempt to remove any optimisation flags from the debug build
+ CFLAGS=`echo " ${CFLAGS} " | \
+ sed -e 's/ -O[0-9]* / /' \
+ -e 's/ -unroll2 / /' \
+ -e 's/ -ip / /' \
+ -e 's/^ //' \
+ -e 's/ $//'`
+ CXXFLAGS=`echo " ${CXXFLAGS} " | \
+ sed -e 's/ -O[0-9]* / /' \
+ -e 's/ -unroll2 / /' \
+ -e 's/ -ip / /' \
+ -e 's/^ //' \
+ -e 's/ $//'`
+ # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before
+ # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM
+ ${CMAKE} ../%{src_dir} -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \
+ -DCMAKE_BUILD_TYPE=Debug \
+ -DMYSQL_UNIX_ADDR="%{mysqldatadir}/mysql.sock" \
+ -DFEATURE_SET="%{feature_set}" \
+ -DCOMPILATION_COMMENT="%{compilation_comment_debug}" \
+ -DMYSQL_SERVER_SUFFIX="%{server_suffix}"
+ echo BEGIN_DEBUG_CONFIG ; egrep '^#define' include/config.h ; echo END_DEBUG_CONFIG
+ make ${MAKE_JFLAG} VERBOSE=1
+)
+# Build full release
+mkdir release
+(
+ cd release
+ # XXX: MYSQL_UNIX_ADDR should be in cmake/* but mysql_version is included before
+ # XXX: install_layout so we can't just set it based on INSTALL_LAYOUT=RPM
+ ${CMAKE} ../%{src_dir} -DBUILD_CONFIG=mysql_release -DINSTALL_LAYOUT=RPM \
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DMYSQL_UNIX_ADDR="%{mysqldatadir}/mysql.sock" \
+ -DFEATURE_SET="%{feature_set}" \
+ -DCOMPILATION_COMMENT="%{compilation_comment_release}" \
+ -DMYSQL_SERVER_SUFFIX="%{server_suffix}"
+ echo BEGIN_NORMAL_CONFIG ; egrep '^#define' include/config.h ; echo END_NORMAL_CONFIG
+ make ${MAKE_JFLAG} VERBOSE=1
+)
+
+# 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
+# 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 \
+ -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
+cd ../..
+cd ..
+
+# TODO / FIXME: autotools only?
+# make check
+
+# TODO / FIXME: Test suite is run elsewhere in release builds -
+# do we need this for users who want to build from source?
+# Also, check whether MTR_BUILD_THREAD=auto would solve all issues
+%if %runselftest
+ # hack to let 32- and 64-bit tests run concurrently on same build machine
+ case `uname -m` in
+ ppc64 | s390x | x86_64 | sparc64 )
+ MTR_BUILD_THREAD=7
+ ;;
+ *)
+ MTR_BUILD_THREAD=11
+ ;;
+ esac
+ export MTR_BUILD_THREAD
+
+ # if you want to change which tests are run, look at mysql-5.5-testing.patch too.
+ (cd release && make test-bt-fast )
+%endif
+
+%install
+RBR=$RPM_BUILD_ROOT
+MBD=$RPM_BUILD_DIR/%{src_dir}
+[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+
+# Ensure that needed directories exists
+# TODO / FIXME: needed ? install -d $RBR%{mysqldatadir}/mysql
+# TODO / FIXME: needed ? install -d $RBR%{_datadir}/mysql-test
+# TODO / FIXME: needed ? install -d $RBR%{_datadir}/mysql/SELinux/RHEL4
+# TODO / FIXME: needed ? install -d $RBR%{_includedir}
+# TODO / FIXME: needed ? install -d $RBR%{_libdir}
+# TODO / FIXME: needed ? install -d $RBR%{_mandir}
+# TODO / FIXME: needed ? install -d $RBR%{_sbindir}
+
+# Install all binaries
+(
+ cd $MBD/release
+ make DESTDIR=$RBR install
+)
+
+# For gcc builds, include libgcc.a in the devel subpackage (BUG 4921). Do
+# this in a sub-shell to ensure we don't pollute the install environment
+# with compiler bits.
+(
+ PATH=${MYSQL_BUILD_PATH:-$PATH}
+ CC=${MYSQL_BUILD_CC:-${CC:-gcc}}
+ CFLAGS=${MYSQL_BUILD_CFLAGS:-${CFLAGS:-$RPM_OPT_FLAGS}}
+ if "${CC}" -v 2>&1 | grep '^gcc.version' >/dev/null 2>&1; then
+ libgcc=`${CC} ${CFLAGS} --print-libgcc-file`
+ if [ -f ${libgcc} ]; then
+ mkdir -p $RBR%{_libdir}/mysql
+ install -m 644 ${libgcc} $RBR%{_libdir}/mysql/libmygcc.a
+ echo "%{_libdir}/mysql/libmygcc.a" >>optional-files-devel
+ fi
+ fi
+)
+
+# multilib header hacks
+# we only apply this to known Red Hat multilib arches, per bug #181335
+case `uname -i` in
+ i386 | x86_64 | ppc | ppc64 | s390 | s390x | sparc | sparc64 )
+ mv $RPM_BUILD_ROOT/usr/include/mysql/my_config.h $RPM_BUILD_ROOT/usr/include/mysql/my_config_`uname -i`.h
+ install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/usr/include/mysql/
+ ;;
+ *)
+ ;;
+esac
+
+mkdir -p $RPM_BUILD_ROOT/var/log
+touch $RPM_BUILD_ROOT/var/log/mysqld.log
+
+# List the installed tree for RPM package maintenance purposes.
+find $RPM_BUILD_ROOT -print | sed "s|^$RPM_BUILD_ROOT||" | sort > ROOTFILES
+
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
+mkdir -p $RPM_BUILD_ROOT/var/run/mysqld
+install -m 0755 -d $RPM_BUILD_ROOT/var/lib/mysql
+install -m 0755 %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/mysqld
+install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/etc/my.cnf
+# obsolete: mv $RPM_BUILD_ROOT/usr/sql-bench $RPM_BUILD_ROOT%{_datadir}/sql-bench # 'sql-bench' is dropped
+# obsolete: mv $RPM_BUILD_ROOT/usr/mysql-test $RPM_BUILD_ROOT%{_datadir}/mysql-test # 'mysql-test' is there already
+# 5.1.32 forgets to install the mysql-test README file
+# obsolete: install -m 0644 mysql-test/README $RPM_BUILD_ROOT%{_datadir}/mysql-test/README # 'README' is there already
+
+mv ${RPM_BUILD_ROOT}%{_bindir}/mysqlbug ${RPM_BUILD_ROOT}%{_libdir}/mysql/mysqlbug
+install -m 0755 scriptstub ${RPM_BUILD_ROOT}%{_bindir}/mysqlbug
+mv ${RPM_BUILD_ROOT}%{_bindir}/mysql_config ${RPM_BUILD_ROOT}%{_libdir}/mysql/mysql_config
+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
+
+rm -f ${RPM_BUILD_ROOT}%{_bindir}/comp_err
+rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/comp_err.1*
+rm -f ${RPM_BUILD_ROOT}%{_bindir}/make_win_binary_distribution
+rm -f ${RPM_BUILD_ROOT}%{_bindir}/make_win_src_distribution
+rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/make_win_bin_dist.1*
+rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/make_win_src_distribution.1*
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/libmysqlclient*.la
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/*.a
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/plugin/*.la
+rm -f ${RPM_BUILD_ROOT}%{_libdir}/mysql/plugin/*.a
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/binary-configure
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/make_binary_distribution
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/make_sharedlib_distribution
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mi_test_all*
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/ndb-config-2-node.ini
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql.server
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysqld_multi.server
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/MySQL-shared-compat.spec
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/*.plist
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/preinstall
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/postinstall
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-*.spec
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/mysql-log-rotate
+rm -f ${RPM_BUILD_ROOT}%{_datadir}/mysql/ChangeLog
+rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-stress-test.pl.1*
+rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/mysql-test-run.pl.1*
+
+mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
+echo "%{_libdir}/mysql" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf
+
+# The below *only* applies to builds not done by MySQL / Sun / Oracle:
+# copy additional docs into build tree so %%doc will find them
+# cp %{SOURCE6} README.mysql-docs
+
+%clean
+[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+
+%pre -n mysql-server%{product_suffix}
+
+# Check if we can safely upgrade. An upgrade is only safe if it's from one
+# of our RPMs in the same version family.
+
+# Handle both ways of spelling the capability.
+installed=`rpm -q --whatprovides mysql-server 2> /dev/null`
+if [ $? -ne 0 -o -z "$installed" ]; then
+ installed=`rpm -q --whatprovides MySQL-server 2> /dev/null`
+fi
+if [ $? -eq 0 -a -n "$installed" ]; then
+ installed=`echo $installed | sed 's/\([^ ]*\) .*/\1/'` # Tests have shown duplicated package names
+ vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1`
+ version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1`
+ myvendor='%{mysql_vendor}'
+ myversion='%{mysql_version}'
+
+ old_family=`echo $version \
+ | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'`
+ new_family=`echo $myversion \
+ | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'`
+
+ [ -z "$vendor" ] && vendor='<unknown>'
+ [ -z "$old_family" ] && old_family="<unrecognized version $version>"
+ [ -z "$new_family" ] && new_family="<bad package specification: version $myversion>"
+
+ error_text=
+ if [ "$vendor" != "$myvendor" ]; then
+ error_text="$error_text
+The current MySQL server package is provided by a different
+vendor ($vendor) than $myvendor.
+Some files may be installed to different locations, including log
+files and the service startup script in %{_sysconfdir}/init.d/.
+"
+ fi
+
+ if [ "$old_family" != "$new_family" ]; then
+ error_text="$error_text
+Upgrading directly from MySQL $old_family to MySQL $new_family may not
+be safe in all cases. A manual dump and restore using mysqldump is
+recommended. It is important to review the MySQL manual's Upgrading
+section for version-specific incompatibilities.
+"
+ fi
+
+ if [ -n "$error_text" ]; then
+ cat <<HERE >&2
+
+******************************************************************
+A MySQL server package ($installed) is installed.
+$error_text
+A manual upgrade is required.
+
+- Ensure that you have a complete, working backup of your data and my.cnf
+ files
+- Shut down the MySQL server cleanly
+- Remove the existing MySQL packages. Usually this command will
+ list the packages you should remove:
+ rpm -qa | grep -i '^mysql-'
+
+ You may choose to use 'rpm --nodeps -ev <package-name>' to remove
+ the package which contains the mysqlclient shared library. The
+ library will be reinstalled by the MySQL-shared-compat package.
+- Install the new MySQL packages supplied by $myvendor
+- Ensure that the MySQL server is started
+- Run the 'mysql_upgrade' program
+
+This is a brief description of the upgrade process. Important details
+can be found in the MySQL manual, in the Upgrading section.
+******************************************************************
+HERE
+ exit 1
+ fi
+fi
+
+/usr/sbin/groupadd -g 27 -o -r mysql >/dev/null 2>&1 || :
+/usr/sbin/useradd -M -N -g mysql -o -r -d /var/lib/mysql -s /bin/bash \
+ -c "MySQL Server" -u 27 mysql >/dev/null 2>&1 || :
+
+%post -n mysql-libs%{product_suffix}
+/sbin/ldconfig
+
+%post -n mysql-server%{product_suffix}
+if [ $1 = 1 ]; then
+ /sbin/chkconfig --add mysqld
+fi
+/bin/chmod 0755 /var/lib/mysql
+/bin/touch /var/log/mysqld.log
+
+%preun -n mysql-server%{product_suffix}
+if [ $1 = 0 ]; then
+ /sbin/service mysqld stop >/dev/null 2>&1
+ /sbin/chkconfig --del mysqld
+fi
+
+%postun -n mysql-libs%{product_suffix}
+if [ $1 = 0 ] ; then
+ /sbin/ldconfig
+fi
+
+%postun -n mysql-server%{product_suffix}
+if [ $1 -ge 1 ]; then
+ /sbin/service mysqld condrestart >/dev/null 2>&1 || :
+fi
+
+
+%files -n mysql%{product_suffix}
+%defattr(-,root,root)
+%doc %{license_files_server}
+
+# The below file *only* applies to builds not done by MySQL / Sun / Oracle:
+# %doc README.mysql-docs
+
+%{_bindir}/msql2mysql
+%{_bindir}/mysql
+%{_bindir}/mysql_config
+%{_bindir}/mysql_find_rows
+%{_bindir}/mysql_waitpid
+%{_bindir}/mysqlaccess
+%{_bindir}/mysqlaccess.conf
+%{_bindir}/mysqladmin
+%{_bindir}/mysqlbinlog
+%{_bindir}/mysqlcheck
+%{_bindir}/mysqldump
+%{_bindir}/mysqlimport
+%{_bindir}/mysqlshow
+%{_bindir}/mysqlslap
+%{_bindir}/my_print_defaults
+
+%{_mandir}/man1/mysql.1*
+%{_mandir}/man1/mysql_config.1*
+%{_mandir}/man1/mysql_find_rows.1*
+%{_mandir}/man1/mysql_waitpid.1*
+%{_mandir}/man1/mysqlaccess.1*
+%{_mandir}/man1/mysqladmin.1*
+%{_mandir}/man1/mysqldump.1*
+%{_mandir}/man1/mysqlshow.1*
+%{_mandir}/man1/mysqlslap.1*
+%{_mandir}/man1/my_print_defaults.1*
+
+%{_libdir}/mysql/mysqlbug
+%{_libdir}/mysql/mysql_config
+
+%files -n mysql-libs%{product_suffix}
+%defattr(-,root,root)
+%doc %{license_files_server}
+# although the default my.cnf contains only server settings, we put it in the
+# libs package because it can be used for client settings too.
+%config(noreplace) /etc/my.cnf
+%dir %{_libdir}/mysql
+%{_libdir}/mysql/libmysqlclient*.so.*
+/etc/ld.so.conf.d/*
+
+%dir %{_datadir}/mysql
+%{_datadir}/mysql/english
+%lang(cs) %{_datadir}/mysql/czech
+%lang(da) %{_datadir}/mysql/danish
+%lang(nl) %{_datadir}/mysql/dutch
+%lang(et) %{_datadir}/mysql/estonian
+%lang(fr) %{_datadir}/mysql/french
+%lang(de) %{_datadir}/mysql/german
+%lang(el) %{_datadir}/mysql/greek
+%lang(hu) %{_datadir}/mysql/hungarian
+%lang(it) %{_datadir}/mysql/italian
+%lang(ja) %{_datadir}/mysql/japanese
+%lang(ko) %{_datadir}/mysql/korean
+%lang(no) %{_datadir}/mysql/norwegian
+%lang(no) %{_datadir}/mysql/norwegian-ny
+%lang(pl) %{_datadir}/mysql/polish
+%lang(pt) %{_datadir}/mysql/portuguese
+%lang(ro) %{_datadir}/mysql/romanian
+%lang(ru) %{_datadir}/mysql/russian
+%lang(sr) %{_datadir}/mysql/serbian
+%lang(sk) %{_datadir}/mysql/slovak
+%lang(es) %{_datadir}/mysql/spanish
+%lang(sv) %{_datadir}/mysql/swedish
+%lang(uk) %{_datadir}/mysql/ukrainian
+%{_datadir}/mysql/charsets
+
+%files -n mysql-server%{product_suffix} -f release/support-files/plugins.files
+%defattr(-,root,root)
+%doc release/support-files/*.cnf
+%doc %{_datadir}/info/mysql.info*
+%doc %{src_dir}/Docs/ChangeLog
+%doc %{src_dir}/Docs/INFO_SRC*
+%doc release/Docs/INFO_BIN*
+
+%{_bindir}/myisamchk
+%{_bindir}/myisam_ftdump
+%{_bindir}/myisamlog
+%{_bindir}/myisampack
+%{_bindir}/mysql_convert_table_format
+%{_bindir}/mysql_fix_extensions
+%{_bindir}/mysql_install_db
+%{_bindir}/mysql_plugin
+%{_bindir}/mysql_secure_installation
+%if %{commercial}
+%else
+%{_bindir}/mysql_setpermission
+%endif
+%{_bindir}/mysql_tzinfo_to_sql
+%{_bindir}/mysql_upgrade
+%{_bindir}/mysql_zap
+%{_bindir}/mysqlbug
+%{_bindir}/mysqldumpslow
+%{_bindir}/mysqld_multi
+%{_bindir}/mysqld_safe
+%{_bindir}/mysqlhotcopy
+%{_bindir}/mysqltest
+%{_bindir}/innochecksum
+%{_bindir}/perror
+%{_bindir}/replace
+%{_bindir}/resolve_stack_dump
+%{_bindir}/resolveip
+
+/usr/libexec/mysqld
+/usr/libexec/mysqld-debug
+%{_libdir}/mysql/plugin/daemon_example.ini
+
+%if %{WITH_TCMALLOC}
+%{_libdir}/mysql/%{malloc_lib_target}
+%endif
+
+# obsolete by "-f release/support-files/plugins.files" above
+# %{_libdir}/mysql/plugin
+
+%{_mandir}/man1/msql2mysql.1*
+%{_mandir}/man1/myisamchk.1*
+%{_mandir}/man1/myisamlog.1*
+%{_mandir}/man1/myisampack.1*
+%{_mandir}/man1/mysql_convert_table_format.1*
+%{_mandir}/man1/myisam_ftdump.1*
+%{_mandir}/man1/mysql.server.1*
+%{_mandir}/man1/mysql_fix_extensions.1*
+%{_mandir}/man1/mysql_install_db.1*
+%{_mandir}/man1/mysql_plugin.1*
+%{_mandir}/man1/mysql_secure_installation.1*
+%{_mandir}/man1/mysql_upgrade.1*
+%{_mandir}/man1/mysql_zap.1*
+%{_mandir}/man1/mysqlbug.1*
+%{_mandir}/man1/mysqldumpslow.1*
+%{_mandir}/man1/mysqlbinlog.1*
+%{_mandir}/man1/mysqlcheck.1*
+%{_mandir}/man1/mysqld_multi.1*
+%{_mandir}/man1/mysqld_safe.1*
+%{_mandir}/man1/mysqlhotcopy.1*
+%{_mandir}/man1/mysqlimport.1*
+%{_mandir}/man1/mysqlman.1*
+%if %{commercial}
+%else
+%{_mandir}/man1/mysql_setpermission.1*
+%endif
+%{_mandir}/man1/mysqltest.1*
+%{_mandir}/man1/innochecksum.1*
+%{_mandir}/man1/perror.1*
+%{_mandir}/man1/replace.1*
+%{_mandir}/man1/resolve_stack_dump.1*
+%{_mandir}/man1/resolveip.1*
+%{_mandir}/man1/mysql_tzinfo_to_sql.1*
+%{_mandir}/man8/mysqld.8*
+
+%{_datadir}/mysql/errmsg-utf8.txt
+%{_datadir}/mysql/fill_help_tables.sql
+%{_datadir}/mysql/magic
+%{_datadir}/mysql/mysql_system_tables.sql
+%{_datadir}/mysql/mysql_system_tables_data.sql
+%{_datadir}/mysql/mysql_test_data_timezone.sql
+%{_datadir}/mysql/my-*.cnf
+%{_datadir}/mysql/config.*.ini
+
+/etc/rc.d/init.d/mysqld
+%attr(0755,mysql,mysql) %dir /var/run/mysqld
+%attr(0755,mysql,mysql) %dir /var/lib/mysql
+%attr(0640,mysql,mysql) %config(noreplace) %verify(not md5 size mtime) /var/log/mysqld.log
+
+# TODO / FIXME: Do we need "libmygcc.a"? If yes, append "-f optional-files-devel"
+# and fix the "rm -f" list in the "install" section.
+%files -n mysql-devel%{product_suffix}
+%defattr(-,root,root)
+/usr/include/mysql
+/usr/share/aclocal/mysql.m4
+%{_libdir}/mysql/libmysqlclient*.so
+
+%files -n mysql-embedded%{product_suffix}
+%defattr(-,root,root)
+%doc %{license_files_server}
+%{_libdir}/mysql/libmysqld.so.*
+%{_bindir}/mysql_embedded
+
+%files -n mysql-embedded-devel%{product_suffix}
+%defattr(-,root,root)
+%{_libdir}/mysql/libmysqld.so
+%{_bindir}/mysql_client_test_embedded
+%{_bindir}/mysqltest_embedded
+%{_mandir}/man1/mysql_client_test_embedded.1*
+%{_mandir}/man1/mysqltest_embedded.1*
+
+%files -n mysql-test%{product_suffix}
+%defattr(-,root,root)
+%{_bindir}/mysql_client_test
+%attr(-,mysql,mysql) %{_datadir}/mysql-test
+
+%{_mandir}/man1/mysql_client_test.1*
+
+%changelog
+* 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.
+
+* Thu Jul 26 2012 Joerg Bruehe <joerg.bruehe@oracle.com>
+- Add the vendor and release series checks from the traditional MySQL RPM
+ spec file, to protect against errors happening during upgrades.
+- Do some code alignment with the traditional MySQL RPM spec file,
+ to make synchronous maintenance (and possibly even integration?) easier.
+
+* Mon Feb 13 2012 Joerg Bruehe <joerg.bruehe@oracle.com>
+- Add "Provides:" lines for the generic names of the subpackages,
+ independent of "product_suffix".
+
+* Tue Feb 7 2012 Joerg Bruehe <joerg.bruehe@oracle.com>
+- Make "mysql_setpermission" and its man page appear in GPL builds only.
+
+* Thu Nov 24 2011 Joerg Bruehe <joerg.bruehe@oracle.com>
+- Add two patches (#18 + #19) regarding the test suite;
+ version 1 of "mysql-test-run.pl" had to go because the auto-detection
+ of Perl dependencies does not handle differences between run directory
+ and delivery location.
+
+* Thu Nov 3 2011 Joerg Bruehe <joerg.bruehe@oracle.com>
+- Adapt from MySQL 5.1 to 5.5, tested using 5.5.17:
+ - Done by the MySQL Build Team at Oracle:
+ set as packager, set copyright owner and related info;
+ - handle command line options, allowing different configurations, platforms, ...
+ - configurations will show up in the file name as "product_suffix",
+ - use "-n" for all subpackage specifications,
+ - license may be GPL or commercial, mention that in the description,
+ the license output and the included license files will vary,
+ - commercial is "nosource",
+ - improve "requires" listings for different platforms,
+ - explicitly use "product_suffix" in the "requires" entries;
+ - adapt to 5.5 changes in features and function:
+ - remove "mysql-bench" package (files are outdated, not maintained),
+ - no InnoDB plugin,
+ - the set of plugins will vary by configuration, to control the "server"
+ package contents use "-f release/support-files/plugins.files" in the
+ "files" section,
+ - remove "mysqlmanager", "mysql_fix_privilege_tables",
+ - add "mysql_embedded", "mysql-plugin", "mysqlaccess.conf", "magic",
+ - "errmsg.txt" is now in UTF8: "errmsg-utf8.txt",
+ - adapt patches to changed code where needed, rename these to include "5.5",
+ - stop using patches which are not applicable to 5.5;
+ - 5.5 uses a different way of building:
+ - autotools are replaced by cmake,
+ - both a "release" and a "debug" server are built in separate subtrees
+ ("out of source"!), this also affects path names in further handling,
+ - the debug server is added to the "server" subpackage,
+ - add "mysql-5.5-libdir.patch" to handle file placement at user site.
+
+* Mon Dec 20 2010 Tom Lane <tgl@redhat.com> 5.1.52-1.1
+- Update to MySQL 5.1.52, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-52.html
+ including numerous small security issues
+Resolves: #652553
+- Sync with current Fedora package; this includes:
+- Duplicate COPYING and EXCEPTIONS-CLIENT in -libs and -embedded subpackages,
+ to ensure they are available when any subset of mysql RPMs are installed,
+ per revised packaging guidelines
+- Allow init script's STARTTIMEOUT/STOPTIMEOUT to be overridden from sysconfig
+
+* Thu Jul 15 2010 Tom Lane <tgl@redhat.com> 5.1.47-4
+- Add backported patch for CVE-2010-2008 (upstream bug 53804)
+Resolves: #614215
+- Add BuildRequires perl(Time::HiRes) ... seems to no longer be installed
+ by just pulling in perl.
+
+* Mon Jun 28 2010 Tom Lane <tgl@redhat.com> 5.1.47-3
+- Add -p "$mypidfile" to initscript's status call to improve corner cases.
+ (Note: can't be fixed in Fedora until 595597 is fixed there.)
+Resolves: #596008
+
+* Mon Jun 7 2010 Tom Lane <tgl@redhat.com> 5.1.47-2
+- Add back "partition" storage engine
+Resolves: #598585
+- Fix broken "federated" storage engine plugin
+Resolves: #587170
+- Read all certificates in SSL certificate files, to support chained certs
+Resolves: #598656
+
+* Mon May 24 2010 Tom Lane <tgl@redhat.com> 5.1.47-1
+- Update to MySQL 5.1.47, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-47.html
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-46.html
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-45.html
+ including fixes for CVE-2010-1621, CVE-2010-1626,
+ CVE-2010-1848, CVE-2010-1849, CVE-2010-1850
+Resolves: #590598
+- Create mysql group explicitly in pre-server script, to ensure correct GID
+
+* Mon Mar 8 2010 Tom Lane <tgl@redhat.com> 5.1.44-2
+- Update to MySQL 5.1.44, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-44.html
+Resolves: #565554
+- Remove mysql.info, which is not freely redistributable
+Related: #560181
+- Revert broken upstream fix for their bug 45058
+Related: #566547
+- Bring init script into some modicum of compliance with Fedora/LSB standards
+Resolves: #557711
+Resolves: #562749
+
+* Mon Feb 15 2010 Tom Lane <tgl@redhat.com> 5.1.43-2
+- Update to MySQL 5.1.43, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-43.html
+Resolves: #565554
+- Remove mysql-cluster, which is no longer supported by upstream in this
+ source distribution. If we want it we'll need a separate SRPM for it.
+Resolves: #565210
+
+* Fri Jan 29 2010 Tom Lane <tgl@redhat.com> 5.1.42-7
+- Add backported patch for CVE-2008-7247 (upstream bug 39277)
+Resolves: #549329
+- Use non-expired certificates for SSL testing (upstream bug 50702)
+
+* Tue Jan 26 2010 Tom Lane <tgl@redhat.com> 5.1.42-6
+- Emit explicit error message if user tries to build RPM as root
+Resolves: #558915
+
+* Wed Jan 20 2010 Tom Lane <tgl@redhat.com> 5.1.42-5
+- Correct Source0: tag and comment to reflect how to get the tarball
+
+* Fri Jan 8 2010 Tom Lane <tgl@redhat.com> 5.1.42-4
+- Sync with current Fedora build, including:
+- Update to MySQL 5.1.42, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-42.html
+- Disable symbolic links by default in /etc/my.cnf
+Resolves: #553653
+- Remove static libraries (.a files) from package, per packaging guidelines
+- Change %%define to %%global, per packaging guidelines
+- Disable building the innodb plugin; it tickles assorted gcc bugs and
+ doesn't seem entirely ready for prime time anyway.
+Resolves: #553632
+- Start mysqld_safe with --basedir=/usr, to avoid unwanted SELinux messages
+ (see 547485)
+- Stop waiting during "service mysqld start" if mysqld_safe exits
+Resolves: #544095
+
+* Mon Nov 23 2009 Tom Lane <tgl@redhat.com> 5.1.41-1
+- Update to MySQL 5.1.41, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-41.html
+ including fixes for CVE-2009-4019
+Resolves: #549327
+- Don't set old_passwords=1; we aren't being bug-compatible with 3.23 anymore
+Resolves: #540735
+
+* Tue Nov 10 2009 Tom Lane <tgl@redhat.com> 5.1.40-1
+- Update to MySQL 5.1.40, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-40.html
+- Do not force the --log-error setting in mysqld init script
+Resolves: #533736
+
+* Sat Oct 17 2009 Tom Lane <tgl@redhat.com> 5.1.39-4
+- Replace kluge fix for ndbd sparc crash with a real fix (mysql bug 48132)
+
+* Thu Oct 15 2009 Tom Lane <tgl@redhat.com> 5.1.39-3
+- Work around two different compiler bugs on sparc, one by backing off
+ optimization from -O2 to -O1, and the other with a klugy patch
+Related: #529298, #529299
+- Clean up bogosity in multilib stub header support: ia64 should not be
+ listed (it's not multilib), sparc and sparc64 should be
+
+* Wed Sep 23 2009 Tom Lane <tgl@redhat.com> 5.1.39-2
+- Work around upstream bug 46895 by disabling outfile_loaddata test
+
+* Tue Sep 22 2009 Tom Lane <tgl@redhat.com> 5.1.39-1
+- Update to MySQL 5.1.39, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-39.html
+
+* Mon Aug 31 2009 Tom Lane <tgl@redhat.com> 5.1.37-5
+- Work around unportable assumptions about stpcpy(); re-enable main.mysql test
+- Clean up some obsolete parameters to the configure script
+
+* Sat Aug 29 2009 Tom Lane <tgl@redhat.com> 5.1.37-4
+- Remove one misguided patch; turns out I was chasing a glibc bug
+- Temporarily disable "main.mysql" test; there's something broken there too,
+ but we need to get mysql built in rawhide for dependency reasons
+
+* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 5.1.37-3
+- rebuilt with new openssl
+
+* Fri Aug 14 2009 Tom Lane <tgl@redhat.com> 5.1.37-2
+- Add a couple of patches to improve the probability of the regression tests
+ completing in koji builds
+
+* Sun Aug 2 2009 Tom Lane <tgl@redhat.com> 5.1.37-1
+- Update to MySQL 5.1.37, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-37.html
+
+* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1.36-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Fri Jul 10 2009 Tom Lane <tgl@redhat.com> 5.1.36-1
+- Update to MySQL 5.1.36, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-36.html
+
+* Sat Jun 6 2009 Tom Lane <tgl@redhat.com> 5.1.35-1
+- Update to MySQL 5.1.35, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-35.html
+- Ensure that /var/lib/mysql is created with the right SELinux context
+Resolves: #502966
+
+* Fri May 15 2009 Tom Lane <tgl@redhat.com> 5.1.34-1
+- Update to MySQL 5.1.34, for various fixes described at
+ http://dev.mysql.com/doc/refman/5.1/en/news-5-1-34.html
+- Increase startup timeout per bug #472222
+
+* Wed Apr 15 2009 Tom Lane <tgl@redhat.com> 5.1.33-2
+- Increase stack size of ndbd threads for safety's sake.
+Related: #494631
+
+* Tue Apr 7 2009 Tom Lane <tgl@redhat.com> 5.1.33-1
+- Update to MySQL 5.1.33.
+- Disable use of pthread_setschedparam; doesn't work the way code expects.
+Related: #477624
+
+* Wed Mar 4 2009 Tom Lane <tgl@redhat.com> 5.1.32-1
+- Update to MySQL 5.1.32.
+
+* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.1.31-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+
+* Fri Feb 13 2009 Tom Lane <tgl@redhat.com> 5.1.31-1
+- Update to MySQL 5.1.31.
+
+* Thu Jan 22 2009 Tom Lane <tgl@redhat.com> 5.1.30-2
+- hm, apparently --with-innodb and --with-ndbcluster are still needed
+ even though no longer documented ...
+
+* Thu Jan 22 2009 Tom Lane <tgl@redhat.com> 5.1.30-1
+- Update to MySQL 5.1.30. Note that this includes an ABI break for
+ libmysqlclient (it's now got .so major version 16).
+- This also updates mysql for new openssl build
+
+* Wed Oct 1 2008 Tom Lane <tgl@redhat.com> 5.0.67-2
+- Build the "embedded server" library, and package it in a new sub-RPM
+ mysql-embedded, along with mysql-embedded-devel for devel support files.
+Resolves: #149829
+
+* Sat Aug 23 2008 Tom Lane <tgl@redhat.com> 5.0.67-1
+- Update to mysql version 5.0.67
+- Move mysql_config's man page to base package, again (apparently I synced
+ that change the wrong way while importing specfile changes for ndbcluster)
+
+* Sun Jul 27 2008 Tom Lane <tgl@redhat.com> 5.0.51a-2
+- Enable ndbcluster support
+Resolves: #163758
+- Suppress odd crash messages during package build, caused by trying to
+ build dbug manual (which we don't install anyway) with dbug disabled
+Resolves: #437053
+- Improve mysql.init to pass configured datadir to mysql_install_db,
+ and to force user=mysql for both mysql_install_db and mysqld_safe.
+Related: #450178
+
+* Mon Mar 3 2008 Tom Lane <tgl@redhat.com> 5.0.51a-1
+- Update to mysql version 5.0.51a
+
+* Mon Mar 3 2008 Tom Lane <tgl@redhat.com> 5.0.45-11
+- Fix mysql-stack-guard patch to work correctly on IA64
+- Fix mysql.init to wait correctly when socket is not in default place
+Related: #435494
+
+* Mon Mar 03 2008 Dennis Gilmore <dennis@ausil.us> 5.0.45-10
+- add sparc64 to 64 bit arches for test suite checking
+- add sparc, sparcv9 and sparc64 to multilib handling
+
+* Thu Feb 28 2008 Tom Lane <tgl@redhat.com> 5.0.45-9
+- Fix the stack overflow problem encountered in January. It seems the real
+issue is that the buildfarm machines were moved to RHEL5, which uses 64K not
+4K pages on PPC, and because RHEL5 takes the guard area out of the requested
+thread stack size we no longer had enough headroom.
+Related: #435337
+
+* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 5.0.45-8
+- Autorebuild for GCC 4.3
+
+* Tue Jan 8 2008 Tom Lane <tgl@redhat.com> 5.0.45-7
+- Unbelievable ... upstream still thinks that it's a good idea to have a
+ regression test that is guaranteed to begin failing come January 1.
+- ... and it seems we need to raise STACK_MIN_SIZE again too.
+
+* Thu Dec 13 2007 Tom Lane <tgl@redhat.com> 5.0.45-6
+- Back-port upstream fixes for CVE-2007-5925, CVE-2007-5969, CVE-2007-6303.
+Related: #422211
+
+* Wed Dec 5 2007 Tom Lane <tgl@redhat.com> 5.0.45-5
+- Rebuild for new openssl
+
+* Sat Aug 25 2007 Tom Lane <tgl@redhat.com> 5.0.45-4
+- Seems we need explicit BuildRequires on gawk and procps now
+- Rebuild to fix Fedora toolchain issues
+
+* Sun Aug 12 2007 Tom Lane <tgl@redhat.com> 5.0.45-3
+- Recent perl changes in rawhide mean we need a more specific BuildRequires
+
+* Thu Aug 2 2007 Tom Lane <tgl@redhat.com> 5.0.45-2
+- Update License tag to match code.
+- Work around recent Fedora change that makes "open" a macro name.
+
+* Sun Jul 22 2007 Tom Lane <tgl@redhat.com> 5.0.45-1
+- Update to MySQL 5.0.45
+Resolves: #246535
+- Move mysql_config's man page to base package
+Resolves: #245770
+- move my_print_defaults to base RPM, for consistency with Stacks packaging
+- mysql user is no longer deleted at RPM uninstall
+Resolves: #241912
+
+* Thu Mar 29 2007 Tom Lane <tgl@redhat.com> 5.0.37-2
+- Use a less hacky method of getting default values in initscript
+Related: #233771, #194596
+- Improve packaging of mysql-libs per suggestions from Remi Collet
+Resolves: #233731
+- Update default /etc/my.cnf ([mysql.server] has been bogus for a long time)
+
+* Mon Mar 12 2007 Tom Lane <tgl@redhat.com> 5.0.37-1
+- Update to MySQL 5.0.37
+Resolves: #231838
+- Put client library into a separate mysql-libs RPM to reduce dependencies
+Resolves: #205630
+
+* Fri Feb 9 2007 Tom Lane <tgl@redhat.com> 5.0.33-1
+- Update to MySQL 5.0.33
+- Install band-aid fix for "view" regression test designed to fail after 2006
+- Don't chmod -R the entire database directory tree on every startup
+Related: #221085
+- Fix unsafe use of install-info
+Resolves: #223713
+- Cope with new automake in F7
+Resolves: #224171
+
+* Thu Nov 9 2006 Tom Lane <tgl@redhat.com> 5.0.27-1
+- Update to MySQL 5.0.27 (see CVE-2006-4031, CVE-2006-4226, CVE-2006-4227)
+Resolves: #202247, #202675, #203427, #203428, #203432, #203434, #208641
+- Fix init script to return status 1 on server start timeout
+Resolves: #203910
+- Move mysqldumpslow from base package to mysql-server
+Resolves: #193559
+- Adjust link options for BDB module
+Resolves: #199368
+
+* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 5.0.22-2.1
+- rebuild
+
+* Sat Jun 10 2006 Tom Lane <tgl@redhat.com> 5.0.22-2
+- Work around brew's tendency not to clean up failed builds completely,
+ by adding code in mysql-testing.patch to kill leftover mysql daemons.
+
+* Thu Jun 8 2006 Tom Lane <tgl@redhat.com> 5.0.22-1
+- Update to MySQL 5.0.22 (fixes CVE-2006-2753)
+- Install temporary workaround for gcc bug on s390x (bz #193912)
+
+* Tue May 2 2006 Tom Lane <tgl@redhat.com> 5.0.21-2
+- Fix bogus perl Requires for mysql-test
+
+* Mon May 1 2006 Tom Lane <tgl@redhat.com> 5.0.21-1
+- Update to MySQL 5.0.21
+
+* Mon Mar 27 2006 Tom Lane <tgl@redhat.com> 5.0.18-4
+- Modify multilib header hack to not break non-RH arches, per bug #181335
+- Remove logrotate script, per bug #180639.
+- Add a new mysql-test RPM to carry the regression test files;
+ hack up test scripts as needed to make them run in /usr/share/mysql-test.
+
+* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 5.0.18-2.1
+- bump again for double-long bug on ppc(64)
+
+* Thu Feb 9 2006 Tom Lane <tgl@redhat.com> 5.0.18-2
+- err-log option has been renamed to log-error, fix my.cnf and initscript
+
+* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 5.0.18-1.1
+- rebuilt for new gcc4.1 snapshot and glibc changes
+
+* Thu Jan 5 2006 Tom Lane <tgl@redhat.com> 5.0.18-1
+- Update to MySQL 5.0.18
+
+* Thu Dec 15 2005 Tom Lane <tgl@redhat.com> 5.0.16-4
+- fix my_config.h for ppc platforms
+
+* Thu Dec 15 2005 Tom Lane <tgl@redhat.com> 5.0.16-3
+- my_config.h needs to guard against 64-bit platforms that also define the
+ 32-bit symbol
+
+* Wed Dec 14 2005 Tom Lane <tgl@redhat.com> 5.0.16-2
+- oops, looks like we want uname -i not uname -m
+
+* Mon Dec 12 2005 Tom Lane <tgl@redhat.com> 5.0.16-1
+- Update to MySQL 5.0.16
+- Add EXCEPTIONS-CLIENT license info to the shipped documentation
+- Make my_config.h architecture-independent for multilib installs;
+ put the original my_config.h into my_config_$ARCH.h
+- Add -fwrapv to CFLAGS so that gcc 4.1 doesn't break it
+
+* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
+- rebuilt
+
+* Mon Nov 14 2005 Tom Lane <tgl@redhat.com> 5.0.15-3
+- Make stop script wait for daemon process to disappear (bz#172426)
+
+* Wed Nov 9 2005 Tom Lane <tgl@redhat.com> 5.0.15-2
+- Rebuild due to openssl library update.
+
+* Thu Nov 3 2005 Tom Lane <tgl@redhat.com> 5.0.15-1
+- Update to MySQL 5.0.15 (scratch build for now)
+
+* Wed Oct 5 2005 Tom Lane <tgl@redhat.com> 4.1.14-1
+- Update to MySQL 4.1.14
+
+* Tue Aug 23 2005 Tom Lane <tgl@redhat.com> 4.1.12-3
+- Use politically correct patch name.
+
+* Tue Jul 12 2005 Tom Lane <tgl@redhat.com> 4.1.12-2
+- Fix buffer overflow newly exposed in isam code; it's the same issue
+ previously found in myisam, and not very exciting, but I'm tired of
+ seeing build warnings.
+
+* Mon Jul 11 2005 Tom Lane <tgl@redhat.com> 4.1.12-1
+- Update to MySQL 4.1.12 (includes a fix for bz#158688, bz#158689)
+- Extend mysql-test-ssl.patch to solve rpl_openssl test failure (bz#155850)
+- Update mysql-lock-ssl.patch to match the upstream committed version
+- Add --with-isam to re-enable the old ISAM table type, per bz#159262
+- Add dependency on openssl-devel per bz#159569
+- Remove manual.txt, as upstream decided not to ship it anymore;
+ it was redundant with the mysql.info file anyway.
+
+* Mon May 9 2005 Tom Lane <tgl@redhat.com> 4.1.11-4
+- Include proper locking for OpenSSL in the server, per bz#155850
+
+* Mon Apr 25 2005 Tom Lane <tgl@redhat.com> 4.1.11-3
+- Enable openssl tests during build, per bz#155850
+- Might as well turn on --disable-dependency-tracking
+
+* Fri Apr 8 2005 Tom Lane <tgl@redhat.com> 4.1.11-2
+- Avoid dependency on <asm/atomic.h>, cause it won't build anymore on ia64.
+ This is probably a cleaner solution for bz#143537, too.
+
+* Thu Apr 7 2005 Tom Lane <tgl@redhat.com> 4.1.11-1
+- Update to MySQL 4.1.11 to fix bz#152911 as well as other issues
+- Move perl-DBI, perl-DBD-MySQL dependencies to server package (bz#154123)
+- Override configure thread library test to suppress HAVE_LINUXTHREADS check
+- Fix BDB failure on s390x (bz#143537)
+- At last we can enable "make test" on all arches
+
+* Fri Mar 11 2005 Tom Lane <tgl@redhat.com> 4.1.10a-1
+- Update to MySQL 4.1.10a to fix security vulnerabilities (bz#150868,
+ for CAN-2005-0711, and bz#150871 for CAN-2005-0709, CAN-2005-0710).
+
+* Sun Mar 6 2005 Tom Lane <tgl@redhat.com> 4.1.10-3
+- Fix package Requires: interdependencies.
+
+* Sat Mar 5 2005 Tom Lane <tgl@redhat.com> 4.1.10-2
+- Need -fno-strict-aliasing in at least one place, probably more.
+- Work around some C spec violations in mysql.
+
+* Fri Feb 18 2005 Tom Lane <tgl@redhat.com> 4.1.10-1
+- Update to MySQL 4.1.10.
+
+* Sat Jan 15 2005 Tom Lane <tgl@redhat.com> 4.1.9-1
+- Update to MySQL 4.1.9.
+
+* Wed Jan 12 2005 Tom Lane <tgl@redhat.com> 4.1.7-10
+- Don't assume /etc/my.cnf will specify pid-file (bz#143724)
+
+* Wed Jan 12 2005 Tim Waugh <twaugh@redhat.com> 4.1.7-9
+- Rebuilt for new readline.
+
+* Tue Dec 21 2004 Tom Lane <tgl@redhat.com> 4.1.7-8
+- Run make test on all archs except s390x (which seems to have a bdb issue)
+
+* Mon Dec 13 2004 Tom Lane <tgl@redhat.com> 4.1.7-7
+- Suppress someone's silly idea that libtool overhead can be skipped
+
+* Sun Dec 12 2004 Tom Lane <tgl@redhat.com> 4.1.7-6
+- Fix init script to not need a valid username for startup check (bz#142328)
+- Fix init script to honor settings appearing in /etc/my.cnf (bz#76051)
+- Enable SSL (bz#142032)
+
+* Thu Dec 2 2004 Tom Lane <tgl@redhat.com> 4.1.7-5
+- Add a restorecon to keep the mysql.log file in the right context (bz#143887)
+
+* Tue Nov 23 2004 Tom Lane <tgl@redhat.com> 4.1.7-4
+- Turn off old_passwords in default /etc/my.cnf file, for better compatibility
+ with mysql 3.x clients (per suggestion from Joe Orton).
+
+* Fri Oct 29 2004 Tom Lane <tgl@redhat.com> 4.1.7-3
+- Handle ldconfig more cleanly (put a file in /etc/ld.so.conf.d/).
+
+* Thu Oct 28 2004 Tom Lane <tgl@redhat.com> 4.1.7-2
+- rebuild in devel branch
+
+* Wed Oct 27 2004 Tom Lane <tgl@redhat.com> 4.1.7-1
+- Update to MySQL 4.1.x.
+
+* Tue Oct 12 2004 Tom Lane <tgl@redhat.com> 3.23.58-13
+- fix security issues CAN-2004-0835, CAN-2004-0836, CAN-2004-0837
+ (bugs #135372, 135375, 135387)
+- fix privilege escalation on GRANT ALL ON `Foo\_Bar` (CAN-2004-0957)
+
+* Wed Oct 06 2004 Tom Lane <tgl@redhat.com> 3.23.58-12
+- fix multilib problem with mysqlbug and mysql_config
+- adjust chkconfig priority per bug #128852
+- remove bogus quoting per bug #129409 (MySQL 4.0 has done likewise)
+- add sleep to mysql.init restart(); may or may not fix bug #133993
+
+* Tue Oct 05 2004 Tom Lane <tgl@redhat.com> 3.23.58-11
+- fix low-priority security issues CAN-2004-0388, CAN-2004-0381, CAN-2004-0457
+ (bugs #119442, 125991, 130347, 130348)
+- fix bug with dropping databases under recent kernels (bug #124352)
+
+* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com> 3.23.58-10
+- rebuilt
+
+* Sat Apr 17 2004 Warren Togami <wtogami@redhat.com> 3.23.58-9
+- remove redundant INSTALL-SOURCE, manual.*
+- compress manual.txt.bz2
+- BR time
+
+* Tue Mar 16 2004 Tom Lane <tgl@redhat.com> 3.23.58-8
+- repair logfile attributes in %%files, per bug #102190
+- repair quoting problem in mysqlhotcopy, per bug #112693
+- repair missing flush in mysql_setpermission, per bug #113960
+- repair broken error message printf, per bug #115165
+- delete mysql user during uninstall, per bug #117017
+- rebuilt
+
+* Tue Mar 02 2004 Elliot Lee <sopwith@redhat.com>
+- rebuilt
+
+* Tue Feb 24 2004 Tom Lane <tgl@redhat.com>
+- fix chown syntax in mysql.init
+- rebuild
+
+* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
+- rebuilt
+
+* Tue Nov 18 2003 Kim Ho <kho@redhat.com> 3.23.58-5
+- update mysql.init to use anonymous user (UNKNOWN_MYSQL_USER) for
+ pinging mysql server (#108779)
+
+* Mon Oct 27 2003 Kim Ho <kho@redhat.com> 3.23.58-4
+- update mysql.init to wait (max 10 seconds) for mysql server to
+ start (#58732)
+
+* Mon Oct 27 2003 Patrick Macdonald <patrickm@redhat.com> 3.23.58-3
+- re-enable Berkeley DB support (#106832)
+- re-enable ia64 testing
+
+* Fri Sep 19 2003 Patrick Macdonald <patrickm@redhat.com> 3.23.58-2
+- rebuilt
+
+* Mon Sep 15 2003 Patrick Macdonald <patrickm@redhat.com> 3.23.58-1
+- upgrade to 3.23.58 for security fix
+
+* Tue Aug 26 2003 Patrick Macdonald <patrickm@redhat.com> 3.23.57-2
+- rebuilt
+
+* Wed Jul 02 2003 Patrick Macdonald <patrickm@redhat.com> 3.23.57-1
+- revert to prior version of MySQL due to license incompatibilities
+ with packages that link against the client. The MySQL folks are
+ looking into the issue.
+
+* Wed Jun 18 2003 Patrick Macdonald <patrickm@redhat.com> 4.0.13-4
+- restrict test on ia64 (temporary)
+
+* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com> 4.0.13-3
+- rebuilt
+
+* Thu May 29 2003 Patrick Macdonald <patrickm@redhat.com> 4.0.13-2
+- fix filter-requires-mysql.sh with less restrictive for mysql-bench
+
+* Wed May 28 2003 Patrick Macdonald <patrickm@redhat.com> 4.0.13-1
+- update for MySQL 4.0
+- back-level shared libraries available in mysqlclient10 package
+
+* Fri May 09 2003 Patrick Macdonald <patrickm@redhat.com> 3.23.56-2
+- add sql-bench package (#90110)
+
+* Wed Mar 19 2003 Patrick Macdonald <patrickm@redhat.com> 3.23.56-1
+- upgrade to 3.23.56 for security fixes
+- remove patch for double-free (included in 3.23.56)
+
+* Tue Feb 18 2003 Patrick Macdonald <patrickm@redhat.com> 3.23.54a-11
+- enable thread safe client
+- add patch for double free fix
+
+* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
+- rebuilt
+
+* Mon Jan 13 2003 Karsten Hopp <karsten@redhat.de> 3.23.54a-9
+- disable checks on s390x
+
+* Sat Jan 4 2003 Jeff Johnson <jbj@redhat.com> 3.23.54a-8
+- use internal dep generator.
+
+* Wed Jan 1 2003 Bill Nottingham <notting@redhat.com> 3.23.54a-7
+- fix mysql_config on hammer
+
+* Sun Dec 22 2002 Tim Powers <timp@redhat.com> 3.23.54a-6
+- don't use rpms internal dep generator
+
+* Tue Dec 17 2002 Elliot Lee <sopwith@redhat.com> 3.23.54a-5
+- Push it into the build system
+
+* Mon Dec 16 2002 Joe Orton <jorton@redhat.com> 3.23.54a-4
+- upgrade to 3.23.54a for safe_mysqld fix
+
+* Thu Dec 12 2002 Joe Orton <jorton@redhat.com> 3.23.54-3
+- upgrade to 3.23.54 for latest security fixes
+
+* Tue Nov 19 2002 Jakub Jelinek <jakub@redhat.com> 3.23.52-5
+- Always include <errno.h> for errno
+- Remove unpackaged files
+
+* Tue Nov 12 2002 Florian La Roche <Florian.LaRoche@redhat.de>
+- do not prereq userdel, not used at all
+
+* Mon Sep 9 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.52-4
+- Use %%{_libdir}
+- Add patch for x86-64
+
+* Wed Sep 4 2002 Jakub Jelinek <jakub@redhat.com> 3.23.52-3
+- rebuilt with gcc-3.2-7
+
+* Thu Aug 29 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.52-2
+- Add --enable-local-infile to configure - a new option
+ which doesn't default to the old behaviour (#72885)
+
+* Fri Aug 23 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.52-1
+- 3.23.52. Fixes a minor security problem, various bugfixes.
+
+* Sat Aug 10 2002 Elliot Lee <sopwith@redhat.com> 3.23.51-5
+- rebuilt with gcc-3.2 (we hope)
+
+* Mon Jul 22 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.51-4
+- rebuild
+
+* Thu Jul 18 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.51-3
+- Fix #63543 and #63542
+
+* Thu Jul 11 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.51-2
+- Turn off bdb on PPC(#68591)
+- Turn off the assembly optimizations, for safety.
+
+* Wed Jun 26 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.51-1
+- Work around annoying auto* thinking this is a crosscompile
+- 3.23.51
+
+* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
+- automated rebuild
+
+* Mon Jun 10 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.50-2
+- Add dependency on perl-DBI and perl-DBD-MySQL (#66349)
+
+* Thu May 30 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.50-1
+- 3.23.50
+
+* Thu May 23 2002 Tim Powers <timp@redhat.com>
+- automated rebuild
+
+* Mon May 13 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.49-4
+- Rebuild
+- Don't set CXX to gcc, it doesn't work anymore
+- Exclude Alpha
+
+* Mon Apr 8 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.49-3
+- Add the various .cnf examples as doc files to mysql-server (#60349)
+- Don't include manual.ps, it's just 200 bytes with a URL inside (#60349)
+- Don't include random files in /usr/share/mysql (#60349)
+- langify (#60349)
+
+* Thu Feb 21 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.49-2
+- Rebuild
+
+* Sun Feb 17 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.49-1
+- 3.23.49
+
+* Thu Feb 14 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.48-2
+- work around perl dependency bug.
+
+* Mon Feb 11 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.48-1
+- 3.23.48
+
+* Thu Jan 17 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.47-4
+- Use kill, not mysqladmin, to flush logs and shut down. Thus,
+ an admin password can be set with no problems.
+- Remove reload from init script
+
+* Wed Jan 16 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.47-3
+- remove db3-devel from buildrequires,
+ MySQL has had its own bundled copy since the mid thirties
+
+* Sun Jan 6 2002 Trond Eivind Glomsrd <teg@redhat.com> 3.23.47-1
+- 3.23.47
+- Don't build for alpha, toolchain immature.
+
+* Mon Dec 3 2001 Trond Eivind Glomsrd <teg@redhat.com> 3.23.46-1
+- 3.23.46
+- use -fno-rtti and -fno-exceptions, and set CXX to increase stability.
+ Recommended by mysql developers.
+
+* Sun Nov 25 2001 Trond Eivind Glomsrd <teg@redhat.com> 3.23.45-1
+- 3.23.45
+
+* Wed Nov 14 2001 Trond Eivind Glomsrd <teg@redhat.com> 3.23.44-2
+- centralize definition of datadir in the initscript (#55873)
+
+* Fri Nov 2 2001 Trond Eivind Glomsrd <teg@redhat.com> 3.23.44-1
+- 3.23.44
+
+* Thu Oct 4 2001 Trond Eivind Glomsrd <teg@redhat.com> 3.23.43-1
+- 3.23.43
+
+* Mon Sep 10 2001 Trond Eivind Glomsrd <teg@redhat.com> 3.23.42-1
+- 3.23.42
+- reenable innodb
+
+* Tue Aug 14 2001 Trond Eivind Glomsrd <teg@redhat.com> 3.23.41-1
+- 3.23.41 bugfix release
+- disable innodb, to avoid the broken updates
+- Use "mysqladmin flush_logs" instead of kill -HUP in logrotate
+ script (#51711)
+
+* Sat Jul 21 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.40, bugfix release
+- Add zlib-devel to buildrequires:
+
+* Fri Jul 20 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- BuildRequires-tweaking
+
+* Thu Jun 28 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- Reenable test, but don't run them for s390, s390x or ia64
+- Make /etc/my.cnf config(noplace). Same for /etc/logrotate.d/mysqld
+
+* Thu Jun 14 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.29
+- enable innodb
+- enable assembly again
+- disable tests for now...
+
+* Tue May 15 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.38
+- Don't use BDB on Alpha - no fast mutexes
+
+* Tue Apr 24 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.37
+- Add _GNU_SOURCE to the compile flags
+
+* Wed Mar 28 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- Make it obsolete our 6.2 PowerTools packages
+- 3.23.36 bugfix release - fixes some security issues
+ which didn't apply to our standard configuration
+- Make "make test" part of the build process, except on IA64
+ (it fails there)
+
+* Tue Mar 20 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.35 bugfix release
+- Don't delete the mysql user on uninstall
+
+* Tue Mar 13 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.34a bugfix release
+
+* Wed Feb 7 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- added readline-devel to BuildRequires:
+
+* Tue Feb 6 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- small i18n-fixes to initscript (action needs $)
+
+* Tue Jan 30 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- make it shut down and rotate logs without using mysqladmin
+ (from #24909)
+
+* Mon Jan 29 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- conflict with "MySQL"
+
+* Tue Jan 23 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- improve gettextizing
+
+* Mon Jan 22 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.32
+- fix logrotate script (#24589)
+
+* Wed Jan 17 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- gettextize
+- move the items in Requires(post): to Requires: in preparation
+ for an errata for 7.0 when 3.23.31 is released
+- 3.23.31
+
+* Tue Jan 16 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- add the log file to the rpm database, and make it 0640
+ (#24116)
+- as above in logrotate script
+- changes to the init sequence - put most of the data
+ in /etc/my.cnf instead of hardcoding in the init script
+- use /var/run/mysqld/mysqld.pid instead of
+ /var/run/mysqld/pid
+- use standard safe_mysqld
+- shut down cleaner
+
+* Mon Jan 08 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.30
+- do an explicit chmod on /var/lib/mysql in post, to avoid
+ any problems with broken permissons. There is a report
+ of rm not changing this on its own (#22989)
+
+* Mon Jan 01 2001 Trond Eivind Glomsrd <teg@redhat.com>
+- bzipped source
+- changed from 85 to 78 in startup, so it starts before
+ apache (which can use modules requiring mysql)
+
+* Wed Dec 27 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.29a
+
+* Tue Dec 19 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- add requirement for new libstdc++, build for errata
+
+* Mon Dec 18 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.29
+
+* Mon Nov 27 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.28 (gamma)
+- remove old patches, as they are now upstreamed
+
+* Thu Nov 14 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- Add a requirement for a new glibc (#20735)
+- build on IA64
+
+* Wed Nov 1 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- disable more assembly
+
+* Wed Nov 1 2000 Jakub Jelinek <jakub@redhat.com>
+- fix mysql on SPARC (#20124)
+
+* Tue Oct 31 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.27
+
+* Wed Oct 25 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- add patch for fixing bogus aliasing in mysql from Jakub,
+ which should fix #18905 and #18620
+
+* Mon Oct 23 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- check for negative niceness values, and negate it
+ if present (#17899)
+- redefine optflags on IA32 FTTB
+
+* Wed Oct 18 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.26, which among other fixes now uses mkstemp()
+ instead of tempnam().
+- revert changes made yesterday, the problem is now
+ isolated
+
+* Tue Oct 17 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- use the compat C++ compiler FTTB. Argh.
+- add requirement of ncurses4 (see above)
+
+* Sun Oct 01 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.25
+- fix shutdown problem (#17956)
+
+* Tue Sep 26 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- Don't try to include no-longer-existing PUBLIC file
+ as doc (#17532)
+
+* Thu Sep 12 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- rename config file to /etc/my.cnf, which is what
+ mysqld wants... doh. (#17432)
+- include a changed safe_mysqld, so the pid file option
+ works.
+- make mysql dir world readable to they can access the
+ mysql socket. (#17432)
+- 3.23.24
+
+* Wed Sep 06 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.23
+
+* Sun Aug 27 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- Add "|| :" to condrestart to avoid non-zero exit code
+
+* Thu Aug 24 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- it's mysql.com, not mysql.org and use correct path to
+ source (#16830)
+
+* Wed Aug 16 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- source file from /etc/rc.d, not /etc/rd.d. Doh.
+
+* Sun Aug 13 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- don't run ldconfig -n, it doesn't update ld.so.cache
+ (#16034)
+- include some missing binaries
+- use safe_mysqld to start the server (request from
+ mysql developers)
+
+* Sat Aug 05 2000 Bill Nottingham <notting@redhat.com>
+- condrestart fixes
+
+* Mon Aug 01 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.22. Disable the old patches, they're now in.
+
+* Thu Jul 27 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- bugfixes in the initscript
+- move the .so link to the devel package
+
+* Wed Jul 19 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- rebuild due to glibc changes
+
+* Tue Jul 18 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- disable compiler patch
+- don't include info directory file
+
+* Mon Jul 17 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- move back to /etc/rc.d/init.d
+
+* Fri Jul 14 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- more cleanups in initscript
+
+* Thu Jul 13 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- add a patch to work around compiler bug
+ (from monty@mysql.com)
+
+* Wed Jul 12 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- don't build the SQL daemon statically (glibc problems)
+- fix the logrotate script - only flush log if mysql
+ is running
+- change the reloading procedure
+- remove icon - glint is obsolete a long time ago
+
+* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
+- automatic rebuild
+
+* Mon Jul 10 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- try the new compiler again
+- build the SQL daemon statically
+- add compile time support for complex charsets
+- enable assembler
+- more cleanups in initscript
+
+* Sun Jul 09 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- use old C++ compiler
+- Exclusivearch x86
+
+* Sat Jul 08 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- move .so files to devel package
+- more cleanups
+- exclude sparc for now
+
+* Wed Jul 05 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- 3.23.21
+- remove file from /etc/sysconfig
+- Fix initscript a bit - initialization of databases doesn't
+ work yet
+- specify the correct licenses
+- include a /etc/my.conf (empty, FTTB)
+- add conditional restart to spec file
+
+* Tue Jul 2 2000 Jakub Jelinek <jakub@redhat.com>
+- Rebuild with new C++
+
+* Fri Jun 30 2000 Trond Eivind Glomsrd <teg@redhat.com>
+- update to 3.23.20
+- use %%configure, %%makeinstall, %%{_tmppath}, %%{_mandir},
+ %%{_infodir}, /etc/init.d
+- remove the bench package
+- change some of the descriptions a little bit
+- fix the init script
+- some compile fixes
+- specify mysql user
+- use mysql uid 27 (postgresql is 26)
+- don't build on ia64
+
+* Sat Feb 26 2000 Jos Vos <jos@xos.nl>
+- Version 3.22.32 release XOS.1 for LinuX/OS 1.8.0
+- Upgrade from version 3.22.27 to 3.22.32.
+- Do "make install" instead of "make install-strip", because "install -s"
+ now appears to fail on various scripts. Afterwards, strip manually.
+- Reorganize subpackages, according to common Red Hat packages: the client
+ program and shared library become the base package and the server and
+ some accompanying files are now in a separate server package. The
+ server package implicitly requires the base package (shared library),
+ but we have added a manual require tag anyway (because of the shared
+ config file, and more).
+- Rename the mysql-benchmark subpackage to mysql-bench.
+
+* Mon Jan 31 2000 Jos Vos <jos@xos.nl>
+- Version 3.22.27 release XOS.2 for LinuX/OS 1.7.1
+- Add post(un)install scripts for updating ld.so.conf (client subpackage).
+
+* Sun Nov 21 1999 Jos Vos <jos@xos.nl>
+- Version 3.22.27 release XOS.1 for LinuX/OS 1.7.0
+- Initial version.
+- Some ideas borrowed from Red Hat Powertools 6.1, although this spec
+ file is a full rewrite from scratch.
diff --git a/packaging/rpm-uln/scriptstub.c b/packaging/rpm-uln/scriptstub.c
new file mode 100644
index 00000000000..de942c136e7
--- /dev/null
+++ b/packaging/rpm-uln/scriptstub.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* Translate call of myself into call of same-named script in LIBDIR */
+/* The macro LIBDIR must be defined as a double-quoted string */
+
+int main (int argc, char **argv)
+{
+ char *basename;
+ char *fullname;
+ char **newargs;
+ int i;
+
+ basename = strrchr(argv[0], '/');
+ if (basename)
+ basename++;
+ else
+ basename = argv[0];
+ fullname = malloc(strlen(LIBDIR) + strlen(basename) + 2);
+ sprintf(fullname, "%s/%s", LIBDIR, basename);
+ newargs = malloc((argc+1) * sizeof(char *));
+ newargs[0] = fullname;
+ for (i = 1; i < argc; i++)
+ newargs[i] = argv[i];
+ newargs[argc] = NULL;
+
+ execvp(fullname, newargs);
+
+ return 1;
+}
diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc
index 8043c46816e..f7f962deaca 100644
--- a/plugin/feedback/utils.cc
+++ b/plugin/feedback/utils.cc
@@ -44,6 +44,12 @@ static const char *get_os_version_name(OSVERSIONINFOEX *ver)
DWORD major = ver->dwMajorVersion;
DWORD minor = ver->dwMinorVersion;
+ if (major == 6 && minor == 2)
+ {
+ return (ver->wProductType == VER_NT_WORKSTATION)?
+ "Windows 8":"Windows Server 2012";
+ }
+
if (major == 6 && minor == 1)
{
return (ver->wProductType == VER_NT_WORKSTATION)?
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 91a47bf3d48..76e92899c2a 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -29,7 +29,7 @@ ENDIF()
IF(CAT_EXECUTABLE)
SET(CAT_COMMAND COMMAND
${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
- ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql >
+ ${CAT_EXECUTABLE} mysql_system_tables.sql mysql_system_tables_fix.sql mysql_performance_tables.sql >
${CMAKE_CURRENT_BINARY_DIR}/mysql_fix_privilege_tables.sql
)
ELSEIF(WIN32)
@@ -37,7 +37,7 @@ ELSEIF(WIN32)
native_outfile )
SET(CAT_COMMAND
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}
- cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql
+ cmd /c copy /b mysql_system_tables.sql + mysql_system_tables_fix.sql + mysql_performance_tables.sql
${native_outfile} )
ELSE()
MESSAGE(FATAL_ERROR "Cannot concatenate files")
@@ -55,6 +55,7 @@ ADD_CUSTOM_COMMAND(
DEPENDS comp_sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_fix.sql
+ ${CMAKE_CURRENT_SOURCE_DIR}/mysql_performance_tables.sql
)
# Add target for the above to be built
@@ -74,6 +75,7 @@ ENDIF()
INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql
+ ${CMAKE_CURRENT_SOURCE_DIR}/mysql_performance_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql
${FIX_PRIVILEGES_SQL}
@@ -283,7 +285,7 @@ SET(mysql_config_COMPONENT COMPONENT Development)
SET(msql2mysql_COMPONENT COMPONENT Client)
SET(mysqlaccess_COMPONENT COMPONENT Client)
SET(mysql_find_rows_COMPONENT COMPONENT Client)
-SET(mytop_COMPONENT Client)
+SET(mytop_COMPONENT Mytop)
IF(WIN32)
# On Windows, some .sh and some .pl.in files are configured
diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in
index 3fdecc968e1..69d20575212 100644
--- a/scripts/mysql_install_db.pl.in
+++ b/scripts/mysql_install_db.pl.in
@@ -423,8 +423,11 @@ my $mysqld_install_cmd_line = quote_options($mysqld_bootstrap,
"--bootstrap",
"--basedir=$opt->{basedir}",
"--datadir=$opt->{ldata}",
+ "--log-warnings=0",
"--loose-skip-innodb",
+ "--loose-skip-ndbcluster",
"--max_allowed_packet=8M",
+ "--default-storage-engine=MyISAM",
"--net_buffer_length=16K",
@args,
);
@@ -437,6 +440,8 @@ report_verbose_wait($opt,"Installing MySQL system tables...");
open(SQL, $create_system_tables)
or error($opt,"can't open $create_system_tables for reading: $!");
+open(SQL2, $fill_system_tables)
+ or error($opt,"can't open $fill_system_tables for reading: $!");
# FIXME > /dev/null ?
if ( open(PIPE, "| $mysqld_install_cmd_line") )
{
@@ -450,8 +455,20 @@ if ( open(PIPE, "| $mysqld_install_cmd_line") )
print PIPE $_;
}
+ while ( <SQL2> )
+ {
+ # TODO: make it similar to the above condition when we're sure
+ # @@hostname returns a fqdn
+ # When doing a "cross bootstrap" install, no reference to the current
+ # host should be added to the system tables. So we filter out any
+ # lines which contain the current host name.
+ next if /\@current_hostname/;
+
+ print PIPE $_;
+ }
close PIPE;
close SQL;
+ close SQL2;
report_verbose($opt,"OK");
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 91780570194..b28e8a3ba1c 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2000, 2011, Oracle and/or its affiliates.
-# Copyright (c) 2009, 2011, Monty Program Ab
+# Copyright (c) 2009, 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
@@ -305,9 +305,10 @@ fi
# Set up paths to SQL scripts required for bootstrap
fill_help_tables="$pkgdatadir/fill_help_tables.sql"
create_system_tables="$pkgdatadir/mysql_system_tables.sql"
+create_system_tables2="$pkgdatadir/mysql_performance_tables.sql"
fill_system_tables="$pkgdatadir/mysql_system_tables_data.sql"
-for f in "$fill_help_tables" "$create_system_tables" "$fill_system_tables"
+for f in "$fill_help_tables" "$create_system_tables" "$create_system_tables2" "$fill_system_tables"
do
if test ! -f "$f"
then
@@ -424,7 +425,7 @@ mysqld_install_cmd_line()
# Create the system and help tables by passing them to "mysqld --bootstrap"
s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..."
-if { echo "use mysql;"; cat "$create_system_tables" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null
+if { echo "use mysql;"; cat "$create_system_tables" "$create_system_tables2" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null
then
s_echo "OK"
else
diff --git a/scripts/mysql_performance_tables.sql b/scripts/mysql_performance_tables.sql
new file mode 100644
index 00000000000..193d79bb502
--- /dev/null
+++ b/scripts/mysql_performance_tables.sql
@@ -0,0 +1,402 @@
+--
+-- PERFORMANCE SCHEMA INSTALLATION
+-- Note that this script is also reused by mysql_upgrade,
+-- so we have to be very careful here to not destroy any
+-- existing database named 'performance_schema' if it
+-- can contain user data.
+-- In case of downgrade, it's ok to drop unknown tables
+-- from a future version, as long as they belong to the
+-- performance schema engine.
+--
+
+set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema');
+
+SET @l1="SET @broken_tables = (select count(*) from information_schema.tables";
+SET @l2=" where engine != \'PERFORMANCE_SCHEMA\' and table_schema=\'performance_schema\')";
+SET @cmd=concat(@l1,@l2);
+
+-- Work around for bug#49542
+SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @l1="SET @broken_views = (select count(*) from information_schema.views";
+SET @l2=" where table_schema='performance_schema')";
+SET @cmd=concat(@l1,@l2);
+
+-- Work around for bug#49542
+SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema');
+
+SET @broken_events = (select count(*) from mysql.event where db='performance_schema');
+
+SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events);
+
+--
+-- The performance schema database.
+-- Only drop and create the database if this is safe (no broken_pfs).
+-- This database is created, even in --without-perfschema builds,
+-- so that the database name is always reserved by the MySQL implementation.
+-- This script must be executed AFTER we have fixed the proc table, to
+-- avoid errors with old proc tables.
+--
+
+SET @cmd= "DROP DATABASE IF EXISTS performance_schema";
+
+SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @cmd= "CREATE DATABASE performance_schema character set utf8";
+
+SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- From this point, only create the performance schema tables
+-- if the server is build with performance schema
+--
+
+set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO');
+
+--
+-- TABLE COND_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.cond_instances(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_CURRENT
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_current(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="EVENT_ID BIGINT unsigned not null,";
+SET @l4="EVENT_NAME VARCHAR(128) not null,";
+SET @l5="SOURCE VARCHAR(64),";
+SET @l6="TIMER_START BIGINT unsigned,";
+SET @l7="TIMER_END BIGINT unsigned,";
+SET @l8="TIMER_WAIT BIGINT unsigned,";
+SET @l9="SPINS INTEGER unsigned,";
+SET @l10="OBJECT_SCHEMA VARCHAR(64),";
+SET @l11="OBJECT_NAME VARCHAR(512),";
+SET @l12="OBJECT_TYPE VARCHAR(64),";
+SET @l13="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l14="NESTING_EVENT_ID BIGINT unsigned,";
+SET @l15="OPERATION VARCHAR(16) not null,";
+SET @l16="NUMBER_OF_BYTES BIGINT unsigned,";
+SET @l17="FLAGS INTEGER unsigned";
+SET @l18=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_HISTORY
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_history(";
+-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_HISTORY_LONG
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_history_long(";
+-- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_instance(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l4="COUNT_STAR BIGINT unsigned not null,";
+SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_thread_by_event_name(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="EVENT_NAME VARCHAR(128) not null,";
+SET @l4="COUNT_STAR BIGINT unsigned not null,";
+SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
+--
+
+SET @l1="CREATE TABLE performance_schema.events_waits_summary_global_by_event_name(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="COUNT_STAR BIGINT unsigned not null,";
+SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,";
+SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,";
+SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,";
+SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null";
+SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE FILE_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.file_instances(";
+SET @l2="FILE_NAME VARCHAR(512) not null,";
+SET @l3="EVENT_NAME VARCHAR(128) not null,";
+SET @l4="OPEN_COUNT INTEGER unsigned not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE FILE_SUMMARY_BY_EVENT_NAME
+--
+
+SET @l1="CREATE TABLE performance_schema.file_summary_by_event_name(";
+SET @l2="EVENT_NAME VARCHAR(128) not null,";
+SET @l3="COUNT_READ BIGINT unsigned not null,";
+SET @l4="COUNT_WRITE BIGINT unsigned not null,";
+SET @l5="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,";
+SET @l6="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null";
+SET @l7=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE FILE_SUMMARY_BY_INSTANCE
+--
+
+SET @l1="CREATE TABLE performance_schema.file_summary_by_instance(";
+SET @l2="FILE_NAME VARCHAR(512) not null,";
+SET @l3="EVENT_NAME VARCHAR(128) not null,";
+SET @l4="COUNT_READ BIGINT unsigned not null,";
+SET @l5="COUNT_WRITE BIGINT unsigned not null,";
+SET @l6="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,";
+SET @l7="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null";
+SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE MUTEX_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.mutex_instances(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l4="LOCKED_BY_THREAD_ID INTEGER";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE PERFORMANCE_TIMERS
+--
+
+SET @l1="CREATE TABLE performance_schema.performance_timers(";
+SET @l2="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,";
+SET @l3="TIMER_FREQUENCY BIGINT,";
+SET @l4="TIMER_RESOLUTION BIGINT,";
+SET @l5="TIMER_OVERHEAD BIGINT";
+SET @l6=") ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE RWLOCK_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.rwlock_instances(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
+SET @l4="WRITE_LOCKED_BY_THREAD_ID INTEGER,";
+SET @l5="READ_LOCKED_BY_COUNT INTEGER unsigned not null";
+SET @l6=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_CONSUMERS
+--
+
+SET @l1="CREATE TABLE performance_schema.setup_consumers(";
+SET @l2="NAME VARCHAR(64) not null,";
+SET @l3="ENABLED ENUM ('YES', 'NO') not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_INSTRUMENTS
+--
+
+SET @l1="CREATE TABLE performance_schema.setup_instruments(";
+SET @l2="NAME VARCHAR(128) not null,";
+SET @l3="ENABLED ENUM ('YES', 'NO') not null,";
+SET @l4="TIMED ENUM ('YES', 'NO') not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE SETUP_TIMERS
+--
+
+SET @l1="CREATE TABLE performance_schema.setup_timers(";
+SET @l2="NAME VARCHAR(64) not null,";
+SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null";
+SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- TABLE THREADS
+--
+
+SET @l1="CREATE TABLE performance_schema.threads(";
+SET @l2="THREAD_ID INTEGER not null,";
+SET @l3="PROCESSLIST_ID INTEGER,";
+SET @l4="NAME VARCHAR(128) not null";
+SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
+
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+--
+-- Unlike 'performance_schema', the 'mysql' database is reserved already,
+-- so no user procedure is supposed to be there.
+--
+-- NOTE: until upgrade is finished, stored routines are not available,
+-- because system tables (e.g. mysql.proc) might be not usable.
+--
+drop procedure if exists mysql.die;
+create procedure mysql.die() signal sqlstate 'HY000' set message_text='Unexpected content found in the performance_schema database.';
+
+--
+-- For broken upgrades, SIGNAL the error
+--
+
+SET @cmd="call mysql.die()";
+
+SET @str = IF(@broken_pfs > 0, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+drop procedure mysql.die;
diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql
index e2ec4ed237e..a55c5f60351 100644
--- a/scripts/mysql_system_tables.sql
+++ b/scripts/mysql_system_tables.sql
@@ -21,6 +21,7 @@
set sql_mode='';
set storage_engine=myisam;
+flush tables;
CREATE TABLE IF NOT EXISTS db ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db,User), KEY User (User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Database privileges';
@@ -100,384 +101,6 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM;
---
--- PERFORMANCE SCHEMA INSTALLATION
--- Note that this script is also reused by mysql_upgrade,
--- so we have to be very careful here to not destroy any
--- existing database named 'performance_schema' if it
--- can contain user data.
--- In case of downgrade, it's ok to drop unknown tables
--- from a future version, as long as they belong to the
--- performance schema engine.
---
-
-set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema');
-
-SET @l1="SET @broken_tables = (select count(*) from information_schema.tables";
-SET @l2=" where engine != \'PERFORMANCE_SCHEMA\' and table_schema=\'performance_schema\')";
-SET @cmd=concat(@l1,@l2);
-
--- Work around for bug#49542
-SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
-SET @l1="SET @broken_views = (select count(*) from information_schema.views";
-SET @l2=" where table_schema='performance_schema')";
-SET @cmd=concat(@l1,@l2);
-
--- Work around for bug#49542
-SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
-SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema');
-
-SET @broken_events = (select count(*) from mysql.event where db='performance_schema');
-
-SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events);
-
---
--- The performance schema database.
--- Only drop and create the database if this is safe (no broken_pfs).
--- This database is created, even in --without-perfschema builds,
--- so that the database name is always reserved by the MySQL implementation.
---
-
-SET @cmd= "DROP DATABASE IF EXISTS performance_schema";
-
-SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
-SET @cmd= "CREATE DATABASE performance_schema character set utf8";
-
-SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- From this point, only create the performance schema tables
--- if the server is build with performance schema
---
-
-set @have_pfs= (select count(engine) from information_schema.engines where engine='PERFORMANCE_SCHEMA' and support != 'NO');
-
---
--- TABLE COND_INSTANCES
---
-
-SET @l1="CREATE TABLE performance_schema.cond_instances(";
-SET @l2="NAME VARCHAR(128) not null,";
-SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null";
-SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE EVENTS_WAITS_CURRENT
---
-
-SET @l1="CREATE TABLE performance_schema.events_waits_current(";
-SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="EVENT_ID BIGINT unsigned not null,";
-SET @l4="EVENT_NAME VARCHAR(128) not null,";
-SET @l5="SOURCE VARCHAR(64),";
-SET @l6="TIMER_START BIGINT unsigned,";
-SET @l7="TIMER_END BIGINT unsigned,";
-SET @l8="TIMER_WAIT BIGINT unsigned,";
-SET @l9="SPINS INTEGER unsigned,";
-SET @l10="OBJECT_SCHEMA VARCHAR(64),";
-SET @l11="OBJECT_NAME VARCHAR(512),";
-SET @l12="OBJECT_TYPE VARCHAR(64),";
-SET @l13="OBJECT_INSTANCE_BEGIN BIGINT not null,";
-SET @l14="NESTING_EVENT_ID BIGINT unsigned,";
-SET @l15="OPERATION VARCHAR(16) not null,";
-SET @l16="NUMBER_OF_BYTES BIGINT unsigned,";
-SET @l17="FLAGS INTEGER unsigned";
-SET @l18=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE EVENTS_WAITS_HISTORY
---
-
-SET @l1="CREATE TABLE performance_schema.events_waits_history(";
--- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE EVENTS_WAITS_HISTORY_LONG
---
-
-SET @l1="CREATE TABLE performance_schema.events_waits_history_long(";
--- lines 2 to 18 are unchanged from EVENTS_WAITS_CURRENT
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9,@l10,@l11,@l12,@l13,@l14,@l15,@l16,@l17,@l18);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE EVENTS_WAITS_SUMMARY_BY_INSTANCE
---
-
-SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_instance(";
-SET @l2="EVENT_NAME VARCHAR(128) not null,";
-SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
-SET @l4="COUNT_STAR BIGINT unsigned not null,";
-SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,";
-SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,";
-SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,";
-SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null";
-SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
---
-
-SET @l1="CREATE TABLE performance_schema.events_waits_summary_by_thread_by_event_name(";
-SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="EVENT_NAME VARCHAR(128) not null,";
-SET @l4="COUNT_STAR BIGINT unsigned not null,";
-SET @l5="SUM_TIMER_WAIT BIGINT unsigned not null,";
-SET @l6="MIN_TIMER_WAIT BIGINT unsigned not null,";
-SET @l7="AVG_TIMER_WAIT BIGINT unsigned not null,";
-SET @l8="MAX_TIMER_WAIT BIGINT unsigned not null";
-SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME
---
-
-SET @l1="CREATE TABLE performance_schema.events_waits_summary_global_by_event_name(";
-SET @l2="EVENT_NAME VARCHAR(128) not null,";
-SET @l3="COUNT_STAR BIGINT unsigned not null,";
-SET @l4="SUM_TIMER_WAIT BIGINT unsigned not null,";
-SET @l5="MIN_TIMER_WAIT BIGINT unsigned not null,";
-SET @l6="AVG_TIMER_WAIT BIGINT unsigned not null,";
-SET @l7="MAX_TIMER_WAIT BIGINT unsigned not null";
-SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE FILE_INSTANCES
---
-
-SET @l1="CREATE TABLE performance_schema.file_instances(";
-SET @l2="FILE_NAME VARCHAR(512) not null,";
-SET @l3="EVENT_NAME VARCHAR(128) not null,";
-SET @l4="OPEN_COUNT INTEGER unsigned not null";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE FILE_SUMMARY_BY_EVENT_NAME
---
-
-SET @l1="CREATE TABLE performance_schema.file_summary_by_event_name(";
-SET @l2="EVENT_NAME VARCHAR(128) not null,";
-SET @l3="COUNT_READ BIGINT unsigned not null,";
-SET @l4="COUNT_WRITE BIGINT unsigned not null,";
-SET @l5="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,";
-SET @l6="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null";
-SET @l7=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE FILE_SUMMARY_BY_INSTANCE
---
-
-SET @l1="CREATE TABLE performance_schema.file_summary_by_instance(";
-SET @l2="FILE_NAME VARCHAR(512) not null,";
-SET @l3="EVENT_NAME VARCHAR(128) not null,";
-SET @l4="COUNT_READ BIGINT unsigned not null,";
-SET @l5="COUNT_WRITE BIGINT unsigned not null,";
-SET @l6="SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,";
-SET @l7="SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null";
-SET @l8=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE MUTEX_INSTANCES
---
-
-SET @l1="CREATE TABLE performance_schema.mutex_instances(";
-SET @l2="NAME VARCHAR(128) not null,";
-SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
-SET @l4="LOCKED_BY_THREAD_ID INTEGER";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE PERFORMANCE_TIMERS
---
-
-SET @l1="CREATE TABLE performance_schema.performance_timers(";
-SET @l2="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null,";
-SET @l3="TIMER_FREQUENCY BIGINT,";
-SET @l4="TIMER_RESOLUTION BIGINT,";
-SET @l5="TIMER_OVERHEAD BIGINT";
-SET @l6=") ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE RWLOCK_INSTANCES
---
-
-SET @l1="CREATE TABLE performance_schema.rwlock_instances(";
-SET @l2="NAME VARCHAR(128) not null,";
-SET @l3="OBJECT_INSTANCE_BEGIN BIGINT not null,";
-SET @l4="WRITE_LOCKED_BY_THREAD_ID INTEGER,";
-SET @l5="READ_LOCKED_BY_COUNT INTEGER unsigned not null";
-SET @l6=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE SETUP_CONSUMERS
---
-
-SET @l1="CREATE TABLE performance_schema.setup_consumers(";
-SET @l2="NAME VARCHAR(64) not null,";
-SET @l3="ENABLED ENUM ('YES', 'NO') not null";
-SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE SETUP_INSTRUMENTS
---
-
-SET @l1="CREATE TABLE performance_schema.setup_instruments(";
-SET @l2="NAME VARCHAR(128) not null,";
-SET @l3="ENABLED ENUM ('YES', 'NO') not null,";
-SET @l4="TIMED ENUM ('YES', 'NO') not null";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE SETUP_TIMERS
---
-
-SET @l1="CREATE TABLE performance_schema.setup_timers(";
-SET @l2="NAME VARCHAR(64) not null,";
-SET @l3="TIMER_NAME ENUM ('CYCLE', 'NANOSECOND', 'MICROSECOND', 'MILLISECOND', 'TICK') not null";
-SET @l4=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
---
--- TABLE THREADS
---
-
-SET @l1="CREATE TABLE performance_schema.threads(";
-SET @l2="THREAD_ID INTEGER not null,";
-SET @l3="PROCESSLIST_ID INTEGER,";
-SET @l4="NAME VARCHAR(128) not null";
-SET @l5=")ENGINE=PERFORMANCE_SCHEMA;";
-
-SET @cmd=concat(@l1,@l2,@l3,@l4,@l5);
-
-SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
CREATE TABLE IF NOT EXISTS proxies_priv (Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Proxied_host char(60) binary DEFAULT '' NOT NULL, Proxied_user char(16) binary DEFAULT '' NOT NULL, With_grant BOOL DEFAULT 0 NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Timestamp timestamp, PRIMARY KEY Host (Host,User,Proxied_host,Proxied_user), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='User proxy privileges';
-- Remember for later if proxies_priv table already existed
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index cc697092e6e..c2d63f12399 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -621,29 +621,6 @@ ALTER TABLE user MODIFY Create_tablespace_priv enum('N','Y') COLLATE utf8_genera
UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePriv = 0;
---
--- Unlike 'performance_schema', the 'mysql' database is reserved already,
--- so no user procedure is supposed to be there.
---
--- NOTE: until upgrade is finished, stored routines are not available,
--- because system tables (e.g. mysql.proc) might be not usable.
---
-drop procedure if exists mysql.die;
-create procedure mysql.die() signal sqlstate 'HY000' set message_text='Unexpected content found in the performance_schema database.';
-
---
--- For broken upgrades, SIGNAL the error
---
-
-SET @cmd="call mysql.die()";
-
-SET @str = IF(@broken_pfs > 0, @cmd, 'SET @dummy = 0');
-PREPARE stmt FROM @str;
-EXECUTE stmt;
-DROP PREPARE stmt;
-
-drop procedure mysql.die;
-
ALTER TABLE user ADD plugin char(64) DEFAULT '', ADD authentication_string TEXT;
ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL;
ALTER TABLE user MODIFY authentication_string TEXT NOT NULL;
diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh
index 9fb9e78e753..43844e5ec68 100644
--- a/scripts/mysqlaccess.sh
+++ b/scripts/mysqlaccess.sh
@@ -930,7 +930,7 @@ sub MergeConfigFile {
$unsafeConfig = $fname;
}
}
- if ( $group eq 'client' ) {
+ if ( $group eq 'client' || $group eq "client-server") {
$MYSQL_CNF{'mysql'}{$item} = $value;
$MYSQL_CNF{'mysqldump'}{$item} = $value;
} else {
@@ -2423,7 +2423,7 @@ sub Print_Header {
sub Print_Footer {
if ($MySQLaccess::CMD) { #command-line mode
print "\n"
- ."BUGs can be reported by email to bugs\@mysql.com\n";
+ ."BUGs can be reported trough https://mariadb.atlassian.net/browse/MDEV\n";
}
if ($MySQLaccess::CGI) { #CGI-BIN mode
if ($MySQLaccess::Param{'brief'}) {
@@ -2431,7 +2431,7 @@ sub Print_Footer {
}
print "<HR>\n"
."<ADDRESS>\n"
- ."BUGs can be reported by email to <a href=mailto:bugs\@mysql.com>bugs\@mysql.com</a><BR>\n"
+ ."BUGs can be reported through <a href=\"https://mariadb.atlassian.net/browse/MDEV\">MariaDB JIRA</a><BR>\n"
# ."Don't forget to mention the version $VERSION!<BR>\n"
."</ADDRESS>\n"
."</BODY>\n"
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 99ce187fcd4..81015746ae9 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -64,6 +64,28 @@ $homedir = $ENV{HOME};
$my_progname = $0;
$my_progname =~ s/.*[\/]//;
+
+if (defined($ENV{UMASK})) {
+ my $UMASK = $ENV{UMASK};
+ my $m;
+ my $fmode = "0640";
+
+ if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) {
+ printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n");
+ printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); }
+ else {
+ $fmode= substr $UMASK, 2, 2;
+ $fmode= "06${fmode}"; }
+
+ if($fmode != $UMASK) {
+ printf("UMASK corrected from $UMASK to $fmode ...\n"); }
+
+ $fmode= oct($fmode);
+
+ umask($fmode);
+}
+
+
main();
####
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index aaf1936afe1..f49f885bf5a 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -32,7 +32,28 @@ syslog_tag_mysqld_safe=mysqld_safe
trap '' 1 2 3 15 # we shouldn't let anyone kill us
-umask 007
+# MySQL-specific environment variable. First off, it's not really a umask,
+# it's the desired mode. Second, it follows umask(2), not umask(3) in that
+# octal needs to be explicit. Our shell might be a proper sh without printf,
+# multiple-base arithmetic, and binary arithmetic, so this will get ugly.
+# We reject decimal values to keep things at least half-sane.
+umask 007 # fallback
+UMASK="${UMASK-0640}"
+fmode=`echo "$UMASK" | sed -e 's/[^0246]//g'`
+octalp=`echo "$fmode"|cut -c1`
+fmlen=`echo "$fmode"|wc -c|sed -e 's/ //g'`
+if [ "x$octalp" != "x0" -o "x$UMASK" != "x$fmode" -o "x$fmlen" != "x5" ]
+then
+ fmode=0640
+ echo "UMASK must be a 3-digit mode with an additional leading 0 to indicate octal." >&2
+ echo "The first digit will be corrected to 6, the others may be 0, 2, 4, or 6." >&2
+fi
+fmode=`echo "$fmode"|cut -c3-4`
+fmode="6$fmode"
+if [ "x$UMASK" != "x0$fmode" ]
+then
+ echo "UMASK corrected from $UMASK to 0$fmode ..."
+fi
defaults=
case "$1" in
@@ -429,29 +450,6 @@ else
DATADIR=@localstatedir@
fi
-#
-# Try to find the plugin directory
-#
-
-# Use user-supplied argument
-if [ -n "${PLUGIN_DIR}" ]; then
- plugin_dir="${PLUGIN_DIR}"
-else
- # Try to find plugin dir relative to basedir
- for dir in lib/mysql/plugin lib/plugin
- do
- if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then
- plugin_dir="${MY_BASEDIR_VERSION}/${dir}"
- break
- fi
- done
- # Give up and use compiled-in default
- if [ -z "${plugin_dir}" ]; then
- plugin_dir='@pkgplugindir@'
- fi
-fi
-plugin_dir="${plugin_dir}${PLUGIN_VARIANT}"
-
if test -z "$MYSQL_HOME"
then
if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf"
@@ -512,6 +510,31 @@ fi
parse_arguments `$print_defaults $defaults --loose-verbose mysqld_safe safe_mysqld`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
+
+#
+# Try to find the plugin directory
+#
+
+# Use user-supplied argument
+if [ -n "${PLUGIN_DIR}" ]; then
+ plugin_dir="${PLUGIN_DIR}"
+else
+ # Try to find plugin dir relative to basedir
+ for dir in lib/mysql/plugin lib/plugin
+ do
+ if [ -d "${MY_BASEDIR_VERSION}/${dir}" ]; then
+ plugin_dir="${MY_BASEDIR_VERSION}/${dir}"
+ break
+ fi
+ done
+ # Give up and use compiled-in default
+ if [ -z "${plugin_dir}" ]; then
+ plugin_dir='@pkgplugindir@'
+ fi
+fi
+plugin_dir="${plugin_dir}${PLUGIN_VARIANT}"
+
+
# Determine what logging facility to use
# Ensure that 'logger' exists, if it's requested
@@ -561,6 +584,12 @@ then
# Log to err_log file
log_notice "Logging to '$err_log'."
logging=file
+
+ if [ ! -e "$err_log" ]; then # if error log already exists,
+ touch "$err_log" # we just append. otherwise,
+ chmod "$fmode" "$err_log" # fix the permissions here!
+ fi
+
else
if [ -n "$syslog_tag" ]
then
@@ -776,6 +805,12 @@ do
eval_log_error "$cmd"
+ if [ $want_syslog -eq 0 -a ! -e "$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
+ fi # it up correctly while we can!
+
end_time=`date +%M%S`
if test ! -f "$pid_file" # This is removed if normal shutdown
diff --git a/sql-common/client.c b/sql-common/client.c
index e4c4c2ad4a1..96fc8cf71a2 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -4444,8 +4444,8 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
DBUG_RETURN(CR_SERVER_HANDSHAKE_ERR);
/* save it in MYSQL */
- memmove(mysql->scramble, pkt, pkt_len);
- mysql->scramble[pkt_len] = 0;
+ memmove(mysql->scramble, pkt, pkt_len - 1);
+ mysql->scramble[pkt_len - 1] = 0;
}
if (mysql->passwd[0])
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 0be452a5f86..4aa7b8f882e 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -298,7 +298,6 @@ IF(WIN32 AND MYSQLD_EXECUTABLE)
COMMAND ${CMAKE_COMMAND}
${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data
- COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
DEPENDS mysqld
)
ADD_CUSTOM_TARGET(initial_database
@@ -325,11 +324,12 @@ IF(WIN32)
ADD_CUSTOM_COMMAND(OUTPUT
${my_bootstrap_sql}
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/scripts
- cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql ${native_outfile}
+ cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql+mysql_performance_tables.sql ${native_outfile}
DEPENDS
${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables.sql
${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables_data.sql
${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql
+ ${CMAKE_SOURCE_DIR}/scripts/mysql_performance_tables.sql
)
ADD_CUSTOM_COMMAND(
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index fb0887e25d1..b7e82d8b4b9 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -409,7 +409,6 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
TABLE *event_table,
const char *db)
{
- int ret=0;
CHARSET_INFO *scs= system_charset_info;
KEY *key_info;
uint key_len;
@@ -419,7 +418,14 @@ Event_db_repository::index_read_for_db_for_i_s(THD *thd, TABLE *schema_table,
DBUG_ENTER("Event_db_repository::index_read_for_db_for_i_s");
DBUG_PRINT("info", ("Using prefix scanning on PK"));
- event_table->file->ha_index_init(0, 1);
+
+ int ret= event_table->file->ha_index_init(0, 1);
+ if (ret)
+ {
+ event_table->file->print_error(ret, MYF(0));
+ DBUG_RETURN(true);
+ }
+
key_info= event_table->key_info;
if (key_info->key_parts == 0 ||
diff --git a/sql/field.cc b/sql/field.cc
index cc911dd80d8..d4468ba3c5b 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -1114,6 +1114,21 @@ bool Field::type_can_have_key_part(enum enum_field_types type)
}
+void Field::make_sort_key(uchar *buff,uint length)
+{
+ if (maybe_null())
+ {
+ if (is_null())
+ {
+ bzero(buff, length + 1);
+ return;
+ }
+ *buff++= 1;
+ }
+ sort_string(buff, length);
+}
+
+
/**
Numeric fields base class constructor.
*/
diff --git a/sql/field.h b/sql/field.h
index f450e596e03..e832928b114 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -519,6 +519,7 @@ public:
return bytes;
}
+ void make_sort_key(uchar *buff, uint length);
virtual void make_field(Send_field *);
virtual void sort_string(uchar *buff,uint length)=0;
virtual bool optimize_range(uint idx, uint part);
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 3f735e94a11..f31afc226cc 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -61,7 +61,6 @@ static void make_sortkey(Sort_param *param, uchar *to, uchar *ref_pos);
static void register_used_fields(Sort_param *param);
static bool save_index(Sort_param *param, uint count,
Filesort_info *table_sort);
-static void make_sortkey(Sort_param *param, uchar *to, uchar *ref_pos);
static uint suffix_length(ulong string_length);
static uint sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
bool *multi_byte_charset);
@@ -181,6 +180,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
when index_merge select has finished with it.
*/
table->sort.io_cache= NULL;
+ DBUG_ASSERT(table_sort.record_pointers == NULL);
outfile= table_sort.io_cache;
my_b_clear(&tempfile);
@@ -608,6 +608,8 @@ static ha_rows find_all_keys(Sort_param *param, SQL_SELECT *select,
if (!quick_select)
{
next_pos=(uchar*) 0; /* Find records in sequence */
+ DBUG_EXECUTE_IF("bug14365043_1",
+ DBUG_SET("+d,ha_rnd_init_fail"););
if (file->ha_rnd_init_with_error(1))
DBUG_RETURN(HA_POS_ERROR);
file->extra_opt(HA_EXTRA_CACHE,
@@ -865,21 +867,9 @@ static void make_sortkey(register Sort_param *param,
bool maybe_null=0;
if ((field=sort_field->field))
{ // Field
- if (field->maybe_null())
- {
- if (field->is_null())
- {
- if (sort_field->reverse)
- memset(to, 255, sort_field->length+1);
- else
- memset(to, 0, sort_field->length+1);
- to+= sort_field->length+1;
- continue;
- }
- else
- *to++=1;
- }
- field->sort_string(to, sort_field->length);
+ field->make_sort_key(to, sort_field->length);
+ if ((maybe_null = field->maybe_null()))
+ to++;
}
else
{ // Item
@@ -1039,8 +1029,11 @@ static void make_sortkey(register Sort_param *param,
}
if (sort_field->reverse)
{ /* Revers key */
- if (maybe_null)
- to[-1]= ~to[-1];
+ if (maybe_null && (to[-1]= !to[-1]))
+ {
+ to+= sort_field->length; // don't waste the time reversing all 0's
+ continue;
+ }
length=sort_field->length;
while (length--)
{
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index 2b72ffef9bf..1544678de38 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2006, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2012, 2013, Monty Proram 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
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 9a9f0b537f7..ce3f17aeb92 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -2850,6 +2850,17 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
if (bitmap_init(&m_bulk_insert_started, NULL, m_tot_parts + 1, FALSE))
DBUG_RETURN(error);
bitmap_clear_all(&m_bulk_insert_started);
+ /*
+ Initialize the bitmap we use to keep track of partitions which returned
+ HA_ERR_KEY_NOT_FOUND from index_read_map.
+ */
+ if (bitmap_init(&m_key_not_found_partitions, NULL, m_tot_parts, FALSE))
+ {
+ bitmap_free(&m_bulk_insert_started);
+ DBUG_RETURN(error);
+ }
+ bitmap_clear_all(&m_key_not_found_partitions);
+ m_key_not_found= false;
/* Initialize the bitmap we use to determine what partitions are used */
if (!m_is_clone_of)
{
@@ -2992,6 +3003,7 @@ err_handler:
(*file)->ha_close();
err_alloc:
bitmap_free(&m_bulk_insert_started);
+ bitmap_free(&m_key_not_found_partitions);
if (!m_is_clone_of)
bitmap_free(&(m_part_info->used_partitions));
@@ -3068,6 +3080,7 @@ int ha_partition::close(void)
DBUG_ASSERT(table->s == table_share);
destroy_record_priority_queue();
bitmap_free(&m_bulk_insert_started);
+ bitmap_free(&m_key_not_found_partitions);
if (!m_is_clone_of)
bitmap_free(&(m_part_info->used_partitions));
file= m_file;
@@ -4590,21 +4603,24 @@ int ha_partition::index_read_map(uchar *buf, const uchar *key,
}
-/*
+/**
Common routine for a number of index_read variants
- SYNOPSIS
- ha_partition::common_index_read()
- buf Buffer where the record should be returned
- have_start_key TRUE <=> the left endpoint is available, i.e.
- we're in index_read call or in read_range_first
- call and the range has left endpoint
-
- FALSE <=> there is no left endpoint (we're in
- read_range_first() call and the range has no left
- endpoint)
+ @param buf Buffer where the record should be returned.
+ @param have_start_key TRUE <=> the left endpoint is available, i.e.
+ we're in index_read call or in read_range_first
+ call and the range has left endpoint.
+ FALSE <=> there is no left endpoint (we're in
+ read_range_first() call and the range has no left
+ endpoint).
- DESCRIPTION
+ @return Operation status
+ @retval 0 OK
+ @retval HA_ERR_END_OF_FILE Whole index scanned, without finding the record.
+ @retval HA_ERR_KEY_NOT_FOUND Record not found, but index cursor positioned.
+ @retval other error code.
+
+ @details
Start scanning the range (when invoked from read_range_first()) or doing
an index lookup (when invoked from index_read_XXX):
- If possible, perform partition selection
@@ -4614,10 +4630,6 @@ int ha_partition::index_read_map(uchar *buf, const uchar *key,
handle_unordered_scan_next_partition)
YES: Fill the priority queue and get the record that is the first in
the ordering
-
- RETURN
- 0 OK
- other HA_ERR_END_OF_FILE or other error code.
*/
int ha_partition::common_index_read(uchar *buf, bool have_start_key)
@@ -4627,14 +4639,16 @@ int ha_partition::common_index_read(uchar *buf, bool have_start_key)
bool reverse_order= FALSE;
DBUG_ENTER("ha_partition::common_index_read");
- DBUG_PRINT("info", ("m_ordered: %u have_start_key: %u",
- m_ordered, have_start_key));
+ DBUG_PRINT("info", ("m_ordered %u m_ordered_scan_ong %u",
+ m_ordered, m_ordered_scan_ongoing));
if (have_start_key)
{
m_start_key.length= key_len= calculate_key_len(table, active_index,
m_start_key.key,
m_start_key.keypart_map);
+ DBUG_PRINT("info", ("have_start_key map %lu find_flag %u len %u",
+ m_start_key.keypart_map, m_start_key.flag, key_len));
DBUG_ASSERT(key_len);
}
if ((error= partition_scan_set_up(buf, have_start_key)))
@@ -4652,24 +4666,16 @@ int ha_partition::common_index_read(uchar *buf, bool have_start_key)
}
DBUG_PRINT("info", ("m_ordered %u m_o_scan_ong %u have_start_key %u",
m_ordered, m_ordered_scan_ongoing, have_start_key));
- if (!m_ordered_scan_ongoing ||
- (have_start_key && m_start_key.flag == HA_READ_KEY_EXACT &&
- !m_pkey_is_clustered &&
- key_len >= m_curr_key_info[0]->key_length))
+ if (!m_ordered_scan_ongoing)
{
/*
- We use unordered index scan either when read_range is used and flag
- is set to not use ordered or when an exact key is used and in this
- case all records will be sorted equal and thus the sort order of the
- resulting records doesn't matter.
+ We use unordered index scan when read_range is used and flag
+ is set to not use ordered.
We also use an unordered index scan when the number of partitions to
scan is only one.
The unordered index scan will use the partition set created.
- Need to set unordered scan ongoing since we can come here even when
- it isn't set.
*/
DBUG_PRINT("info", ("doing unordered scan"));
- m_ordered_scan_ongoing= FALSE;
error= handle_unordered_scan_next_partition(buf);
}
else
@@ -4850,6 +4856,8 @@ int ha_partition::index_next(uchar * buf)
TODO(low priority):
If we want partition to work with the HANDLER commands, we
must be able to do index_last() -> index_prev() -> index_next()
+ and if direction changes, we must step back those partitions in
+ the record queue so we don't return a value from the wrong direction.
*/
DBUG_ASSERT(m_index_scan_type != partition_index_last);
if (!m_ordered_scan_ongoing)
@@ -5103,10 +5111,18 @@ int ha_partition::partition_scan_set_up(uchar * buf, bool idx_read_flag)
int ha_partition::handle_unordered_next(uchar *buf, bool is_next_same)
{
- handler *file= m_file[m_part_spec.start_part];
+ handler *file;
int error;
DBUG_ENTER("ha_partition::handle_unordered_next");
+ if (m_part_spec.start_part >= m_tot_parts)
+ {
+ /* Should never happen! */
+ DBUG_ASSERT(0);
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ }
+ file= m_file[m_part_spec.start_part];
+
/*
We should consider if this should be split into three functions as
partition_read_range is_next_same are always local constants
@@ -5167,6 +5183,7 @@ int ha_partition::handle_unordered_next(uchar *buf, bool is_next_same)
int ha_partition::handle_unordered_scan_next_partition(uchar * buf)
{
uint i;
+ int saved_error= HA_ERR_END_OF_FILE;
DBUG_ENTER("ha_partition::handle_unordered_scan_next_partition");
for (i= m_part_spec.start_part; i <= m_part_spec.end_part; i++)
@@ -5217,26 +5234,33 @@ int ha_partition::handle_unordered_scan_next_partition(uchar * buf)
}
if ((error != HA_ERR_END_OF_FILE) && (error != HA_ERR_KEY_NOT_FOUND))
DBUG_RETURN(error);
- DBUG_PRINT("info", ("HA_ERR_END_OF_FILE on partition %d", i));
+
+ /*
+ If HA_ERR_KEY_NOT_FOUND, we must return that error instead of
+ HA_ERR_END_OF_FILE, to be able to continue search.
+ */
+ if (saved_error != HA_ERR_KEY_NOT_FOUND)
+ saved_error= error;
+ DBUG_PRINT("info", ("END_OF_FILE/KEY_NOT_FOUND on partition %d", i));
}
- m_part_spec.start_part= NO_CURRENT_PART_ID;
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ if (saved_error == HA_ERR_END_OF_FILE)
+ m_part_spec.start_part= NO_CURRENT_PART_ID;
+ DBUG_RETURN(saved_error);
}
-/*
- Common routine to start index scan with ordered results
+/**
+ Common routine to start index scan with ordered results.
- SYNOPSIS
- handle_ordered_index_scan()
- out:buf Read row in MySQL Row Format
+ @param[out] buf Read row in MySQL Row Format
- RETURN VALUE
- HA_ERR_END_OF_FILE End of scan
- 0 Success
- other Error code
+ @return Operation status
+ @retval HA_ERR_END_OF_FILE End of scan
+ @retval HA_ERR_KEY_NOT_FOUNE End of scan
+ @retval 0 Success
+ @retval other Error code
- DESCRIPTION
+ @details
This part contains the logic to handle index scans that require ordered
output. This includes all except those started by read_range_first with
the flag ordered set to FALSE. Thus most direct index_read and all
@@ -5258,8 +5282,14 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
uint j= queue_first_element(&m_queue);
bool found= FALSE;
uchar *part_rec_buf_ptr= m_ordered_rec_buffer;
+ int saved_error= HA_ERR_END_OF_FILE;
DBUG_ENTER("ha_partition::handle_ordered_index_scan");
+ if (m_key_not_found)
+ {
+ m_key_not_found= false;
+ bitmap_clear_all(&m_key_not_found_partitions);
+ }
m_top_entry= NO_CURRENT_PART_ID;
queue_remove_all(&m_queue);
@@ -5321,6 +5351,13 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
{
DBUG_RETURN(error);
}
+ else if (error == HA_ERR_KEY_NOT_FOUND)
+ {
+ DBUG_PRINT("info", ("HA_ERR_KEY_NOT_FOUND from partition %u", i));
+ bitmap_set_bit(&m_key_not_found_partitions, i);
+ m_key_not_found= true;
+ saved_error= error;
+ }
part_rec_buf_ptr+= m_rec_length + PARTITION_BYTES_IN_POS;
}
if (found)
@@ -5338,7 +5375,7 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
DBUG_PRINT("info", ("Record returned from partition %d", m_top_entry));
DBUG_RETURN(0);
}
- DBUG_RETURN(HA_ERR_END_OF_FILE);
+ DBUG_RETURN(saved_error);
}
@@ -5366,6 +5403,59 @@ void ha_partition::return_top_record(uchar *buf)
}
+/**
+ Add index_next/prev from partitions without exact match.
+
+ If there where any partitions that returned HA_ERR_KEY_NOT_FOUND when
+ ha_index_read_map was done, those partitions must be included in the
+ following index_next/prev call.
+*/
+
+int ha_partition::handle_ordered_index_scan_key_not_found()
+{
+ int error;
+ uint i;
+ uchar *part_buf= m_ordered_rec_buffer;
+ uchar *curr_rec_buf= NULL;
+ DBUG_ENTER("ha_partition::handle_ordered_index_scan_key_not_found");
+ DBUG_ASSERT(m_key_not_found);
+ /*
+ Loop over all used partitions to get the correct offset
+ into m_ordered_rec_buffer.
+ */
+ for (i= 0; i < m_tot_parts; i++)
+ {
+ if (!bitmap_is_set(&m_part_info->used_partitions, i))
+ continue;
+
+ if (bitmap_is_set(&m_key_not_found_partitions, i))
+ {
+ /*
+ This partition is used and did return HA_ERR_KEY_NOT_FOUND
+ in index_read_map.
+ */
+ curr_rec_buf= part_buf + PARTITION_BYTES_IN_POS;
+ error= m_file[i]->index_next(curr_rec_buf);
+ /* HA_ERR_KEY_NOT_FOUND is not allowed from index_next! */
+ DBUG_ASSERT(error != HA_ERR_KEY_NOT_FOUND);
+ if (!error)
+ queue_insert(&m_queue, part_buf);
+ else if (error != HA_ERR_END_OF_FILE && error != HA_ERR_KEY_NOT_FOUND)
+ DBUG_RETURN(error);
+ }
+ part_buf+= m_rec_length + PARTITION_BYTES_IN_POS;
+ }
+ DBUG_ASSERT(curr_rec_buf);
+ bitmap_clear_all(&m_key_not_found_partitions);
+ m_key_not_found= false;
+
+ /* Update m_top_entry, which may have changed. */
+ uchar *key_buffer= queue_top(&m_queue);
+ m_top_entry= uint2korr(key_buffer);
+ DBUG_RETURN(0);
+}
+
+
/*
Common routine to handle index_next with ordered results
@@ -5385,9 +5475,45 @@ int ha_partition::handle_ordered_next(uchar *buf, bool is_next_same)
int error;
uint part_id= m_top_entry;
uchar *rec_buf= queue_top(&m_queue) + PARTITION_BYTES_IN_POS;
- handler *file= m_file[part_id];
+ handler *file;
DBUG_ENTER("ha_partition::handle_ordered_next");
+ if (m_key_not_found)
+ {
+ if (is_next_same)
+ {
+ /* Only rows which match the key. */
+ m_key_not_found= false;
+ bitmap_clear_all(&m_key_not_found_partitions);
+ }
+ else
+ {
+ /* There are partitions not included in the index record queue. */
+ uint old_elements= m_queue.elements;
+ if ((error= handle_ordered_index_scan_key_not_found()))
+ DBUG_RETURN(error);
+ /*
+ If the queue top changed, i.e. one of the partitions that gave
+ HA_ERR_KEY_NOT_FOUND in index_read_map found the next record,
+ return it.
+ Otherwise replace the old with a call to index_next (fall through).
+ */
+ if (old_elements != m_queue.elements && part_id != m_top_entry)
+ {
+ return_top_record(buf);
+ DBUG_RETURN(0);
+ }
+ }
+ }
+ if (part_id >= m_tot_parts)
+ {
+ /* This should never happen! */
+ DBUG_ASSERT(0);
+ DBUG_RETURN(HA_ERR_END_OF_FILE);
+ }
+
+ file= m_file[part_id];
+
if (m_index_scan_type == partition_read_range)
{
error= file->read_range_next();
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index fff586f52e4..53f0c4f2484 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -182,6 +182,9 @@ private:
static int compare_number_of_records(ha_partition *me,
const uint32 *a,
const uint32 *b);
+ /** partitions that returned HA_ERR_KEY_NOT_FOUND. */
+ MY_BITMAP m_key_not_found_partitions;
+ bool m_key_not_found;
public:
handler *clone(const char *name, MEM_ROOT *mem_root);
virtual void set_part_info(partition_info *part_info)
@@ -516,6 +519,7 @@ private:
int handle_unordered_next(uchar * buf, bool next_same);
int handle_unordered_scan_next_partition(uchar * buf);
int handle_ordered_index_scan(uchar * buf, bool reverse_order);
+ int handle_ordered_index_scan_key_not_found();
int handle_ordered_next(uchar * buf, bool next_same);
int handle_ordered_prev(uchar * buf);
void return_top_record(uchar * buf);
diff --git a/sql/handler.cc b/sql/handler.cc
index 0fac0d756ca..150bbee39a9 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -700,7 +700,6 @@ static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
return FALSE;
}
-
/**
@note
don't bother to rollback here, it's done already
@@ -710,6 +709,25 @@ void ha_close_connection(THD* thd)
plugin_foreach(thd, closecon_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, 0);
}
+static my_bool kill_handlerton(THD *thd, plugin_ref plugin,
+ void *level)
+{
+ handlerton *hton= plugin_data(plugin, handlerton *);
+
+ if (hton->state == SHOW_OPTION_YES && hton->kill_query &&
+ thd_get_ha_data(thd, hton))
+ hton->kill_query(hton, thd, *(enum thd_kill_levels *) level);
+ return FALSE;
+}
+
+void ha_kill_query(THD* thd, enum thd_kill_levels level)
+{
+ DBUG_ENTER("ha_kill_query");
+ plugin_foreach(thd, kill_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, &level);
+ DBUG_VOID_RETURN;
+}
+
+
/* ========================================================================
======================= TRANSACTIONS ===================================*/
@@ -2365,18 +2383,25 @@ int handler::read_first_row(uchar * buf, uint primary_key)
if (stats.deleted < 10 || primary_key >= MAX_KEY ||
!(index_flags(primary_key, 0, 0) & HA_READ_ORDER))
{
- if ((!(error= ha_rnd_init(1))))
+ if (!(error= ha_rnd_init(1)))
{
- while ((error= ha_rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
- (void) ha_rnd_end();
+ while ((error= ha_rnd_next(buf)) == HA_ERR_RECORD_DELETED)
+ /* skip deleted row */;
+ const int end_error= ha_rnd_end();
+ if (!error)
+ error= end_error;
}
}
else
{
/* Find the first row through the primary key */
- if (!(error = ha_index_init(primary_key, 0)))
+ if (!(error= ha_index_init(primary_key, 0)))
+ {
error= ha_index_first(buf);
- (void) ha_index_end();
+ const int end_error= ha_index_end();
+ if (!error)
+ error= end_error;
+ }
}
DBUG_RETURN(error);
}
@@ -2775,7 +2800,15 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment,
table->mark_columns_used_by_index_no_reset(table->s->next_number_index,
table->read_set);
column_bitmaps_signal();
- ha_index_init(table->s->next_number_index, 1);
+
+ if (ha_index_init(table->s->next_number_index, 1))
+ {
+ /* This should never happen, assert in debug, and fail in release build */
+ DBUG_ASSERT(0);
+ *first_value= ULONGLONG_MAX;
+ return;
+ }
+
if (table->s->next_number_keypart == 0)
{ // Autoincrement at key-start
error=ha_index_last(table->record[1]);
@@ -2806,13 +2839,25 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment,
}
if (error)
- nr=1;
+ {
+ if (error == HA_ERR_END_OF_FILE || error == HA_ERR_KEY_NOT_FOUND)
+ {
+ /* No entry found, start with 1. */
+ nr= 1;
+ }
+ else
+ {
+ DBUG_ASSERT(0);
+ nr= ULONGLONG_MAX;
+ }
+ }
else
nr= ((ulonglong) table->next_number_field->
val_int_offset(table->s->rec_buff_length)+1);
ha_index_end();
(void) extra(HA_EXTRA_NO_KEYREAD);
*first_value= nr;
+ return;
}
@@ -4725,7 +4770,9 @@ extern "C" enum icp_result handler_index_cond_check(void* h_arg)
THD *thd= h->table->in_use;
enum icp_result res;
- if (thd_killed(thd))
+ enum thd_kill_levels abort_at= h->has_transactions() ?
+ THD_ABORT_SOFTLY : THD_ABORT_ASAP;
+ if (thd_kill_level(thd) > abort_at)
return ICP_ABORTED_BY_USER;
if (h->end_range && h->compare_key2(h->end_range) > 0)
@@ -5156,6 +5203,7 @@ int handler::ha_write_row(uchar *buf)
int error;
Log_func *log_func= Write_rows_log_event::binlog_row_logging_function;
DBUG_ENTER("handler::ha_write_row");
+ DEBUG_SYNC_C("ha_write_row_start");
MYSQL_INSERT_ROW_START(table_share->db.str, table_share->table_name.str);
mark_trx_read_write();
diff --git a/sql/handler.h b/sql/handler.h
index f1f2ac6469f..c38dec198b9 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -866,6 +866,10 @@ struct handlerton
*/
int (*close_connection)(handlerton *hton, THD *thd);
/*
+ Tell handler that query has been killed.
+ */
+ void (*kill_query)(handlerton *hton, THD *thd, enum thd_kill_levels level);
+ /*
sv points to an uninitialized storage area of requested size
(see savepoint_offset description)
*/
@@ -1878,6 +1882,7 @@ public:
int ha_open(TABLE *table, const char *name, int mode, uint test_if_locked);
int ha_index_init(uint idx, bool sorted)
{
+ DBUG_EXECUTE_IF("ha_index_init_fail", return HA_ERR_TABLE_DEF_CHANGED;);
int result;
DBUG_ENTER("ha_index_init");
DBUG_ASSERT(inited==NONE);
@@ -1902,6 +1907,7 @@ public:
virtual int prepare_index_scan() { return 0; }
int ha_rnd_init(bool scan) __attribute__ ((warn_unused_result))
{
+ DBUG_EXECUTE_IF("ha_rnd_init_fail", return HA_ERR_TABLE_DEF_CHANGED;);
int result;
DBUG_ENTER("ha_rnd_init");
DBUG_ASSERT(inited==NONE || (inited==RND && scan));
@@ -2783,7 +2789,7 @@ private:
*/
virtual int open(const char *name, int mode, uint test_if_locked)=0;
- /* Note: ha_index_read_idx_map() may buypass index_init() */
+ /* Note: ha_index_read_idx_map() may bypass index_init() */
virtual int index_init(uint idx, bool sorted) { return 0; }
virtual int index_end() { return 0; }
/**
@@ -3016,6 +3022,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin);
TYPELIB *ha_known_exts(void);
int ha_panic(enum ha_panic_function flag);
void ha_close_connection(THD* thd);
+void ha_kill_query(THD* thd, enum thd_kill_levels level);
bool ha_flush_logs(handlerton *db_type);
void ha_drop_database(char* path);
void ha_checkpoint_state(bool disable);
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 763c4647532..ee30d071602 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -367,6 +367,14 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
err_code= vio_getnameinfo(ip, hostname_buffer, NI_MAXHOST, NULL, 0,
NI_NAMEREQD);
+ /* BEGIN : DEBUG */
+ DBUG_EXECUTE_IF("addr_fake_ipv4",
+ {
+ strcpy(hostname_buffer, "santa.claus.ipv4.example.com");
+ err_code= 0;
+ };);
+ /* END : DEBUG */
+
if (err_code)
{
// NOTE: gai_strerror() returns a string ending by a dot.
@@ -439,6 +447,12 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
DBUG_RETURN(err_status);
}
+ /*
+ To avoid crashing the server in DBUG_EXECUTE_IF,
+ Define a variable which depicts state of addr_info_list.
+ */
+ bool free_addr_info_list= false;
+
/* Get IP-addresses for the resolved host name (FCrDNS technique). */
struct addrinfo hints;
@@ -453,6 +467,42 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
(const char *) hostname_buffer));
err_code= getaddrinfo(hostname_buffer, NULL, &hints, &addr_info_list);
+ if (err_code == 0)
+ free_addr_info_list= true;
+
+ /* BEGIN : DEBUG */
+ DBUG_EXECUTE_IF("addr_fake_ipv4",
+ {
+ if (free_addr_info_list)
+ freeaddrinfo(addr_info_list);
+
+ struct sockaddr_in *debug_addr;
+ static struct sockaddr_in debug_sock_addr[2];
+ static struct addrinfo debug_addr_info[2];
+ /* Simulating ipv4 192.0.2.5 */
+ debug_addr= & debug_sock_addr[0];
+ debug_addr->sin_family= AF_INET;
+ debug_addr->sin_addr.s_addr= inet_addr("192.0.2.5");
+
+ /* Simulating ipv4 192.0.2.4 */
+ debug_addr= & debug_sock_addr[1];
+ debug_addr->sin_family= AF_INET;
+ debug_addr->sin_addr.s_addr= inet_addr("192.0.2.4");
+
+ debug_addr_info[0].ai_addr= (struct sockaddr*) & debug_sock_addr[0];
+ debug_addr_info[0].ai_addrlen= sizeof (struct sockaddr_in);
+ debug_addr_info[0].ai_next= & debug_addr_info[1];
+
+ debug_addr_info[1].ai_addr= (struct sockaddr*) & debug_sock_addr[1];
+ debug_addr_info[1].ai_addrlen= sizeof (struct sockaddr_in);
+ debug_addr_info[1].ai_next= NULL;
+
+ addr_info_list= & debug_addr_info[0];
+ err_code= 0;
+ free_addr_info_list= false;
+ };);
+
+ /* END : DEBUG */
if (err_code == EAI_NONAME)
{
@@ -505,7 +555,8 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
{
DBUG_PRINT("error", ("Out of memory."));
- freeaddrinfo(addr_info_list);
+ if (free_addr_info_list)
+ freeaddrinfo(addr_info_list);
DBUG_RETURN(TRUE);
}
@@ -539,7 +590,8 @@ bool ip_to_hostname(struct sockaddr_storage *ip_storage,
/* Free the result of getaddrinfo(). */
- freeaddrinfo(addr_info_list);
+ if (free_addr_info_list)
+ freeaddrinfo(addr_info_list);
/* Add an entry for the IP to the cache. */
diff --git a/sql/item.cc b/sql/item.cc
index 966b5392b13..96f61c08982 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -5579,7 +5579,7 @@ bool Item::eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs)
/**
Create a field to hold a string value from an item.
- If max_length > CONVERT_IF_BIGGER_TO_BLOB create a blob @n
+ If too_big_for_varchar() create a blob @n
If max_length > 0 create a varchar @n
If max_length == 0 create a CHAR(0)
@@ -5594,7 +5594,7 @@ Field *Item::make_string_field(TABLE *table)
Note: the following check is repeated in
subquery_types_allow_materialization():
*/
- if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
+ if (too_big_for_varchar())
field= new Field_blob(max_length, maybe_null, name,
collation.collation, TRUE);
/* Item_type_holder holds the exact type, do not change it */
@@ -5699,7 +5699,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
DBUG_ASSERT(0);
/* If something goes awfully wrong, it's better to get a string than die */
case MYSQL_TYPE_STRING:
- if (fixed_length && max_length < CONVERT_IF_BIGGER_TO_BLOB)
+ if (fixed_length && !too_big_for_varchar())
{
field= new Field_string(max_length, maybe_null, name,
collation.collation);
@@ -8851,9 +8851,10 @@ int Item_cache_temporal::save_in_field(Field *field, bool no_conversions)
}
-void Item_cache_temporal::store_packed(longlong val_arg)
+void Item_cache_temporal::store_packed(longlong val_arg, Item *example)
{
/* An explicit values is given, save it. */
+ store(example);
value_cached= true;
value= val_arg;
null_value= false;
@@ -9599,11 +9600,18 @@ table_map Item_ref::used_tables() const
void Item_ref::update_used_tables()
-{
+{
if (!get_depended_from())
- (*ref)->update_used_tables();
+ (*ref)->update_used_tables();
+ maybe_null|= (*ref)->maybe_null;
}
+void Item_direct_view_ref::update_used_tables()
+{
+ Item_ref::update_used_tables();
+ if (view->table && view->table->maybe_null)
+ maybe_null= TRUE;
+}
table_map Item_direct_view_ref::used_tables() const
{
diff --git a/sql/item.h b/sql/item.h
index 172932434d2..9b10cdf601b 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2,7 +2,7 @@
#define SQL_ITEM_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 as published by
@@ -611,7 +611,11 @@ public:
@see Query_arena::free_list
*/
Item *next;
- uint32 max_length; /* Maximum length, in bytes */
+ /*
+ The maximum value length in characters multiplied by collation->mbmaxlen.
+ Almost always it's the maximum value length in bytes.
+ */
+ uint32 max_length;
/*
TODO: convert name and name_length fields into LEX_STRING to keep them in
sync (see bug #11829681/60295 etc). Then also remove some strlen(name)
@@ -1424,6 +1428,8 @@ public:
bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs);
uint32 max_char_length() const
{ return max_length / collation.collation->mbmaxlen; }
+ bool too_big_for_varchar() const
+ { return max_char_length() > CONVERT_IF_BIGGER_TO_BLOB; }
void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs)
{
max_length= char_to_byte_length_safe(max_char_length_arg, cs->mbmaxlen);
@@ -1434,24 +1440,11 @@ public:
max_length= char_to_byte_length_safe(max_char_length_arg,
collation.collation->mbmaxlen);
}
- void fix_char_length_ulonglong(ulonglong max_char_length_arg)
- {
- ulonglong max_result_length= max_char_length_arg *
- collation.collation->mbmaxlen;
- if (max_result_length >= MAX_BLOB_WIDTH)
- {
- max_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
- }
- else
- max_length= (uint32) max_result_length;
- }
/*
Return TRUE if the item points to a column of an outer-joined table.
*/
virtual bool is_outer_field() const { DBUG_ASSERT(fixed); return FALSE; }
Item* set_expr_cache(THD *thd);
- virtual Item *get_cached_item() { return NULL; }
virtual Item_equal *get_item_equal() { return NULL; }
virtual void set_item_equal(Item_equal *item_eq) {};
@@ -2057,9 +2050,14 @@ public:
bitmap_fast_test_and_set(tab->read_set, field->field_index);
if (field->vcol_info)
tab->mark_virtual_col(field);
- }
+ }
+ }
+ void update_used_tables()
+ {
+ update_table_bitmaps();
+ if (field && field->table)
+ maybe_null|= field->maybe_null();
}
- void update_used_tables() { update_table_bitmaps(); }
Item *get_tmp_table_item(THD *thd);
bool collect_item_field_processor(uchar * arg);
bool add_field_to_set_processor(uchar * arg);
@@ -3110,7 +3108,11 @@ public:
enum Item_result result_type () const { return orig_item->result_type(); }
enum_field_types field_type() const { return orig_item->field_type(); }
table_map used_tables() const { return orig_item->used_tables(); }
- void update_used_tables() { orig_item->update_used_tables(); }
+ void update_used_tables()
+ {
+ orig_item->update_used_tables();
+ maybe_null|= orig_item->maybe_null;
+ }
bool const_item() const { return orig_item->const_item(); }
table_map not_null_tables() const { return orig_item->not_null_tables(); }
bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
@@ -3202,6 +3204,7 @@ public:
Item *replace_equal_field(uchar *arg);
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)
{
return (*ref)->walk(processor, walk_subquery, arg) ||
@@ -4027,7 +4030,7 @@ public:
bool cache_value();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
int save_in_field(Field *field, bool no_conversions);
- void store_packed(longlong val_arg);
+ void store_packed(longlong val_arg, Item *example);
/*
Having a clone_item method tells optimizer that this object
is a constant and need not be optimized further.
@@ -4036,7 +4039,7 @@ public:
Item *clone_item()
{
Item_cache_temporal *item= new Item_cache_temporal(cached_field_type);
- item->store_packed(value);
+ item->store_packed(value, example);
return item;
}
};
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 4db783242c7..3b09da68927 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.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
@@ -914,7 +914,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
if (save_arena)
thd->set_query_arena(save_arena);
- cache->store_packed(value);
+ cache->store_packed(value, item);
*cache_arg= cache;
*item_arg= cache_arg;
}
@@ -1353,7 +1353,7 @@ int Arg_comparator::compare_e_row()
void Item_func_truth::fix_length_and_dec()
{
- maybe_null= 0;
+ set_persist_maybe_null(0);
null_value= 0;
decimals= 0;
max_length= 1;
@@ -1865,7 +1865,8 @@ longlong Item_func_eq::val_int()
void Item_func_equal::fix_length_and_dec()
{
Item_bool_func2::fix_length_and_dec();
- maybe_null=null_value=0;
+ set_persist_maybe_null(0);
+ null_value= 0;
}
longlong Item_func_equal::val_int()
@@ -2004,7 +2005,7 @@ void Item_func_interval::fix_length_and_dec()
}
}
}
- maybe_null= 0;
+ set_persist_maybe_null(0);
max_length= 2;
used_tables_cache|= row->used_tables();
not_null_tables_cache= row->not_null_tables();
@@ -2685,7 +2686,7 @@ void
Item_func_nullif::fix_length_and_dec()
{
Item_bool_func2::fix_length_and_dec();
- maybe_null=1;
+ set_persist_maybe_null(1);
if (args[0]) // Only false if EOM
{
max_length=args[0]->max_length;
@@ -4546,6 +4547,8 @@ void Item_cond::update_used_tables()
item->update_used_tables();
used_tables_cache|= item->used_tables();
const_item_cache&= item->const_item();
+ if (!persistent_maybe_null && item->maybe_null)
+ maybe_null= 1;
}
}
@@ -4720,10 +4723,9 @@ longlong Item_is_not_null_test::val_int()
*/
void Item_is_not_null_test::update_used_tables()
{
+ args[0]->update_used_tables();
if (!args[0]->maybe_null)
used_tables_cache= 0; /* is always true */
- else
- args[0]->update_used_tables();
}
@@ -5004,7 +5006,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref)
int comp_res= regcomp(TRUE);
if (comp_res == -1)
{ // Will always return NULL
- maybe_null=1;
+ set_persist_maybe_null(1);
fixed= 1;
return FALSE;
}
@@ -5014,7 +5016,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref)
maybe_null= args[0]->maybe_null;
}
else
- maybe_null=1;
+ set_persist_maybe_null(1);
fixed= 1;
return FALSE;
}
@@ -5828,6 +5830,8 @@ void Item_equal::update_used_tables()
used_tables_cache|= item->used_tables();
/* see commentary at Item_equal::update_const() */
const_item_cache&= item->const_item() && !item->is_outer_field();
+ if (!persistent_maybe_null && item->maybe_null)
+ maybe_null= 1;
}
}
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index f183ee9f8a8..afb7bf005bb 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -767,6 +767,11 @@ public:
my_decimal *decimal_op(my_decimal *);
enum_field_types field_type() const;
void fix_length_and_dec();
+ void update_used_tables()
+ {
+ Item_func_coalesce::update_used_tables();
+ maybe_null|= args[1]->maybe_null;
+ }
const char *func_name() const { return "ifnull"; }
Field *tmp_table_field(TABLE *table);
uint decimal_precision() const;
@@ -789,6 +794,11 @@ public:
enum_field_types field_type() const { return cached_field_type; }
bool fix_fields(THD *, Item **);
void fix_length_and_dec();
+ void update_used_tables()
+ {
+ Item_func::update_used_tables();
+ maybe_null|= args[1]->maybe_null || args[2]->maybe_null;
+ }
uint decimal_precision() const;
const char *func_name() const { return "if"; }
bool eval_not_null_tables(uchar *opt_arg);
@@ -1254,6 +1264,12 @@ public:
my_decimal *val_decimal(my_decimal *);
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec();
+ void update_used_tables()
+ {
+ Item_func::update_used_tables();
+ if (else_expr_num == -1 || args[else_expr_num]->maybe_null)
+ maybe_null= 1;
+ }
uint decimal_precision() const;
table_map not_null_tables() const { return 0; }
enum Item_result result_type () const { return cached_result_type; }
@@ -1375,13 +1391,14 @@ public:
enum Functype functype() const { return ISNULL_FUNC; }
void fix_length_and_dec()
{
- decimals=0; max_length=1; maybe_null=0;
+ decimals=0; max_length=1; set_persist_maybe_null(0);
update_used_tables();
}
const char *func_name() const { return "isnull"; }
/* Optimize case of not_null_column IS NULL */
virtual void update_used_tables()
{
+ args[0]->update_used_tables();
if (!args[0]->maybe_null)
{
used_tables_cache= 0; /* is always false */
@@ -1389,7 +1406,6 @@ public:
}
else
{
- args[0]->update_used_tables();
used_tables_cache= args[0]->used_tables();
const_item_cache= args[0]->const_item();
}
@@ -1437,7 +1453,7 @@ public:
enum Functype functype() const { return ISNOTNULL_FUNC; }
void fix_length_and_dec()
{
- decimals=0; max_length=1; maybe_null=0;
+ decimals=0; max_length=1; set_persist_maybe_null(0);
}
const char *func_name() const { return "isnotnull"; }
optimize_type select_optimize() const { return OPTIMIZE_NULL; }
@@ -1505,6 +1521,12 @@ public:
void cleanup();
longlong val_int();
bool fix_fields(THD *thd, Item **ref);
+ void update_used_tables()
+ {
+ Item_bool_func::update_used_tables();
+ if (regex_is_const)
+ maybe_null= 1;
+ }
const char *func_name() const { return "regexp"; }
virtual inline void print(String *str, enum_query_type query_type)
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 520b5522d38..aca76eac82a 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008-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
@@ -111,7 +111,7 @@ void Item_func::set_arguments(List<Item> &list)
}
Item_func::Item_func(List<Item> &list)
- :allowed_arg_cols(1)
+ :allowed_arg_cols(1), persistent_maybe_null(0)
{
set_arguments(list);
}
@@ -119,6 +119,7 @@ Item_func::Item_func(List<Item> &list)
Item_func::Item_func(THD *thd, Item_func *item)
:Item_result_field(thd, item),
allowed_arg_cols(item->allowed_arg_cols),
+ persistent_maybe_null(0),
arg_count(item->arg_count),
used_tables_cache(item->used_tables_cache),
not_null_tables_cache(item->not_null_tables_cache),
@@ -446,6 +447,8 @@ void Item_func::update_used_tables()
args[i]->update_used_tables();
used_tables_cache|=args[i]->used_tables();
const_item_cache&=args[i]->const_item();
+ if (!persistent_maybe_null && args[i]->maybe_null)
+ maybe_null= 1;
}
}
@@ -1712,7 +1715,7 @@ void Item_func_div::fix_length_and_dec()
case IMPOSSIBLE_RESULT:
DBUG_ASSERT(0);
}
- maybe_null= 1; // devision by zero
+ set_persist_maybe_null(1); // devision by zero
DBUG_VOID_RETURN;
}
@@ -1796,7 +1799,7 @@ void Item_func_int_div::fix_length_and_dec()
max_length=args[0]->max_length -
(argtype == DECIMAL_RESULT || argtype == INT_RESULT ?
args[0]->decimals : 0);
- maybe_null=1;
+ set_persist_maybe_null(1);
unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag;
}
@@ -1883,7 +1886,7 @@ void Item_func_mod::result_precision()
void Item_func_mod::fix_length_and_dec()
{
Item_num_op::fix_length_and_dec();
- maybe_null= 1;
+ set_persist_maybe_null(1);
unsigned_flag= args[0]->unsigned_flag;
}
@@ -3078,7 +3081,7 @@ longlong Item_func_field::val_int()
void Item_func_field::fix_length_and_dec()
{
- maybe_null=0; max_length=3;
+ set_persist_maybe_null(0); max_length=3;
cmp_type= args[0]->result_type();
for (uint i=1; i < arg_count ; i++)
cmp_type= item_cmp_type(cmp_type, args[i]->result_type());
@@ -4195,7 +4198,8 @@ longlong Item_func_last_insert_id::val_int()
thd->first_successful_insert_id_in_prev_stmt= value;
return value;
}
- return thd->read_first_successful_insert_id_in_prev_stmt();
+ return
+ static_cast<longlong>(thd->read_first_successful_insert_id_in_prev_stmt());
}
@@ -5317,7 +5321,7 @@ void Item_func_get_user_var::fix_length_and_dec()
{
THD *thd=current_thd;
int error;
- maybe_null=1;
+ set_persist_maybe_null(1);
decimals=NOT_FIXED_DEC;
max_length=MAX_BLOB_WIDTH;
@@ -5516,7 +5520,7 @@ void Item_func_get_system_var::update_null_value()
void Item_func_get_system_var::fix_length_and_dec()
{
char *cptr;
- maybe_null= TRUE;
+ set_persist_maybe_null(1);
max_length= 0;
if (var->check_type(var_type))
@@ -6083,7 +6087,7 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
status_var_increment(thd->status_var.feature_fulltext);
- maybe_null=1;
+ set_persist_maybe_null(1);
join_key=0;
/*
@@ -6417,7 +6421,7 @@ longlong Item_func_row_count::val_int()
Item_func_sp::Item_func_sp(Name_resolution_context *context_arg, sp_name *name)
:Item_func(), context(context_arg), m_name(name), m_sp(NULL), sp_result_field(NULL)
{
- maybe_null= 1;
+ set_persist_maybe_null(1);
m_name->init_qname(current_thd);
dummy_table= (TABLE*) sql_calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE));
dummy_table->s= (TABLE_SHARE*) (dummy_table+1);
@@ -6428,7 +6432,7 @@ Item_func_sp::Item_func_sp(Name_resolution_context *context_arg,
sp_name *name, List<Item> &list)
:Item_func(list), context(context_arg), m_name(name), m_sp(NULL),sp_result_field(NULL)
{
- maybe_null= 1;
+ set_persist_maybe_null(1);
m_name->init_qname(current_thd);
dummy_table= (TABLE*) sql_calloc(sizeof(TABLE)+ sizeof(TABLE_SHARE));
dummy_table->s= (TABLE_SHARE*) (dummy_table+1);
@@ -6556,6 +6560,19 @@ Item_func_sp::init_result_field(THD *thd)
/**
+ @note
+ Deterministic stored procedures are considered inexpensive.
+ Consequently such procedures may be evaluated during optimization,
+ if they are constant (checked by the optimizer).
+*/
+
+bool Item_func_sp::is_expensive()
+{
+ return !(m_sp->m_chistics->detistic);
+}
+
+
+/**
@brief Initialize local members with values from the Field interface.
@note called from Item::fix_fields.
@@ -6569,7 +6586,7 @@ void Item_func_sp::fix_length_and_dec()
decimals= sp_result_field->decimals();
max_length= sp_result_field->field_length;
collation.set(sp_result_field->charset());
- maybe_null= 1;
+ set_persist_maybe_null(1);
unsigned_flag= test(sp_result_field->flags & UNSIGNED_FLAG);
DBUG_VOID_RETURN;
diff --git a/sql/item_func.h b/sql/item_func.h
index b9b6c865bfd..f562c87fe1c 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1,7 +1,7 @@
#ifndef ITEM_FUNC_INCLUDED
#define ITEM_FUNC_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 as published by
@@ -39,6 +39,8 @@ protected:
0 means get this number from first argument
*/
uint allowed_arg_cols;
+ /* maybe_null can't be changed by parameters or used table state */
+ bool persistent_maybe_null;
public:
uint arg_count;
table_map used_tables_cache, not_null_tables_cache;
@@ -64,13 +66,13 @@ public:
enum Type type() const { return FUNC_ITEM; }
virtual enum Functype functype() const { return UNKNOWN_FUNC; }
Item_func(void):
- allowed_arg_cols(1), arg_count(0)
+ allowed_arg_cols(1), persistent_maybe_null(0), arg_count(0)
{
with_sum_func= 0;
with_field= 0;
}
Item_func(Item *a):
- allowed_arg_cols(1), arg_count(1)
+ allowed_arg_cols(1), persistent_maybe_null(0), arg_count(1)
{
args= tmp_arg;
args[0]= a;
@@ -78,7 +80,7 @@ public:
with_field= a->with_field;
}
Item_func(Item *a,Item *b):
- allowed_arg_cols(1), arg_count(2)
+ allowed_arg_cols(1), persistent_maybe_null(0), arg_count(2)
{
args= tmp_arg;
args[0]= a; args[1]= b;
@@ -86,7 +88,7 @@ public:
with_field= a->with_field || b->with_field;
}
Item_func(Item *a,Item *b,Item *c):
- allowed_arg_cols(1)
+ allowed_arg_cols(1), persistent_maybe_null(0)
{
arg_count= 0;
if ((args= (Item**) sql_alloc(sizeof(Item*)*3)))
@@ -98,7 +100,7 @@ public:
}
}
Item_func(Item *a,Item *b,Item *c,Item *d):
- allowed_arg_cols(1)
+ allowed_arg_cols(1), persistent_maybe_null(0)
{
arg_count= 0;
if ((args= (Item**) sql_alloc(sizeof(Item*)*4)))
@@ -112,7 +114,7 @@ public:
}
}
Item_func(Item *a,Item *b,Item *c,Item *d,Item* e):
- allowed_arg_cols(1)
+ allowed_arg_cols(1), persistent_maybe_null(0)
{
arg_count= 5;
if ((args= (Item**) sql_alloc(sizeof(Item*)*5)))
@@ -170,6 +172,18 @@ public:
my_decimal *val_decimal(my_decimal *);
+ void fix_char_length_ulonglong(ulonglong max_char_length_arg)
+ {
+ ulonglong max_result_length= max_char_length_arg *
+ collation.collation->mbmaxlen;
+ if (max_result_length >= MAX_BLOB_WIDTH)
+ {
+ max_length= MAX_BLOB_WIDTH;
+ set_persist_maybe_null(1);
+ }
+ else
+ max_length= (uint32) max_result_length;
+ }
bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems,
uint flags, int item_sep)
{
@@ -371,6 +385,11 @@ public:
info.bool_function= &Item::restore_to_before_no_rows_in_result;
walk(&Item::call_bool_func_processor, FALSE, (uchar*) &info);
}
+ inline void set_persist_maybe_null(bool mb_null)
+ {
+ maybe_null= mb_null;
+ persistent_maybe_null= 1;
+ }
};
@@ -586,7 +605,7 @@ public:
}
double val_real();
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
- void fix_length_and_dec() { maybe_null= 1; }
+ void fix_length_and_dec() { set_persist_maybe_null(1); }
const char *func_name() const { return "double_typecast"; }
virtual void print(String *str, enum_query_type query_type);
};
@@ -727,7 +746,7 @@ class Item_dec_func :public Item_real_func
void fix_length_and_dec()
{
decimals=NOT_FIXED_DEC; max_length=float_length(decimals);
- maybe_null=1;
+ set_persist_maybe_null(1);
}
};
@@ -1059,7 +1078,7 @@ public:
Item_func_coercibility(Item *a) :Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "coercibility"; }
- void fix_length_and_dec() { max_length=10; maybe_null= 0; }
+ void fix_length_and_dec() { max_length=10; set_persist_maybe_null(0); }
table_map not_null_tables() const { return 0; }
};
@@ -1201,6 +1220,7 @@ public:
const char *func_name() const { return "last_insert_id"; }
void fix_length_and_dec()
{
+ unsigned_flag= TRUE;
if (arg_count)
max_length= args[0]->max_length;
unsigned_flag=1;
@@ -1221,7 +1241,7 @@ public:
{}
longlong val_int();
const char *func_name() const { return "benchmark"; }
- void fix_length_and_dec() { max_length=1; maybe_null=0; }
+ void fix_length_and_dec() { max_length=1; set_persist_maybe_null(0); }
virtual void print(String *str, enum_query_type query_type);
bool check_vcol_func_processor(uchar *int_arg)
{
@@ -1474,7 +1494,7 @@ public:
double val_real() { DBUG_ASSERT(fixed == 1); null_value= 1; return 0.0; }
longlong val_int() { DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
enum Item_result result_type () const { return STRING_RESULT; }
- void fix_length_and_dec() { maybe_null=1; max_length=0; }
+ void fix_length_and_dec() { set_persist_maybe_null(1); max_length=0; }
};
#endif /* HAVE_DLOPEN */
@@ -1495,7 +1515,7 @@ class Item_func_get_lock :public Item_int_func
Item_func_get_lock(Item *a,Item *b) :Item_int_func(a,b) {}
longlong val_int();
const char *func_name() const { return "get_lock"; }
- void fix_length_and_dec() { max_length=1; maybe_null=1;}
+ void fix_length_and_dec() { max_length=1; set_persist_maybe_null(1);}
bool check_vcol_func_processor(uchar *int_arg)
{
return trace_unsupported_by_check_vcol_func_processor(func_name());
@@ -1509,7 +1529,7 @@ public:
Item_func_release_lock(Item *a) :Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "release_lock"; }
- void fix_length_and_dec() { max_length=1; maybe_null=1;}
+ void fix_length_and_dec() { max_length=1; set_persist_maybe_null(1);}
bool check_vcol_func_processor(uchar *int_arg)
{
return trace_unsupported_by_check_vcol_func_processor(func_name());
@@ -1527,7 +1547,7 @@ public:
Item_master_pos_wait(Item *a,Item *b, Item *c, Item *d) :Item_int_func(a,b,c,d) {}
longlong val_int();
const char *func_name() const { return "master_pos_wait"; }
- void fix_length_and_dec() { max_length=21; maybe_null=1;}
+ void fix_length_and_dec() { max_length=21; set_persist_maybe_null(1);}
bool check_vcol_func_processor(uchar *int_arg)
{
return trace_unsupported_by_check_vcol_func_processor(func_name());
@@ -1744,7 +1764,8 @@ public:
Item_func_inet_aton(Item *a) :Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "inet_aton"; }
- void fix_length_and_dec() { decimals= 0; max_length= 21; maybe_null= 1; unsigned_flag= 1;}
+ void fix_length_and_dec()
+ { decimals= 0; max_length= 21; set_persist_maybe_null(1); unsigned_flag= 1; }
};
@@ -1813,7 +1834,8 @@ public:
Item_func_is_free_lock(Item *a) :Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "is_free_lock"; }
- void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
+ void fix_length_and_dec()
+ { decimals= 0; max_length= 1; set_persist_maybe_null(1); }
bool check_vcol_func_processor(uchar *int_arg)
{
return trace_unsupported_by_check_vcol_func_processor(func_name());
@@ -1827,7 +1849,8 @@ public:
Item_func_is_used_lock(Item *a) :Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "is_used_lock"; }
- void fix_length_and_dec() { decimals=0; max_length=10; maybe_null=1;}
+ void fix_length_and_dec()
+ { decimals= 0; max_length= 10; set_persist_maybe_null(1);}
bool check_vcol_func_processor(uchar *int_arg)
{
return trace_unsupported_by_check_vcol_func_processor(func_name());
@@ -1850,7 +1873,7 @@ public:
Item_func_row_count() :Item_int_func() {}
longlong val_int();
const char *func_name() const { return "row_count"; }
- void fix_length_and_dec() { decimals= 0; maybe_null=0; }
+ void fix_length_and_dec() { decimals= 0; set_persist_maybe_null(0); }
bool check_vcol_func_processor(uchar *int_arg)
{
@@ -1887,7 +1910,8 @@ private:
bool init_result_field(THD *thd);
protected:
- bool is_expensive_processor(uchar *arg) { return TRUE; }
+ bool is_expensive_processor(uchar *arg)
+ { return is_expensive(); }
public:
@@ -1966,7 +1990,7 @@ public:
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec(void);
- bool is_expensive() { return 1; }
+ bool is_expensive();
inline Field *get_sp_result_field()
{
@@ -1990,7 +2014,7 @@ public:
Item_func_found_rows() :Item_int_func() {}
longlong val_int();
const char *func_name() const { return "found_rows"; }
- void fix_length_and_dec() { decimals= 0; maybe_null=0; }
+ void fix_length_and_dec() { decimals= 0; set_persist_maybe_null(0); }
bool check_vcol_func_processor(uchar *int_arg)
{
return trace_unsupported_by_check_vcol_func_processor(func_name());
@@ -2033,6 +2057,11 @@ public:
enum_field_types field_type() const { return last_value->field_type(); }
bool const_item() const { return 0; }
void evaluate_sideeffects();
+ void update_used_tables()
+ {
+ Item_func::update_used_tables();
+ maybe_null= last_value->maybe_null;
+ }
};
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index bc89a6c14b3..e3e80bdf59f 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -53,7 +53,7 @@ void Item_geometry_func::fix_length_and_dec()
collation.set(&my_charset_bin);
decimals=0;
max_length= (uint32) 4294967295U;
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
@@ -147,7 +147,7 @@ void Item_func_as_wkt::fix_length_and_dec()
{
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
max_length=MAX_BLOB_WIDTH;
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h
index 3638d9f62e8..ee61f921adb 100644
--- a/sql/item_geofunc.h
+++ b/sql/item_geofunc.h
@@ -89,7 +89,7 @@ public:
{
// "GeometryCollection" is the longest
fix_length_and_charset(20, default_charset());
- maybe_null= 1;
+ set_persist_maybe_null(1);
};
};
@@ -224,7 +224,7 @@ public:
{
Item_func::print(str, query_type);
}
- void fix_length_and_dec() { maybe_null= 1; }
+ void fix_length_and_dec() { set_persist_maybe_null(1); }
bool is_null() { (void) val_int(); return null_value; }
};
@@ -251,7 +251,7 @@ public:
Item_func::print(str, query_type);
}
- void fix_length_and_dec() { maybe_null= 1; }
+ void fix_length_and_dec() { set_persist_maybe_null(1); }
bool is_null() { (void) val_int(); return null_value; }
};
@@ -342,7 +342,7 @@ public:
longlong val_int();
optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "st_isempty"; }
- void fix_length_and_dec() { maybe_null= 1; }
+ void fix_length_and_dec() { set_persist_maybe_null(1); }
};
class Item_func_issimple: public Item_bool_func
@@ -356,7 +356,7 @@ public:
longlong val_int();
optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "st_issimple"; }
- void fix_length_and_dec() { maybe_null= 1; }
+ void fix_length_and_dec() { set_persist_maybe_null(1); }
};
class Item_func_isclosed: public Item_bool_func
@@ -366,7 +366,7 @@ public:
longlong val_int();
optimize_type select_optimize() const { return OPTIMIZE_NONE; }
const char *func_name() const { return "st_isclosed"; }
- void fix_length_and_dec() { maybe_null= 1; }
+ void fix_length_and_dec() { set_persist_maybe_null(1); }
};
class Item_func_dimension: public Item_int_func
@@ -376,7 +376,7 @@ public:
Item_func_dimension(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "st_dimension"; }
- void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
+ void fix_length_and_dec() { max_length= 10; set_persist_maybe_null(1); }
};
class Item_func_x: public Item_real_func
@@ -389,7 +389,7 @@ public:
void fix_length_and_dec()
{
Item_real_func::fix_length_and_dec();
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
};
@@ -404,7 +404,7 @@ public:
void fix_length_and_dec()
{
Item_real_func::fix_length_and_dec();
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
};
@@ -416,7 +416,7 @@ public:
Item_func_numgeometries(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "st_numgeometries"; }
- void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
+ void fix_length_and_dec() { max_length= 10; set_persist_maybe_null(1); }
};
@@ -427,7 +427,7 @@ public:
Item_func_numinteriorring(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "st_numinteriorrings"; }
- void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
+ void fix_length_and_dec() { max_length= 10; set_persist_maybe_null(1); }
};
@@ -438,7 +438,7 @@ public:
Item_func_numpoints(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "st_numpoints"; }
- void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
+ void fix_length_and_dec() { max_length= 10; set_persist_maybe_null(1); }
};
@@ -452,7 +452,7 @@ public:
void fix_length_and_dec()
{
Item_real_func::fix_length_and_dec();
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
};
@@ -467,7 +467,7 @@ public:
void fix_length_and_dec()
{
Item_real_func::fix_length_and_dec();
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
};
@@ -479,7 +479,7 @@ public:
Item_func_srid(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "srid"; }
- void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
+ void fix_length_and_dec() { max_length= 10; set_persist_maybe_null(1); }
};
diff --git a/sql/item_row.cc b/sql/item_row.cc
index 2c4a628075e..ee7bd837553 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -74,7 +74,8 @@ bool Item_row::fix_fields(THD *thd, Item **ref)
Item **arg, **arg_end;
for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++)
{
- if ((*arg)->fix_fields(thd, arg))
+ if (!(*arg)->fixed &&
+ (*arg)->fix_fields(thd, arg))
return TRUE;
// we can't assign 'item' before, because fix_fields() can change arg
Item *item= *arg;
@@ -145,11 +146,13 @@ void Item_row::update_used_tables()
{
used_tables_cache= 0;
const_item_cache= 1;
+ maybe_null= 0;
for (uint i= 0; i < arg_count; i++)
{
items[i]->update_used_tables();
used_tables_cache|= items[i]->used_tables();
const_item_cache&= items[i]->const_item();
+ maybe_null|= items[i]->maybe_null;
}
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index a2bbdd63b40..bcd3b881934 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.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
@@ -341,7 +342,7 @@ String *Item_func_sha2::val_str_ascii(String *str)
void Item_func_sha2::fix_length_and_dec()
{
- maybe_null = 1;
+ set_persist_maybe_null(1);
max_length = 0;
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
@@ -467,7 +468,7 @@ String *Item_func_aes_decrypt::val_str(String *str)
void Item_func_aes_decrypt::fix_length_and_dec()
{
max_length=args[0]->max_length;
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
@@ -1337,7 +1338,7 @@ void Item_str_func::left_right_max_length()
if (args[1]->const_item())
{
int length= (int) args[1]->val_int();
- if (length <= 0)
+ if (args[1]->null_value || length <= 0)
char_length=0;
else
set_if_smaller(char_length, (uint) length);
@@ -1444,7 +1445,9 @@ void Item_func_substr::fix_length_and_dec()
if (args[1]->const_item())
{
int32 start= (int32) args[1]->val_int();
- if (start < 0)
+ if (args[1]->null_value)
+ max_length= 0;
+ else if (start < 0)
max_length= ((uint)(-start) > max_length) ? 0 : (uint)(-start);
else
max_length-= min((uint)(start - 1), max_length);
@@ -1452,7 +1455,7 @@ void Item_func_substr::fix_length_and_dec()
if (arg_count == 3 && args[2]->const_item())
{
int32 length= (int32) args[2]->val_int();
- if (length <= 0)
+ if (args[2]->null_value || length <= 0)
max_length=0; /* purecov: inspected */
else
set_if_smaller(max_length,(uint) length);
@@ -2411,7 +2414,7 @@ void Item_func_elt::fix_length_and_dec()
set_if_bigger(decimals,args[i]->decimals);
}
fix_char_length(char_length);
- maybe_null=1; // NULL if wrong first arg
+ set_persist_maybe_null(1); // NULL if wrong first arg
}
@@ -2650,7 +2653,9 @@ void Item_func_repeat::fix_length_and_dec()
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Set here so that rest of code sees out-of-bound value as such. */
- if (count > INT_MAX32)
+ if (args[1]->null_value)
+ count= 0;
+ else if (count > INT_MAX32)
count= INT_MAX32;
ulonglong char_length= (ulonglong) args[0]->max_char_length() * count;
@@ -2659,7 +2664,7 @@ void Item_func_repeat::fix_length_and_dec()
else
{
max_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
}
@@ -2729,14 +2734,16 @@ void Item_func_rpad::fix_length_and_dec()
DBUG_ASSERT(collation.collation->mbmaxlen > 0);
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Set here so that rest of code sees out-of-bound value as such. */
- if (char_length > INT_MAX32)
+ if (args[1]->null_value)
+ char_length= 0;
+ else if (char_length > INT_MAX32)
char_length= INT_MAX32;
fix_char_length_ulonglong(char_length);
}
else
{
max_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
}
@@ -2833,14 +2840,16 @@ void Item_func_lpad::fix_length_and_dec()
DBUG_ASSERT(collation.collation->mbmaxlen > 0);
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Set here so that rest of code sees out-of-bound value as such. */
- if (char_length > INT_MAX32)
+ if (args[1]->null_value)
+ char_length= 0;
+ else if (char_length > INT_MAX32)
char_length= INT_MAX32;
fix_char_length_ulonglong(char_length);
}
else
{
max_length= MAX_BLOB_WIDTH;
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
}
@@ -3814,7 +3823,7 @@ bool Item_func_dyncol_create::fix_fields(THD *thd, Item **ref)
void Item_func_dyncol_create::fix_length_and_dec()
{
- maybe_null= TRUE;
+ set_persist_maybe_null(1);
collation.set(&my_charset_bin);
decimals= 0;
}
@@ -4366,8 +4375,7 @@ String *Item_dyncol_get::val_str(String *str_result)
case DYN_COL_DECIMAL:
{
int res;
- int length=
- my_decimal_string_length((const my_decimal*)&val.x.decimal.value);
+ int length= decimal_string_size(&val.x.decimal.value);
if (str_result->alloc(length))
goto null;
if ((res= decimal2string(&val.x.decimal.value, (char*) str_result->ptr(),
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index d21c938f378..a42240f1b35 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -3,6 +3,7 @@
/*
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
@@ -354,7 +355,7 @@ public:
String *val_str(String *);
void fix_length_and_dec()
{
- maybe_null=1;
+ set_persist_maybe_null(1);
/* 9 = MAX ((8- (arg_len % 8)) + 1) */
max_length = args[0]->max_length + 9;
}
@@ -370,7 +371,7 @@ public:
String *val_str(String *);
void fix_length_and_dec()
{
- maybe_null=1;
+ set_persist_maybe_null(1);
/* 9 = MAX ((8- (arg_len % 8)) + 1) */
max_length= args[0]->max_length;
if (max_length >= 9U)
@@ -398,7 +399,7 @@ public:
constructor_helper();
}
String *val_str(String *);
- void fix_length_and_dec() { maybe_null=1; max_length = 13; }
+ void fix_length_and_dec() { set_persist_maybe_null(1); max_length = 13; }
const char *func_name() const { return "encrypt"; }
bool check_vcol_func_processor(uchar *int_arg)
{
@@ -468,7 +469,7 @@ public:
void fix_length_and_dec()
{
max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
const char *func_name() const { return "database"; }
const char *fully_qualified_func_name() const { return "database()"; }
@@ -649,7 +650,7 @@ public:
{
collation.set(default_charset());
max_length=64;
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
};
@@ -676,7 +677,7 @@ public:
Item_func_unhex(Item *a) :Item_str_func(a)
{
/* there can be bad hex strings */
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
const char *func_name() const { return "unhex"; }
String *val_str(String *);
@@ -762,7 +763,7 @@ public:
void fix_length_and_dec()
{
collation.set(&my_charset_bin, DERIVATION_COERCIBLE);
- maybe_null=1;
+ set_persist_maybe_null(1);
max_length=MAX_BLOB_WIDTH;
}
bool check_vcol_func_processor(uchar *int_arg)
@@ -795,7 +796,7 @@ public:
{
decimals= 0;
fix_length_and_charset(3 * 8 + 7, default_charset());
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
};
@@ -910,7 +911,7 @@ public:
{
collation.set(system_charset_info);
max_length= 64 * collation.collation->mbmaxlen; // should be enough
- maybe_null= 0;
+ set_persist_maybe_null(0);
};
table_map not_null_tables() const { return 0; }
};
@@ -925,7 +926,7 @@ public:
{
collation.set(system_charset_info);
max_length= 64 * collation.collation->mbmaxlen; // should be enough
- maybe_null= 0;
+ set_persist_maybe_null(0);
};
table_map not_null_tables() const { return 0; }
};
@@ -971,7 +972,8 @@ class Item_func_uncompress: public Item_str_func
String buffer;
public:
Item_func_uncompress(Item *a): Item_str_func(a){}
- void fix_length_and_dec(){ maybe_null= 1; max_length= MAX_BLOB_WIDTH; }
+ void fix_length_and_dec()
+ { set_persist_maybe_null(1); max_length= MAX_BLOB_WIDTH; }
const char *func_name() const{return "uncompress";}
String *val_str(String *) ZLIB_DEPENDED_FUNCTION
};
@@ -1053,7 +1055,7 @@ public:
:Item_str_func(str, num)
{}
void fix_length_and_dec()
- { maybe_null= 1; max_length= MAX_BLOB_WIDTH; }
+ { set_persist_maybe_null(1); max_length= MAX_BLOB_WIDTH; }
/* Mark that collation can change between calls */
bool dynamic_result() { return 1; }
@@ -1072,7 +1074,8 @@ class Item_func_dyncol_list: public Item_str_func
{
public:
Item_func_dyncol_list(Item *str) :Item_str_func(str) {};
- void fix_length_and_dec() { maybe_null= 1; max_length= MAX_BLOB_WIDTH; };
+ void fix_length_and_dec()
+ { set_persist_maybe_null(1); max_length= MAX_BLOB_WIDTH; };
const char *func_name() const{ return "column_list"; }
String *val_str(String *);
};
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 2ee513320ce..8b3ce257642 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -3258,11 +3258,14 @@ int subselect_uniquesubquery_engine::scan_table()
TABLE *table= tab->table;
DBUG_ENTER("subselect_uniquesubquery_engine::scan_table");
- if (table->file->inited)
- table->file->ha_index_end();
-
- if (table->file->ha_rnd_init_with_error(1))
- DBUG_RETURN(1);
+ if ((table->file->inited &&
+ (error= table->file->ha_index_end())) ||
+ (error= table->file->ha_rnd_init(1)))
+ {
+ (void) report_error(table, error);
+ DBUG_RETURN(true);
+ }
+
table->file->extra_opt(HA_EXTRA_CACHE,
current_thd->variables.read_buff_size);
table->null_row= 0;
@@ -3398,8 +3401,13 @@ int subselect_uniquesubquery_engine::exec()
DBUG_RETURN(0);
}
- if (!table->file->inited)
- table->file->ha_index_init(tab->ref.key, 0);
+ if (!table->file->inited &&
+ (error= table->file->ha_index_init(tab->ref.key, 0)))
+ {
+ (void) report_error(table, error);
+ DBUG_RETURN(true);
+ }
+
error= table->file->ha_index_read_map(table->record[0],
tab->ref.key_buff,
make_prev_keypart_map(tab->
@@ -3563,8 +3571,13 @@ int subselect_indexsubquery_engine::exec()
DBUG_RETURN(0);
}
- if (!table->file->inited)
- table->file->ha_index_init(tab->ref.key, 1);
+ if (!table->file->inited &&
+ (error= table->file->ha_index_init(tab->ref.key, 1)))
+ {
+ (void) report_error(table, error);
+ DBUG_RETURN(true);
+ }
+
error= table->file->ha_index_read_map(table->record[0],
tab->ref.key_buff,
make_prev_keypart_map(tab->
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index b1e248032bc..8816e1352a9 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1,5 +1,5 @@
/* 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
@@ -1097,7 +1097,7 @@ void Aggregator_distinct::endup()
{
/* go over the tree of distinct keys and calculate the aggregate value */
use_distinct_values= TRUE;
- tree->walk(item_sum_distinct_walk, (void*) this);
+ tree->walk(table, item_sum_distinct_walk, (void*) this);
use_distinct_values= FALSE;
}
/* prevent consecutive recalculations */
@@ -2916,13 +2916,12 @@ int group_concat_key_cmp_with_distinct(void* arg, const void* key1,
const void* key2)
{
Item_func_group_concat *item_func= (Item_func_group_concat*)arg;
- TABLE *table= item_func->table;
for (uint i= 0; i < item_func->arg_count_field; i++)
{
Item *item= item_func->args[i];
/*
- If field_item is a const item then either get_tp_table_field returns 0
+ If field_item is a const item then either get_tmp_table_field returns 0
or it is an item over a const table.
*/
if (item->const_item())
@@ -2934,7 +2933,8 @@ int group_concat_key_cmp_with_distinct(void* arg, const void* key1,
*/
Field *field= item->get_tmp_table_field();
int res;
- uint offset= field->offset(field->table->record[0])-table->s->null_bytes;
+ uint offset= (field->offset(field->table->record[0]) -
+ field->table->s->null_bytes);
if((res= field->cmp((uchar*)key1 + offset, (uchar*)key2 + offset)))
return res;
}
@@ -2952,28 +2952,37 @@ int group_concat_key_cmp_with_order(void* arg, const void* key1,
{
Item_func_group_concat* grp_item= (Item_func_group_concat*) arg;
ORDER **order_item, **end;
- TABLE *table= grp_item->table;
for (order_item= grp_item->order, end=order_item+ grp_item->arg_count_order;
order_item < end;
order_item++)
{
Item *item= *(*order_item)->item;
+ /*
+ If field_item is a const item then either get_tmp_table_field returns 0
+ or it is an item over a const table.
+ */
+ if (item->const_item())
+ continue;
/*
We have to use get_tmp_table_field() instead of
real_item()->get_tmp_table_field() because we want the field in
the temporary table, not the original field
+
+ Note that for the case of ROLLUP, field may point to another table
+ tham grp_item->table. This is howver ok as the table definitions are
+ the same.
*/
Field *field= item->get_tmp_table_field();
/*
- If item is a const item then either get_tp_table_field returns 0
+ If item is a const item then either get_tmp_table_field returns 0
or it is an item over a const table.
*/
- if (field && !item->const_item())
+ if (field)
{
int res;
uint offset= (field->offset(field->table->record[0]) -
- table->s->null_bytes);
+ field->table->s->null_bytes);
if ((res= field->cmp((uchar*)key1 + offset, (uchar*)key2 + offset)))
return (*order_item)->asc ? res : -res;
}
@@ -2997,6 +3006,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
{
Item_func_group_concat *item= (Item_func_group_concat *) item_arg;
TABLE *table= item->table;
+ uint max_length= table->in_use->variables.group_concat_max_len;
String tmp((char *)table->record[1], table->s->reclength,
default_charset_info);
String tmp2;
@@ -3039,7 +3049,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
item->row_count++;
/* stop if length of result more than max_length */
- if (result->length() > item->max_length)
+ if (result->length() > max_length)
{
int well_formed_error;
CHARSET_INFO *cs= item->collation.collation;
@@ -3052,7 +3062,7 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
*/
add_length= cs->cset->well_formed_len(cs,
ptr + old_length,
- ptr + item->max_length,
+ ptr + max_length,
result->length(),
&well_formed_error);
result->length(old_length + add_length);
@@ -3166,12 +3176,13 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
*/
ORDER *tmp;
if (!(tmp= (ORDER *) thd->alloc(sizeof(ORDER *) * arg_count_order +
- sizeof(ORDER) * arg_count_order)))
+ sizeof(ORDER) * arg_count_order)))
return;
order= (ORDER **)(tmp + arg_count_order);
for (uint i= 0; i < arg_count_order; i++, tmp++)
{
memcpy(tmp, item->order[i], sizeof(ORDER));
+ tmp->next= i == arg_count_order-1 ? 0 : tmp+1;
order[i]= tmp;
}
}
@@ -3216,19 +3227,11 @@ Field *Item_func_group_concat::make_string_field(TABLE *table)
{
Field *field;
DBUG_ASSERT(collation.collation);
- /*
- max_characters is maximum number of characters
- what can fit into max_length size. It's necessary
- to use field size what allows to store group_concat
- result without truncation. For this purpose we use
- max_characters * CS->mbmaxlen.
- */
- const uint32 max_characters= max_length / collation.collation->mbminlen;
- if (max_characters > CONVERT_IF_BIGGER_TO_BLOB)
- field= new Field_blob(max_characters * collation.collation->mbmaxlen,
+ if (too_big_for_varchar())
+ field= new Field_blob(max_length,
maybe_null, name, collation.collation, TRUE);
else
- field= new Field_varstring(max_characters * collation.collation->mbmaxlen,
+ field= new Field_varstring(max_length,
maybe_null, name, table->s, collation.collation);
if (field)
@@ -3343,7 +3346,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
result.set_charset(collation.collation);
result_field= 0;
null_value= 1;
- max_length= thd->variables.group_concat_max_len;
+ max_length= thd->variables.group_concat_max_len
+ / collation.collation->mbminlen
+ * collation.collation->mbmaxlen;
uint32 offset;
if (separator->needs_conversion(separator->length(), separator->charset(),
@@ -3461,7 +3466,8 @@ bool Item_func_group_concat::setup(THD *thd)
*/
if (!(table= create_tmp_table(thd, tmp_table_param, all_fields,
(ORDER*) 0, 0, TRUE,
- (select_lex->options | thd->variables.option_bits),
+ (select_lex->options |
+ thd->variables.option_bits),
HA_POS_ERROR, (char*) "")))
DBUG_RETURN(TRUE);
table->file->extra(HA_EXTRA_NO_ROWS);
diff --git a/sql/item_sum.h b/sql/item_sum.h
index c8dce60c7d4..40a28d8beae 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -1439,7 +1439,7 @@ public:
virtual Field *make_string_field(TABLE *table);
enum_field_types field_type() const
{
- if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB )
+ if (too_big_for_varchar())
return MYSQL_TYPE_BLOB;
else
return MYSQL_TYPE_VARCHAR;
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 117276e488b..02a7b8511af 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, 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
@@ -945,7 +945,7 @@ void Item_func_monthname::fix_length_and_dec()
collation.set(cs, DERIVATION_COERCIBLE, repertoire);
decimals=0;
max_length= locale->max_month_name_length * collation.collation->mbmaxlen;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
@@ -1095,7 +1095,7 @@ void Item_func_dayname::fix_length_and_dec()
collation.set(cs, DERIVATION_COERCIBLE, repertoire);
decimals=0;
max_length= locale->max_day_name_length * collation.collation->mbmaxlen;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
@@ -1446,7 +1446,7 @@ void Item_temporal_func::fix_length_and_dec()
{ MAX_DATETIME_WIDTH, MAX_DATETIME_WIDTH, MAX_DATE_WIDTH,
MAX_DATETIME_WIDTH, MIN_TIME_WIDTH };
- maybe_null= true;
+ set_persist_maybe_null(1);
max_length= max_time_type_width[mysql_type_to_time_type(field_type())+2];
if (decimals)
{
@@ -1501,13 +1501,10 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
bzero(ltime, sizeof(MYSQL_TIME));
if (get_date_from_daynr((long) value, &ltime->year, &ltime->month,
&ltime->day))
- return (null_value= 1);
-
- if ((fuzzy_date & TIME_NO_ZERO_DATE) && ltime->year == 0)
- return (null_value= 1);
+ return 0;
ltime->time_type= MYSQL_TIMESTAMP_DATE;
- return (null_value= 0);
+ return 0;
}
@@ -1519,7 +1516,7 @@ void Item_func_curdate::fix_length_and_dec()
ltime.hour= ltime.minute= ltime.second= 0;
ltime.time_type= MYSQL_TIMESTAMP_DATE;
Item_datefunc::fix_length_and_dec();
- maybe_null= false;
+ set_persist_maybe_null(0);
}
/**
@@ -1758,7 +1755,7 @@ void Item_func_date_format::fix_length_and_dec()
collation.collation->mbmaxlen;
set_if_smaller(max_length,MAX_BLOB_WIDTH);
}
- maybe_null=1; // If wrong date
+ set_persist_maybe_null(1); // If wrong date
}
@@ -2102,7 +2099,7 @@ void Item_extract::print(String *str, enum_query_type query_type)
void Item_extract::fix_length_and_dec()
{
- maybe_null=1; // If wrong date
+ set_persist_maybe_null(1); // If wrong date
switch (int_type) {
case INTERVAL_YEAR: max_length=4; date_value=1; break;
case INTERVAL_YEAR_MONTH: max_length=6; date_value=1; break;
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 3af08a8168e..3e3cd698efc 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -82,7 +82,7 @@ public:
{
decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
enum_monotonicity_info get_monotonicity_info() const;
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
@@ -105,7 +105,7 @@ public:
{
decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
enum_monotonicity_info get_monotonicity_info() const;
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
@@ -138,7 +138,7 @@ public:
{
decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -170,7 +170,7 @@ public:
{
decimals= 0;
fix_char_length(2);
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -208,7 +208,7 @@ public:
{
decimals= 0;
fix_char_length(3);
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -229,7 +229,7 @@ public:
{
decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -250,7 +250,7 @@ public:
{
decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -271,7 +271,7 @@ public:
{
decimals=0;
max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -292,7 +292,7 @@ public:
{
decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -313,7 +313,7 @@ public:
{
decimals=0;
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
};
@@ -327,7 +327,7 @@ public:
{
decimals=0;
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -350,7 +350,7 @@ public:
{
decimals=0;
max_length=4*MY_CHARSET_BIN_MB_MAXLEN;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -384,7 +384,7 @@ public:
{
decimals= 0;
fix_char_length(1);
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -419,7 +419,7 @@ public:
decimals= args[0]->decimals;
set_if_smaller(decimals, TIME_SECOND_PART_DIGITS);
max_length=17 + (decimals ? decimals + 1 : 0);
- maybe_null= 1;
+ set_persist_maybe_null(1);
}
void find_num_type() { hybrid_type= decimals ? DECIMAL_RESULT : INT_RESULT; }
double real_op() { DBUG_ASSERT(0); return 0; }
@@ -466,7 +466,7 @@ public:
const char *func_name() const { return "time_to_sec"; }
void fix_num_length_and_dec()
{
- maybe_null= true;
+ set_persist_maybe_null(1);
Item_func_seconds_hybrid::fix_num_length_and_dec();
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
@@ -537,7 +537,7 @@ public:
{
store_now_in_TIME(&ltime);
Item_timefunc::fix_length_and_dec();
- maybe_null= false;
+ set_persist_maybe_null(0);
}
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
/*
@@ -619,7 +619,7 @@ public:
{
store_now_in_TIME(&ltime);
Item_temporal_func::fix_length_and_dec();
- maybe_null= false;
+ set_persist_maybe_null(0);
}
bool get_date(MYSQL_TIME *res, ulonglong fuzzy_date);
virtual void store_now_in_TIME(MYSQL_TIME *now_time)=0;
@@ -664,7 +664,7 @@ public:
void update_used_tables()
{
Item_func_now::update_used_tables();
- maybe_null= false;
+ set_persist_maybe_null(0);
used_tables_cache|= RAND_TABLE_BIT;
}
};
@@ -959,7 +959,7 @@ public:
void fix_length_and_dec()
{
decimals=0;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
bool check_vcol_func_processor(uchar *int_arg) { return FALSE;}
@@ -981,7 +981,7 @@ public:
void fix_length_and_dec()
{
decimals=0;
- maybe_null=1;
+ set_persist_maybe_null(1);
}
virtual void print(String *str, enum_query_type query_type);
};
@@ -1003,7 +1003,7 @@ public:
const char *func_name() const { return "get_format"; }
void fix_length_and_dec()
{
- maybe_null= 1;
+ set_persist_maybe_null(1);
decimals=0;
fix_length_and_charset(17, default_charset());
}
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index ae0a74c5ba6..5a824e48b7b 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -2604,6 +2604,7 @@ void Item_xml_str_func::fix_length_and_dec()
status_var_increment(current_thd->status_var.feature_xml);
nodeset_func= 0;
+ set_persist_maybe_null(1);
if (agg_arg_charsets_for_comparison(collation, args, arg_count))
return;
diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h
index 800cf6ed760..3356b4ac902 100644
--- a/sql/item_xmlfunc.h
+++ b/sql/item_xmlfunc.h
@@ -34,14 +34,10 @@ protected:
public:
Item_xml_str_func(Item *a, Item *b):
Item_str_func(a,b)
- {
- maybe_null= TRUE;
- }
+ {}
Item_xml_str_func(Item *a, Item *b, Item *c):
Item_str_func(a,b,c)
- {
- maybe_null= TRUE;
- }
+ {}
void fix_length_and_dec();
String *parse_xml(String *raw_xml, String *parsed_xml_buf);
bool check_vcol_func_processor(uchar *int_arg)
diff --git a/sql/log.cc b/sql/log.cc
index 9d476e2a262..0444499c72b 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2010-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
@@ -1552,10 +1552,7 @@ binlog_trans_log_savepos(THD *thd, my_off_t *pos)
{
DBUG_ENTER("binlog_trans_log_savepos");
DBUG_ASSERT(pos != NULL);
- if (thd_get_ha_data(thd, binlog_hton) == NULL)
- thd->binlog_setup_trx_data();
- binlog_cache_mngr *const cache_mngr=
- (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
+ binlog_cache_mngr *const cache_mngr= thd->binlog_setup_trx_data();
DBUG_ASSERT(mysql_bin_log.is_open());
*pos= cache_mngr->trx_cache.get_byte_position();
DBUG_PRINT("return", ("*pos: %lu", (ulong) *pos));
@@ -2105,15 +2102,17 @@ static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv)
binlog_trans_log_savepos(thd, (my_off_t*) sv);
/* Write it to the binary log */
- String log_query;
- if (log_query.append(STRING_WITH_LEN("SAVEPOINT ")) ||
+ char buf[1024];
+ String log_query(buf, sizeof(buf), &my_charset_bin);
+ if (log_query.copy(STRING_WITH_LEN("SAVEPOINT "), &my_charset_bin) ||
append_identifier(thd, &log_query,
thd->lex->ident.str, thd->lex->ident.length))
DBUG_RETURN(1);
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
Query_log_event qinfo(thd, log_query.ptr(), log_query.length(),
TRUE, FALSE, TRUE, errcode);
- DBUG_RETURN(mysql_bin_log.write(&qinfo));
+ int ret= mysql_bin_log.write(&qinfo);
+ DBUG_RETURN(ret);
}
static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
@@ -2128,8 +2127,9 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
if (unlikely(trans_has_updated_non_trans_table(thd) ||
(thd->variables.option_bits & OPTION_KEEP_LOG)))
{
- String log_query;
- if (log_query.append(STRING_WITH_LEN("ROLLBACK TO ")) ||
+ char buf[1024];
+ String log_query(buf, sizeof(buf), &my_charset_bin);
+ if (log_query.copy(STRING_WITH_LEN("ROLLBACK TO "), &my_charset_bin) ||
append_identifier(thd, &log_query,
thd->lex->ident.str, thd->lex->ident.length))
DBUG_RETURN(1);
@@ -4953,14 +4953,14 @@ bool stmt_has_updated_non_trans_table(const THD* thd)
binlog_hton, which has internal linkage.
*/
-int THD::binlog_setup_trx_data()
+binlog_cache_mngr *THD::binlog_setup_trx_data()
{
DBUG_ENTER("THD::binlog_setup_trx_data");
binlog_cache_mngr *cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(this, binlog_hton);
if (cache_mngr)
- DBUG_RETURN(0); // Already set up
+ DBUG_RETURN(cache_mngr); // Already set up
cache_mngr= (binlog_cache_mngr*) my_malloc(sizeof(binlog_cache_mngr), MYF(MY_ZEROFILL));
if (!cache_mngr ||
@@ -4970,18 +4970,18 @@ int THD::binlog_setup_trx_data()
LOG_PREFIX, binlog_cache_size, MYF(MY_WME)))
{
my_free(cache_mngr);
- DBUG_RETURN(1); // Didn't manage to set it up
+ DBUG_RETURN(0); // Didn't manage to set it up
}
thd_set_ha_data(this, binlog_hton, cache_mngr);
- cache_mngr= new (thd_get_ha_data(this, binlog_hton))
+ cache_mngr= new (cache_mngr)
binlog_cache_mngr(max_binlog_stmt_cache_size,
max_binlog_cache_size,
&binlog_stmt_cache_use,
&binlog_stmt_cache_disk_use,
&binlog_cache_use,
&binlog_cache_disk_use);
- DBUG_RETURN(0);
+ DBUG_RETURN(cache_mngr);
}
/*
@@ -5064,9 +5064,7 @@ binlog_start_consistent_snapshot(handlerton *hton, THD *thd)
int err= 0;
DBUG_ENTER("binlog_start_consistent_snapshot");
- thd->binlog_setup_trx_data();
- binlog_cache_mngr *const cache_mngr=
- (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
+ binlog_cache_mngr *const cache_mngr= thd->binlog_setup_trx_data();
/* Server layer calls us with LOCK_commit_ordered locked, so this is safe. */
strmake(cache_mngr->last_commit_pos_file, mysql_bin_log.last_commit_pos_file,
@@ -5178,11 +5176,7 @@ THD::binlog_get_pending_rows_event(bool is_transactional) const
void
THD::binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional)
{
- if (thd_get_ha_data(this, binlog_hton) == NULL)
- binlog_setup_trx_data();
-
- binlog_cache_mngr *const cache_mngr=
- (binlog_cache_mngr*) thd_get_ha_data(this, binlog_hton);
+ binlog_cache_mngr *const cache_mngr= binlog_setup_trx_data();
DBUG_ASSERT(cache_mngr);
@@ -5261,12 +5255,18 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
/*
Write pending event to the cache.
*/
+ DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending",
+ {DBUG_SET("+d,simulate_file_write_error");});
if (pending->write(file))
{
set_write_error(thd, is_transactional);
if (check_write_error(thd) && cache_data &&
stmt_has_updated_non_trans_table(thd))
cache_data->set_incident();
+ delete pending;
+ cache_data->set_pending(NULL);
+ DBUG_EXECUTE_IF("simulate_disk_full_at_flush_pending",
+ {DBUG_SET("-d,simulate_file_write_error");});
DBUG_RETURN(1);
}
@@ -5350,12 +5350,10 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
}
else
{
- if (thd->binlog_setup_trx_data())
+ binlog_cache_mngr *const cache_mngr= thd->binlog_setup_trx_data();
+ if (!cache_mngr)
goto err;
- binlog_cache_mngr *const cache_mngr=
- (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
-
is_trans_cache= use_trans_cache(thd, using_trans);
file= cache_mngr->get_binlog_cache_log(is_trans_cache);
cache_data= cache_mngr->get_binlog_cache_data(is_trans_cache);
@@ -7987,8 +7985,9 @@ TC_LOG_BINLOG::log_and_order(THD *thd, my_xid xid, bool all,
int err;
DBUG_ENTER("TC_LOG_BINLOG::log_and_order");
- binlog_cache_mngr *cache_mngr=
- (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
+ binlog_cache_mngr *cache_mngr= thd->binlog_setup_trx_data();
+ if (!cache_mngr)
+ DBUG_RETURN(0);
cache_mngr->using_xa= TRUE;
cache_mngr->xa_xid= xid;
@@ -8536,7 +8535,7 @@ static int show_binlog_vars(THD *thd, SHOW_VAR *var, char *buff)
}
static SHOW_VAR binlog_status_vars_top[]= {
- {"binlog", (char *) &show_binlog_vars, SHOW_FUNC},
+ {"Binlog", (char *) &show_binlog_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG}
};
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 87b2f7c4bc8..10f0fe1e931 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2010, 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
@@ -46,7 +46,7 @@
#include "rpl_record.h"
#include "transaction.h"
#include <my_dir.h>
-#include "sql_show.h"
+#include "sql_show.h" // append_identifier
#endif /* MYSQL_CLIENT */
@@ -92,6 +92,23 @@ TYPELIB binlog_checksum_typelib=
*/
#define FMT_G_BUFSIZE(PREC) (3 + (PREC) + 5 + 1)
+/*
+ Explicit instantiation to unsigned int of template available_buffer
+ function.
+*/
+template unsigned int available_buffer<unsigned int>(const char*,
+ const char*,
+ unsigned int);
+
+/*
+ Explicit instantiation to unsigned int of template valid_buffer_range
+ function.
+*/
+template bool valid_buffer_range<unsigned int>(unsigned int,
+ const char*,
+ const char*,
+ unsigned int);
+
/*
replication event checksum is introduced in the following "checksum-home" version.
The checksum-aware servers extract FD's version to decide whether the FD event
@@ -1576,7 +1593,7 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
ev = new Rand_log_event(buf, description_event);
break;
case USER_VAR_EVENT:
- ev = new User_var_log_event(buf, description_event);
+ ev = new User_var_log_event(buf, event_len, description_event);
break;
case FORMAT_DESCRIPTION_EVENT:
ev = new Format_description_log_event(buf, event_len, description_event);
@@ -2301,7 +2318,7 @@ void Rows_log_event::print_verbose(IO_CACHE *file,
for (const uchar *value= m_rows_buf; value < m_rows_end; )
{
size_t length;
- my_b_printf(file, "### %s %s.%s\n",
+ my_b_printf(file, "### %s %`s.%`s\n",
sql_command,
map->get_db_name(), map->get_table_name());
/* Print the first image */
@@ -2467,7 +2484,7 @@ void Query_log_event::pack_info(THD *thd, Protocol *protocol)
{
buf.append(STRING_WITH_LEN("use "));
append_identifier(thd, &buf, db, db_len);
- buf.append("; ");
+ buf.append(STRING_WITH_LEN("; "));
}
if (query && q_len)
buf.append(query, q_len);
@@ -3446,17 +3463,11 @@ void Query_log_event::print_query_header(IO_CACHE* file,
}
else if (db)
{
- /* Room for expand ` to `` + initial/final ` + \0 */
- char buf[FN_REFLEN*2+3];
-
different_db= memcmp(print_event_info->db, db, db_len + 1);
if (different_db)
memcpy(print_event_info->db, db, db_len + 1);
if (db[0] && different_db)
- {
- my_snprintf(buf, sizeof(buf), "%`s", db);
- my_b_printf(file, "use %s%s\n", buf, print_event_info->delimiter);
- }
+ my_b_printf(file, "use %`s%s\n", db, print_event_info->delimiter);
}
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
@@ -3997,7 +4008,7 @@ Default database: '%s'. Query: '%s'",
{
DBUG_PRINT("info",("error ignored"));
clear_all_errors(thd, const_cast<Relay_log_info*>(rli));
- thd->killed= NOT_KILLED;
+ thd->reset_killed();
}
/*
Other cases: mostly we expected no error and get one.
@@ -5290,7 +5301,7 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info,
}
if (db && db[0] && different_db)
- my_b_printf(&cache, "%suse %s%s\n",
+ my_b_printf(&cache, "%suse %`s%s\n",
commented ? "# " : "",
db, print_event_info->delimiter);
@@ -5342,7 +5353,7 @@ void Load_log_event::print(FILE* file_arg, PRINT_EVENT_INFO* print_event_info,
{
if (i)
my_b_printf(&cache, ",");
- my_b_printf(&cache, "%s", field);
+ my_b_printf(&cache, "%`s", field);
field += field_lens[i] + 1;
}
@@ -6482,19 +6493,35 @@ void User_var_log_event::pack_info(THD *thd, Protocol* protocol)
User_var_log_event::
-User_var_log_event(const char* buf,
+User_var_log_event(const char* buf, uint event_len,
const Format_description_log_event* description_event)
:Log_event(buf, description_event)
#ifndef MYSQL_CLIENT
, deferred(false)
#endif
{
+ bool error= false;
+ const char* buf_start= buf;
/* The Post-Header is empty. The Variable Data part begins immediately. */
const char *start= buf;
buf+= description_event->common_header_len +
description_event->post_header_len[USER_VAR_EVENT-1];
name_len= uint4korr(buf);
name= (char *) buf + UV_NAME_LEN_SIZE;
+
+ /*
+ We don't know yet is_null value, so we must assume that name_len
+ may have the bigger value possible, is_null= True and there is no
+ payload for val.
+ */
+ if (0 == name_len ||
+ !valid_buffer_range<uint>(name_len, buf_start, name,
+ event_len - UV_VAL_IS_NULL))
+ {
+ error= true;
+ goto err;
+ }
+
buf+= UV_NAME_LEN_SIZE + name_len;
is_null= (bool) *buf;
flags= User_var_log_event::UNDEF_F; // defaults to UNDEF_F
@@ -6507,6 +6534,14 @@ User_var_log_event(const char* buf,
}
else
{
+ if (!valid_buffer_range<uint>(UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE
+ + UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE,
+ buf_start, buf, event_len))
+ {
+ error= true;
+ goto err;
+ }
+
type= (Item_result) buf[UV_VAL_IS_NULL];
charset_number= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE);
val_len= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
@@ -6514,6 +6549,12 @@ User_var_log_event(const char* buf,
val= (char *) (buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
UV_CHARSET_NUMBER_SIZE + UV_VAL_LEN_SIZE);
+ if (!valid_buffer_range<uint>(val_len, buf_start, val, event_len))
+ {
+ error= true;
+ goto err;
+ }
+
/**
We need to check if this is from an old server
that did not pack information for flags.
@@ -6548,6 +6589,10 @@ User_var_log_event(const char* buf,
val_len);
}
}
+
+err:
+ if (error)
+ name= 0;
}
@@ -6693,8 +6738,9 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
char *hex_str;
CHARSET_INFO *cs;
- if (!(hex_str= (char *)my_alloca(2*val_len+1+2))) // 2 hex digits / byte
- break; // no error, as we are 'void'
+ hex_str= (char *)my_malloc(2*val_len+1+2,MYF(MY_WME)); // 2 hex digits / byte
+ if (!hex_str)
+ return;
str_to_hex(hex_str, val, val_len);
/*
For proper behaviour when mysqlbinlog|mysql, we need to explicitely
@@ -6712,7 +6758,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
my_b_printf(&cache, ":=_%s %s COLLATE `%s`%s\n",
cs->csname, hex_str, cs->name,
print_event_info->delimiter);
- my_afree(hex_str);
+ my_free(hex_str);
}
break;
case ROW_RESULT:
@@ -7951,9 +7997,9 @@ void Execute_load_query_log_event::pack_info(THD *thd, Protocol *protocol)
buf.real_alloc(9 + db_len + q_len + 10 + 21);
if (db && db_len)
{
- if (buf.append("use ") ||
+ if (buf.append(STRING_WITH_LEN("use ")) ||
append_identifier(thd, &buf, db, db_len) ||
- buf.append("; "))
+ buf.append(STRING_WITH_LEN("; ")))
return;
}
if (query && q_len && buf.append(query, q_len))
diff --git a/sql/log_event.h b/sql/log_event.h
index dfbefdb359e..ff13cab9cd5 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -2740,7 +2740,7 @@ public:
void print(FILE* file, PRINT_EVENT_INFO* print_event_info);
#endif
- User_var_log_event(const char* buf,
+ User_var_log_event(const char* buf, uint event_len,
const Format_description_log_event *description_event);
~User_var_log_event() {}
Log_event_type get_type_code() { return USER_VAR_EVENT;}
@@ -2752,9 +2752,9 @@ public:
and which case the applier adjusts execution path.
*/
bool is_deferred() { return deferred; }
- void set_deferred() { deferred= val; }
+ void set_deferred() { deferred= true; }
#endif
- bool is_valid() const { return 1; }
+ bool is_valid() const { return name != 0; }
private:
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index bd837adc9d9..e9afe474418 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -725,7 +725,10 @@ static int find_and_fetch_row(TABLE *table, uchar *key)
int error;
/* We have a key: search the table using the index */
if (!table->file->inited && (error= table->file->ha_index_init(0, FALSE)))
+ {
+ table->file->print_error(error, MYF(0));
DBUG_RETURN(error);
+ }
/*
Don't print debug messages when running valgrind since they can
@@ -858,7 +861,7 @@ static int find_and_fetch_row(TABLE *table, uchar *key)
default:
table->file->print_error(error, MYF(0));
DBUG_PRINT("info", ("Record not found"));
- table->file->ha_rnd_end();
+ (void) table->file->ha_rnd_end();
DBUG_RETURN(error);
}
}
@@ -2410,7 +2413,7 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli)
continue;
DBUG_PRINT("info",("no record matching the given row found"));
table->file->print_error(error, MYF(0));
- table->file->ha_index_end();
+ (void) table->file->ha_index_end();
DBUG_RETURN(error);
}
}
diff --git a/sql/mdl.cc b/sql/mdl.cc
index 97858646652..7fd522d053a 100644
--- a/sql/mdl.cc
+++ b/sql/mdl.cc
@@ -14,7 +14,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-#include "mdl.h"
+#include "sql_class.h"
#include "debug_sync.h"
#include <hash.h>
#include <mysqld_error.h>
@@ -1185,7 +1185,7 @@ MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout,
wait_state_name);
thd_wait_begin(thd, THD_WAIT_META_DATA_LOCK);
- while (!m_wait_status && !thd_killed(thd) &&
+ while (!m_wait_status && !thd->killed &&
wait_result != ETIMEDOUT && wait_result != ETIME)
{
wait_result= mysql_cond_timedwait(&m_COND_wait_status, &m_LOCK_wait_status,
@@ -1207,7 +1207,7 @@ MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout,
false, which means that the caller intends to restart the
wait.
*/
- if (thd_killed(thd))
+ if (thd->killed)
m_wait_status= KILLED;
else if (set_status_on_timeout)
m_wait_status= TIMEOUT;
@@ -2078,7 +2078,11 @@ MDL_context::acquire_lock(MDL_request *mdl_request, ulong lock_wait_timeout)
*/
m_wait.reset_status();
- if (lock->needs_notification(ticket))
+ /*
+ Don't break conflicting locks if timeout is 0 as 0 is used
+ To check if there is any conflicting locks...
+ */
+ if (lock->needs_notification(ticket) && lock_wait_timeout)
lock->notify_conflicting_locks(this);
mysql_prlock_unlock(&lock->m_rwlock);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 0704a016fed..202cabaec58 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -709,8 +709,8 @@ char *opt_logname, *opt_slow_logname, *opt_bin_logname;
static volatile sig_atomic_t kill_in_progress;
my_bool opt_stack_trace;
-my_bool opt_expect_abort= 0;
-static my_bool opt_bootstrap, opt_myisam_log;
+my_bool opt_expect_abort= 0, opt_bootstrap= 0;
+static my_bool opt_myisam_log;
static int cleanup_done;
static ulong opt_specialflag;
static char *opt_binlog_index_name;
@@ -5445,7 +5445,7 @@ void create_thread_to_handle_connection(THD *thd)
if (cached_thread_count > wake_thread)
{
/* Get thread from cache */
- thread_cache.append(thd);
+ thread_cache.push_back(thd);
wake_thread++;
mysql_cond_signal(&COND_thread_cache);
}
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 520fa03bdbf..6bde25f08fb 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -77,7 +77,7 @@ extern CHARSET_INFO *character_set_filesystem;
extern MY_BITMAP temp_pool;
extern bool opt_large_files, server_id_supplied;
extern bool opt_update_log, opt_bin_log, opt_error_log;
-extern my_bool opt_log, opt_slow_log;
+extern my_bool opt_log, opt_slow_log, opt_bootstrap;
extern my_bool opt_backup_history_log;
extern my_bool opt_backup_progress_log;
extern ulonglong log_output_options;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index d3c2ec5a132..7a3a0c94a18 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -117,6 +117,7 @@
#include "records.h" // init_read_record, end_read_record
#include <m_ctype.h>
#include "sql_select.h"
+#include "filesort.h" // filesort_free_buffers
#ifndef EXTRA_DEBUG
#define test_rb_tree(A,B) {}
@@ -1790,8 +1791,6 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
bzero((char*) &alloc,sizeof(alloc));
file= head->file;
record= head->record[0];
- save_read_set= head->read_set;
- save_write_set= head->write_set;
/* Allocate a bitmap for used columns (Q: why not on MEM_ROOT?) */
if (!(bitmap= (my_bitmap_map*) my_malloc(head->s->column_bitmap_size,
@@ -1861,7 +1860,6 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
free_root(&alloc,MYF(0));
my_free(column_bitmap.bitmap);
}
- head->column_bitmaps_set(save_read_set, save_write_set);
my_free(mrr_buf_desc);
DBUG_VOID_RETURN;
}
@@ -1895,7 +1893,8 @@ int QUICK_INDEX_SORT_SELECT::init()
int QUICK_INDEX_SORT_SELECT::reset()
{
DBUG_ENTER("QUICK_INDEX_SORT_SELECT::reset");
- DBUG_RETURN(read_keys_and_merge());
+ const int retval= read_keys_and_merge();
+ DBUG_RETURN(retval);
}
bool
@@ -2006,6 +2005,8 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
handler *save_file= file, *org_file;
my_bool org_key_read;
THD *thd= head->in_use;
+ MY_BITMAP * const save_read_set= head->read_set;
+ MY_BITMAP * const save_write_set= head->write_set;
DBUG_ENTER("QUICK_RANGE_SELECT::init_ror_merged_scan");
in_ror_merged_scan= 1;
@@ -2056,6 +2057,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
last_rowid= file->ref;
end:
+ DBUG_ASSERT(head->read_set == &column_bitmap);
/*
We are only going to read key fields and call position() on 'file'
The following sets head->tmp_set to only use this key and then updates
@@ -2069,7 +2071,8 @@ end:
if (!head->no_keyread)
{
doing_key_read= 1;
- head->mark_columns_used_by_index(index);
+ head->mark_columns_used_by_index_no_reset(index, head->read_set);
+ head->enable_keyread();
}
head->prepare_for_position();
@@ -2091,8 +2094,9 @@ end:
head->file= org_file;
head->key_read= org_key_read;
- bitmap_copy(&column_bitmap, head->read_set);
- head->column_bitmaps_set(&column_bitmap, &column_bitmap);
+
+ /* Restore head->read_set (and write_set) to what they had before the call */
+ head->column_bitmaps_set(save_read_set, save_write_set);
if (reset())
{
@@ -2142,16 +2146,27 @@ 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.
*/
- if (quick->init_ror_merged_scan(TRUE))
- DBUG_RETURN(1);
+ int error= quick->init_ror_merged_scan(TRUE);
+ if (error)
+ DBUG_RETURN(error);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
}
while ((cur= quick_it++))
{
quick= cur->quick;
+#ifndef DBUG_OFF
+ 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))
DBUG_RETURN(1);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
+
+ // Sets are shared by all members of "quick_selects" so must not change
+#ifndef DBUG_OFF
+ DBUG_ASSERT(quick->head->read_set == save_read_set);
+ DBUG_ASSERT(quick->head->write_set == save_write_set);
+#endif
/* All merged scans share the same record buffer in intersection. */
quick->record= head->record[0];
}
@@ -2327,8 +2342,8 @@ int QUICK_ROR_UNION_SELECT::reset()
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
while ((quick= it++))
{
- if (quick->reset())
- DBUG_RETURN(1);
+ if ((error= quick->reset()))
+ DBUG_RETURN(error);
if ((error= quick->get_next()))
{
if (error == HA_ERR_END_OF_FILE)
@@ -2339,10 +2354,10 @@ int QUICK_ROR_UNION_SELECT::reset()
queue_insert(&queue, (uchar*)quick);
}
- if (head->file->ha_rnd_init_with_error(1))
+ if ((error= head->file->ha_rnd_init(1)))
{
DBUG_PRINT("error", ("ROR index_merge rnd_init call failed"));
- DBUG_RETURN(1);
+ DBUG_RETURN(error);
}
DBUG_RETURN(0);
@@ -10610,7 +10625,10 @@ int read_keys_and_merge_scans(THD *thd,
*unique_ptr= unique;
}
else
+ {
unique->reset();
+ filesort_free_buffers(head, false);
+ }
DBUG_ASSERT(file->ref_length == unique->get_size());
DBUG_ASSERT(thd->variables.sortbuff_size == unique->get_max_in_memory_size());
@@ -10769,6 +10787,13 @@ int QUICK_INDEX_INTERSECT_SELECT::get_next()
If a Clustered PK scan is present, it is used only to check if row
satisfies its condition (and never used for row retrieval).
+ Locking: to ensure that exclusive locks are only set on records that
+ are included in the final result we must release the lock
+ on all rows we read but do not include in the final result. This
+ must be done on each index that reads the record and the lock
+ must be released using the same handler (the same quick object) as
+ used when reading the record.
+
RETURN
0 - Ok
other - Error code if any error occurred.
@@ -10779,6 +10804,12 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
List_iterator_fast<QUICK_SELECT_WITH_RECORD> quick_it(quick_selects);
QUICK_SELECT_WITH_RECORD *qr;
QUICK_RANGE_SELECT* quick;
+
+ /* quick that reads the given rowid first. This is needed in order
+ to be able to unlock the row using the same handler object that locked
+ it */
+ QUICK_RANGE_SELECT* quick_with_last_rowid;
+
int error, cmp;
uint last_rowid_count=0;
DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::get_next");
@@ -10792,7 +10823,10 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
if (cpk_quick)
{
while (!error && !cpk_quick->row_in_ranges())
+ {
+ quick->file->unlock_row(); /* row not in range; unlock */
error= quick->get_next();
+ }
}
if (error)
DBUG_RETURN(error);
@@ -10804,6 +10838,7 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
quick->file->position(quick->record);
memcpy(last_rowid, quick->file->ref, head->file->ref_length);
last_rowid_count= 1;
+ quick_with_last_rowid= quick;
while (last_rowid_count < quick_selects.elements)
{
@@ -10817,9 +10852,17 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
do
{
if ((error= quick->get_next()))
+ {
+ quick_with_last_rowid->file->unlock_row();
DBUG_RETURN(error);
+ }
quick->file->position(quick->record);
cmp= head->file->cmp_ref(quick->file->ref, last_rowid);
+ if (cmp < 0)
+ {
+ /* This row is being skipped. Release lock on it. */
+ quick->file->unlock_row();
+ }
} while (cmp < 0);
key_copy(qr->key_tuple, record, head->key_info + quick->index,
@@ -10833,13 +10876,19 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
{
while (!cpk_quick->row_in_ranges())
{
+ quick->file->unlock_row(); /* row not in range; unlock */
if ((error= quick->get_next()))
+ {
+ quick_with_last_rowid->file->unlock_row();
DBUG_RETURN(error);
+ }
}
quick->file->position(quick->record);
}
memcpy(last_rowid, quick->file->ref, head->file->ref_length);
+ quick_with_last_rowid->file->unlock_row();
last_rowid_count= 1;
+ quick_with_last_rowid= quick;
//save the fields here
key_copy(qr->key_tuple, record, head->key_info + quick->index,
@@ -10947,9 +10996,15 @@ int QUICK_RANGE_SELECT::reset()
uchar *mrange_buff;
int error;
HANDLER_BUFFER empty_buf;
+ MY_BITMAP * const save_read_set= head->read_set;
+ MY_BITMAP * const save_write_set= head->write_set;
DBUG_ENTER("QUICK_RANGE_SELECT::reset");
last_range= NULL;
cur_range= (QUICK_RANGE**) ranges.buffer;
+ RANGE_SEQ_IF seq_funcs= {NULL, quick_range_seq_init, quick_range_seq_next, 0, 0};
+
+ if (in_ror_merged_scan)
+ head->column_bitmaps_set_no_signal(&column_bitmap, &column_bitmap);
if (file->inited == handler::RND)
{
@@ -10960,10 +11015,13 @@ int QUICK_RANGE_SELECT::reset()
if (file->inited == handler::NONE)
{
- if (in_ror_merged_scan)
- head->column_bitmaps_set_no_signal(&column_bitmap, &column_bitmap);
+ DBUG_EXECUTE_IF("bug14365043_2",
+ DBUG_SET("+d,ha_index_init_fail"););
if ((error= file->ha_index_init(index,1)))
- DBUG_RETURN(error);
+ {
+ file->print_error(error, MYF(0));
+ goto err;
+ }
}
/* Allocate buffer if we need one but haven't allocated it yet */
@@ -10998,10 +11056,14 @@ int QUICK_RANGE_SELECT::reset()
if (!mrr_buf_desc)
empty_buf.buffer= empty_buf.buffer_end= empty_buf.end_of_used_area= NULL;
- RANGE_SEQ_IF seq_funcs= {NULL, quick_range_seq_init, quick_range_seq_next, 0, 0};
error= file->multi_range_read_init(&seq_funcs, (void*)this, ranges.elements,
mrr_flags, mrr_buf_desc? mrr_buf_desc:
&empty_buf);
+err:
+ /* Restore bitmaps set on entry */
+ if (in_ror_merged_scan)
+ head->column_bitmaps_set_no_signal(save_read_set, save_write_set);
+
DBUG_RETURN(error);
}
@@ -11024,6 +11086,9 @@ int QUICK_RANGE_SELECT::reset()
int QUICK_RANGE_SELECT::get_next()
{
range_id_t dummy;
+ MY_BITMAP * const save_read_set= head->read_set;
+ MY_BITMAP * const save_write_set= head->write_set;
+
DBUG_ENTER("QUICK_RANGE_SELECT::get_next");
if (in_ror_merged_scan)
{
@@ -13169,7 +13234,10 @@ int QUICK_GROUP_MIN_MAX_SELECT::reset(void)
head->enable_keyread(); /* We need only the key attributes */
}
if ((result= file->ha_index_init(index,1)))
+ {
+ head->file->print_error(result, MYF(0));
DBUG_RETURN(result);
+ }
if (quick_prefix_select && quick_prefix_select->reset())
DBUG_RETURN(1);
result= file->ha_index_last(record);
@@ -13344,9 +13412,10 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
*/
if (min_max_arg_part && min_max_arg_part->field->is_null())
{
+ uchar *tmp_key_buff= (uchar*)my_alloca(max_used_key_length);
/* Find the first subsequent record without NULL in the MIN/MAX field. */
- key_copy(tmp_record, record, index_info, max_used_key_length);
- result= file->ha_index_read_map(record, tmp_record,
+ key_copy(tmp_key_buff, record, index_info, max_used_key_length);
+ result= file->ha_index_read_map(record, tmp_key_buff,
make_keypart_map(real_key_parts),
HA_READ_AFTER_KEY);
/*
@@ -13362,10 +13431,11 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min()
if (!result)
{
if (key_cmp(index_info->key_part, group_prefix, real_prefix_len))
- key_restore(record, tmp_record, index_info, 0);
+ key_restore(record, tmp_key_buff, index_info, 0);
}
else if (result == HA_ERR_KEY_NOT_FOUND || result == HA_ERR_END_OF_FILE)
result= 0; /* There is a result in any case. */
+ my_afree(tmp_key_buff);
}
}
diff --git a/sql/opt_range.h b/sql/opt_range.h
index efb45f96345..c59b2a7eb02 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -430,7 +430,7 @@ protected:
/* Members to deal with case when this quick select is a ROR-merged scan */
bool in_ror_merged_scan;
- MY_BITMAP column_bitmap, *save_read_set, *save_write_set;
+ MY_BITMAP column_bitmap;
bool free_file; /* TRUE <=> this->file is "owned" by this quick select */
/* Range pointers to be used when not using MRR interface */
diff --git a/sql/opt_range_mrr.cc b/sql/opt_range_mrr.cc
index a4345059f85..1f4e36178db 100644
--- a/sql/opt_range_mrr.cc
+++ b/sql/opt_range_mrr.cc
@@ -248,6 +248,7 @@ walk_up_n_right:
/* Here minimum contains also function code bits, and maximum is +inf */
range->start_key.key= seq->param->min_key;
range->start_key.length= min_key_length;
+ range->start_key.keypart_map= make_prev_keypart_map(cur->min_key_parts);
range->start_key.flag= (ha_rkey_function) (cur->min_key_flag ^ GEOM_FLAG);
}
else
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 75566b97d3b..e149de6fe53 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -853,8 +853,7 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs)
create a blob column because item->max_length is too big.
The following check is copied from Item::make_string_field():
*/
- if (inner->max_length / inner->collation.collation->mbmaxlen >
- CONVERT_IF_BIGGER_TO_BLOB)
+ if (inner->too_big_for_varchar())
{
DBUG_RETURN(FALSE);
}
@@ -3868,6 +3867,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME);
/* STEP 2: Figure if we'll be using a key or blob+constraint */
+ /* it always has my_charset_bin, so mbmaxlen==1 */
if (uniq_tuple_length_arg >= CONVERT_IF_BIGGER_TO_BLOB)
using_unique_constraint= TRUE;
diff --git a/sql/records.cc b/sql/records.cc
index c98532c1424..d28799ea9d2 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -68,6 +68,7 @@ static int rr_index_desc(READ_RECORD *info);
void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
bool print_error, uint idx, bool reverse)
{
+ int error;
empty_record(table);
bzero((char*) info,sizeof(*info));
info->thd= thd;
@@ -77,8 +78,13 @@ void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
info->unlock_row= rr_unlock_row;
table->status=0; /* And it's always found */
- if (!table->file->inited)
- table->file->ha_index_init(idx, 1);
+ if (!table->file->inited &&
+ (error= table->file->ha_index_init(idx, 1)))
+ {
+ if (print_error)
+ table->file->print_error(error, MYF(0));
+ }
+
/* read_record will be changed to rr_index in rr_index_first */
info->read_record= reverse ? rr_index_last : rr_index_first;
}
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 48fdd3937c5..d52b2992afd 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -71,9 +71,9 @@ class Master_info : public Slave_reporting_capability
/* the variables below are needed because we can change masters on the fly */
char master_log_name[FN_REFLEN+6]; /* Room for multi-*/
- char host[HOSTNAME_LENGTH+1];
- char user[USERNAME_LENGTH+1];
- char password[MAX_PASSWORD_LENGTH+1];
+ char host[HOSTNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1];
+ char user[USERNAME_LENGTH*+1];
+ char password[MAX_PASSWORD_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1];
LEX_STRING connection_name; /* User supplied connection name */
LEX_STRING cmp_connection_name; /* Connection name in lower case */
bool ssl; // enables use of SSL connection if true
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 17919d3c1f1..d5cd6a3efed 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -181,7 +181,8 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
ln= rli->relay_log.generate_name(opt_relay_logname, "-relay-bin",
1, buf);
/* We send the warning only at startup, not after every RESET SLAVE */
- if (!opt_relay_logname && !opt_relaylog_index_name && !name_warning_sent)
+ if (!opt_relay_logname && !opt_relaylog_index_name && !name_warning_sent &&
+ !opt_bootstrap)
{
/*
User didn't give us info to name the relay log index file.
diff --git a/sql/sp.cc b/sql/sp.cc
index 0d9bbb37ede..b80fa968483 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1418,7 +1418,6 @@ bool lock_db_routines(THD *thd, char *db)
{
TABLE *table;
uint key_len;
- int nxtres= 0;
Open_tables_backup open_tables_state_backup;
MDL_request_list mdl_requests;
Lock_db_routines_error_handler err_handler;
@@ -1446,7 +1445,13 @@ bool lock_db_routines(THD *thd, char *db)
table->field[MYSQL_PROC_FIELD_DB]->store(db, strlen(db), system_charset_info);
key_len= table->key_info->key_part[0].store_length;
table->field[MYSQL_PROC_FIELD_DB]->get_key_image(keybuf, key_len, Field::itRAW);
- table->file->ha_index_init(0, 1);
+ int nxtres= table->file->ha_index_init(0, 1);
+ if (nxtres)
+ {
+ table->file->print_error(nxtres, MYF(0));
+ close_system_tables(thd, &open_tables_state_backup);
+ DBUG_RETURN(true);
+ }
if (! table->file->ha_index_read_map(table->record[0], keybuf, (key_part_map)1,
HA_READ_KEY_EXACT))
@@ -1509,7 +1514,11 @@ sp_drop_db_routines(THD *thd, char *db)
table->field[MYSQL_PROC_FIELD_DB]->get_key_image(keybuf, key_len, Field::itRAW);
ret= SP_OK;
- table->file->ha_index_init(0, 1);
+ if (table->file->ha_index_init(0, 1))
+ {
+ ret= SP_KEY_NOT_FOUND;
+ goto err_idx_init;
+ }
if (!table->file->ha_index_read_map(table->record[0], keybuf, (key_part_map)1,
HA_READ_KEY_EXACT))
{
@@ -1535,6 +1544,7 @@ sp_drop_db_routines(THD *thd, char *db)
}
table->file->ha_index_end();
+err_idx_init:
close_thread_tables(thd);
/*
Make sure to only release the MDL lock on mysql.proc, not other
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 0dec9b5f145..cb9c0325845 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -4019,8 +4019,6 @@ typedef struct st_sp_table
Multi-set key:
db_name\0table_name\0alias\0 - for normal tables
db_name\0table_name\0 - for temporary tables
- Note that in both cases we don't take last '\0' into account when
- we count length of key.
*/
LEX_STRING qname;
uint db_length, table_name_length;
@@ -4077,19 +4075,26 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
for (; table ; table= table->next_global)
if (!table->derived && !table->schema_table)
{
- char tname[(SAFE_NAME_LEN + 1) * 3]; // db\0table\0alias\0
- uint tlen, alen;
-
- tlen= table->db_length;
- memcpy(tname, table->db, tlen);
- tname[tlen++]= '\0';
- memcpy(tname+tlen, table->table_name, table->table_name_length);
- tlen+= table->table_name_length;
- tname[tlen++]= '\0';
- alen= strlen(table->alias);
- memcpy(tname+tlen, table->alias, alen);
- tlen+= alen;
- tname[tlen]= '\0';
+ /*
+ Structure of key for the multi-set is "db\0table\0alias\0".
+ Since "alias" part can have arbitrary length we use String
+ object to construct the key. By default String will use
+ buffer allocated on stack with NAME_LEN bytes reserved for
+ alias, since in most cases it is going to be smaller than
+ NAME_LEN bytes.
+ */
+ char tname_buff[(SAFE_NAME_LEN + 1) * 3];
+ String tname(tname_buff, sizeof(tname_buff), &my_charset_bin);
+ uint temp_table_key_length;
+
+ tname.length(0);
+ tname.append(table->db, table->db_length);
+ tname.append('\0');
+ tname.append(table->table_name, table->table_name_length);
+ tname.append('\0');
+ temp_table_key_length= tname.length();
+ tname.append(table->alias);
+ tname.append('\0');
/*
Upgrade the lock type because this table list will be used
@@ -4104,9 +4109,10 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
(and therefore should not be prelocked). Otherwise we will erroneously
treat table with same name but with different alias as non-temporary.
*/
- if ((tab= (SP_TABLE*) my_hash_search(&m_sptabs, (uchar *)tname, tlen)) ||
- ((tab= (SP_TABLE*) my_hash_search(&m_sptabs, (uchar *)tname,
- tlen - alen - 1)) &&
+ if ((tab= (SP_TABLE*) my_hash_search(&m_sptabs, (uchar *)tname.ptr(),
+ tname.length())) ||
+ ((tab= (SP_TABLE*) my_hash_search(&m_sptabs, (uchar *)tname.ptr(),
+ temp_table_key_length)) &&
tab->temp))
{
if (tab->lock_type < table->lock_type)
@@ -4125,11 +4131,11 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE)
{
tab->temp= TRUE;
- tab->qname.length= tlen - alen - 1;
+ tab->qname.length= temp_table_key_length;
}
else
- tab->qname.length= tlen;
- tab->qname.str= (char*) thd->memdup(tname, tab->qname.length + 1);
+ tab->qname.length= tname.length();
+ tab->qname.str= (char*) thd->memdup(tname.ptr(), tab->qname.length);
if (!tab->qname.str)
return FALSE;
tab->table_name_length= table->table_name_length;
@@ -4198,7 +4204,7 @@ sp_head::add_used_tables_to_table_list(THD *thd,
if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) *
stab->lock_count)) ||
!(key_buff= (char*)thd->memdup(stab->qname.str,
- stab->qname.length + 1)))
+ stab->qname.length)))
DBUG_RETURN(FALSE);
for (uint j= 0; j < stab->lock_count; j++)
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index 6fe4be989db..30acfebabb2 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -67,19 +67,15 @@ sp_rcontext::~sp_rcontext()
bool sp_rcontext::init(THD *thd)
{
uint handler_count= m_root_parsing_ctx->max_handler_index();
- uint i;
in_sub_stmt= thd->in_sub_stmt;
if (init_var_table(thd) || init_var_items())
return TRUE;
- if (!(m_raised_conditions= new (thd->mem_root) MYSQL_ERROR[handler_count]))
+ if (!(m_raised_conditions= new (thd->mem_root) Sql_condition_info[handler_count]))
return TRUE;
- for (i= 0; i<handler_count; i++)
- m_raised_conditions[i].init(thd->mem_root);
-
return
!(m_handler=
(sp_handler_t*)thd->alloc(handler_count * sizeof(sp_handler_t))) ||
@@ -419,7 +415,7 @@ sp_rcontext::activate_handler(THD *thd,
/* Reset error state. */
thd->clear_error();
- thd->killed= NOT_KILLED; // Some errors set thd->killed
+ thd->reset_killed(); // Some errors set thd->killed
// (e.g. "bad data").
/* Return IP of the activated SQL handler. */
@@ -446,13 +442,12 @@ sp_rcontext::exit_handler()
DBUG_VOID_RETURN;
}
-MYSQL_ERROR*
-sp_rcontext::raised_condition() const
+Sql_condition_info* sp_rcontext::raised_condition() const
{
if (m_ihsp > 0)
{
uint hindex= m_in_handler[m_ihsp - 1].index;
- MYSQL_ERROR *raised= & m_raised_conditions[hindex];
+ Sql_condition_info *raised= & m_raised_conditions[hindex];
return raised;
}
diff --git a/sql/sp_rcontext.h b/sql/sp_rcontext.h
index 3d976f94381..5008a73d96c 100644
--- a/sql/sp_rcontext.h
+++ b/sql/sp_rcontext.h
@@ -58,6 +58,46 @@ typedef struct
uint index;
} sp_active_handler_t;
+
+class Sql_condition_info : public Sql_alloc
+{
+public:
+ /** SQL error code. */
+ uint m_sql_errno;
+
+ /** Error level. */
+ MYSQL_ERROR::enum_warning_level m_level;
+
+ /** SQLSTATE. */
+ char m_sql_state[SQLSTATE_LENGTH + 1];
+
+ /** Text message. */
+ char m_message[MYSQL_ERRMSG_SIZE];
+
+ void set(uint sql_errno, const char* sqlstate,
+ MYSQL_ERROR::enum_warning_level level,
+ const char* msg)
+ {
+ m_sql_errno= sql_errno;
+ m_level= level;
+
+ memcpy(m_sql_state, sqlstate, SQLSTATE_LENGTH);
+ m_sql_state[SQLSTATE_LENGTH]= '\0';
+
+ strncpy(m_message, msg, MYSQL_ERRMSG_SIZE);
+ }
+
+ void clear()
+ {
+ m_sql_errno= 0;
+ m_level= MYSQL_ERROR::WARN_LEVEL_ERROR;
+
+ m_sql_state[0]= '\0';
+ m_message[0]= '\0';
+ }
+};
+
+
/*
This class is a runtime context of a Stored Routine. It is used in an
execution and is intended to contain all dynamic objects (i.e. objects, which
@@ -146,8 +186,7 @@ class sp_rcontext : public Sql_alloc
MYSQL_ERROR::enum_warning_level level,
const char *msg);
- MYSQL_ERROR *
- raised_condition() const;
+ Sql_condition_info *raised_condition() const;
void
push_hstack(uint h);
@@ -232,7 +271,7 @@ private:
SQL conditions caught by each handler.
This is an array indexed by handler index.
*/
- MYSQL_ERROR *m_raised_conditions;
+ Sql_condition_info *m_raised_conditions;
uint m_hcount; // Stack pointer for m_handler
uint *m_hstack; // Return stack for continue handlers
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 2d1493b17de..2f854251ce5 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1,5 +1,5 @@
/* 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 as published by
@@ -50,6 +50,7 @@
#include "sql_connect.h"
#include "hostname.h"
#include "sql_db.h"
+#include "sql_array.h"
bool mysql_user_table_is_in_short_password_format= false;
@@ -560,6 +561,18 @@ static bool update_user_table(THD *thd, TABLE *table, const char *host,
static my_bool acl_load(THD *thd, TABLE_LIST *tables);
static my_bool grant_load(THD *thd, TABLE_LIST *tables);
static inline void get_grantor(THD *thd, char* grantor);
+/*
+ Enumeration of various ACL's and Hashes used in handle_grant_struct()
+*/
+enum enum_acl_lists
+{
+ USER_ACL= 0,
+ DB_ACL,
+ COLUMN_PRIVILEGES_HASH,
+ PROC_PRIVILEGES_HASH,
+ FUNC_PRIVILEGES_HASH,
+ PROXY_USERS_ACL
+};
/*
Convert scrambled password to binary form, according to scramble type,
@@ -767,7 +780,12 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
convert db to lower case and give a warning if the db wasn't
already in lower case
*/
- (void) strmov(tmp_name, host.db);
+ char *end = strnmov(tmp_name, host.db, sizeof(tmp_name));
+ if (end >= tmp_name + sizeof(tmp_name))
+ {
+ sql_print_warning(ER(ER_WRONG_DB_NAME), host.db);
+ continue;
+ }
my_casedn_str(files_charset_info, host.db);
if (strcmp(host.db, tmp_name) != 0)
sql_print_warning("'host' entry '%s|%s' had database in mixed "
@@ -1038,7 +1056,12 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
convert db to lower case and give a warning if the db wasn't
already in lower case
*/
- (void)strmov(tmp_name, db.db);
+ char *end = strnmov(tmp_name, db.db, sizeof(tmp_name));
+ if (end >= tmp_name + sizeof(tmp_name))
+ {
+ sql_print_warning(ER(ER_WRONG_DB_NAME), db.db);
+ continue;
+ }
my_casedn_str(files_charset_info, db.db);
if (strcmp(db.db, tmp_name) != 0)
{
@@ -2698,7 +2721,13 @@ replace_proxies_priv_table(THD *thd, TABLE *table, const LEX_USER *user,
get_grantor(thd, grantor);
- table->file->ha_index_init(0, 1);
+ if ((error= table->file->ha_index_init(0, 1)))
+ {
+ table->file->print_error(error, MYF(0));
+ DBUG_PRINT("info", ("ha_index_init error"));
+ DBUG_RETURN(-1);
+ }
+
if (table->file->ha_index_read_map(table->record[0], user_key,
HA_WHOLE_KEY,
HA_READ_KEY_EXACT))
@@ -2940,7 +2969,12 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
key_copy(key, col_privs->record[0], col_privs->key_info, key_prefix_len);
col_privs->field[4]->store("",0, &my_charset_latin1);
- col_privs->file->ha_index_init(0, 1);
+ if (col_privs->file->ha_index_init(0, 1))
+ {
+ cols= 0;
+ return;
+ }
+
if (col_privs->file->ha_index_read_map(col_privs->record[0], (uchar*) key,
(key_part_map)15,
HA_READ_KEY_EXACT))
@@ -3004,15 +3038,23 @@ static GRANT_NAME *name_hash_search(HASH *name_hash,
const char *user, const char *tname,
bool exact, bool name_tolower)
{
- char helping [SAFE_NAME_LEN*2+USERNAME_LENGTH+3], *name_ptr;
+ char helping[SAFE_NAME_LEN*2+USERNAME_LENGTH+3];
+ char *hend = helping + sizeof(helping);
uint len;
GRANT_NAME *grant_name,*found=0;
HASH_SEARCH_STATE state;
- name_ptr= strmov(strmov(helping, user) + 1, db) + 1;
- len = (uint) (strmov(name_ptr, tname) - helping) + 1;
+ char *db_ptr= strmov(helping, user) + 1;
+ char *tname_ptr= strnmov(db_ptr, db, hend - db_ptr) + 1;
+ if (tname_ptr > hend)
+ return 0; // invalid name = not found
+ char *end= strnmov(tname_ptr, tname, hend - tname_ptr) + 1;
+ if (end > hend)
+ return 0; // invalid name = not found
+
+ len = (uint) (end - helping);
if (name_tolower)
- my_casedn_str(files_charset_info, name_ptr);
+ my_casedn_str(files_charset_info, tname_ptr);
for (grant_name= (GRANT_NAME*) my_hash_first(name_hash, (uchar*) helping,
len, &state);
grant_name ;
@@ -3072,7 +3114,7 @@ static int replace_column_table(GRANT_TABLE *g_t,
const char *db, const char *table_name,
ulong rights, bool revoke_grant)
{
- int error=0,result=0;
+ int result=0;
uchar key[MAX_KEY_LENGTH];
uint key_prefix_length;
KEY_PART_INFO *key_part= table->key_info->key_part;
@@ -3099,7 +3141,13 @@ static int replace_column_table(GRANT_TABLE *g_t,
List_iterator <LEX_COLUMN> iter(columns);
class LEX_COLUMN *column;
- table->file->ha_index_init(0, 1);
+ int error= table->file->ha_index_init(0, 1);
+ if (error)
+ {
+ table->file->print_error(error, MYF(0));
+ DBUG_RETURN(-1);
+ }
+
while ((column= iter++))
{
ulong privileges= column->rights;
@@ -3970,7 +4018,12 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
if (lower_case_table_names && db)
{
- strmov(tmp_db,db);
+ char *end= strnmov(tmp_db,db, sizeof(tmp_db));
+ if (end >= tmp_db + sizeof(tmp_db))
+ {
+ my_error(ER_WRONG_DB_NAME ,MYF(0), db);
+ DBUG_RETURN(TRUE);
+ }
my_casedn_str(files_charset_info, tmp_db);
db=tmp_db;
}
@@ -4155,7 +4208,10 @@ static my_bool grant_load_procs_priv(TABLE *p_table)
(void) my_hash_init(&func_priv_hash, &my_charset_utf8_bin,
0,0,0, (my_hash_get_key) get_grant_table,
0,0);
- p_table->file->ha_index_init(0, 1);
+
+ if (p_table->file->ha_index_init(0, 1))
+ DBUG_RETURN(TRUE);
+
p_table->use_all_columns();
if (!p_table->file->ha_index_first(p_table->record[0]))
@@ -4256,7 +4312,10 @@ static my_bool grant_load(THD *thd, TABLE_LIST *tables)
t_table = tables[0].table;
c_table = tables[1].table;
- t_table->file->ha_index_init(0, 1);
+
+ if (t_table->file->ha_index_init(0, 1))
+ goto end_index_init;
+
t_table->use_all_columns();
c_table->use_all_columns();
@@ -4301,9 +4360,10 @@ static my_bool grant_load(THD *thd, TABLE_LIST *tables)
return_val=0; // Return ok
end_unlock:
- thd->variables.sql_mode= old_sql_mode;
t_table->file->ha_index_end();
my_pthread_setspecific_ptr(THR_MALLOC, save_mem_root_ptr);
+end_index_init:
+ thd->variables.sql_mode= old_sql_mode;
DBUG_RETURN(return_val);
}
@@ -5990,20 +6050,19 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop,
Delete from grant structure if drop is true.
Update in grant structure if drop is false and user_to is not NULL.
Search in grant structure if drop is false and user_to is NULL.
- Structures are numbered as follows:
- 0 acl_users
- 1 acl_dbs
- 2 column_priv_hash
- 3 proc_priv_hash
- 4 func_priv_hash
- 5 acl_proxy_users
+ Structures are enumerated as follows:
+ 0 ACL_USER
+ 1 ACL_DB
+ 2 COLUMN_PRIVILEGES_HASH
+ 3 PROC_PRIVILEGES_HASH
+ 4 FUNC_PRIVILEGES_HASH
+ 5 PROXY_USERS_ACL
@retval > 0 At least one element matched.
@retval 0 OK, but no element matched.
- @retval -1 Wrong arguments to function.
*/
-static int handle_grant_struct(uint struct_no, bool drop,
+static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
LEX_USER *user_from, LEX_USER *user_to)
{
int result= 0;
@@ -6027,28 +6086,29 @@ static int handle_grant_struct(uint struct_no, bool drop,
/* Get the number of elements in the in-memory structure. */
switch (struct_no) {
- case 0:
+ case USER_ACL:
elements= acl_users.elements;
break;
- case 1:
+ case DB_ACL:
elements= acl_dbs.elements;
break;
- case 2:
+ case COLUMN_PRIVILEGES_HASH:
grant_name_hash= &column_priv_hash;
elements= grant_name_hash->records;
break;
- case 3:
+ case PROC_PRIVILEGES_HASH:
grant_name_hash= &proc_priv_hash;
elements= grant_name_hash->records;
break;
- case 4:
+ case FUNC_PRIVILEGES_HASH:
grant_name_hash= &func_priv_hash;
elements= grant_name_hash->records;
break;
- case 5:
+ case PROXY_USERS_ACL:
elements= acl_proxy_users.elements;
break;
default:
+ DBUG_ASSERT(0);
return -1;
}
@@ -6063,27 +6123,27 @@ static int handle_grant_struct(uint struct_no, bool drop,
Get a pointer to the element.
*/
switch (struct_no) {
- case 0:
+ case USER_ACL:
acl_user= dynamic_element(&acl_users, idx, ACL_USER*);
user= acl_user->user;
host= acl_user->host.hostname;
break;
- case 1:
+ case DB_ACL:
acl_db= dynamic_element(&acl_dbs, idx, ACL_DB*);
user= acl_db->user;
host= acl_db->host.hostname;
break;
- case 2:
- case 3:
- case 4:
+ case COLUMN_PRIVILEGES_HASH:
+ case PROC_PRIVILEGES_HASH:
+ case FUNC_PRIVILEGES_HASH:
grant_name= (GRANT_NAME*) my_hash_element(grant_name_hash, idx);
user= grant_name->user;
host= grant_name->host.hostname;
break;
- case 5:
+ case PROXY_USERS_ACL:
acl_proxy_user= dynamic_element(&acl_proxy_users, idx, ACL_PROXY_USER*);
user= acl_proxy_user->get_user();
host= acl_proxy_user->get_host();
@@ -6109,21 +6169,21 @@ static int handle_grant_struct(uint struct_no, bool drop,
if ( drop )
{
switch ( struct_no ) {
- case 0:
+ case USER_ACL:
delete_dynamic_element(&acl_users, idx);
break;
- case 1:
+ case DB_ACL:
delete_dynamic_element(&acl_dbs, idx);
break;
- case 2:
- case 3:
- case 4:
+ case COLUMN_PRIVILEGES_HASH:
+ case PROC_PRIVILEGES_HASH:
+ case FUNC_PRIVILEGES_HASH:
my_hash_delete(grant_name_hash, (uchar*) grant_name);
break;
- case 5:
+ case PROXY_USERS_ACL:
delete_dynamic_element(&acl_proxy_users, idx);
break;
@@ -6147,19 +6207,19 @@ static int handle_grant_struct(uint struct_no, bool drop,
else if ( user_to )
{
switch ( struct_no ) {
- case 0:
+ case USER_ACL:
acl_user->user= strdup_root(&mem, user_to->user.str);
acl_user->host.hostname= strdup_root(&mem, user_to->host.str);
break;
- case 1:
+ case DB_ACL:
acl_db->user= strdup_root(&mem, user_to->user.str);
acl_db->host.hostname= strdup_root(&mem, user_to->host.str);
break;
- case 2:
- case 3:
- case 4:
+ case COLUMN_PRIVILEGES_HASH:
+ case PROC_PRIVILEGES_HASH:
+ case FUNC_PRIVILEGES_HASH:
{
/*
Save old hash key and its length to be able properly update
@@ -6195,11 +6255,10 @@ static int handle_grant_struct(uint struct_no, bool drop,
break;
}
- case 5:
+ case PROXY_USERS_ACL:
acl_proxy_user->set_user (&mem, user_to->user.str);
acl_proxy_user->set_host (&mem, user_to->host.str);
break;
-
}
}
else
@@ -6256,7 +6315,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
else
{
/* Handle user array. */
- if ((handle_grant_struct(0, drop, user_from, user_to)) || found)
+ if ((handle_grant_struct(USER_ACL, drop, user_from, user_to)) || found)
{
result= 1; /* At least one record/element found. */
/* If search is requested, we do not need to search further. */
@@ -6274,7 +6333,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
else
{
/* Handle db array. */
- if (((handle_grant_struct(1, drop, user_from, user_to) && ! result) ||
+ if (((handle_grant_struct(DB_ACL, drop, user_from, user_to) && ! result) ||
found) && ! result)
{
result= 1; /* At least one record/element found. */
@@ -6293,7 +6352,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
else
{
/* Handle procs array. */
- if (((handle_grant_struct(3, drop, user_from, user_to) && ! result) ||
+ if (((handle_grant_struct(PROC_PRIVILEGES_HASH, drop, user_from, user_to) && ! result) ||
found) && ! result)
{
result= 1; /* At least one record/element found. */
@@ -6302,7 +6361,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
goto end;
}
/* Handle funcs array. */
- if (((handle_grant_struct(4, drop, user_from, user_to) && ! result) ||
+ if (((handle_grant_struct(FUNC_PRIVILEGES_HASH, drop, user_from, user_to) && ! result) ||
found) && ! result)
{
result= 1; /* At least one record/element found. */
@@ -6337,7 +6396,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
else
{
/* Handle columns hash. */
- if (((handle_grant_struct(2, drop, user_from, user_to) && ! result) ||
+ if (((handle_grant_struct(COLUMN_PRIVILEGES_HASH, drop, user_from, user_to) && ! result) ||
found) && ! result)
result= 1; /* At least one record/element found. */
}
@@ -6354,7 +6413,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop,
else
{
/* Handle proxies_priv array. */
- if ((handle_grant_struct(5, drop, user_from, user_to) && !result) ||
+ if ((handle_grant_struct(PROXY_USERS_ACL, drop, user_from, user_to) && !result) ||
found)
result= 1; /* At least one record/element found. */
}
@@ -7082,14 +7141,25 @@ acl_check_proxy_grant_access(THD *thd, const char *host, const char *user,
DBUG_RETURN(FALSE);
}
- /* one can grant proxy to himself to others */
- if (!strcmp(thd->security_ctx->user, user) &&
+ /*
+ one can grant proxy for self to others.
+ Security context in THD contains two pairs of (user,host):
+ 1. (user,host) pair referring to inbound connection.
+ 2. (priv_user,priv_host) pair obtained from mysql.user table after doing
+ authnetication of incoming connection.
+ Privileges should be checked wrt (priv_user, priv_host) tuple, because
+ (user,host) pair obtained from inbound connection may have different
+ values than what is actually stored in mysql.user table and while granting
+ or revoking proxy privilege, user is expected to provide entries mentioned
+ in mysql.user table.
+ */
+ if (!strcmp(thd->security_ctx->priv_user, user) &&
!my_strcasecmp(system_charset_info, host,
- thd->security_ctx->host))
+ thd->security_ctx->priv_host))
{
DBUG_PRINT("info", ("strcmp (%s, %s) my_casestrcmp (%s, %s) equal",
- thd->security_ctx->user, user,
- host, thd->security_ctx->host));
+ thd->security_ctx->priv_user, user,
+ host, thd->security_ctx->priv_host));
DBUG_RETURN(FALSE);
}
@@ -7755,6 +7825,7 @@ struct MPVIO_EXT :public MYSQL_PLUGIN_VIO
} cached_server_packet;
int packets_read, packets_written; ///< counters for send/received packets
uint connect_errors; ///< if there were connect errors for this host
+ bool make_it_fail;
/** when plugin returns a failure this tells us what really happened */
enum { SUCCESS, FAILURE, RESTART } status;
};
@@ -8020,14 +8091,14 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
/**
Finds acl entry in user database for authentication purposes.
- Finds a user and copies it into mpvio. Reports an authentication
- failure if a user is not found.
+ Finds a user and copies it into mpvio. Creates a fake user
+ if no matching user account is found.
@note find_acl_user is not the same, because it doesn't take into
account the case when user is not empty, but acl_user->user is empty
@retval 0 found
- @retval 1 not found
+ @retval 1 error
*/
static bool find_mpvio_user(MPVIO_EXT *mpvio)
{
@@ -8050,8 +8121,27 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
if (!mpvio->acl_user)
{
- login_failed_error(mpvio->thd);
- DBUG_RETURN (1);
+ /*
+ A matching user was not found. Fake it. Take any user, make the
+ authentication fail later.
+ This way we get a realistically looking failure, with occasional
+ "change auth plugin" requests even for nonexistent users. The ratio
+ of "change auth plugin" request will be the same for real and
+ nonexistent users.
+ Note, that we cannot pick any user at random, it must always be
+ the same user account for the incoming sctx->user name.
+ */
+ ulong nr1=1, nr2=4;
+ CHARSET_INFO *cs= &my_charset_latin1;
+ cs->coll->hash_sort(cs, (uchar*) sctx->user, strlen(sctx->user), &nr1, &nr2);
+
+ mysql_mutex_lock(&acl_cache->lock);
+ uint i= nr1 % acl_users.elements;
+ ACL_USER *acl_user_tmp= dynamic_element(&acl_users, i, ACL_USER*);
+ mpvio->acl_user= acl_user_tmp->copy(mpvio->thd->mem_root);
+ mysql_mutex_unlock(&acl_cache->lock);
+
+ mpvio->make_it_fail= true;
}
/* user account requires non-default plugin and the client is too old */
@@ -8178,6 +8268,7 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ thd->password= passwd_len > 0;
if (find_mpvio_user(mpvio))
DBUG_RETURN(1);
@@ -8473,8 +8564,8 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
mpvio->cached_server_packet.pkt_len))
return packet_error;
- passwd_len= my_net_read(&mpvio->thd->net);
- passwd= (char*)mpvio->thd->net.read_pos;
+ passwd_len= my_net_read(&thd->net);
+ passwd= (char*)thd->net.read_pos;
}
*buff= (uchar*) passwd;
@@ -8576,6 +8667,10 @@ static int server_mpvio_read_packet(MYSQL_PLUGIN_VIO *param, uchar **buf)
*buf= (uchar*) mpvio->cached_client_reply.pkt;
mpvio->cached_client_reply.pkt= 0;
mpvio->packets_read++;
+
+ if (mpvio->make_it_fail)
+ goto err;
+
DBUG_RETURN ((int) mpvio->cached_client_reply.pkt_len);
}
@@ -8610,6 +8705,9 @@ static int server_mpvio_read_packet(MYSQL_PLUGIN_VIO *param, uchar **buf)
else
*buf= mpvio->thd->net.read_pos;
+ if (mpvio->make_it_fail)
+ goto err;
+
DBUG_RETURN((int)pkt_len);
err:
@@ -8617,7 +8715,12 @@ err:
{
inc_host_errors(mpvio->thd->security_ctx->ip);
if (!mpvio->thd->is_error())
- my_error(ER_HANDSHAKE_ERROR, MYF(0));
+ {
+ if (mpvio->make_it_fail)
+ login_failed_error(mpvio->thd);
+ else
+ my_error(ER_HANDSHAKE_ERROR, MYF(0));
+ }
}
DBUG_RETURN(-1);
}
@@ -8822,6 +8925,7 @@ bool acl_authenticate(THD *thd, uint connect_errors,
mpvio.thd= thd;
mpvio.connect_errors= connect_errors;
mpvio.status= MPVIO_EXT::FAILURE;
+ mpvio.make_it_fail= false;
mpvio.auth_info.host_or_ip= thd->security_ctx->host_or_ip;
mpvio.auth_info.host_or_ip_length=
(unsigned int) strlen(thd->security_ctx->host_or_ip);
diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc
index f1f991242e7..793eead9869 100644
--- a/sql/sql_audit.cc
+++ b/sql/sql_audit.cc
@@ -132,12 +132,9 @@ static const uint audit_handlers_count=
static my_bool acquire_plugins(THD *thd, plugin_ref plugin, void *arg)
{
- uint event_class= *(uint*) arg;
- unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
+ ulong *event_class_mask= (ulong*) arg;
st_mysql_audit *data= plugin_data(plugin, struct st_mysql_audit *);
- set_audit_mask(event_class_mask, event_class);
-
/* Check if this plugin is interested in the event */
if (check_audit_mask(data->class_mask, event_class_mask))
return 0;
@@ -176,15 +173,13 @@ static my_bool acquire_plugins(THD *thd, plugin_ref plugin, void *arg)
@details Ensure that audit plugins interested in given event
class are locked by current thread.
*/
-void mysql_audit_acquire_plugins(THD *thd, uint event_class)
+void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask)
{
- unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
DBUG_ENTER("mysql_audit_acquire_plugins");
- set_audit_mask(event_class_mask, event_class);
if (thd && !check_audit_mask(mysql_global_audit_mask, event_class_mask) &&
check_audit_mask(thd->audit_class_mask, event_class_mask))
{
- plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, &event_class);
+ plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, event_class_mask);
add_audit_mask(thd->audit_class_mask, event_class_mask);
}
DBUG_VOID_RETURN;
@@ -206,7 +201,9 @@ void mysql_audit_notify(THD *thd, uint event_class, uint event_subtype, ...)
va_list ap;
audit_handler_t *handlers= audit_handlers + event_class;
DBUG_ASSERT(event_class < audit_handlers_count);
- mysql_audit_acquire_plugins(thd, event_class);
+ unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
+ set_audit_mask(event_class_mask, event_class);
+ mysql_audit_acquire_plugins(thd, event_class_mask);
va_start(ap, event_subtype);
(*handlers)(thd, event_subtype, ap);
va_end(ap);
@@ -364,6 +361,34 @@ int initialize_audit_plugin(st_plugin_int *plugin)
add_audit_mask(mysql_global_audit_mask, data->class_mask);
mysql_mutex_unlock(&LOCK_audit_mask);
+ /*
+ Pre-acquire the newly inslalled audit plugin for events that
+ may potentially occur further during INSTALL PLUGIN.
+
+ When audit event is triggered, audit subsystem acquires interested
+ plugins by walking through plugin list. Evidently plugin list
+ iterator protects plugin list by acquiring LOCK_plugin, see
+ plugin_foreach_with_mask().
+
+ On the other hand [UN]INSTALL PLUGIN is acquiring LOCK_plugin
+ rather for a long time.
+
+ When audit event is triggered during [UN]INSTALL PLUGIN, plugin
+ list iterator acquires the same lock (within the same thread)
+ second time.
+
+ This hack should be removed when LOCK_plugin is fixed so it
+ protects only what it supposed to protect.
+
+ See also mysql_install_plugin() and mysql_uninstall_plugin()
+ */
+ THD *thd= current_thd;
+ if (thd)
+ {
+ acquire_plugins(thd, plugin_int_to_ref(plugin), data->class_mask);
+ add_audit_mask(thd->audit_class_mask, data->class_mask);
+ }
+
return 0;
}
@@ -494,7 +519,7 @@ static void event_class_dispatch(THD *thd, unsigned int event_class,
#else /* EMBEDDED_LIBRARY */
-void mysql_audit_acquire_plugins(THD *thd, uint event_class)
+void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask)
{
}
diff --git a/sql/sql_audit.h b/sql/sql_audit.h
index b2ce31f1d26..46afe4b7596 100644
--- a/sql/sql_audit.h
+++ b/sql/sql_audit.h
@@ -31,7 +31,7 @@ extern void mysql_audit_finalize();
extern void mysql_audit_init_thd(THD *thd);
extern void mysql_audit_free_thd(THD *thd);
-extern void mysql_audit_acquire_plugins(THD *thd, uint event_class);
+extern void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask);
#ifndef EMBEDDED_LIBRARY
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 58b13d4cd8a..b3321bd2771 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -8973,7 +8973,8 @@ fill_record(THD * thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
ER(ER_WARNING_NON_DEFAULT_VALUE_FOR_VIRTUAL_COLUMN),
rfield->field_name, table->s->table_name.str);
}
- if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors)
+ if ((!rfield->vcol_info || rfield->stored_in_db) &&
+ (value->save_in_field(rfield, 0)) < 0 && !ignore_errors)
{
my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
goto err;
@@ -9329,7 +9330,11 @@ bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
in_use->killed= KILL_SYSTEM_THREAD;
mysql_mutex_lock(&in_use->mysys_var->mutex);
if (in_use->mysys_var->current_cond)
+ {
+ mysql_mutex_lock(in_use->mysys_var->current_mutex);
mysql_cond_broadcast(in_use->mysys_var->current_cond);
+ mysql_mutex_unlock(in_use->mysys_var->current_mutex);
+ }
mysql_mutex_unlock(&in_use->mysys_var->mutex);
signalled= TRUE;
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 47c104c2a65..7577056c3c5 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -684,7 +684,7 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
values doesn't have to very accurate and the memory it points to is static,
but we need to attempt a snapshot on the pointer values to avoid using NULL
values. The pointer to thd->query however, doesn't point to static memory
- and has to be protected by LOCK_thread_count or risk pointing to
+ and has to be protected by thd->LOCK_thd_data or risk pointing to
uninitialized memory.
*/
const char *proc_info= thd->proc_info;
@@ -719,20 +719,21 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
str.append(proc_info);
}
- mysql_mutex_lock(&thd->LOCK_thd_data);
-
- if (thd->query())
+ /* Don't wait if LOCK_thd_data is used as this could cause a deadlock */
+ if (!mysql_mutex_trylock(&thd->LOCK_thd_data))
{
- if (max_query_len < 1)
- len= thd->query_length();
- else
- len= min(thd->query_length(), max_query_len);
- str.append('\n');
- str.append(thd->query(), len);
+ if (thd->query())
+ {
+ if (max_query_len < 1)
+ len= thd->query_length();
+ else
+ len= min(thd->query_length(), max_query_len);
+ str.append('\n');
+ str.append(thd->query(), len);
+ }
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
}
- mysql_mutex_unlock(&thd->LOCK_thd_data);
-
if (str.c_ptr_safe() == buffer)
return buffer;
@@ -795,6 +796,7 @@ THD::THD()
stmt_da(&main_da),
thread_id(0),
global_disable_checkpoint(0),
+ failed_com_change_user(0),
is_fatal_error(0),
transaction_rollback_request(0),
is_fatal_sub_stmt_error(0),
@@ -1365,7 +1367,7 @@ void THD::change_user(void)
mysql_mutex_unlock(&LOCK_status);
cleanup();
- killed= NOT_KILLED;
+ reset_killed();
cleanup_done= 0;
init();
stmt_map.reset();
@@ -1636,6 +1638,10 @@ void THD::awake(killed_state state_to_set)
MYSQL_CALLBACK(scheduler, post_kill_notification, (this));
}
+ /* Interrupt target waiting inside a storage engine. */
+ if (state_to_set != NOT_KILLED)
+ ha_kill_query(this, thd_kill_level(this));
+
/* Broadcast a condition to kick the target if it is waiting on it. */
if (mysys_var)
{
@@ -3880,21 +3886,31 @@ void THD::restore_backup_open_tables_state(Open_tables_backup *backup)
DBUG_VOID_RETURN;
}
+#if MARIA_PLUGIN_INTERFACE_VERSION < 0x0200
/**
- Check the killed state of a user thread
- @param thd user thread
- @retval 0 the user thread is active
- @retval 1 the user thread has been killed
-
- This is used to signal a storage engine if it should be killed.
- See also THD::check_killed().
+ This is a backward compatibility method, made obsolete
+ by the thd_kill_statement service. Keep it here to avoid breaking the
+ ABI in case some binary plugins still use it.
*/
-
+#undef thd_killed
extern "C" int thd_killed(const MYSQL_THD thd)
{
+ return thd_kill_level(thd) > THD_ABORT_SOFTLY;
+}
+#else
+#error now thd_killed() function can go away
+#endif
+
+/*
+ return thd->killed status to the client,
+ mapped to the API enum thd_kill_levels values.
+*/
+extern "C" enum thd_kill_levels thd_kill_level(const MYSQL_THD thd)
+{
THD* current= current_thd;
+
if (!thd)
- thd= current_thd;
+ thd= current;
if (thd == current)
{
@@ -3903,11 +3919,11 @@ extern "C" int thd_killed(const MYSQL_THD thd)
apc_target->process_apc_requests();
}
- if (!(thd->killed & KILL_HARD_BIT))
- return 0;
- return thd->killed;
-}
+ if (likely(thd->killed == NOT_KILLED))
+ return THD_IS_NOT_KILLED;
+ return thd->killed & KILL_HARD_BIT ? THD_ABORT_ASAP : THD_ABORT_SOFTLY;
+}
/**
Send an out-of-band progress report to the client
@@ -4949,7 +4965,7 @@ THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
There is no good place to set up the transactional data, so we
have to do it here.
*/
- if (binlog_setup_trx_data())
+ if (binlog_setup_trx_data() == NULL)
DBUG_RETURN(NULL);
Rows_log_event* pending= binlog_get_pending_rows_event(is_transactional);
@@ -5642,4 +5658,3 @@ bool Discrete_intervals_list::append(Discrete_interval *new_interval)
}
#endif /* !defined(MYSQL_CLIENT) */
-
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 9d00d3ff905..87b9783c1ed 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1751,7 +1751,7 @@ public:
bool save_prep_leaf_list;
#ifndef MYSQL_CLIENT
- int binlog_setup_trx_data();
+ binlog_cache_mngr * binlog_setup_trx_data();
/*
Public interface to write RBR events to the binlog
@@ -2234,6 +2234,7 @@ public:
bool no_errors;
uint8 password;
+ uint8 failed_com_change_user;
/**
Set to TRUE if execution of the current compound statement
@@ -2748,6 +2749,19 @@ public:
{
return ::killed_errno(killed);
}
+ inline void reset_killed()
+ {
+ /*
+ Resetting killed has to be done under a mutex to ensure
+ its not done during an awake() call.
+ */
+ if (killed != NOT_KILLED)
+ {
+ mysql_mutex_lock(&LOCK_thd_data);
+ killed= NOT_KILLED;
+ mysql_mutex_unlock(&LOCK_thd_data);
+ }
+ }
inline void send_kill_message() const
{
int err= killed_errno();
@@ -3974,6 +3988,8 @@ class Unique :public Sql_alloc
uint full_size;
uint min_dupl_count; /* always 0 for unions, > 0 for intersections */
+ bool merge(TABLE *table, uchar *buff, bool without_last_merge);
+
public:
ulong elements;
Unique(qsort_cmp2 comp_func, void *comp_func_fixed_arg,
@@ -4014,7 +4030,7 @@ public:
}
void reset();
- bool walk(tree_walk_action action, void *walk_action_arg);
+ bool walk(TABLE *table, tree_walk_action action, void *walk_action_arg);
uint get_size() const { return size; }
ulonglong get_max_in_memory_size() const { return max_in_memory_size; }
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 81a85f10a16..9f6185280cd 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -905,6 +905,19 @@ static int check_connection(THD *thd)
my_error(ER_BAD_HOST_ERROR, MYF(0));
return 1;
}
+ /* BEGIN : DEBUG */
+ DBUG_EXECUTE_IF("addr_fake_ipv4",
+ {
+ struct sockaddr *sa= (sockaddr *) &net->vio->remote;
+ sa->sa_family= AF_INET;
+ struct in_addr *ip4= &((struct sockaddr_in *)sa)->sin_addr;
+ /* See RFC 5737, 192.0.2.0/23 is reserved */
+ const char* fake= "192.0.2.4";
+ ip4->s_addr= inet_addr(fake);
+ strcpy(ip, fake);
+ };);
+ /* END : DEBUG */
+
if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME))))
return 1; /* The error is set by my_strdup(). */
thd->main_security_ctx.host_or_ip= thd->main_security_ctx.ip;
diff --git a/sql/sql_const.h b/sql/sql_const.h
index 255a0162e93..c6aa52197d5 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -43,8 +43,8 @@
#define MAX_MBWIDTH 3 /* Max multibyte sequence */
#define MAX_FIELD_CHARLENGTH 255
#define MAX_FIELD_VARCHARLENGTH 65535
-#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */
-#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Used for CREATE ... SELECT */
+#define MAX_FIELD_BLOBLENGTH UINT_MAX32 /* cf field_blob::get_length() */
+#define CONVERT_IF_BIGGER_TO_BLOB 512 /* Threshold *in characters* */
/* Max column width +1 */
#define MAX_FIELD_WIDTH (MAX_FIELD_CHARLENGTH*MAX_MBWIDTH+1)
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index dc8a2e9f057..87650e643f2 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.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
@@ -755,7 +756,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
{
ulong deleted_tables= 0;
bool error= true;
- char path[FN_REFLEN+16];
+ char path[FN_REFLEN + 16];
MY_DIR *dirp;
uint length;
bool found_other_files= false;
@@ -928,7 +929,7 @@ update_binlog:
if (!(query= (char*) thd->alloc(MAX_DROP_TABLE_Q_LEN)))
goto exit; /* not much else we can do */
- query_pos= query_data_start= strmov(query,"drop table ");
+ query_pos= query_data_start= strmov(query,"DROP TABLE ");
query_end= query + MAX_DROP_TABLE_Q_LEN;
db_len= strlen(db);
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index c4055a9221f..1c93a59904c 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -846,14 +846,14 @@ retry:
case RFIRST:
if (keyname)
{
- table->file->ha_index_or_rnd_end();
- table->file->ha_index_init(keyno, 1);
- error= table->file->ha_index_first(table->record[0]);
+ if (!(error= table->file->ha_index_or_rnd_end()) &&
+ !(error= table->file->ha_index_init(keyno, 1)))
+ error= table->file->ha_index_first(table->record[0]);
}
else
{
- table->file->ha_index_or_rnd_end();
- if (!(error= table->file->ha_rnd_init(1)))
+ if (!(error= table->file->ha_index_or_rnd_end()) &&
+ !(error= table->file->ha_rnd_init(1)))
error= table->file->ha_rnd_next(table->record[0]);
}
mode= RNEXT;
@@ -872,10 +872,10 @@ retry:
/* else fall through */
case RLAST:
DBUG_ASSERT(keyname != 0);
- table->file->ha_index_or_rnd_end();
- table->file->ha_index_init(keyno, 1);
- error= table->file->ha_index_last(table->record[0]);
- mode= RPREV;
+ if (!(error= table->file->ha_index_or_rnd_end()) &&
+ !(error= table->file->ha_index_init(keyno, 1)))
+ error= table->file->ha_index_last(table->record[0]);
+ mode=RPREV;
break;
case RNEXT_SAME:
/* Continue scan on "(keypart1,keypart2,...)=(c1, c2, ...) */
@@ -889,13 +889,14 @@ retry:
if (!(key= (uchar*) thd->calloc(ALIGN_SIZE(handler->key_len))))
goto err;
- table->file->ha_index_or_rnd_end();
- table->file->ha_index_init(keyno, 1);
+ if ((error= table->file->ha_index_or_rnd_end()))
+ break;
key_copy(key, table->record[0], table->key_info + keyno,
handler->key_len);
- error= table->file->ha_index_read_map(table->record[0],
- key, handler->keypart_map,
- ha_rkey_mode);
+ if (!(error= table->file->ha_index_init(keyno, 1)))
+ error= table->file->ha_index_read_map(table->record[0],
+ key, handler->keypart_map,
+ ha_rkey_mode);
mode= rkey_to_rnext[(int)ha_rkey_mode];
break;
}
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index c352272e95c..458904ebe1d 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -303,8 +303,14 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
rtopic_id= find_fields[help_relation_help_topic_id].field;
rkey_id= find_fields[help_relation_help_keyword_id].field;
- topics->file->ha_index_init(iindex_topic,1);
- relations->file->ha_index_init(iindex_relations,1);
+ if (topics->file->ha_index_init(iindex_topic,1) ||
+ relations->file->ha_index_init(iindex_relations,1))
+ {
+ if (topics->file->inited)
+ topics->file->ha_index_end();
+ my_message(ER_CORRUPT_HELP_DB, ER(ER_CORRUPT_HELP_DB), MYF(0));
+ DBUG_RETURN(-1);
+ }
rkey_id->store((longlong) key_id, TRUE);
rkey_id->get_key_image(buff, rkey_id->pack_length(), Field::itRAW);
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index cb887d88f56..833e134bff9 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -2250,11 +2250,8 @@ bool delayed_get_table(THD *thd, MDL_request *grl_protection_request,
want to send "Server shutdown in progress" in the
INSERT THREAD.
*/
- if (di->thd.stmt_da->sql_errno() == ER_SERVER_SHUTDOWN)
- my_message(ER_QUERY_INTERRUPTED, ER(ER_QUERY_INTERRUPTED), MYF(0));
- else
- my_message(di->thd.stmt_da->sql_errno(), di->thd.stmt_da->message(),
- MYF(0));
+ my_message(di->thd.stmt_da->sql_errno(), di->thd.stmt_da->message(),
+ MYF(0));
}
di->unlock();
goto end_create;
@@ -2303,7 +2300,8 @@ end_create:
TABLE *Delayed_insert::get_local_table(THD* client_thd)
{
my_ptrdiff_t adjust_ptrs;
- Field **field,**org_field, *found_next_number_field, **dfield_ptr= 0;
+ Field **field,**org_field, *found_next_number_field;
+ Field **UNINIT_VAR(vfield), **UNINIT_VAR(dfield_ptr);
TABLE *copy;
TABLE_SHARE *share;
uchar *bitmap;
@@ -2339,7 +2337,7 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
killed using mysql_notify_thread_having_shared_lock() or
kill_delayed_threads_for_table().
*/
- if (!thd.is_error() || thd.stmt_da->sql_errno() == ER_SERVER_SHUTDOWN)
+ if (!thd.is_error())
my_message(ER_QUERY_INTERRUPTED, ER(ER_QUERY_INTERRUPTED), MYF(0));
else
my_message(thd.stmt_da->sql_errno(), thd.stmt_da->message(), MYF(0));
@@ -2363,6 +2361,13 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
if (!copy_tmp)
goto error;
+ if (share->vfields)
+ {
+ vfield= (Field **) client_thd->alloc((share->vfields+1)*sizeof(Field*));
+ if (!vfield)
+ goto error;
+ }
+
/* Copy the TABLE object. */
copy= new (copy_tmp) TABLE;
*copy= *table;
@@ -2408,6 +2413,28 @@ TABLE *Delayed_insert::get_local_table(THD* client_thd)
}
}
*field=0;
+
+ if (share->vfields)
+ {
+ copy->vfield= vfield;
+ for (field= copy->field; *field; field++)
+ {
+ if ((*field)->vcol_info)
+ {
+ bool error_reported= FALSE;
+ if (unpack_vcol_info_from_frm(client_thd,
+ client_thd->mem_root,
+ copy,
+ *field,
+ &(*field)->vcol_info->expr_str,
+ &error_reported))
+ goto error;
+ *vfield++= *field;
+ }
+ }
+ *vfield= 0;
+ }
+
if (share->default_fields)
*dfield_ptr= NULL;
@@ -2715,7 +2742,10 @@ pthread_handler_t handle_delayed_insert(void *arg)
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
thd->set_current_time();
threads.append(thd);
- thd->killed=abort_loop ? KILL_CONNECTION : NOT_KILLED;
+ if (abort_loop)
+ thd->killed= KILL_CONNECTION;
+ else
+ thd->reset_killed();
mysql_mutex_unlock(&LOCK_thread_count);
mysql_thread_set_psi_id(thd->thread_id);
@@ -2814,8 +2844,12 @@ pthread_handler_t handle_delayed_insert(void *arg)
set_timespec(abstime, delayed_insert_timeout);
/* Information for pthread_kill */
+ mysql_mutex_unlock(&di->mutex);
+ mysql_mutex_lock(&di->thd.mysys_var->mutex);
di->thd.mysys_var->current_mutex= &di->mutex;
di->thd.mysys_var->current_cond= &di->cond;
+ mysql_mutex_unlock(&di->thd.mysys_var->mutex);
+ mysql_mutex_lock(&di->mutex);
thd_proc_info(&(di->thd), "Waiting for INSERT");
DBUG_PRINT("info",("Waiting for someone to insert rows"));
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 93e3eb51518..b8ce3b6720e 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -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
@@ -1876,6 +1877,7 @@ void st_select_lex::init_query()
ref_pointer_array= 0;
select_n_where_fields= 0;
select_n_having_items= 0;
+ n_child_sum_items= 0;
subquery_in_having= explicit_limit= 0;
is_item_list_lookup= 0;
first_execution= 1;
diff --git a/sql/sql_list.h b/sql/sql_list.h
index 2b2d9e59771..b4e0ab84aab 100644
--- a/sql/sql_list.h
+++ b/sql/sql_list.h
@@ -1,7 +1,6 @@
#ifndef INCLUDES_MYSQL_SQL_LIST_H
#define INCLUDES_MYSQL_SQL_LIST_H
-/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2012, 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
@@ -169,6 +168,14 @@ protected:
public:
uint elements;
+ bool operator==(const base_list &rhs) const
+ {
+ return
+ elements == rhs.elements &&
+ first == rhs.first &&
+ last == rhs.last;
+ }
+
inline void empty() { elements=0; first= &end_of_list; last=&first;}
inline base_list() { empty(); }
/**
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 7d030329419..6a4712ca5b5 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -728,14 +728,14 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex,
List_iterator<Item> lu(thd->lex->update_list);
List_iterator<Item> lv(thd->lex->value_list);
- query_str.append(" SET ");
+ query_str.append(STRING_WITH_LEN(" SET "));
n= 0;
while ((item= lu++))
{
val= lv++;
if (n++)
- query_str.append(", ");
+ query_str.append(STRING_WITH_LEN(", "));
append_identifier(thd, &query_str, item->name, strlen(item->name));
query_str.append(val->name);
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2d3d91ff9d8..b125047cb98 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -991,7 +991,18 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->security_ctx->user= 0;
thd->user_connect= 0;
- rc= acl_authenticate(thd, 0, packet_length);
+ /*
+ to limit COM_CHANGE_USER ability to brute-force passwords,
+ we only allow three unsuccessful COM_CHANGE_USER per connection.
+ */
+ if (thd->failed_com_change_user >= 3)
+ {
+ my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+ rc= 1;
+ }
+ else
+ rc= acl_authenticate(thd, 0, packet_length);
+
MYSQL_AUDIT_NOTIFY_CONNECTION_CHANGE_USER(thd);
if (rc)
{
@@ -1006,6 +1017,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->variables.collation_connection= save_collation_connection;
thd->variables.character_set_results= save_character_set_results;
thd->update_charset();
+ thd->failed_com_change_user++;
+ my_sleep(1000000);
}
else
{
@@ -4633,16 +4646,20 @@ finish:
if (! thd->in_sub_stmt)
{
- /* report error issued during command execution */
- if (thd->killed_errno())
- {
- if (! thd->stmt_da->is_set())
- thd->send_kill_message();
- }
- if (thd->killed < KILL_CONNECTION)
+ if (thd->killed != NOT_KILLED)
{
- thd->killed= NOT_KILLED;
- thd->mysys_var->abort= 0;
+ /* report error issued during command execution */
+ if (thd->killed_errno())
+ {
+ /* If we already sent 'ok', we can ignore any kill query statements */
+ if (! thd->stmt_da->is_set())
+ thd->send_kill_message();
+ }
+ if (thd->killed < KILL_CONNECTION)
+ {
+ thd->reset_killed();
+ thd->mysys_var->abort= 0;
+ }
}
if (thd->is_error() || (thd->variables.option_bits & OPTION_MASTER_SQL_ERROR))
trans_rollback_stmt(thd);
@@ -6266,8 +6283,13 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ptr->next_name_resolution_table= NULL;
/* Link table in global list (all used tables) */
lex->add_to_query_tables(ptr);
- ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type,
- MDL_TRANSACTION);
+
+ // Pure table aliases do not need to be locked:
+ if (!test(table_options & TL_OPTION_ALIAS))
+ {
+ ptr->mdl_request.init(MDL_key::TABLE, ptr->db, ptr->table_name, mdl_type,
+ MDL_TRANSACTION);
+ }
DBUG_RETURN(ptr);
}
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index d1c12ee4f83..38d8dcf7994 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 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
@@ -1875,8 +1875,11 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv,
DBUG_RETURN(FALSE);
error:
mysql_mutex_unlock(&LOCK_plugin);
- sql_print_error("Couldn't load plugin named '%s' with soname '%s'.",
- name.str, dl.str);
+ if (name.str)
+ sql_print_error("Couldn't load plugin '%s' from '%s'.",
+ name.str, dl.str);
+ else
+ sql_print_error("Couldn't load plugins from '%s'.", dl.str);
DBUG_RETURN(TRUE);
}
@@ -2021,7 +2024,7 @@ static bool finalize_install(THD *thd, TABLE *table, const LEX_STRING *name)
struct st_plugin_int *tmp= plugin_find_internal(name, MYSQL_ANY_PLUGIN);
int error;
DBUG_ASSERT(tmp);
- mysql_mutex_assert_owner(&LOCK_plugin);
+ mysql_mutex_assert_owner(&LOCK_plugin); // because of tmp->state
if (tmp->state == PLUGIN_IS_DISABLED)
{
@@ -2108,8 +2111,12 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
This hack should be removed when LOCK_plugin is fixed so it
protects only what it supposed to protect.
+
+ See also mysql_uninstall_plugin() and initialize_audit_plugin()
*/
- mysql_audit_acquire_plugins(thd, MYSQL_AUDIT_GENERAL_CLASS);
+ unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
+ { MYSQL_AUDIT_GENERAL_CLASSMASK };
+ mysql_audit_acquire_plugins(thd, event_class_mask);
mysql_mutex_lock(&LOCK_plugin);
mysql_rwlock_wrlock(&LOCK_system_variables_hash);
@@ -2252,8 +2259,15 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
When audit event is triggered during [UN]INSTALL PLUGIN, plugin
list iterator acquires the same lock (within the same thread)
second time.
+
+ This hack should be removed when LOCK_plugin is fixed so it
+ protects only what it supposed to protect.
+
+ See also mysql_install_plugin() and initialize_audit_plugin()
*/
- mysql_audit_acquire_plugins(thd, MYSQL_AUDIT_GENERAL_CLASS);
+ unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
+ { MYSQL_AUDIT_GENERAL_CLASSMASK };
+ mysql_audit_acquire_plugins(thd, event_class_mask);
mysql_mutex_lock(&LOCK_plugin);
@@ -2263,11 +2277,19 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
{
fix_dl_name(thd->mem_root, &dl);
st_plugin_dl *plugin_dl= plugin_dl_find(&dl);
- struct st_maria_plugin *plugin;
- for (plugin= plugin_dl->plugins; plugin->info; plugin++)
+ if (plugin_dl)
{
- LEX_STRING str= { const_cast<char*>(plugin->name), strlen(plugin->name) };
- error|= do_uninstall(thd, table, &str);
+ for (struct st_maria_plugin *plugin= plugin_dl->plugins;
+ plugin->info; plugin++)
+ {
+ LEX_STRING str= { const_cast<char*>(plugin->name), strlen(plugin->name) };
+ error|= do_uninstall(thd, table, &str);
+ }
+ }
+ else
+ {
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "SONAME", dl.str);
+ error= true;
}
}
reap_plugins();
diff --git a/sql/sql_plugin_services.h b/sql/sql_plugin_services.h
index c779547059d..e3ef338eaad 100644
--- a/sql/sql_plugin_services.h
+++ b/sql/sql_plugin_services.h
@@ -54,13 +54,18 @@ static struct progress_report_service_st progress_report_handler= {
set_thd_proc_info
};
+static struct kill_statement_service_st thd_kill_statement_handler= {
+ thd_kill_level
+};
+
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_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()
+ { "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 39976e1a430..345556a0b7f 100644
--- a/sql/sql_priv.h
+++ b/sql/sql_priv.h
@@ -153,6 +153,41 @@
#define OPTION_ALLOW_BATCH (ULL(1) << 36) // THD, intern (slave)
#define OPTION_SKIP_REPLICATION (ULL(1) << 37) // THD, user
+/*
+ Check how many bytes are available on buffer.
+
+ @param buf_start Pointer to buffer start.
+ @param buf_current Pointer to the current position on buffer.
+ @param buf_len Buffer length.
+
+ @return Number of bytes available on event buffer.
+*/
+template <class T> T available_buffer(const char* buf_start,
+ const char* buf_current,
+ T buf_len)
+{
+ return buf_len - (buf_current - buf_start);
+}
+
+/*
+ Check if jump value is within buffer limits.
+
+ @param jump Number of positions we want to advance.
+ @param buf_start Pointer to buffer start
+ @param buf_current Pointer to the current position on buffer.
+ @param buf_len Buffer length.
+
+ @return True If jump value is within buffer limits.
+ False Otherwise.
+*/
+template <class T> bool valid_buffer_range(T jump,
+ const char* buf_start,
+ const char* buf_current,
+ T buf_len)
+{
+ return (jump <= available_buffer(buf_start, buf_current, buf_len));
+}
+
/* The rest of the file is included in the server only */
#ifndef MYSQL_CLIENT
diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc
index 2d00a19870b..feb7810fa28 100644
--- a/sql/sql_profile.cc
+++ b/sql/sql_profile.cc
@@ -46,6 +46,7 @@
#define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3)
#define MAX_QUERY_LENGTH 300
+#define MAX_QUERY_HISTORY 101
/**
Connects Information_Schema and Profiling.
@@ -264,9 +265,12 @@ void PROF_MEASUREMENT::collect()
QUERY_PROFILE::QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg)
:profiling(profiling_arg), profiling_query_id(0), query_source(NULL)
{
- profile_start= new PROF_MEASUREMENT(this, status_arg);
- entries.push_back(profile_start);
- profile_end= profile_start;
+ m_seq_counter= 1;
+ PROF_MEASUREMENT *prof= new PROF_MEASUREMENT(this, status_arg);
+ prof->m_seq= m_seq_counter++;
+ m_start_time_usecs= prof->time_usecs;
+ m_end_time_usecs= m_start_time_usecs;
+ entries.push_back(prof);
}
QUERY_PROFILE::~QUERY_PROFILE()
@@ -305,9 +309,14 @@ void QUERY_PROFILE::new_status(const char *status_arg,
else
prof= new PROF_MEASUREMENT(this, status_arg);
- profile_end= prof;
+ prof->m_seq= m_seq_counter++;
+ m_end_time_usecs= prof->time_usecs;
entries.push_back(prof);
+ /* Maintain the query history size. */
+ while (entries.elements > MAX_QUERY_HISTORY)
+ delete entries.pop();
+
DBUG_VOID_RETURN;
}
@@ -467,8 +476,7 @@ bool PROFILING::show_profiles()
String elapsed;
- PROF_MEASUREMENT *ps= prof->profile_start;
- PROF_MEASUREMENT *pe= prof->profile_end;
+ double query_time_usecs= prof->m_end_time_usecs - prof->m_start_time_usecs;
if (++idx <= unit->offset_limit_cnt)
continue;
@@ -477,7 +485,7 @@ bool PROFILING::show_profiles()
protocol->prepare_for_resend();
protocol->store((uint32)(prof->profiling_query_id));
- protocol->store((double)(pe->time_usecs - ps->time_usecs)/(1000.0*1000),
+ protocol->store((double)(query_time_usecs/(1000.0*1000)),
(uint32) TIME_FLOAT_DIGITS-1, &elapsed);
if (prof->query_source != NULL)
protocol->store(prof->query_source, strlen(prof->query_source),
@@ -537,17 +545,18 @@ int PROFILING::fill_statistics_info(THD *thd_arg, TABLE_LIST *tables, Item *cond
us also include a numbering of each state per query. The query_id and
the "seq" together are unique.
*/
- ulonglong seq;
+ ulong seq;
void *entry_iterator;
PROF_MEASUREMENT *entry, *previous= NULL;
/* ...and for each query, go through all its state-change steps. */
- for (seq= 0, entry_iterator= query->entries.new_iterator();
+ for (entry_iterator= query->entries.new_iterator();
entry_iterator != NULL;
entry_iterator= query->entries.iterator_next(entry_iterator),
- seq++, previous=entry, row_number++)
+ previous=entry, row_number++)
{
entry= query->entries.iterator_value(entry_iterator);
+ seq= entry->m_seq;
/* Skip the first. We count spans of fence, not fence-posts. */
if (previous == NULL) continue;
diff --git a/sql/sql_profile.h b/sql/sql_profile.h
index 7705f6ca476..f8970bb162a 100644
--- a/sql/sql_profile.h
+++ b/sql/sql_profile.h
@@ -186,6 +186,7 @@ private:
char *file;
unsigned int line;
+ ulong m_seq;
double time_usecs;
char *allocated_status_memory;
@@ -217,8 +218,9 @@ private:
query_id_t profiling_query_id; /* Session-specific id. */
char *query_source;
- PROF_MEASUREMENT *profile_start;
- PROF_MEASUREMENT *profile_end;
+ double m_start_time_usecs;
+ double m_end_time_usecs;
+ ulong m_seq_counter;
Queue<PROF_MEASUREMENT> entries;
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index e18b0cd04c0..5b2e498cb00 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1642,6 +1642,31 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
}
}
+/**
+ Get value for a string parameter with error checking
+
+ Note that in case of error the original string should not be updated!
+
+ @ret 0 ok
+ @ret 1 error
+*/
+
+static bool get_string_parameter(char *to, const char *from, size_t length,
+ const char *name)
+{
+ if (from) // Empty paramaters allowed
+ {
+ size_t from_length;
+ if ((from_length= strlen(from)) > length)
+ {
+ my_error(ER_WRONG_STRING_LENGTH, MYF(0), from, name, (int) length);
+ return 1;
+ }
+ memcpy(to, from, from_length+1);
+ }
+ return 0;
+}
+
/**
Execute a CHANGE MASTER statement.
@@ -1770,12 +1795,17 @@ bool change_master(THD* thd, Master_info* mi)
}
DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos));
- if (lex_mi->host)
- strmake(mi->host, lex_mi->host, sizeof(mi->host)-1);
- if (lex_mi->user)
- strmake(mi->user, lex_mi->user, sizeof(mi->user)-1);
- if (lex_mi->password)
- strmake(mi->password, lex_mi->password, sizeof(mi->password)-1);
+ if (get_string_parameter(mi->host, lex_mi->host, sizeof(mi->host)-1,
+ "MASTER_HOST") ||
+ get_string_parameter(mi->user, lex_mi->user, sizeof(mi->user)-1,
+ "MASTER_USER") ||
+ get_string_parameter(mi->password, lex_mi->password,
+ sizeof(mi->password)-1, "MASTER_PASSWORD"))
+ {
+ ret= TRUE;
+ goto err;
+ }
+
if (lex_mi->port)
mi->port = lex_mi->port;
if (lex_mi->connect_retry)
diff --git a/sql/sql_repl.h b/sql/sql_repl.h
index 7dc58c47d52..c5a0b31388e 100644
--- a/sql/sql_repl.h
+++ b/sql/sql_repl.h
@@ -25,9 +25,9 @@ typedef struct st_slave_info
{
uint32 server_id;
uint32 rpl_recovery_rank, master_id;
- char host[HOSTNAME_LENGTH+1];
+ char host[HOSTNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1];
char user[USERNAME_LENGTH+1];
- char password[MAX_PASSWORD_LENGTH+1];
+ char password[MAX_PASSWORD_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1];
uint16 port;
THD* thd;
} SLAVE_INFO;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 63718dc9d55..41c0b07bc49 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.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
@@ -228,7 +228,7 @@ static int create_sort_index(THD *thd, JOIN *join, ORDER *order,
static int remove_duplicates(JOIN *join,TABLE *entry,List<Item> &fields,
Item *having);
static int remove_dup_with_compare(THD *thd, TABLE *entry, Field **field,
- ulong offset,Item *having);
+ Item *having);
static int remove_dup_with_hash_index(THD *thd,TABLE *table,
uint field_count, Field **first_field,
ulong key_length,Item *having);
@@ -383,7 +383,7 @@ bool handle_select(THD *thd, LEX *lex, select_result *result,
ER(ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT),
thd->accessed_rows_and_keys,
thd->lex->limit_rows_examined->val_uint());
- thd->killed= NOT_KILLED;
+ thd->reset_killed();
}
/* Disable LIMIT ROWS EXAMINED after query execution. */
thd->lex->limit_rows_examined_cnt= ULONGLONG_MAX;
@@ -2077,6 +2077,8 @@ bool JOIN::setup_subquery_caches()
*/
void JOIN::restore_tmp()
{
+ DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join));
+ DBUG_ASSERT(tmp_join != this);
memcpy(tmp_join, this, (size_t) sizeof(JOIN));
}
@@ -7750,8 +7752,9 @@ get_best_combination(JOIN *join)
if ( !(keyuse= join->best_positions[tablenr].key))
{
j->type=JT_ALL;
- if (tablenr != join->const_tables)
- join->full_join=1;
+ if (join->best_positions[tablenr].use_join_buffer &&
+ tablenr != join->const_tables)
+ join->full_join= 1;
}
/*if (join->best_positions[tablenr].sj_strategy == SJ_OPT_LOOSE_SCAN)
@@ -8744,7 +8747,9 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
We will use join cache here : prevent sorting of the first
table only and sort at the end.
*/
- if (i != join->const_tables && join->table_count > join->const_tables + 1)
+ if (i != join->const_tables &&
+ join->table_count > join->const_tables + 1 &&
+ join->best_positions[i].use_join_buffer)
join->full_join= 1;
}
@@ -10769,7 +10774,6 @@ void JOIN::cleanup(bool full)
filesort_free_buffers(first_tab->table, full);
}
}
-
if (full)
{
JOIN_TAB *sort_tab= first_linear_tab(this, WITHOUT_CONST_TABLES);
@@ -10804,21 +10808,19 @@ void JOIN::cleanup(bool full)
}
}
}
- /*
- We are not using tables anymore
- Unlock all tables. We may be in an INSERT .... SELECT statement.
- */
if (full)
{
- if (tmp_join)
- tmp_table_param.copy_field= 0;
- group_fields.delete_elements();
/*
- Ensure that the above delete_elements() would not be called
+ Ensure that the following delete_elements() would not be called
twice for the same list.
*/
- if (tmp_join && tmp_join != this)
- tmp_join->group_fields= group_fields;
+ if (tmp_join && tmp_join != this &&
+ tmp_join->group_fields == this->group_fields)
+ tmp_join->group_fields.empty();
+
+ // Run Cached_item DTORs!
+ group_fields.delete_elements();
+
/*
We can't call delete_elements() on copy_funcs as this will cause
problems in free_elements() as some of the elements are then deleted.
@@ -14330,10 +14332,20 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
if (group)
{
+ ORDER **prev= &group;
if (!param->quick_group)
group=0; // Can't use group key
else for (ORDER *tmp=group ; tmp ; tmp=tmp->next)
{
+ /* Exclude found constant from the list */
+ if ((*tmp->item)->const_item())
+ {
+ *prev= tmp->next;
+ param->group_parts--;
+ continue;
+ }
+ else
+ prev= &(tmp->next);
/*
marker == 4 means two things:
- store NULLs in the key, and
@@ -14341,7 +14353,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
can't index BIT fields.
*/
(*tmp->item)->marker=4; // Store null in key
- if ((*tmp->item)->max_length >= CONVERT_IF_BIGGER_TO_BLOB)
+ if ((*tmp->item)->too_big_for_varchar())
using_unique_constraint=1;
}
if (param->group_length >= MAX_BLOB_WIDTH)
@@ -15880,11 +15892,11 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
if (table->group && join->tmp_table_param.sum_func_count &&
table->s->keys && !table->file->inited)
{
- int tmp_error;
- if ((tmp_error= table->file->ha_index_init(0, 0)))
+ rc= table->file->ha_index_init(0, 0);
+ if (rc)
{
- table->file->print_error(tmp_error, MYF(0)); /* purecov: inspected */
- DBUG_RETURN(-1); /* purecov: inspected */
+ table->file->print_error(rc, MYF(0));
+ DBUG_RETURN(-1);
}
}
}
@@ -16918,7 +16930,12 @@ int join_read_key2(THD *thd, JOIN_TAB *tab, TABLE *table, TABLE_REF *table_ref)
int error;
if (!table->file->inited)
{
- table->file->ha_index_init(table_ref->key, (tab ? tab->sorted : TRUE));
+ error= table->file->ha_index_init(table_ref->key, tab ? tab->sorted : TRUE);
+ if (error)
+ {
+ (void) report_error(table, error);
+ return 1;
+ }
}
/* TODO: Why don't we do "Late NULLs Filtering" here? */
@@ -17009,8 +17026,8 @@ join_read_always_key(JOIN_TAB *tab)
{
if ((error= table->file->ha_index_init(tab->ref.key, tab->sorted)))
{
- table->file->print_error(error, MYF(0));/* purecov: inspected */
- return(1); /* purecov: inspected */
+ (void) report_error(table, error);
+ return 1;
}
}
@@ -17040,14 +17057,13 @@ join_read_last_key(JOIN_TAB *tab)
int error;
TABLE *table= tab->table;
- if (!table->file->inited)
+ if (!table->file->inited &&
+ (error= table->file->ha_index_init(tab->ref.key, tab->sorted)))
{
- if ((error= table->file->ha_index_init(tab->ref.key, tab->sorted)))
- {
- table->file->print_error(error, MYF(0));/* purecov: inspected */
- return(1); /* purecov: inspected */
- }
+ (void) report_error(table, error);
+ return 1;
}
+
if (cp_buffer_from_ref(tab->join->thd, table, &tab->ref))
return -1;
if ((error= table->file->ha_index_read_map(table->record[0],
@@ -17266,9 +17282,10 @@ join_ft_read_first(JOIN_TAB *tab)
if (!table->file->inited &&
(error= table->file->ha_index_init(tab->ref.key, 1)))
{
- table->file->print_error(error, MYF(0)); /* purecov: inspected */
- return(1); /* purecov: inspected */
+ (void) report_error(table, error);
+ return 1;
}
+
table->file->ft_init();
if ((error= table->file->ha_ft_read(table->record[0])))
@@ -17691,9 +17708,10 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
/* Change method to update rows */
if ((error= table->file->ha_index_init(0, 0)))
{
- table->file->print_error(error, MYF(0));/* purecov: inspected */
- DBUG_RETURN(NESTED_LOOP_ERROR); /* purecov: inspected */
+ table->file->print_error(error, MYF(0));
+ DBUG_RETURN(NESTED_LOOP_ERROR);
}
+
join->join_tab[join->top_join_tab_count-1].next_select=end_unique_update;
}
join->send_records++;
@@ -18335,18 +18353,36 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
table->s->primary_key != MAX_KEY &&
table->s->primary_key != idx)
{
+ KEY_PART_INFO *start,*end;
+ uint pk_part_idx= 0;
on_pk_suffix= TRUE;
- key_part= table->key_info[table->s->primary_key].key_part;
- key_part_end=key_part+table->key_info[table->s->primary_key].key_parts;
+ start= key_part= table->key_info[table->s->primary_key].key_part;
const_key_parts=table->const_key_parts[table->s->primary_key];
- for (; const_key_parts & 1 ; const_key_parts>>= 1)
- key_part++;
/*
- The primary and secondary key parts were all const (i.e. there's
- one row). The sorting doesn't matter.
+ Calculate true key_part_end and const_key_parts
+ (we have to stop as first not continous primary key part)
*/
- if (key_part == key_part_end && reverse == 0)
+ for (key_part_end= key_part,
+ end= key_part+table->key_info[table->s->primary_key].key_parts;
+ key_part_end < end; key_part_end++, pk_part_idx++)
+ {
+ /* Found hole in the pk_parts; Abort */
+ if (!(table->key_info[idx].ext_key_part_map &
+ (((key_part_map) 1) << pk_part_idx)))
+ break;
+ }
+ /* Adjust const_key_parts */
+ const_key_parts&= (((key_part_map) 1) << pk_part_idx) -1;
+
+ for (; const_key_parts & 1 ; const_key_parts>>= 1)
+ key_part++;
+ /*
+ Test if the primary key parts were all const (i.e. there's one row).
+ The sorting doesn't matter.
+ */
+ if (key_part == start+table->key_info[table->s->primary_key].key_parts &&
+ reverse == 0)
{
key_parts= 0;
reverse= 1;
@@ -18366,7 +18402,8 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
if (reverse && flag != reverse)
DBUG_RETURN(0);
reverse=flag; // Remember if reverse
- key_part++;
+ if (key_part < key_part_end)
+ key_part++;
}
if (on_pk_suffix)
{
@@ -19269,19 +19306,24 @@ void JOIN::clean_pre_sort_join_tab()
}
-/*****************************************************************************
- Remove duplicates from tmp table
- This should be recoded to add a unique index to the table and remove
- duplicates
- Table is a locked single thread table
- fields is the number of fields to check (from the end)
-*****************************************************************************/
+/**
+ Compare fields from table->record[0] and table->record[1],
+ possibly skipping few first fields.
+
+ @param table
+ @param ptr field to start the comparison from,
+ somewhere in the table->field[] array
+ @retval 1 different
+ @retval 0 identical
+*/
static bool compare_record(TABLE *table, Field **ptr)
{
for (; *ptr ; ptr++)
{
- if ((*ptr)->cmp_offset(table->s->rec_buff_length))
+ Field *f= *ptr;
+ if (f->is_null() != f->is_null(table->s->rec_buff_length) ||
+ (!f->is_null() && f->cmp_offset(table->s->rec_buff_length)))
return 1;
}
return 0;
@@ -19309,16 +19351,16 @@ static void free_blobs(Field **ptr)
static int
-remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
+remove_duplicates(JOIN *join, TABLE *table, List<Item> &fields, Item *having)
{
int error;
- ulong reclength,offset;
+ ulong keylength= 0;
uint field_count;
THD *thd= join->thd;
DBUG_ENTER("remove_duplicates");
- entry->reginfo.lock_type=TL_WRITE;
+ table->reginfo.lock_type=TL_WRITE;
/* Calculate how many saved fields there is in list */
field_count=0;
@@ -19335,11 +19377,10 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
join->unit->select_limit_cnt= 1; // Only send first row
DBUG_RETURN(0);
}
- Field **first_field=entry->field+entry->s->fields - field_count;
- offset= (field_count ?
- entry->field[entry->s->fields - field_count]->
- offset(entry->record[0]) : 0);
- reclength=entry->s->reclength-offset;
+
+ Field **first_field=table->field+table->s->fields - field_count;
+ for (Field **ptr=first_field; *ptr; ptr++)
+ keylength+= (*ptr)->sort_length() + (*ptr)->maybe_null();
/*
Disable LIMIT ROWS EXAMINED in order to avoid interrupting prematurely
@@ -19347,19 +19388,18 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
*/
thd->lex->limit_rows_examined_cnt= ULONGLONG_MAX;
if (thd->killed == ABORT_QUERY)
- thd->killed= NOT_KILLED;
- free_io_cache(entry); // Safety
- entry->file->info(HA_STATUS_VARIABLE);
- if (entry->s->db_type() == heap_hton ||
- (!entry->s->blob_fields &&
- ((ALIGN_SIZE(reclength) + HASH_OVERHEAD) * entry->file->stats.records <
+ thd->reset_killed();
+
+ free_io_cache(table); // Safety
+ table->file->info(HA_STATUS_VARIABLE);
+ if (table->s->db_type() == heap_hton ||
+ (!table->s->blob_fields &&
+ ((ALIGN_SIZE(keylength) + HASH_OVERHEAD) * table->file->stats.records <
thd->variables.sortbuff_size)))
- error=remove_dup_with_hash_index(join->thd, entry,
- field_count, first_field,
- reclength, having);
+ error=remove_dup_with_hash_index(join->thd, table, field_count, first_field,
+ keylength, having);
else
- error=remove_dup_with_compare(join->thd, entry, first_field, offset,
- having);
+ error=remove_dup_with_compare(join->thd, table, first_field, having);
if (join->select_lex != join->select_lex->master_unit()->fake_select_lex)
thd->lex->set_limit_rows_examined();
@@ -19369,18 +19409,13 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
- ulong offset, Item *having)
+ Item *having)
{
handler *file=table->file;
- char *org_record,*new_record;
- uchar *record;
+ uchar *record=table->record[0];
int error;
- ulong reclength= table->s->reclength-offset;
DBUG_ENTER("remove_dup_with_compare");
- org_record=(char*) (record=table->record[0])+offset;
- new_record=(char*) table->record[1]+offset;
-
if (file->ha_rnd_init_with_error(1))
DBUG_RETURN(1);
@@ -19417,7 +19452,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
error=0;
goto err;
}
- memcpy(new_record,org_record,reclength);
+ store_record(table,record[1]);
/* Read through rest of file and mark duplicated rows deleted */
bool found=0;
@@ -19476,8 +19511,9 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
int error;
handler *file= table->file;
ulong extra_length= ALIGN_SIZE(key_length)-key_length;
- uint *field_lengths,*field_length;
+ uint *field_lengths, *field_length;
HASH hash;
+ Field **ptr;
DBUG_ENTER("remove_dup_with_hash_index");
if (!my_multi_malloc(MYF(MY_WME),
@@ -19489,21 +19525,8 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
NullS))
DBUG_RETURN(1);
- {
- Field **ptr;
- ulong total_length= 0;
- for (ptr= first_field, field_length=field_lengths ; *ptr ; ptr++)
- {
- uint length= (*ptr)->sort_length();
- (*field_length++)= length;
- total_length+= length;
- }
- DBUG_PRINT("info",("field_count: %u key_length: %lu total_length: %lu",
- field_count, key_length, total_length));
- DBUG_ASSERT(total_length <= key_length);
- key_length= total_length;
- extra_length= ALIGN_SIZE(key_length)-key_length;
- }
+ for (ptr= first_field, field_length=field_lengths ; *ptr ; ptr++)
+ (*field_length++)= (*ptr)->sort_length();
if (my_hash_init(&hash, &my_charset_bin, (uint) file->stats.records, 0,
key_length, (my_hash_get_key) 0, 0, 0))
@@ -19543,10 +19566,10 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table,
/* copy fields to key buffer */
org_key_pos= key_pos;
field_length=field_lengths;
- for (Field **ptr= first_field ; *ptr ; ptr++)
+ for (ptr= first_field ; *ptr ; ptr++)
{
- (*ptr)->sort_string(key_pos,*field_length);
- key_pos+= *field_length++;
+ (*ptr)->make_sort_key(key_pos, *field_length);
+ key_pos+= (*ptr)->maybe_null() + *field_length++;
}
/* Check if it exists before */
if (my_hash_search(&hash, org_key_pos, key_length))
@@ -23168,7 +23191,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
{
int direction;
ha_rows select_limit= select_limit_arg;
- uint used_key_parts;
+ uint used_key_parts= 0;
if (keys.is_set(nr) &&
(direction= test_if_order_by_key(order, table, nr, &used_key_parts)))
@@ -23236,7 +23259,7 @@ test_if_cheaper_ordering(const JOIN_TAB *tab, ORDER *order, TABLE *table,
to be adjusted accordingly if some components of
the secondary key are included in the primary key.
*/
- for(uint i= 0; i < used_pk_parts; i++)
+ for(uint i= 1; i < used_pk_parts; i++)
{
if (pkinfo->key_part[i].field->key_start.is_set(nr))
{
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 33e31913e41..095ad409a94 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -2810,7 +2810,6 @@ static bool show_status_array(THD *thd, const char *wild,
int len;
LEX_STRING null_lex_str;
SHOW_VAR tmp, *var;
- COND *partial_cond= 0;
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
bool res= FALSE;
CHARSET_INFO *charset= system_charset_info;
@@ -2824,7 +2823,6 @@ static bool show_status_array(THD *thd, const char *wild,
if (*prefix)
*prefix_end++= '_';
len=name_buffer + sizeof(name_buffer) - prefix_end;
- partial_cond= make_cond_for_info_schema(cond, table->pos_in_table_list);
for (; variables->name; variables++)
{
@@ -2862,14 +2860,14 @@ static bool show_status_array(THD *thd, const char *wild,
if (show_type == SHOW_ARRAY)
{
show_status_array(thd, wild, (SHOW_VAR *) var->value, value_type,
- status_var, name_buffer, table, ucase_names, partial_cond);
+ status_var, name_buffer, table, ucase_names, cond);
}
else
{
if ((wild_checked ||
(wild && wild[0] && wild_case_compare(system_charset_info,
name_buffer, wild))) &&
- (!partial_cond || partial_cond->val_int()))
+ (!cond || cond->val_int()))
{
char *value=var->value;
const char *pos, *end; // We assign a lot of const's
@@ -5897,7 +5895,13 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
{
DBUG_RETURN(1);
}
- proc_table->file->ha_index_init(0, 1);
+
+ if (proc_table->file->ha_index_init(0, 1))
+ {
+ res= 1;
+ goto err;
+ }
+
if ((res= proc_table->file->ha_index_first(proc_table->record[0])))
{
res= (res == HA_ERR_END_OF_FILE) ? 0 : 1;
@@ -5923,7 +5927,9 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
}
err:
- proc_table->file->ha_index_end();
+ if (proc_table->file->inited)
+ (void) proc_table->file->ha_index_end();
+
close_system_tables(thd, &open_tables_state_backup);
DBUG_RETURN(res);
}
@@ -7122,9 +7128,12 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
schema_table_idx == SCH_GLOBAL_VARIABLES)
option_type= OPT_GLOBAL;
+ COND *partial_cond= make_cond_for_info_schema(cond, tables);
+
mysql_rwlock_rdlock(&LOCK_system_variables_hash);
res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars, option_type),
- option_type, NULL, "", tables->table, upper_case_names, cond);
+ option_type, NULL, "", tables->table,
+ upper_case_names, partial_cond);
mysql_rwlock_unlock(&LOCK_system_variables_hash);
DBUG_RETURN(res);
}
@@ -7161,13 +7170,18 @@ int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
tmp1= &thd->status_var;
}
+ COND *partial_cond= make_cond_for_info_schema(cond, tables);
+ // Evaluate and cache const subqueries now, before the mutex.
+ if (partial_cond)
+ partial_cond->val_int();
+
mysql_mutex_lock(&LOCK_status);
if (option_type == OPT_GLOBAL)
calc_sum_of_all_status(&tmp);
res= show_status_array(thd, wild,
(SHOW_VAR *)all_status_vars.buffer,
option_type, tmp1, "", tables->table,
- upper_case_names, cond);
+ upper_case_names, partial_cond);
mysql_mutex_unlock(&LOCK_status);
DBUG_RETURN(res);
}
diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc
index c9f1f42159f..e671ad9526f 100644
--- a/sql/sql_signal.cc
+++ b/sql/sql_signal.cc
@@ -479,7 +479,7 @@ bool Signal_statement::execute(THD *thd)
bool Resignal_statement::execute(THD *thd)
{
- MYSQL_ERROR *signaled;
+ Sql_condition_info *signaled;
int result= TRUE;
DBUG_ENTER("Resignal_statement::execute");
@@ -492,15 +492,21 @@ bool Resignal_statement::execute(THD *thd)
DBUG_RETURN(result);
}
+ MYSQL_ERROR signaled_err(thd->mem_root);
+ signaled_err.set(signaled->m_sql_errno,
+ signaled->m_sql_state,
+ signaled->m_level,
+ signaled->m_message);
+
if (m_cond == NULL)
{
/* RESIGNAL without signal_value */
- result= raise_condition(thd, signaled);
+ result= raise_condition(thd, &signaled_err);
DBUG_RETURN(result);
}
/* RESIGNAL with signal_value */
- result= raise_condition(thd, signaled);
+ result= raise_condition(thd, &signaled_err);
DBUG_RETURN(result);
}
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 687fdf26228..e34b4b21819 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -1296,7 +1296,7 @@ public:
if (tree->elements == 0)
return (ulonglong) tree->elements_in_tree();
count= 0;
- tree->walk(count_distinct_walk, (void*) &count);
+ tree->walk(table_field->table, count_distinct_walk, (void*) &count);
return count;
}
};
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 5c0471fdfaa..57dbd979933 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2010, 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
@@ -154,7 +154,7 @@ bool get_date_from_daynr(long daynr,uint *ret_year,uint *ret_month,
uchar *month_pos;
DBUG_ENTER("get_date_from_daynr");
- if (daynr < 365 || daynr > MAX_DAY_NUMBER)
+ if (daynr < 366 || daynr > MAX_DAY_NUMBER)
DBUG_RETURN(1);
year= (uint) (daynr*100 / 36525L);
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc
index 9d4ca5e1373..4b77344c042 100644
--- a/sql/sql_truncate.cc
+++ b/sql/sql_truncate.cc
@@ -24,7 +24,7 @@
#include "sql_acl.h" // DROP_ACL
#include "sql_parse.h" // check_one_table_access()
#include "sql_truncate.h"
-#include "sql_show.h"
+#include "sql_show.h" //append_identifier()
/**
@@ -263,6 +263,7 @@ static bool recreate_temporary_table(THD *thd, TABLE *table)
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);
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 56f413afbd1..eb4454ecab3 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -716,7 +716,7 @@ bool st_select_lex_unit::exec()
ER(ER_QUERY_EXCEEDED_ROWS_EXAMINED_LIMIT),
thd->accessed_rows_and_keys,
thd->lex->limit_rows_examined->val_uint());
- thd->killed= NOT_KILLED;
+ thd->reset_killed();
break;
}
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 8a0d95722e8..28b9fe7eacd 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -471,12 +471,15 @@ int mysql_update(THD *thd,
We can't update table directly; We must first search after all
matching rows before updating the table!
*/
+
+ // Verify that table->restore_column_maps_after_mark_index() will work
+ DBUG_ASSERT(table->read_set == &table->def_read_set);
+ DBUG_ASSERT(table->write_set == &table->def_write_set);
+
if (used_index < MAX_KEY && old_covering_keys.is_set(used_index))
table->add_read_columns_used_by_index(used_index);
else
- {
table->use_all_columns();
- }
/* note: We avoid sorting if we sort on the used index */
if (order && (need_sort || used_key_is_modified))
@@ -613,8 +616,11 @@ int mysql_update(THD *thd,
if (error >= 0)
goto err;
}
- if (table->key_read)
- table->restore_column_maps_after_mark_index();
+ /*
+ This restore bitmaps, works for add_read_columns_used_by_index() and
+ use_all_columns():
+ */
+ table->restore_column_maps_after_mark_index();
}
if (ignore)
@@ -2238,11 +2244,16 @@ err:
}
err2:
- (void) table->file->ha_rnd_end();
- (void) tmp_table->file->ha_rnd_end();
+ if (table->file->inited)
+ (void) table->file->ha_rnd_end();
+ if (tmp_table->file->inited)
+ (void) tmp_table->file->ha_rnd_end();
check_opt_it.rewind();
while (TABLE *tbl= check_opt_it++)
- tbl->file->ha_rnd_end();
+ {
+ if (tbl->file->inited)
+ (void) tbl->file->ha_rnd_end();
+ }
if (updated != org_updated)
{
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 1fd6f5150cb..9664aad1e19 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -11587,11 +11587,19 @@ show_param:
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_AUTHORS;
+ push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
+ ER(ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT),
+ "SHOW AUTHORS");
}
| CONTRIBUTORS_SYM
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_CONTRIBUTORS;
+ push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT,
+ ER(ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT),
+ "SHOW CONTRIBUTORS");
}
| PRIVILEGES
{
diff --git a/sql/table.cc b/sql/table.cc
index 117345ad25d..a011fa845a7 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -2163,9 +2163,11 @@ end:
@brief
Unpack the definition of a virtual column from its linear representation
- @parm
+ @param
thd The thread object
@param
+ mem_root The mem_root object where to allocated memory
+ @param
table The table containing the virtual column
@param
field The field for the virtual
@@ -2194,6 +2196,7 @@ end:
TRUE Otherwise
*/
bool unpack_vcol_info_from_frm(THD *thd,
+ MEM_ROOT *mem_root,
TABLE *table,
Field *field,
LEX_STRING *vcol_expr,
@@ -2221,7 +2224,7 @@ bool unpack_vcol_info_from_frm(THD *thd,
"PARSE_VCOL_EXPR (<expr_string_from_frm>)".
*/
- if (!(vcol_expr_str= (char*) alloc_root(&table->mem_root,
+ if (!(vcol_expr_str= (char*) alloc_root(mem_root,
vcol_expr->length +
parse_vcol_keyword.length + 3)))
{
@@ -2255,10 +2258,10 @@ bool unpack_vcol_info_from_frm(THD *thd,
We need to use CONVENTIONAL_EXECUTION here to ensure that
any new items created by fix_fields() are not reverted.
*/
- Query_arena expr_arena(&table->mem_root,
+ Query_arena expr_arena(mem_root,
Query_arena::STMT_CONVENTIONAL_EXECUTION);
- if (!(vcol_arena= (Query_arena *) alloc_root(&table->mem_root,
- sizeof(Query_arena))))
+ if (!(vcol_arena= (Query_arena *) alloc_root(mem_root,
+ sizeof(Query_arena))))
goto err;
*vcol_arena= expr_arena;
table->expr_arena= vcol_arena;
@@ -2525,6 +2528,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
if (share->vfields && (*field_ptr)->vcol_info)
{
if (unpack_vcol_info_from_frm(thd,
+ &outparam->mem_root,
outparam,
*field_ptr,
&(*field_ptr)->vcol_info->expr_str,
@@ -5004,19 +5008,33 @@ TABLE *TABLE_LIST::get_real_join_table()
DBUG_ASSERT(tbl->derived == NULL ||
tbl->derived->first_select()->next_select() == NULL);
- if (tbl->table)
- table= tbl->table;
- tbl= (tbl->view != NULL ?
- tbl->view->select_lex.get_table_list() :
- tbl->derived->first_select()->get_table_list());
-
- /* find left table in outer join on this level */
- while(tbl->outer_join & JOIN_TYPE_RIGHT)
{
- DBUG_ASSERT(tbl->next_local);
- tbl= tbl->next_local;
+ List_iterator_fast<TABLE_LIST> ti;
+ {
+ List_iterator_fast<TABLE_LIST>
+ ti(tbl->view != NULL ?
+ tbl->view->select_lex.top_join_list :
+ tbl->derived->first_select()->top_join_list);
+ for (;;)
+ {
+ tbl= NULL;
+ /*
+ Find left table in outer join on this level
+ (the list is reverted).
+ */
+ for (TABLE_LIST *t= ti++; t; t= ti++)
+ tbl= t;
+ /*
+ It is impossible that the list is empty
+ so tbl can't be NULL after above loop.
+ */
+ if (!tbl->nested_join)
+ break;
+ /* go deeper if we've found nested join */
+ ti= tbl->nested_join->join_list;
+ }
+ }
}
-
}
return tbl->table;
diff --git a/sql/table.h b/sql/table.h
index 0625d791b49..1a567ae75d1 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -2412,6 +2412,9 @@ 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);
+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);
void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key,
diff --git a/sql/tztime.cc b/sql/tztime.cc
index ad5deea7b25..b16cc65d6bb 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1718,14 +1718,11 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
}
table= tz_tables[0].table;
- /*
- It is OK to ignore ha_index_init()/ha_index_end() return values since
- mysql.time_zone* tables are MyISAM and these operations always succeed
- for MyISAM.
- */
- (void)table->file->ha_index_init(0, 1);
- table->use_all_columns();
+ if (table->file->ha_index_init(0, 1))
+ goto end_with_close;
+
+ table->use_all_columns();
tz_leapcnt= 0;
res= table->file->ha_index_first(table->record[0]);
@@ -1913,12 +1910,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
tz_tables= tz_tables->next_local;
table->field[0]->store(tz_name->ptr(), tz_name->length(),
&my_charset_latin1);
- /*
- It is OK to ignore ha_index_init()/ha_index_end() return values since
- mysql.time_zone* tables are MyISAM and these operations always succeed
- for MyISAM.
- */
- (void)table->file->ha_index_init(0, 1);
+ if (table->file->ha_index_init(0, 1))
+ goto end;
if (table->file->ha_index_read_map(table->record[0], table->field[0]->ptr,
HA_WHOLE_KEY, HA_READ_KEY_EXACT))
@@ -1951,7 +1944,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
field->get_key_image(keybuff,
min(field->key_length(), sizeof(keybuff)),
Field::itRAW);
- (void)table->file->ha_index_init(0, 1);
+ if (table->file->ha_index_init(0, 1))
+ goto end;
if (table->file->ha_index_read_map(table->record[0], keybuff,
HA_WHOLE_KEY, HA_READ_KEY_EXACT))
@@ -1983,7 +1977,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
field->get_key_image(keybuff,
min(field->key_length(), sizeof(keybuff)),
Field::itRAW);
- (void)table->file->ha_index_init(0, 1);
+ if (table->file->ha_index_init(0, 1))
+ goto end;
res= table->file->ha_index_read_map(table->record[0], keybuff,
(key_part_map)1, HA_READ_KEY_EXACT);
@@ -2053,7 +2048,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
*/
table= tz_tables->table;
table->field[0]->store((longlong) tzid, TRUE);
- (void)table->file->ha_index_init(0, 1);
+ if (table->file->ha_index_init(0, 1))
+ goto end;
res= table->file->ha_index_read_map(table->record[0], keybuff,
(key_part_map)1, HA_READ_KEY_EXACT);
@@ -2187,8 +2183,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
end:
- if (table)
- (void)table->file->ha_index_end();
+ if (table && table->file->inited)
+ (void) table->file->ha_index_end();
DBUG_RETURN(return_val);
}
diff --git a/sql/uniques.cc b/sql/uniques.cc
index 22f098f8f9a..9fa06311ece 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -77,7 +77,10 @@ int unique_intersect_write_to_ptrs(uchar* key, element_count count, Unique *uniq
Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
uint size_arg, ulonglong max_in_memory_size_arg,
uint min_dupl_count_arg)
- :max_in_memory_size(max_in_memory_size_arg), size(size_arg), elements(0)
+ :max_in_memory_size(max_in_memory_size_arg),
+ record_pointers(NULL),
+ size(size_arg),
+ elements(0)
{
min_dupl_count= min_dupl_count_arg;
full_size= size;
@@ -582,6 +585,7 @@ end:
SYNOPSIS
Unique:walk()
All params are 'IN':
+ table parameter for the call of the merge method
action function-visitor, typed in include/my_tree.h
function is called for each unique element
arg argument for visitor, which is passed to it on each call
@@ -590,71 +594,67 @@ end:
<> 0 error
*/
-bool Unique::walk(tree_walk_action action, void *walk_action_arg)
+bool Unique::walk(TABLE *table, tree_walk_action action, void *walk_action_arg)
{
- int res;
+ int res= 0;
uchar *merge_buffer;
if (elements == 0) /* the whole tree is in memory */
return tree_walk(&tree, action, walk_action_arg, left_root_right);
+ table->sort.found_records=elements+tree.elements_in_tree;
/* flush current tree to the file to have some memory for merge buffer */
if (flush())
return 1;
if (flush_io_cache(&file) || reinit_io_cache(&file, READ_CACHE, 0L, 0, 0))
return 1;
- if (!(merge_buffer= (uchar *) my_malloc((ulong) max_in_memory_size,
- MYF(MY_THREAD_SPECIFIC))))
+ ulong buff_sz= (max_in_memory_size / full_size + 1) * full_size;
+ if (!(merge_buffer= (uchar *) my_malloc(buff_sz, MYF(MY_THREAD_SPECIFIC))))
return 1;
- res= merge_walk(merge_buffer, (ulong) max_in_memory_size, size,
- (BUFFPEK *) file_ptrs.buffer,
- (BUFFPEK *) file_ptrs.buffer + file_ptrs.elements,
- action, walk_action_arg,
- tree.compare, tree.custom_arg, &file);
+ if (buff_sz < full_size * (file_ptrs.elements + 1UL))
+ res= merge(table, merge_buffer, buff_sz >= full_size * MERGEBUFF2) ;
+
+ if (!res)
+ {
+ res= merge_walk(merge_buffer, (ulong) max_in_memory_size, full_size,
+ (BUFFPEK *) file_ptrs.buffer,
+ (BUFFPEK *) file_ptrs.buffer + file_ptrs.elements,
+ action, walk_action_arg,
+ tree.compare, tree.custom_arg, &file);
+ }
my_free(merge_buffer);
return res;
}
+
/*
- Modify the TABLE element so that when one calls init_records()
- the rows will be read in priority order.
-*/
+ DESCRIPTION
+ Perform multi-pass sort merge of the elements accessed through table->sort,
+ using the buffer buff as the merge buffer. The last pass is not performed
+ if without_last_merge is TRUE.
+ SYNOPSIS
+ Unique:merge()
+ All params are 'IN':
+ table the parameter to access sort context
+ buff merge buffer
+ without_last_merge TRUE <=> do not perform the last merge
+ RETURN VALUE
+ 0 OK
+ <> 0 error
+ */
-bool Unique::get(TABLE *table)
+bool Unique::merge(TABLE *table, uchar *buff, bool without_last_merge)
{
- table->sort.found_records=elements+tree.elements_in_tree;
- if (my_b_tell(&file) == 0)
- {
- /* Whole tree is in memory; Don't use disk if you don't need to */
- if ((record_pointers=table->sort.record_pointers= (uchar*)
- my_malloc(size * tree.elements_in_tree, MYF(MY_THREAD_SPECIFIC))))
- {
- tree_walk_action action= min_dupl_count ?
- (tree_walk_action) unique_intersect_write_to_ptrs :
- (tree_walk_action) unique_write_to_ptrs;
- filtered_out_elems= 0;
- (void) tree_walk(&tree, action,
- this, left_root_right);
- table->sort.found_records-= filtered_out_elems;
- return 0;
- }
- }
- /* Not enough memory; Save the result to file && free memory used by tree */
- if (flush())
- return 1;
-
- IO_CACHE *outfile=table->sort.io_cache;
+ IO_CACHE *outfile= table->sort.io_cache;
BUFFPEK *file_ptr= (BUFFPEK*) file_ptrs.buffer;
uint maxbuffer= file_ptrs.elements - 1;
- uchar *sort_buffer;
my_off_t save_pos;
- bool error=1;
-
- /* Open cached file if it isn't open */
- outfile=table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
- MYF(MY_ZEROFILL |
- MY_THREAD_SPECIFIC));
+ bool error= 1;
+ /* Open cached file if it isn't open */
+ if (!outfile)
+ outfile= table->sort.io_cache= (IO_CACHE*) my_malloc(sizeof(IO_CACHE),
+ MYF(MY_THREAD_SPECIFIC|MY_ZEROFILL));
if (!outfile ||
(! my_b_inited(outfile) &&
open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER,
@@ -665,20 +665,16 @@ bool Unique::get(TABLE *table)
Sort_param sort_param;
bzero((char*) &sort_param,sizeof(sort_param));
sort_param.max_rows= elements;
- sort_param.sort_form=table;
+ sort_param.sort_form= table;
sort_param.rec_length= sort_param.sort_length= sort_param.ref_length=
full_size;
sort_param.min_dupl_count= min_dupl_count;
sort_param.res_length= 0;
sort_param.max_keys_per_buffer=
(uint) (max_in_memory_size / sort_param.sort_length);
- sort_param.not_killable=1;
+ sort_param.not_killable= 1;
- if (!(sort_buffer=(uchar*) my_malloc((sort_param.max_keys_per_buffer+1) *
- sort_param.sort_length,
- MYF(MY_THREAD_SPECIFIC))))
- return 1;
- sort_param.unique_buff= sort_buffer+(sort_param.max_keys_per_buffer *
+ sort_param.unique_buff= buff +(sort_param.max_keys_per_buffer *
sort_param.sort_length);
sort_param.compare= (qsort2_cmp) buffpek_compare;
@@ -686,27 +682,74 @@ bool Unique::get(TABLE *table)
sort_param.cmp_context.key_compare_arg= tree.custom_arg;
/* Merge the buffers to one file, removing duplicates */
- if (merge_many_buff(&sort_param,sort_buffer,file_ptr,&maxbuffer,&file))
+ if (merge_many_buff(&sort_param,buff,file_ptr,&maxbuffer,&file))
goto err;
if (flush_io_cache(&file) ||
reinit_io_cache(&file,READ_CACHE,0L,0,0))
goto err;
sort_param.res_length= sort_param.rec_length-
(min_dupl_count ? sizeof(min_dupl_count) : 0);
- if (merge_index(&sort_param, sort_buffer, file_ptr, maxbuffer, &file, outfile))
+ if (without_last_merge)
+ {
+ file_ptrs.elements= maxbuffer+1;
+ return 0;
+ }
+ if (merge_index(&sort_param, buff, file_ptr, maxbuffer, &file, outfile))
goto err;
- error=0;
+ error= 0;
err:
- my_free(sort_buffer);
if (flush_io_cache(outfile))
- error=1;
+ error= 1;
/* Setup io_cache for reading */
- save_pos=outfile->pos_in_file;
+ save_pos= outfile->pos_in_file;
if (reinit_io_cache(outfile,READ_CACHE,0L,0,0))
- error=1;
+ error= 1;
outfile->end_of_file=save_pos;
return error;
}
+/*
+ Modify the TABLE element so that when one calls init_records()
+ the rows will be read in priority order.
+*/
+
+bool Unique::get(TABLE *table)
+{
+ bool rc= 1;
+ uchar *sort_buffer= NULL;
+ table->sort.found_records= elements+tree.elements_in_tree;
+
+ if (my_b_tell(&file) == 0)
+ {
+ /* Whole tree is in memory; Don't use disk if you don't need to */
+ if ((record_pointers=table->sort.record_pointers= (uchar*)
+ my_malloc(size * tree.elements_in_tree, MYF(MY_THREAD_SPECIFIC))))
+ {
+ tree_walk_action action= min_dupl_count ?
+ (tree_walk_action) unique_intersect_write_to_ptrs :
+ (tree_walk_action) unique_write_to_ptrs;
+ filtered_out_elems= 0;
+ (void) tree_walk(&tree, action,
+ this, left_root_right);
+ table->sort.found_records-= filtered_out_elems;
+ return 0;
+ }
+ }
+ /* Not enough memory; Save the result to file && free memory used by tree */
+ if (flush())
+ return 1;
+
+ ulong buff_sz= (max_in_memory_size / full_size + 1) * full_size;
+ if (!(sort_buffer= (uchar*) my_malloc(buff_sz, MYF(MY_THREAD_SPECIFIC))))
+ return 1;
+
+ if (merge(table, sort_buffer, FALSE))
+ goto err;
+ rc= 0;
+
+err:
+ my_free(sort_buffer);
+ return rc;
+}
diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
index a6fdff72f50..1f4d8126be6 100644
--- a/storage/innobase/btr/btr0btr.c
+++ b/storage/innobase/btr/btr0btr.c
@@ -1594,7 +1594,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);
@@ -1713,7 +1713,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);
@@ -1788,7 +1788,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);
@@ -1845,10 +1845,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);
@@ -2778,8 +2778,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 */
@@ -2813,7 +2813,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 */
@@ -3178,7 +3179,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 */
}
@@ -3354,8 +3355,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 */
@@ -3488,7 +3489,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 */
@@ -3671,7 +3673,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 */
@@ -4149,7 +4151,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));
@@ -4177,7 +4179,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/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
index ce43cba8525..1f92de245b1 100644
--- a/storage/innobase/btr/btr0cur.c
+++ b/storage/innobase/btr/btr0cur.c
@@ -673,7 +673,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(
@@ -2042,7 +2042,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
@@ -2253,7 +2253,7 @@ btr_cur_pessimistic_update(
MTR_MEMO_X_LOCK));
ut_ad(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));
@@ -2391,7 +2391,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);
@@ -2498,7 +2498,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);
@@ -2524,7 +2524,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) {
@@ -2886,7 +2886,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
@@ -2986,12 +2986,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)
@@ -3086,7 +3088,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);
@@ -3096,7 +3098,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 */
}
@@ -3157,7 +3159,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/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
index 70841a168ab..1af019dfc45 100644
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
@@ -242,7 +242,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;
@@ -2582,8 +2582,9 @@ 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;
}
diff --git a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
index 7c8100df58e..60894cae6ad 100644
--- a/storage/innobase/buf/buf0lru.c
+++ b/storage/innobase/buf/buf0lru.c
@@ -1998,7 +1998,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/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index 6f2c2caffaf..d5b16d419f1 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -487,10 +487,12 @@ Looks for column n in an 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 */
+dict_index_get_nth_col_or_prefix_pos(
+/*=================================*/
+ const dict_index_t* index, /*!< in: index */
+ ulint n, /*!< in: column number */
+ ibool inc_prefix) /*!< in: TRUE=consider
+ column prefixes too */
{
const dict_field_t* field;
const dict_col_t* col;
@@ -512,7 +514,8 @@ dict_index_get_nth_col_pos(
for (pos = 0; pos < n_fields; pos++) {
field = dict_index_get_nth_field(index, pos);
- if (col == field->col && field->prefix_len == 0) {
+ if (col == field->col
+ && (inc_prefix || field->prefix_len == 0)) {
return(pos);
}
@@ -521,6 +524,20 @@ dict_index_get_nth_col_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.
@@ -2017,7 +2034,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;
@@ -2094,7 +2110,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));
@@ -2111,7 +2127,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/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index 23fe76f2281..8fe33459994 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -187,14 +187,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;
@@ -1286,7 +1288,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;
@@ -2301,11 +2302,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);
@@ -2348,13 +2347,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() */
buf_LRU_flush_or_remove_pages(
id, evict_all
? BUF_REMOVE_ALL_NO_WRITE
@@ -2364,6 +2376,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);
@@ -2421,7 +2442,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);
@@ -3695,7 +3716,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);
@@ -4408,7 +4429,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);
@@ -4624,7 +4647,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;
@@ -4755,7 +4778,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;
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 42b0fe2b65f..bf7bfce6b5c 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -342,6 +342,7 @@ static PSI_file_info all_innodb_files[] = {
static INNOBASE_SHARE *get_share(const char *table_name);
static void free_share(INNOBASE_SHARE *share);
static int innobase_close_connection(handlerton *hton, THD* thd);
+static void innobase_kill_query(handlerton *hton, THD* thd, enum thd_kill_levels level);
static void innobase_commit_ordered(handlerton *hton, THD* thd, bool all);
static int innobase_commit(handlerton *hton, THD* thd, bool all);
static int innobase_rollback(handlerton *hton, THD* thd, bool all);
@@ -921,8 +922,7 @@ convert_error_code_to_mysql(
return(0);
case DB_INTERRUPTED:
- my_error(ER_QUERY_INTERRUPTED, MYF(0));
- /* fall through */
+ return(HA_ERR_ABORTED_BY_USER);
case DB_FOREIGN_EXCEED_MAX_CASCADE:
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
@@ -1013,11 +1013,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),
@@ -1487,19 +1499,19 @@ innobase_next_autoinc(
*/
max_value= (~(ulonglong) 0);
- /* Current value should never be greater than the maximum. */
- ut_a(current <= max_value);
-
/* According to MySQL documentation, if the offset is greater than
the step then the offset is ignored. */
if (offset > block) {
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;
@@ -2145,7 +2157,7 @@ trx_is_interrupted(
/*===============*/
trx_t* trx) /*!< in: transaction */
{
- return(trx && trx->mysql_thd && thd_killed((THD*) trx->mysql_thd));
+ return(trx && trx->mysql_thd && thd_kill_level((THD*) trx->mysql_thd));
}
/**********************************************************************//**
@@ -2276,6 +2288,7 @@ innobase_init(
innobase_hton->flags=HTON_NO_FLAGS;
innobase_hton->release_temporary_latches=innobase_release_temporary_latches;
innobase_hton->alter_table_flags = innobase_alter_table_flags;
+ innobase_hton->kill_query = innobase_kill_query;
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
@@ -3324,6 +3337,35 @@ innobase_close_connection(
}
+/*****************************************************************//**
+Cancel any pending lock request associated with the current THD. */
+static
+void
+innobase_kill_query(
+/*======================*/
+ handlerton* hton, /*!< in: innobase handlerton */
+ THD* thd, /*!< in: MySQL thread being killed */
+ enum thd_kill_levels level) /*!< in: kill level */
+{
+ trx_t* trx;
+ DBUG_ENTER("innobase_kill_query");
+ DBUG_ASSERT(hton == innodb_hton_ptr);
+
+ mutex_enter(&kernel_mutex);
+
+ trx = thd_to_trx(thd);
+
+ /* Cancel a pending lock request. */
+ if (trx && trx->wait_lock) {
+ lock_cancel_waiting_and_release(trx->wait_lock);
+ }
+
+ mutex_exit(&kernel_mutex);
+
+ DBUG_VOID_RETURN;
+}
+
+
/*************************************************************************//**
** InnoDB database tables
*****************************************************************************/
@@ -8825,7 +8867,7 @@ ha_innobase::check(
row_mysql_unlock_data_dictionary(prebuilt->trx);
}
- if (thd_killed(user_thd)) {
+ if (thd_kill_level(user_thd)) {
break;
}
@@ -8882,7 +8924,7 @@ ha_innobase::check(
mutex_exit(&kernel_mutex);
prebuilt->trx->op_info = "";
- if (thd_killed(user_thd)) {
+ if (thd_kill_level(user_thd)) {
my_error(ER_QUERY_INTERRUPTED, MYF(0));
}
@@ -11867,8 +11909,8 @@ static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method,
#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,
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 7ef3e954636..a33af4db2fe 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -80,12 +80,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
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index dc65fb3ff1a..451e37f2136 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -112,13 +112,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 */
@@ -151,7 +155,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:
diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
index c7887afef92..70af56b99f2 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.c
+++ b/storage/innobase/ibuf/ibuf0ibuf.c
@@ -2868,6 +2868,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,
@@ -4176,11 +4184,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) {
@@ -4285,6 +4293,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) {
@@ -4319,7 +4343,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);
@@ -4600,7 +4630,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/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index cbc6103c2ee..6819f2bc2c5 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -635,7 +635,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
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index b609bce9d41..54af14313c4 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -910,6 +910,18 @@ dict_index_get_nth_col_pos(
const dict_index_t* index, /*!< in: index */
ulint n); /*!< in: column number */
/********************************************************************//**
+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_or_prefix_pos(
+/*=================================*/
+ const dict_index_t* index, /*!< in: index */
+ ulint n, /*!< in: column number */
+ ibool inc_prefix); /*!< in: TRUE=consider
+ column prefixes too */
+/********************************************************************//**
Returns TRUE if the index contains a column or a prefix of that column.
@return TRUE if contains the column or its prefix */
UNIV_INTERN
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 4c371c8d5cf..980417715b3 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/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/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index 00c1d0516e6..9cf3b9805bc 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/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/innobase/include/row0undo.h b/storage/innobase/include/row0undo.h
index 6eb4ca448b3..9420d022e3b 100644
--- a/storage/innobase/include/row0undo.h
+++ b/storage/innobase/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/innobase/include/row0upd.ic b/storage/innobase/include/row0upd.ic
index 10646241125..6706c9f8c69 100644
--- a/storage/innobase/include/row0upd.ic
+++ b/storage/innobase/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/innobase/include/univ.i b/storage/innobase/include/univ.i
index ce7181e7bd5..0b0b4b8d04c 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -295,6 +295,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
/* The universal page size of the database */
diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c
index 6c55a1badc5..03ba4d12cd0 100644
--- a/storage/innobase/log/log0recv.c
+++ b/storage/innobase/log/log0recv.c
@@ -1636,9 +1636,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 */
diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
index 1068c033871..46eb9c4a935 100644
--- a/storage/innobase/os/os0file.c
+++ b/storage/innobase/os/os0file.c
@@ -1397,6 +1397,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);
@@ -1512,6 +1519,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);
diff --git a/storage/innobase/page/page0cur.c b/storage/innobase/page/page0cur.c
index 55ba72b4fe9..a722f5b188d 100644
--- a/storage/innobase/page/page0cur.c
+++ b/storage/innobase/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 */
@@ -1973,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/innobase/page/page0page.c b/storage/innobase/page/page0page.c
index 78135b0aff2..81051f8f4fe 100644
--- a/storage/innobase/page/page0page.c
+++ b/storage/innobase/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);
@@ -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);
@@ -1128,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 */
@@ -1199,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 */
diff --git a/storage/innobase/page/page0zip.c b/storage/innobase/page/page0zip.c
index ca3836689d3..9f895e60803 100644
--- a/storage/innobase/page/page0zip.c
+++ b/storage/innobase/page/page0zip.c
@@ -1433,7 +1433,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) {
@@ -3119,6 +3119,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 */
{
@@ -3206,39 +3207,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:
@@ -3260,9 +3324,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 */
@@ -3593,7 +3658,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 */
}
@@ -3640,7 +3705,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,
@@ -3649,7 +3714,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 */
}
@@ -3716,7 +3781,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) {
@@ -3787,7 +3852,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;
@@ -3808,7 +3873,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 */
}
@@ -4035,7 +4100,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 */
}
@@ -4059,7 +4124,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 */
}
@@ -4360,14 +4425,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 */
}
@@ -4445,7 +4510,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));
@@ -4532,7 +4597,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)) {
@@ -4593,7 +4658,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/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
index 20e8c13ea70..7e1d18d41b6 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -1855,7 +1855,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
@@ -1993,6 +1994,8 @@ err_exit:
row_drop_table_for_mysql(table->name, trx, FALSE);
trx_commit_for_mysql(trx);
+ } else {
+ dict_mem_table_free(table);
}
break;
diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
index 7bec0a26225..b46b2eacd9d 100644
--- a/storage/innobase/row/row0sel.c
+++ b/storage/innobase/row/row0sel.c
@@ -2487,6 +2487,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
@@ -3915,6 +3918,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 */
@@ -4839,11 +4847,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:
@@ -4865,14 +4877,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/innobase/row/row0umod.c b/storage/innobase/row/row0umod.c
index 9597c476125..9e5fb8686c6 100644
--- a/storage/innobase/row/row0umod.c
+++ b/storage/innobase/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);
}
@@ -847,7 +795,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/innobase/row/row0undo.c b/storage/innobase/row/row0undo.c
index 09970b7fe21..a1c1d72f8c6 100644
--- a/storage/innobase/row/row0undo.c
+++ b/storage/innobase/row/row0undo.c
@@ -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/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 632236dc8fe..6264a342d7a 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -3052,7 +3052,10 @@ int ha_maria::create(const char *name, register TABLE *table_arg,
ha_create_info->transactional != HA_CHOICE_NO);
if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
+ {
create_flags|= HA_CREATE_TMP_TABLE;
+ create_info.transactional= 0;
+ }
if (ha_create_info->options & HA_CREATE_KEEP_FILES)
create_flags|= HA_CREATE_KEEP_FILES;
if (options & HA_OPTION_PACK_RECORD)
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 305984ee94d..438057e22df 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -237,7 +237,8 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
}
/* sanity check */
- if (share->base.keystart > 65535 || share->base.rec_reflength > 8)
+ if (share->base.keystart > 65535 ||
+ share->base.rec_reflength > 8 || share->base.key_reflength > 7)
{
my_errno=HA_ERR_CRASHED;
goto err;
diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c
index 7d8b577e8b0..c8546ee56f5 100644
--- a/storage/myisam/myisamchk.c
+++ b/storage/myisam/myisamchk.c
@@ -291,7 +291,14 @@ static struct my_option my_long_options[] =
&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},
- { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
+ { "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},
+ { "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),
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index 9a6ada2f814..104fecb2d1e 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -119,7 +119,7 @@
mode when a server is installed.
The implementation of the database creation script is located in
- @verbatim ./scripts/mysql_system_tables.sql @endverbatim
+ @verbatim ./scripts/mysql_performance_tables.sql @endverbatim
@subsection INT_CONFIG Runtime configuration interface
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 97e83cd9221..3305875c124 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -3591,12 +3591,12 @@ struct st_mysql_storage_engine sphinx_storage_engine =
struct st_mysql_show_var sphinx_status_vars[] =
{
- {"sphinx_total", (char *)sphinx_showfunc_total, SHOW_SIMPLE_FUNC},
- {"sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_SIMPLE_FUNC},
- {"sphinx_time", (char *)sphinx_showfunc_time, SHOW_SIMPLE_FUNC},
- {"sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_SIMPLE_FUNC},
- {"sphinx_words", (char *)sphinx_showfunc_words, SHOW_SIMPLE_FUNC},
- {"sphinx_error", (char *)sphinx_showfunc_error, SHOW_SIMPLE_FUNC},
+ {"Sphinx_total", (char *)sphinx_showfunc_total, SHOW_SIMPLE_FUNC},
+ {"Sphinx_total_found", (char *)sphinx_showfunc_total_found, SHOW_SIMPLE_FUNC},
+ {"Sphinx_time", (char *)sphinx_showfunc_time, SHOW_SIMPLE_FUNC},
+ {"Sphinx_word_count", (char *)sphinx_showfunc_word_count, SHOW_SIMPLE_FUNC},
+ {"Sphinx_words", (char *)sphinx_showfunc_words, SHOW_SIMPLE_FUNC},
+ {"Sphinx_error", (char *)sphinx_showfunc_error, SHOW_SIMPLE_FUNC},
{0, 0, (enum_mysql_show_type)0}
};
diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c
index 61c07ac792e..687853a422e 100644
--- a/storage/xtradb/btr/btr0cur.c
+++ b/storage/xtradb/btr/btr0cur.c
@@ -239,6 +239,7 @@ btr_cur_latch_leaves(
mtr_t* mtr) /*!< in: mtr */
{
ulint mode;
+ ulint sibling_mode;
ulint left_page_no;
ulint right_page_no;
buf_block_t* get_block;
@@ -261,14 +262,21 @@ btr_cur_latch_leaves(
#endif /* UNIV_BTR_DEBUG */
get_block->check_index_page_at_flush = TRUE;
return;
+ case BTR_SEARCH_TREE:
case BTR_MODIFY_TREE:
- /* x-latch also brothers from left to right */
+ if (UNIV_UNLIKELY(latch_mode == BTR_SEARCH_TREE)) {
+ mode = RW_S_LATCH;
+ sibling_mode = RW_NO_LATCH;
+ } else {
+ mode = sibling_mode = RW_X_LATCH;
+ }
+ /* Fetch and possibly latch also brothers from left to right */
left_page_no = btr_page_get_prev(page, mtr);
if (left_page_no != FIL_NULL) {
get_block = btr_block_get(
space, zip_size, left_page_no,
- RW_X_LATCH, cursor->index, mtr);
+ sibling_mode, cursor->index, mtr);
if (srv_pass_corrupt_table && !get_block) {
return;
@@ -280,12 +288,21 @@ btr_cur_latch_leaves(
ut_a(btr_page_get_next(get_block->frame, mtr)
== page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
- get_block->check_index_page_at_flush = TRUE;
+ if (sibling_mode == RW_NO_LATCH) {
+ /* btr_block_get() called with RW_NO_LATCH will
+ fix the read block in the buffer. This serves
+ no purpose for the fake changes prefetching,
+ thus we unfix the sibling blocks immediately.*/
+ mtr_memo_release(mtr, get_block,
+ MTR_MEMO_BUF_FIX);
+ } else {
+ get_block->check_index_page_at_flush = TRUE;
+ }
}
get_block = btr_block_get(
space, zip_size, page_no,
- RW_X_LATCH, cursor->index, mtr);
+ mode, cursor->index, mtr);
if (srv_pass_corrupt_table && !get_block) {
return;
@@ -301,7 +318,7 @@ btr_cur_latch_leaves(
if (right_page_no != FIL_NULL) {
get_block = btr_block_get(
space, zip_size, right_page_no,
- RW_X_LATCH, cursor->index, mtr);
+ sibling_mode, cursor->index, mtr);
if (srv_pass_corrupt_table && !get_block) {
return;
@@ -313,7 +330,12 @@ btr_cur_latch_leaves(
ut_a(btr_page_get_prev(get_block->frame, mtr)
== page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
- get_block->check_index_page_at_flush = TRUE;
+ if (sibling_mode == RW_NO_LATCH) {
+ mtr_memo_release(mtr, get_block,
+ MTR_MEMO_BUF_FIX);
+ } else {
+ get_block->check_index_page_at_flush = TRUE;
+ }
}
return;
@@ -1566,6 +1588,9 @@ btr_cur_pessimistic_insert(
}
if (!(flags & BTR_NO_UNDO_LOG_FLAG)) {
+
+ ut_a(cursor->tree_height != ULINT_UNDEFINED);
+
/* First reserve enough free space for the file segments
of the index tree, so that the insert will not fail because
of lack of space */
@@ -1860,7 +1885,8 @@ btr_cur_update_alloc_zip(
ulint length, /*!< in: size needed */
ibool create, /*!< in: TRUE=delete-and-insert,
FALSE=update-in-place */
- mtr_t* mtr) /*!< in: mini-transaction */
+ mtr_t* mtr, /*!< in: mini-transaction */
+ trx_t* trx) /*!< in: NULL or transaction */
{
ut_a(page_zip == buf_block_get_page_zip(block));
ut_ad(page_zip);
@@ -1877,6 +1903,14 @@ btr_cur_update_alloc_zip(
return(FALSE);
}
+ if (trx && trx->fake_changes) {
+ /* Don't call page_zip_compress_write_log_no_data as that has
+ assert which would fail. Assume there won't be a compression
+ failure. */
+
+ return TRUE;
+ }
+
if (!page_zip_compress(page_zip, buf_block_get_frame(block),
index, mtr)) {
/* Unable to compress the page */
@@ -1960,7 +1994,8 @@ btr_cur_update_in_place(
/* Check that enough space is available on the compressed page. */
if (page_zip
&& !btr_cur_update_alloc_zip(page_zip, block, index,
- rec_offs_size(offsets), FALSE, mtr)) {
+ rec_offs_size(offsets), FALSE, mtr,
+ trx)) {
return(DB_ZIP_OVERFLOW);
}
@@ -2159,7 +2194,8 @@ any_extern:
if (page_zip
&& !btr_cur_update_alloc_zip(page_zip, block, index,
- new_rec_size, TRUE, mtr)) {
+ new_rec_size, TRUE, mtr,
+ thr_get_trx(thr))) {
err = DB_ZIP_OVERFLOW;
goto err_exit;
}
@@ -2402,7 +2438,15 @@ btr_cur_pessimistic_update(
of the index tree, so that the update will not fail because
of lack of space */
- n_extents = cursor->tree_height / 16 + 3;
+ if (UNIV_UNLIKELY(cursor->tree_height == ULINT_UNDEFINED)) {
+ /* When the tree height is uninitialized due to fake
+ changes, reserve some hardcoded number of extents. */
+ ut_a(thr && thr_get_trx(thr)->fake_changes);
+ n_extents = 3;
+ }
+ else {
+ n_extents = cursor->tree_height / 16 + 3;
+ }
if (flags & BTR_NO_UNDO_LOG_FLAG) {
reserve_flag = FSP_CLEANING;
@@ -2439,7 +2483,7 @@ btr_cur_pessimistic_update(
itself. Thus the following call is safe. */
row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update,
FALSE, *heap);
- if (!(flags & BTR_KEEP_SYS_FLAG)) {
+ if (!(flags & BTR_KEEP_SYS_FLAG) && !trx->fake_changes) {
row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR,
roll_ptr);
row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID,
@@ -3210,6 +3254,8 @@ btr_cur_pessimistic_delete(
of the index tree, so that the node pointer updates will
not fail because of lack of space */
+ ut_a(cursor->tree_height != ULINT_UNDEFINED);
+
n_extents = cursor->tree_height / 32 + 1;
success = fsp_reserve_free_extents(&n_reserved,
diff --git a/storage/xtradb/btr/btr0pcur.c b/storage/xtradb/btr/btr0pcur.c
index b335e2c8aee..a1b7affdeb7 100644
--- a/storage/xtradb/btr/btr0pcur.c
+++ b/storage/xtradb/btr/btr0pcur.c
@@ -47,6 +47,7 @@ btr_pcur_create_for_mysql(void)
pcur->btr_cur.index = NULL;
btr_pcur_init(pcur);
+ pcur->btr_cur.tree_height = ULINT_UNDEFINED;
return(pcur);
}
diff --git a/storage/xtradb/buf/buf0lru.c b/storage/xtradb/buf/buf0lru.c
index a6a1f8dcf9c..14b5c65132c 100644
--- a/storage/xtradb/buf/buf0lru.c
+++ b/storage/xtradb/buf/buf0lru.c
@@ -239,9 +239,11 @@ buf_LRU_drop_page_hash_batch(
When doing a DROP TABLE/DISCARD TABLESPACE we have to drop all page
hash index entries belonging to that table. This function tries to
do that in batch. Note that this is a 'best effort' attempt and does
-not guarantee that ALL hash entries will be removed. */
+not guarantee that ALL hash entries will be removed.
+
+@return number of hashed pages found*/
static
-void
+ulint
buf_LRU_drop_page_hash_for_tablespace(
/*==================================*/
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
@@ -251,13 +253,14 @@ buf_LRU_drop_page_hash_for_tablespace(
ulint* page_arr;
ulint num_entries;
ulint zip_size;
+ ulint num_found = 0;
zip_size = fil_space_get_zip_size(id);
if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
/* Somehow, the tablespace does not exist. Nothing to drop. */
ut_ad(0);
- return;
+ return num_found;
}
page_arr = ut_malloc(
@@ -315,6 +318,7 @@ next_page:
ut_a(num_entries < BUF_LRU_DROP_SEARCH_SIZE);
++num_entries;
+ ++num_found;
if (num_entries < BUF_LRU_DROP_SEARCH_SIZE) {
goto next_page;
@@ -370,6 +374,8 @@ next_page:
/* Drop any remaining batch of search hashed pages. */
buf_LRU_drop_page_hash_batch(id, zip_size, page_arr, num_entries);
ut_free(page_arr);
+
+ return num_found;
}
/******************************************************************//**
@@ -814,8 +820,6 @@ buf_LRU_mark_space_was_deleted(
for (i = 0; i < srv_buf_pool_instances; i++) {
buf_pool_t* buf_pool;
buf_page_t* bpage;
- buf_chunk_t* chunk;
- ulint j, k;
buf_pool = buf_pool_from_array(i);
@@ -832,28 +836,10 @@ buf_LRU_mark_space_was_deleted(
mutex_exit(&buf_pool->LRU_list_mutex);
- btr_search_s_lock_all();
- chunk = buf_pool->chunks;
- for (j = buf_pool->n_chunks; j--; chunk++) {
- buf_block_t* block = chunk->blocks;
- for (k = chunk->size; k--; block++) {
- if (buf_block_get_state(block)
- != BUF_BLOCK_FILE_PAGE
- || !block->index
- || buf_page_get_space(&block->page) != id) {
- continue;
- }
-
- btr_search_s_unlock_all();
-
- rw_lock_x_lock(&block->lock);
- btr_search_drop_page_hash_index(block);
- rw_lock_x_unlock(&block->lock);
-
- btr_search_s_lock_all();
- }
- }
- btr_search_s_unlock_all();
+ /* The AHI entries for the tablespace being deleted should be
+ removed by now. */
+ ut_ad(buf_LRU_drop_page_hash_for_tablespace(buf_pool, id)
+ == 0);
}
}
diff --git a/storage/xtradb/buf/buf0rea.c b/storage/xtradb/buf/buf0rea.c
index 67379d614a0..6d76a488af7 100644
--- a/storage/xtradb/buf/buf0rea.c
+++ b/storage/xtradb/buf/buf0rea.c
@@ -235,6 +235,9 @@ not_to_recover:
sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
((buf_block_t*) bpage)->frame, bpage, trx);
}
+ if(sync) {
+ thd_wait_end(NULL);
+ }
if (*err == DB_TABLESPACE_DELETED) {
buf_read_page_handle_error(bpage);
@@ -250,7 +253,6 @@ not_to_recover:
}
if (sync) {
- thd_wait_end(NULL);
/* The i/o is already completed when we arrive from
fil_read */
if (!buf_page_io_complete(bpage)) {
diff --git a/storage/xtradb/fsp/fsp0fsp.c b/storage/xtradb/fsp/fsp0fsp.c
index d4a2745b90b..5cbc74b0862 100644
--- a/storage/xtradb/fsp/fsp0fsp.c
+++ b/storage/xtradb/fsp/fsp0fsp.c
@@ -3031,7 +3031,11 @@ try_again:
some of them will contain extent descriptor pages, and therefore
will not be free extents */
- n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
+ if (size <= free_limit) {
+ n_free_up = 0;
+ } else {
+ n_free_up = (size - free_limit) / FSP_EXTENT_SIZE;
+ }
if (n_free_up > 0) {
n_free_up--;
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index b37112db773..5a09bb36292 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -381,6 +381,7 @@ static PSI_file_info all_innodb_files[] = {
static INNOBASE_SHARE *get_share(const char *table_name);
static void free_share(INNOBASE_SHARE *share);
static int innobase_close_connection(handlerton *hton, THD* thd);
+static void innobase_kill_query(handlerton *hton, THD* thd, enum thd_kill_levels level);
static void innobase_commit_ordered(handlerton *hton, THD* thd, bool all);
static int innobase_commit(handlerton *hton, THD* thd, bool all);
static int innobase_rollback(handlerton *hton, THD* thd, bool all);
@@ -1053,6 +1054,13 @@ thd_to_trx(
return(*(trx_t**) thd_ha_data(thd, innodb_hton_ptr));
}
+my_bool
+ha_innobase::is_fake_change_enabled(THD* thd)
+{
+ trx_t* trx = thd_to_trx(thd);
+ return(trx && trx->fake_changes);
+}
+
/********************************************************************//**
Call this function when mysqld passes control to the client. That is to
avoid deadlocks on the adaptive hash S-latch possibly held by thd. For more
@@ -1117,8 +1125,7 @@ convert_error_code_to_mysql(
return(0);
case DB_INTERRUPTED:
- my_error(ER_QUERY_INTERRUPTED, MYF(0));
- /* fall through */
+ return(HA_ERR_ABORTED_BY_USER);
case DB_FOREIGN_EXCEED_MAX_CASCADE:
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
@@ -2382,7 +2389,7 @@ trx_is_interrupted(
/*===============*/
trx_t* trx) /*!< in: transaction */
{
- return(trx && trx->mysql_thd && thd_killed((THD*) trx->mysql_thd));
+ return(trx && trx->mysql_thd && thd_kill_level((THD*) trx->mysql_thd));
}
/**********************************************************************//**
@@ -2639,6 +2646,7 @@ innobase_init(
innobase_hton->flags=HTON_NO_FLAGS;
innobase_hton->release_temporary_latches=innobase_release_temporary_latches;
innobase_hton->alter_table_flags = innobase_alter_table_flags;
+ innobase_hton->kill_query = innobase_kill_query;
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
@@ -3052,6 +3060,14 @@ innobase_change_buffering_inited_ok:
srv_use_checksums = (ibool) innobase_use_checksums;
srv_fast_checksum = (ibool) innobase_fast_checksum;
+ if (innobase_fast_checksum) {
+ fprintf(stderr,
+ "InnoDB: Warning: innodb_fast_checksum is DEPRECATED "
+ "and *WILL* be removed in Percona Server 5.6. Please "
+ "consult the Percona Server 5.6 documentation for "
+ "help in upgrading.\n");
+ }
+
srv_blocking_lru_restore = (ibool) innobase_blocking_lru_restore;
#ifdef HAVE_LARGE_PAGES
@@ -3938,6 +3954,33 @@ innobase_close_connection(
DBUG_RETURN(0);
}
+/*****************************************************************//**
+Cancel any pending lock request associated with the current THD. */
+static
+void
+innobase_kill_query(
+/*======================*/
+ handlerton* hton, /*!< in: innobase handlerton */
+ THD* thd, /*!< in: MySQL thread being killed */
+ enum thd_kill_levels level) /*!< in: kill level */
+{
+ trx_t* trx;
+ DBUG_ENTER("innobase_kill_query");
+ DBUG_ASSERT(hton == innodb_hton_ptr);
+
+ mutex_enter(&kernel_mutex);
+
+ trx = thd_to_trx(thd);
+
+ /* Cancel a pending lock request. */
+ if (trx && trx->wait_lock) {
+ lock_cancel_waiting_and_release(trx->wait_lock);
+ }
+
+ mutex_exit(&kernel_mutex);
+
+ DBUG_VOID_RETURN;
+}
/*************************************************************************//**
** InnoDB database tables
@@ -6280,7 +6323,9 @@ no_commit:
error = row_insert_for_mysql((byte*) record, prebuilt);
#ifdef EXTENDED_FOR_USERSTAT
- if (error == DB_SUCCESS) rows_changed++;
+ if (UNIV_LIKELY(error == DB_SUCCESS && !trx->fake_changes)) {
+ rows_changed++;
+ }
#endif
/* Handle duplicate key errors */
@@ -6645,7 +6690,9 @@ ha_innobase::update_row(
}
#ifdef EXTENDED_FOR_USERSTAT
- if (error == DB_SUCCESS) rows_changed++;
+ if (UNIV_LIKELY(error == DB_SUCCESS && !trx->fake_changes)) {
+ rows_changed++;
+ }
#endif
innodb_srv_conc_exit_innodb(trx);
@@ -6710,7 +6757,9 @@ ha_innobase::delete_row(
error = row_update_for_mysql((byte*) record, prebuilt);
#ifdef EXTENDED_FOR_USERSTAT
- if (error == DB_SUCCESS) rows_changed++;
+ if (UNIV_LIKELY(error == DB_SUCCESS && !trx->fake_changes)) {
+ rows_changed++;
+ }
#endif
innodb_srv_conc_exit_innodb(trx);
@@ -9844,7 +9893,7 @@ ha_innobase::check(
row_mysql_unlock_data_dictionary(prebuilt->trx);
}
- if (thd_killed(user_thd)) {
+ if (thd_kill_level(user_thd)) {
break;
}
@@ -9901,7 +9950,7 @@ ha_innobase::check(
mutex_exit(&kernel_mutex);
prebuilt->trx->op_info = "";
- if (thd_killed(user_thd)) {
+ if (thd_kill_level(user_thd)) {
my_error(ER_QUERY_INTERRUPTED, MYF(0));
}
@@ -12693,6 +12742,8 @@ static MYSQL_SYSVAR_BOOL(checksums, innobase_use_checksums,
static MYSQL_SYSVAR_BOOL(fast_checksum, innobase_fast_checksum,
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "DEPRECATED. #### WARNING #### : This feature is DEPRECATED and WILL "
+ "be removed in Percona Server 5.6. "
"Change the algorithm of checksum for the whole of datapage to 4-bytes word based. "
"The original checksum is checked after the new one. It may be slow for reading page"
" which has orginal checksum. Overwrite the page or recreate the InnoDB database, "
@@ -13126,6 +13177,11 @@ static MYSQL_SYSVAR_BOOL(track_changed_pages, srv_track_changed_pages,
"Track the redo log for changed pages and output a changed page bitmap",
NULL, NULL, FALSE);
+static MYSQL_SYSVAR_ULONGLONG(max_bitmap_file_size, srv_max_bitmap_file_size,
+ PLUGIN_VAR_RQCMDARG,
+ "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,
PLUGIN_VAR_RQCMDARG,
"The maximum number of rows for "
@@ -13328,6 +13384,13 @@ static MYSQL_SYSVAR_ULINT(lazy_drop_table, srv_lazy_drop_table,
"e.g. for http://bugs.mysql.com/51325",
NULL, NULL, 0, 0, 1, 0);
+static MYSQL_SYSVAR_BOOL(locking_fake_changes, srv_fake_changes_locks,
+ PLUGIN_VAR_NOCMDARG,
+ "###EXPERIMENTAL### if enabled, transactions will get S row locks instead "
+ "of X locks for fake changes. If disabled, fake change transactions will "
+ "not take any locks at all.",
+ NULL, NULL, TRUE);
+
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(page_size),
MYSQL_SYSVAR(log_block_size),
@@ -13419,6 +13482,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(use_native_aio),
MYSQL_SYSVAR(change_buffering),
MYSQL_SYSVAR(track_changed_pages),
+ MYSQL_SYSVAR(max_bitmap_file_size),
MYSQL_SYSVAR(changed_pages_limit),
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
MYSQL_SYSVAR(change_buffering_debug),
@@ -13437,6 +13501,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
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),
NULL
};
@@ -13685,7 +13750,7 @@ int ha_innobase::multi_range_read_explain_info(uint mrr_mode, char *str, size_t
bool ha_innobase::is_thd_killed()
{
- return thd_killed(user_thd);
+ return thd_kill_level(user_thd);
}
/**
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index 4d9c0a1ab35..359d0b95367 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -137,6 +137,7 @@ class ha_innobase: public handler
int close(void);
double scan_time();
double read_time(uint index, uint ranges, ha_rows rows);
+ my_bool is_fake_change_enabled(THD *thd);
bool is_corrupt() const;
int write_row(uchar * buf);
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index 29a80594344..4b33d6a780c 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -7147,29 +7147,38 @@ static ST_FIELD_INFO i_s_innodb_changed_pages_info[] =
};
/***********************************************************************
- This function parses condition and gets upper bounds for start and end LSN's
- if condition corresponds to certain pattern.
+ This function implements ICP for I_S.INNODB_CHANGED_PAGES by parsing a
+ condition and getting lower and upper bounds for start and end LSNs if the
+ condition corresponds to a certain pattern.
- We can't know right position to avoid scanning bitmap files from the beginning
- to the lower bound. But we can stop scanning bitmap files if we reach upper bound.
+ In the most general form, we understand queries like
- It's expected the most used queries will be like the following:
-
- SELECT * FROM INNODB_CHANGED_PAGES WHERE START_LSN > num1 AND start_lsn < num2;
+ SELECT * FROM INNODB_CHANGED_PAGES
+ WHERE START_LSN > num1 AND START_LSN < num2
+ AND END_LSN > num3 AND END_LSN < num4;
- That's why the pattern is:
+ That's why the pattern syntax is:
pattern: comp | and_comp;
comp: lsn < int_num | lsn <= int_num | int_num > lsn | int_num >= lsn;
lsn: start_lsn | end_lsn;
- and_comp: some_expression AND some_expression | some_expression AND and_comp;
- some_expression: comp | any_other_expression;
+ and_comp: expression AND expression | expression AND and_comp;
+ expression: comp | any_other_expression;
+
+ The two bounds are handled differently: the lower bound is used to find the
+ correct starting _file_, the upper bound the last _block_ that needs reading.
+
+ Lower bound conditions are handled in the following way: start_lsn >= X
+ specifies that the reading must start from the file that has the highest
+ starting LSN less than or equal to X. start_lsn > X is equivalent to
+ start_lsn >= X + 1. For end_lsn, end_lsn >= X is treated as
+ start_lsn >= X - 1 and end_lsn > X as start_lsn >= X.
- Suppose the condition is start_lsn < 100, this means we have to read all
- blocks with start_lsn < 100. Which is equivalent to reading all the blocks
- with end_lsn <= 99, or just end_lsn < 100. That's why it's enough to find
- maximum lsn value, doesn't matter if this is start or end lsn and compare
- it with "start_lsn" field.
+ For the upper bound, suppose the condition is start_lsn < 100, this means we
+ have to read all blocks with start_lsn < 100. Which is equivalent to reading
+ all the blocks with end_lsn <= 99, or just end_lsn < 100. That's why it's
+ enough to find maximum lsn value, doesn't matter if this is start or end lsn
+ and compare it with "start_lsn" field. LSN <= 100 is treated as LSN < 101.
Example:
@@ -7180,92 +7189,130 @@ static ST_FIELD_INFO i_s_innodb_changed_pages_info[] =
555 > end_lsn AND
page_id = 100;
- max_lsn will be set to 555.
+ end_lsn will be set to 555, start_lsn will be set 11.
+
+ Support for other functions (equal, NULL-safe equal, BETWEEN, IN, etc.) will
+ be added on demand.
+
*/
static
void
limit_lsn_range_from_condition(
/*===========================*/
- TABLE* table, /*!<in: table */
- COND* cond, /*!<in: condition */
- ib_uint64_t* max_lsn) /*!<in/out: maximum LSN
- (must be initialized with maximum
- available value) */
+ TABLE* table, /*!<in: table */
+ COND* cond, /*!<in: condition */
+ ib_uint64_t* start_lsn, /*!<in/out: minumum LSN */
+ ib_uint64_t* end_lsn) /*!<in/out: maximum LSN */
{
+ enum Item_func::Functype func_type;
+
if (cond->type() != Item::COND_ITEM &&
cond->type() != Item::FUNC_ITEM)
return;
- switch (((Item_func*) cond)->functype())
+ func_type = ((Item_func*) cond)->functype();
+
+ switch (func_type)
{
- case Item_func::COND_AND_FUNC:
- {
- List_iterator<Item> li(*((Item_cond*) cond)->
- argument_list());
- Item *item;
- while ((item= li++))
- limit_lsn_range_from_condition(table,
- item,
- max_lsn);
- break;
+ case Item_func::COND_AND_FUNC:
+ {
+ List_iterator<Item> li(*((Item_cond*) cond)
+ ->argument_list());
+ Item *item;
+
+ while ((item= li++)) {
+ limit_lsn_range_from_condition(table, item, start_lsn,
+ end_lsn);
+ }
+ break;
+ }
+ case Item_func::LT_FUNC:
+ case Item_func::LE_FUNC:
+ case Item_func::GT_FUNC:
+ case Item_func::GE_FUNC:
+ {
+ Item *left;
+ Item *right;
+ Item_field *item_field;
+ ib_uint64_t tmp_result;
+ ibool is_end_lsn;
+
+ /* a <= b equals to b >= a that's why we just exchange "left"
+ and "right" in the case of ">" or ">=" function. We don't
+ touch the operation itself. */
+ if (((Item_func*) cond)->functype() == Item_func::LT_FUNC
+ || ((Item_func*) cond)->functype() == Item_func::LE_FUNC) {
+ left = ((Item_func*) cond)->arguments()[0];
+ right = ((Item_func*) cond)->arguments()[1];
+ } else {
+ left = ((Item_func*) cond)->arguments()[1];
+ right = ((Item_func*) cond)->arguments()[0];
}
- case Item_func::LT_FUNC:
- case Item_func::LE_FUNC:
- case Item_func::GT_FUNC:
- case Item_func::GE_FUNC:
- {
- Item *left;
- Item *right;
- Item_field *item_field;
- ib_uint64_t tmp_result;
-
- /*
- a <= b equals to b >= a that's why we just exchange
- "left" and "right" in the case of ">" or ">="
- function
- */
- if (((Item_func*) cond)->functype() ==
- Item_func::LT_FUNC ||
- ((Item_func*) cond)->functype() ==
- Item_func::LE_FUNC)
- {
- left = ((Item_func*) cond)->arguments()[0];
- right = ((Item_func*) cond)->arguments()[1];
- } else {
- left = ((Item_func*) cond)->arguments()[1];
- right = ((Item_func*) cond)->arguments()[0];
- }
- if (!left || !right)
- return;
- if (left->type() != Item::FIELD_ITEM)
- return;
- if (right->type() != Item::INT_ITEM)
- return;
+ if (left->type() == Item::FIELD_ITEM) {
+ item_field = (Item_field *)left;
+ } else if (right->type() == Item::FIELD_ITEM) {
+ item_field = (Item_field *)right;
+ } else {
+ return;
+ }
- item_field = (Item_field*)left;
+ /* Check if the current field belongs to our table */
+ if (table != item_field->field->table) {
+ return;
+ }
- if (/* START_LSN */
- table->field[2] != item_field->field &&
- /* END_LSN */
- table->field[3] != item_field->field)
- {
- return;
- }
+ /* Check if the field is START_LSN or END_LSN */
+ /* END_LSN */
+ is_end_lsn = table->field[3]->eq(item_field->field);
+
+ if (/* START_LSN */ !table->field[2]->eq(item_field->field)
+ && !is_end_lsn) {
+ return;
+ }
+
+ if (left->type() == Item::FIELD_ITEM
+ && right->type() == Item::INT_ITEM) {
- /* Check if the current field belongs to our table */
- if (table != item_field->field->table)
- return;
+ /* The case of start_lsn|end_lsn <|<= const, i.e. the
+ upper bound. */
tmp_result = right->val_int();
- if (tmp_result < *max_lsn)
- *max_lsn = tmp_result;
+ if (((func_type == Item_func::LE_FUNC)
+ || (func_type == Item_func::GE_FUNC))
+ && (tmp_result != IB_ULONGLONG_MAX)) {
- break;
+ tmp_result++;
+ }
+ if (tmp_result < *end_lsn) {
+ *end_lsn = tmp_result;
+ }
+
+ } else if (left->type() == Item::INT_ITEM
+ && right->type() == Item::FIELD_ITEM) {
+
+ /* The case of const <|<= start_lsn|end_lsn, i.e. the
+ lower bound */
+
+ tmp_result = left->val_int();
+ if (is_end_lsn && tmp_result != 0) {
+ tmp_result--;
+ }
+ if (((func_type == Item_func::LT_FUNC)
+ || (func_type == Item_func::GT_FUNC))
+ && (tmp_result != IB_ULONGLONG_MAX)) {
+
+ tmp_result++;
+ }
+ if (tmp_result > *start_lsn) {
+ *start_lsn = tmp_result;
+ }
}
- default:;
- }
+ break;
+ }
+ default:;
+ }
}
/***********************************************************************
@@ -7282,40 +7329,55 @@ i_s_innodb_changed_pages_fill(
TABLE* table = (TABLE *) tables->table;
log_bitmap_iterator_t i;
ib_uint64_t output_rows_num = 0UL;
- ib_uint64_t max_lsn = ~0ULL;
+ ib_uint64_t max_lsn = IB_ULONGLONG_MAX;
+ ib_uint64_t min_lsn = 0ULL;
+
+ DBUG_ENTER("i_s_innodb_changed_pages_fill");
- if (!srv_track_changed_pages)
- return 0;
+ /* deny access to non-superusers */
+ if (check_global_access(thd, PROCESS_ACL)) {
+
+ DBUG_RETURN(0);
+ }
- if (!log_online_bitmap_iterator_init(&i))
- return 1;
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
- if (cond)
- limit_lsn_range_from_condition(table, cond, &max_lsn);
+ if (!srv_track_changed_pages) {
+ DBUG_RETURN(0);
+ }
+
+ if (cond) {
+ limit_lsn_range_from_condition(table, cond, &min_lsn,
+ &max_lsn);
+ }
+
+ if (!log_online_bitmap_iterator_init(&i, min_lsn, max_lsn)) {
+ DBUG_RETURN(1);
+ }
while(log_online_bitmap_iterator_next(&i) &&
(!srv_changed_pages_limit ||
output_rows_num < srv_changed_pages_limit) &&
/*
- There is no need to compare both start LSN and end LSN fields
- with maximum value. It's enough to compare only start LSN.
- Example:
-
- max_lsn = 100
- \\\\\\\\\\\\\\\\\\\\\\\\\|\\\\\\\\ - Query 1
- I------I I-------I I-------------I I----I
- ////////////////// | - Query 2
- 1 2 3 4
-
- Query 1:
- SELECT * FROM INNODB_CHANGED_PAGES WHERE start_lsn < 100
- will select 1,2,3 bitmaps
- Query 2:
- SELECT * FROM INNODB_CHANGED_PAGES WHERE end_lsn < 100
- will select 1,2 bitmaps
-
- The condition start_lsn <= 100 will be false after reading
- 1,2,3 bitmaps which suits for both cases.
+ There is no need to compare both start LSN and end LSN fields
+ with maximum value. It's enough to compare only start LSN.
+ Example:
+
+ max_lsn = 100
+ \\\\\\\\\\\\\\\\\\\\\\\\\|\\\\\\\\ - Query 1
+ I------I I-------I I-------------I I----I
+ ////////////////// | - Query 2
+ 1 2 3 4
+
+ Query 1:
+ SELECT * FROM INNODB_CHANGED_PAGES WHERE start_lsn < 100
+ will select 1,2,3 bitmaps
+ Query 2:
+ SELECT * FROM INNODB_CHANGED_PAGES WHERE end_lsn < 100
+ will select 1,2 bitmaps
+
+ The condition start_lsn <= 100 will be false after reading
+ 1,2,3 bitmaps which suits for both cases.
*/
LOG_BITMAP_ITERATOR_START_LSN(i) <= max_lsn)
{
@@ -7330,10 +7392,10 @@ i_s_innodb_changed_pages_fill(
LOG_BITMAP_ITERATOR_PAGE_NUM(i));
/* START_LSN */
table->field[2]->store(
- LOG_BITMAP_ITERATOR_START_LSN(i));
+ LOG_BITMAP_ITERATOR_START_LSN(i), true);
/* END_LSN */
table->field[3]->store(
- LOG_BITMAP_ITERATOR_END_LSN(i));
+ LOG_BITMAP_ITERATOR_END_LSN(i), true);
/*
I_S tables are in-memory tables. If bitmap file is big enough
@@ -7353,14 +7415,14 @@ i_s_innodb_changed_pages_fill(
if (schema_table_store_record(thd, table))
{
log_online_bitmap_iterator_release(&i);
- return 1;
+ DBUG_RETURN(1);
}
++output_rows_num;
}
log_online_bitmap_iterator_release(&i);
- return 0;
+ DBUG_RETURN(0);
}
static
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.c b/storage/xtradb/ibuf/ibuf0ibuf.c
index 78cb6e20176..77305e42fb1 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.c
+++ b/storage/xtradb/ibuf/ibuf0ibuf.c
@@ -4044,7 +4044,7 @@ updated_in_place:
update)
&& (!page_zip || btr_cur_update_alloc_zip(
page_zip, block, index,
- rec_offs_size(offsets), FALSE, mtr))) {
+ rec_offs_size(offsets), FALSE, mtr, NULL))) {
/* This is the easy case. Do something similar
to btr_cur_update_in_place(). */
row_upd_rec_in_place(rec, index, offsets,
diff --git a/storage/xtradb/include/btr0btr.h b/storage/xtradb/include/btr0btr.h
index 03e89ae3f7d..fb06a774b82 100644
--- a/storage/xtradb/include/btr0btr.h
+++ b/storage/xtradb/include/btr0btr.h
@@ -65,7 +65,10 @@ enum btr_latch_mode {
/** Search the previous record. */
BTR_SEARCH_PREV = 35,
/** Modify the previous record. */
- BTR_MODIFY_PREV = 36
+ BTR_MODIFY_PREV = 36,
+ /** Weaker BTR_MODIFY_TREE that does not lock the leaf page siblings,
+ used for fake changes. */
+ BTR_SEARCH_TREE = 37 /* BTR_MODIFY_TREE | 4 */
};
/* BTR_INSERT, BTR_DELETE and BTR_DELETE_MARK are mutually exclusive. */
diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h
index cbc6103c2ee..cb44129aeb5 100644
--- a/storage/xtradb/include/btr0cur.h
+++ b/storage/xtradb/include/btr0cur.h
@@ -259,8 +259,9 @@ btr_cur_update_alloc_zip(
ulint length, /*!< in: size needed */
ibool create, /*!< in: TRUE=delete-and-insert,
FALSE=update-in-place */
- mtr_t* mtr) /*!< in: mini-transaction */
- __attribute__((nonnull, warn_unused_result));
+ mtr_t* mtr, /*!< in: mini-transaction */
+ trx_t* trx) /*!< in: NULL or transaction */
+ __attribute__((nonnull (1, 2, 3, 6), warn_unused_result));
/*************************************************************//**
Updates a record when the update causes no size changes in its fields.
@return DB_SUCCESS or error number */
diff --git a/storage/xtradb/include/log0online.h b/storage/xtradb/include/log0online.h
index 0e0ca169f6f..e7c3f301e45 100644
--- a/storage/xtradb/include/log0online.h
+++ b/storage/xtradb/include/log0online.h
@@ -27,6 +27,16 @@ Online database log parsing for changed page tracking
#include "univ.i"
#include "os0file.h"
+/** Single bitmap file information */
+typedef struct log_online_bitmap_file_struct log_online_bitmap_file_t;
+
+/** A set of bitmap files containing some LSN range */
+typedef struct log_online_bitmap_file_range_struct
+log_online_bitmap_file_range_t;
+
+/** An iterator over changed page info */
+typedef struct log_bitmap_iterator_struct log_bitmap_iterator_t;
+
/*********************************************************************//**
Initializes the online log following subsytem. */
UNIV_INTERN
@@ -49,45 +59,32 @@ void
log_online_follow_redo_log();
/*=========================*/
-/** The iterator through all bits of changed pages bitmap blocks */
-struct log_bitmap_iterator_struct
-{
- char in_name[FN_REFLEN]; /*!< the file name for bitmap
- input */
- os_file_t in; /*!< the bitmap input file */
- ib_uint64_t in_offset; /*!< the next write position in the
- bitmap output file */
- ib_uint32_t bit_offset; /*!< bit offset inside of bitmap
- block*/
- ib_uint64_t start_lsn; /*!< Start lsn of the block */
- ib_uint64_t end_lsn; /*!< End lsn of the block */
- ib_uint32_t space_id; /*!< Block space id */
- ib_uint32_t first_page_id; /*!< First block page id */
- ibool changed; /*!< true if current page was changed */
- byte* page; /*!< Bitmap block */
-};
-
-typedef struct log_bitmap_iterator_struct log_bitmap_iterator_t;
-
#define LOG_BITMAP_ITERATOR_START_LSN(i) \
- ((i).start_lsn)
+ ((i).start_lsn)
#define LOG_BITMAP_ITERATOR_END_LSN(i) \
- ((i).end_lsn)
+ ((i).end_lsn)
#define LOG_BITMAP_ITERATOR_SPACE_ID(i) \
- ((i).space_id)
+ ((i).space_id)
#define LOG_BITMAP_ITERATOR_PAGE_NUM(i) \
- ((i).first_page_id + (i).bit_offset)
+ ((i).first_page_id + (i).bit_offset)
#define LOG_BITMAP_ITERATOR_PAGE_CHANGED(i) \
- ((i).changed)
+ ((i).changed)
/*********************************************************************//**
-Initializes log bitmap iterator.
+Initializes log bitmap iterator. The minimum LSN is used for finding the
+correct starting file with records and it there may be records returned by
+the iterator that have LSN less than start_lsn.
+
@return TRUE if the iterator is initialized OK, FALSE otherwise. */
UNIV_INTERN
ibool
log_online_bitmap_iterator_init(
/*============================*/
- log_bitmap_iterator_t *i); /*!<in/out: iterator */
+ log_bitmap_iterator_t *i, /*!<in/out: iterator */
+ ib_uint64_t min_lsn, /*!<in: start LSN for the
+ iterator */
+ ib_uint64_t max_lsn); /*!<in: end LSN for the
+ iterator */
/*********************************************************************//**
Releases log bitmap iterator. */
@@ -108,4 +105,57 @@ log_online_bitmap_iterator_next(
/*============================*/
log_bitmap_iterator_t *i); /*!<in/out: iterator */
+/** Struct for single bitmap file information */
+struct log_online_bitmap_file_struct {
+ char name[FN_REFLEN]; /*!< Name with full path */
+ os_file_t file; /*!< Handle to opened file */
+ ib_uint64_t size; /*!< Size of the file */
+ ib_uint64_t offset; /*!< Offset of the next read,
+ or count of already-read bytes
+ */
+};
+
+/** Struct for a set of bitmap files containing some LSN range */
+struct log_online_bitmap_file_range_struct {
+ size_t count; /*!< Number of files */
+ /*!< Dynamically-allocated array of info about individual files */
+ struct {
+ char name[FN_REFLEN]; /*!< Name of a file */
+ ib_uint64_t start_lsn; /*!< Starting LSN of
+ data in this file */
+ ulong seq_num; /*!< Sequence number of
+ this file */
+ } *files;
+};
+
+/** Struct for an iterator through all bits of changed pages bitmap blocks */
+struct log_bitmap_iterator_struct
+{
+ log_online_bitmap_file_range_t in_files; /*!< The bitmap files
+ for this iterator */
+ size_t in_i; /*!< Currently read
+ file index in in_files
+ */
+ log_online_bitmap_file_t in; /*!< Currently read
+ file */
+ ib_uint32_t bit_offset; /*!< bit offset inside
+ the current bitmap
+ block */
+ ib_uint64_t start_lsn; /*!< Start LSN of the
+ current bitmap block */
+ ib_uint64_t end_lsn; /*!< End LSN of the
+ current bitmap block */
+ ib_uint32_t space_id; /*!< Current block
+ space id */
+ ib_uint32_t first_page_id; /*!< Id of the first
+ page in the current
+ block */
+ ibool last_page_in_run;/*!< "Last page in
+ run" flag value for the
+ current block */
+ ibool changed; /*!< true if current
+ page was changed */
+ byte* page; /*!< Bitmap block */
+};
+
#endif
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index a95eb8a1d58..6c5b61487f2 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -144,7 +144,8 @@ extern char* srv_doublewrite_file;
extern ibool srv_recovery_stats;
-extern my_bool srv_track_changed_pages;
+extern my_bool srv_track_changed_pages;
+extern ib_uint64_t srv_max_bitmap_file_size;
extern
ulonglong srv_changed_pages_limit;
@@ -395,6 +396,10 @@ extern uint srv_auto_lru_dump;
/** Whether startup should be blocked until buffer pool is fully restored */
extern ibool srv_blocking_lru_restore;
+/** When TRUE, fake change transcations take S rather than X row locks.
+When FALSE, row locks are not taken at all. */
+extern my_bool srv_fake_changes_locks;
+
/** Status variables to be passed to MySQL */
typedef struct export_var_struct export_struc;
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 5d2cd2d0313..77acf54d8dc 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -54,7 +54,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_BUGFIX 8
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 29.1
+#define PERCONA_INNODB_VERSION 29.3
#endif
/* The following is the InnoDB version as shown in
diff --git a/storage/xtradb/include/ut0ut.h b/storage/xtradb/include/ut0ut.h
index 47ab6eb9b74..48f30b33e65 100644
--- a/storage/xtradb/include/ut0ut.h
+++ b/storage/xtradb/include/ut0ut.h
@@ -122,6 +122,15 @@ ut_max(
/*===*/
ulint n1, /*!< in: first number */
ulint n2); /*!< in: second number */
+/******************************************************//**
+Calculates the maximum of two ib_uint64_t values.
+@return the maximum */
+UNIV_INLINE
+ib_uint64_t
+ut_max_uint64(
+/*==========*/
+ ib_uint64_t n1, /*!< in: first number */
+ ib_uint64_t n2); /*!< in: second number */
/****************************************************************//**
Calculates minimum of two ulint-pairs. */
UNIV_INLINE
diff --git a/storage/xtradb/include/ut0ut.ic b/storage/xtradb/include/ut0ut.ic
index 6f55c7e410e..d56deb6266f 100644
--- a/storage/xtradb/include/ut0ut.ic
+++ b/storage/xtradb/include/ut0ut.ic
@@ -49,6 +49,19 @@ ut_max(
return((n1 <= n2) ? n2 : n1);
}
+/******************************************************//**
+Calculates the maximum of two ib_uint64_t values.
+@return the maximum */
+UNIV_INLINE
+ib_uint64_t
+ut_max_uint64(
+/*==========*/
+ ib_uint64_t n1, /*!< in: first number */
+ ib_uint64_t n2) /*!< in: second number */
+{
+ return((n1 <= n2) ? n2 : n1);
+}
+
/****************************************************************//**
Calculates minimum of two ulint-pairs. */
UNIV_INLINE
diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c
index 414d3ae2c49..f172ad6695b 100644
--- a/storage/xtradb/lock/lock0lock.c
+++ b/storage/xtradb/lock/lock0lock.c
@@ -5481,8 +5481,13 @@ lock_sec_rec_read_check_and_lock(
return(DB_SUCCESS);
}
- if (thr && thr_get_trx(thr)->fake_changes && mode == LOCK_X) {
- mode = LOCK_S;
+ if (UNIV_UNLIKELY((thr && thr_get_trx(thr)->fake_changes))) {
+ if (!srv_fake_changes_locks) {
+ return(DB_SUCCESS);
+ }
+ if (mode == LOCK_X) {
+ mode = LOCK_S;
+ }
}
heap_no = page_rec_get_heap_no(rec);
@@ -5561,8 +5566,13 @@ lock_clust_rec_read_check_and_lock(
return(DB_SUCCESS);
}
- if (thr && thr_get_trx(thr)->fake_changes && mode == LOCK_X) {
- mode = LOCK_S;
+ if (UNIV_UNLIKELY((thr && thr_get_trx(thr)->fake_changes))) {
+ if (!srv_fake_changes_locks) {
+ return(DB_SUCCESS);
+ }
+ if (mode == LOCK_X) {
+ mode = LOCK_S;
+ }
}
heap_no = page_rec_get_heap_no(rec);
diff --git a/storage/xtradb/log/log0log.c b/storage/xtradb/log/log0log.c
index f2066b49662..e7c7a165b9c 100644
--- a/storage/xtradb/log/log0log.c
+++ b/storage/xtradb/log/log0log.c
@@ -248,7 +248,7 @@ log_check_tracking_margin(
checked for the already-written log. */
{
ib_uint64_t tracked_lsn;
- ulint tracked_lsn_age;
+ ib_uint64_t tracked_lsn_age;
if (!srv_track_changed_pages) {
return FALSE;
@@ -460,7 +460,7 @@ log_close(void)
ib_uint64_t oldest_lsn;
ib_uint64_t lsn;
ib_uint64_t tracked_lsn;
- ulint tracked_lsn_age;
+ ib_uint64_t tracked_lsn_age;
log_t* log = log_sys;
ib_uint64_t checkpoint_age;
diff --git a/storage/xtradb/log/log0online.c b/storage/xtradb/log/log0online.c
index 1d478c467e6..55eb9d17c46 100644
--- a/storage/xtradb/log/log0online.c
+++ b/storage/xtradb/log/log0online.c
@@ -48,10 +48,8 @@ struct log_bitmap_struct {
parsed, it points to the start,
otherwise points immediatelly past the
end of the incomplete log record. */
- char* out_name; /*!< the file name for bitmap output */
- os_file_t out; /*!< the bitmap output file */
- ib_uint64_t out_offset; /*!< the next write position in the
- bitmap output file */
+ log_online_bitmap_file_t out; /*!< The current bitmap file */
+ ulint out_seq_num; /*!< the bitmap file sequence number */
ib_uint64_t start_lsn; /*!< the LSN of the next unparsed
record and the start of the next LSN
interval to be parsed. */
@@ -76,8 +74,13 @@ struct log_bitmap_struct {
/* The log parsing and bitmap output struct instance */
static struct log_bitmap_struct* log_bmp_sys;
-/* File name stem for modified page bitmaps */
-static const char* modified_page_stem = "ib_modified_log.";
+/** File name stem for bitmap files. */
+static const char* bmp_file_name_stem = "ib_modified_log_";
+
+/** File name template for bitmap files. The 1st format tag is a directory
+name, the 2nd tag is the stem, the 3rd tag is a file sequence number, the 4th
+tag is the start LSN for the file. */
+static const char* bmp_file_name_template = "%s%s%lu_%llu.xdb";
/* On server startup with empty database srv_start_lsn == 0, in
which case the first LSN of actual log records will be this. */
@@ -85,7 +88,7 @@ which case the first LSN of actual log records will be this. */
/* Tests if num bit of bitmap is set */
#define IS_BIT_SET(bitmap, num) \
- (*((bitmap) + ((num) >> 3)) & (1UL << ((num) & 7UL)))
+ (*((bitmap) + ((num) >> 3)) & (1UL << ((num) & 7UL)))
/** The bitmap file block size in bytes. All writes will be multiples of this.
*/
@@ -243,10 +246,69 @@ log_online_calc_checksum(
}
/****************************************************************//**
+Read one bitmap data page and check it for corruption.
+
+@return TRUE if page read OK, FALSE if I/O error */
+static
+ibool
+log_online_read_bitmap_page(
+/*========================*/
+ log_online_bitmap_file_t *bitmap_file, /*!<in/out: bitmap
+ file */
+ byte *page, /*!<out: read page.
+ Must be at least
+ MODIFIED_PAGE_BLOCK_SIZE
+ bytes long */
+ ibool *checksum_ok) /*!<out: TRUE if page
+ checksum OK */
+{
+ ulint offset_low = (ulint)(bitmap_file->offset & 0xFFFFFFFF);
+ ulint offset_high = (ulint)(bitmap_file->offset >> 32);
+ ulint checksum;
+ ulint actual_checksum;
+ ibool success;
+
+ ut_a(bitmap_file->size >= MODIFIED_PAGE_BLOCK_SIZE);
+ ut_a(bitmap_file->offset
+ <= bitmap_file->size - MODIFIED_PAGE_BLOCK_SIZE);
+ ut_a(bitmap_file->offset % MODIFIED_PAGE_BLOCK_SIZE == 0);
+
+ success = os_file_read(bitmap_file->file, page, offset_low,
+ offset_high, MODIFIED_PAGE_BLOCK_SIZE);
+
+ if (UNIV_UNLIKELY(!success)) {
+
+ /* The following call prints an error message */
+ os_file_get_last_error(TRUE);
+ fprintf(stderr,
+ "InnoDB: Warning: failed reading changed page bitmap "
+ "file \'%s\'\n", bitmap_file->name);
+ return FALSE;
+ }
+
+ bitmap_file->offset += MODIFIED_PAGE_BLOCK_SIZE;
+ ut_ad(bitmap_file->offset <= bitmap_file->size);
+
+ checksum = mach_read_from_4(page + MODIFIED_PAGE_BLOCK_CHECKSUM);
+ actual_checksum = log_online_calc_checksum(page);
+ *checksum_ok = (checksum == actual_checksum);
+
+ return TRUE;
+}
+
+/****************************************************************//**
Get the last tracked fully LSN from the bitmap file by reading
backwards untile a correct end page is found. Detects incomplete
writes and corrupted data. Sets the start output position for the
written bitmap data.
+
+Multiple bitmap files are handled using the following assumptions:
+1) Only the last file might be corrupted. In case where no good data was found
+in the last file, assume that the next to last file is OK. This assumption
+does not limit crash recovery capability in any way.
+2) If the whole of the last file was corrupted, assume that the start LSN in
+its name is correct and use it for (re-)tracking start.
+
@return the last fully tracked LSN */
static
ib_uint64_t
@@ -254,73 +316,46 @@ log_online_read_last_tracked_lsn()
/*==============================*/
{
byte page[MODIFIED_PAGE_BLOCK_SIZE];
- ib_uint64_t read_offset = log_bmp_sys->out_offset;
- /* Initialize these to nonequal values so that file size == 0 case with
- zero loop repetitions is handled correctly */
- ulint checksum = 0;
- ulint actual_checksum = !checksum;
ibool is_last_page = FALSE;
+ ibool checksum_ok = FALSE;
ib_uint64_t result;
+ ib_uint64_t read_offset = log_bmp_sys->out.offset;
- ut_ad(log_bmp_sys->out_offset % MODIFIED_PAGE_BLOCK_SIZE == 0);
-
- while (checksum != actual_checksum && read_offset > 0 && !is_last_page)
+ while (!checksum_ok && read_offset > 0 && !is_last_page)
{
-
- ulint offset_low, offset_high;
- ibool success;
-
read_offset -= MODIFIED_PAGE_BLOCK_SIZE;
- offset_high = (ulint)(read_offset >> 32);
- offset_low = (ulint)(read_offset & 0xFFFFFFFF);
-
- success = os_file_read(log_bmp_sys->out, page, offset_low,
- offset_high, MODIFIED_PAGE_BLOCK_SIZE);
- if (!success) {
+ log_bmp_sys->out.offset = read_offset;
- /* The following call prints an error message */
- os_file_get_last_error(TRUE);
- /* Here and below assume that bitmap file names do not
- contain apostrophes, thus no need for
- ut_print_filename(). */
- fprintf(stderr, "InnoDB: Warning: failed reading "
- "changed page bitmap file \'%s\'\n",
- log_bmp_sys->out_name);
- return MIN_TRACKED_LSN;
+ if (!log_online_read_bitmap_page(&log_bmp_sys->out, page,
+ &checksum_ok)) {
+ checksum_ok = FALSE;
+ result = 0;
+ break;
}
- is_last_page
- = mach_read_from_4(page + MODIFIED_PAGE_IS_LAST_BLOCK);
- checksum = mach_read_from_4(page
- + MODIFIED_PAGE_BLOCK_CHECKSUM);
- actual_checksum = log_online_calc_checksum(page);
- if (checksum != actual_checksum) {
+ if (checksum_ok) {
+ is_last_page
+ = mach_read_from_4
+ (page + MODIFIED_PAGE_IS_LAST_BLOCK);
+ } else {
- fprintf(stderr, "InnoDB: Warning: corruption "
- "detected in \'%s\' at offset %llu\n",
- log_bmp_sys->out_name, read_offset);
+ fprintf(stderr,
+ "InnoDB: Warning: corruption detected in "
+ "\'%s\' at offset %llu\n",
+ log_bmp_sys->out.name, read_offset);
}
-
};
- if (UNIV_LIKELY(checksum == actual_checksum && is_last_page)) {
-
- log_bmp_sys->out_offset = read_offset
- + MODIFIED_PAGE_BLOCK_SIZE;
- result = mach_read_from_8(page + MODIFIED_PAGE_END_LSN);
- }
- else {
- log_bmp_sys->out_offset = read_offset;
- result = 0;
- }
+ result = (checksum_ok && is_last_page)
+ ? mach_read_from_8(page + MODIFIED_PAGE_END_LSN) : 0;
/* Truncate the output file to discard the corrupted bitmap data, if
any */
- if (!os_file_set_eof_at(log_bmp_sys->out,
- log_bmp_sys->out_offset)) {
+ if (!os_file_set_eof_at(log_bmp_sys->out.file,
+ log_bmp_sys->out.offset)) {
fprintf(stderr, "InnoDB: Warning: failed truncating "
"changed page bitmap file \'%s\' to %llu bytes\n",
- log_bmp_sys->out_name, log_bmp_sys->out_offset);
+ log_bmp_sys->out.name, log_bmp_sys->out.offset);
result = 0;
}
return result;
@@ -350,6 +385,37 @@ log_set_tracked_lsn(
#endif
}
+/*********************************************************************//**
+Check if missing, if any, LSN interval can be read and tracked using the
+current LSN value, the LSN value where the tracking stopped, and the log group
+capacity.
+
+@return TRUE if the missing interval can be tracked or if there's no missing
+data. */
+static
+ibool
+log_online_can_track_missing(
+/*=========================*/
+ ib_uint64_t last_tracked_lsn, /*!<in: last tracked LSN */
+ ib_uint64_t tracking_start_lsn) /*!<in: current LSN */
+{
+ /* last_tracked_lsn might be < MIN_TRACKED_LSN in the case of empty
+ bitmap file, handle this too. */
+ last_tracked_lsn = ut_max_uint64(last_tracked_lsn, MIN_TRACKED_LSN);
+
+ 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");
+ exit(1);
+ }
+
+ return (last_tracked_lsn == tracking_start_lsn)
+ || (log_sys->lsn - last_tracked_lsn
+ <= log_sys->log_group_capacity);
+}
+
+
/****************************************************************//**
Diagnose a gap in tracked LSN range on server startup due to crash or
very fast shutdown and try to close it by tracking the data
@@ -365,22 +431,20 @@ log_online_track_missing_on_startup(
{
ut_ad(last_tracked_lsn != tracking_start_lsn);
- fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' is %llu, but "
- "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);
-
- /* last_tracked_lsn might be < MIN_TRACKED_LSN in the case of empty
- bitmap file, handle this too. */
- last_tracked_lsn = ut_max(last_tracked_lsn, MIN_TRACKED_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);
/* See if we can fully recover the missing interval */
- if (log_sys->lsn - last_tracked_lsn < log_sys->log_group_capacity) {
+ if (log_online_can_track_missing(last_tracked_lsn,
+ tracking_start_lsn)) {
fprintf(stderr,
"Reading the log to advance the last tracked LSN.\n");
- log_bmp_sys->start_lsn = last_tracked_lsn;
+ 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();
ut_ad(log_bmp_sys->end_lsn >= tracking_start_lsn);
@@ -406,16 +470,101 @@ log_online_track_missing_on_startup(
}
/*********************************************************************//**
+Format a bitmap output file name to log_bmp_sys->out.name. */
+static
+void
+log_online_make_bitmap_name(
+/*=========================*/
+ ib_uint64_t start_lsn) /*!< in: the start LSN name part */
+{
+ ut_snprintf(log_bmp_sys->out.name, FN_REFLEN, bmp_file_name_template,
+ srv_data_home, bmp_file_name_stem,
+ log_bmp_sys->out_seq_num, start_lsn);
+
+}
+
+/*********************************************************************//**
+Create a new empty bitmap output file. */
+static
+void
+log_online_start_bitmap_file()
+/*==========================*/
+{
+ ibool success;
+
+ 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);
+ if (UNIV_UNLIKELY(!success)) {
+
+ /* The following call prints an error message */
+ os_file_get_last_error(TRUE);
+ fprintf(stderr,
+ "InnoDB: Error: Cannot create \'%s\'\n",
+ log_bmp_sys->out.name);
+ exit(1);
+ }
+
+ log_bmp_sys->out.offset = 0;
+}
+
+/*********************************************************************//**
+Close the current bitmap output file and create the next one. */
+static
+void
+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);
+ log_bmp_sys->out_seq_num++;
+ log_online_make_bitmap_name(next_file_start_lsn);
+ log_online_start_bitmap_file();
+}
+
+/*********************************************************************//**
+Check the name of a given file if it's a changed page bitmap file and
+return file sequence and start LSN name components if it is. If is not,
+the values of output parameters are undefined.
+
+@return TRUE if a given file is a changed page bitmap file. */
+static
+ibool
+log_online_is_bitmap_file(
+/*======================*/
+ const os_file_stat_t* file_info, /*!<in: file to
+ check */
+ ulong* bitmap_file_seq_num, /*!<out: bitmap file
+ sequence number */
+ ib_uint64_t* bitmap_file_start_lsn) /*!<out: bitmap file
+ start LSN */
+{
+ char stem[FN_REFLEN];
+
+ ut_ad (strlen(file_info->name) < OS_FILE_MAX_PATH);
+
+ return ((file_info->type == OS_FILE_TYPE_FILE
+ || file_info->type == OS_FILE_TYPE_LINK)
+ && (sscanf(file_info->name, "%[a-z_]%lu_%llu.xdb", stem,
+ bitmap_file_seq_num, bitmap_file_start_lsn) == 3)
+ && (!strcmp(stem, bmp_file_name_stem)));
+}
+
+/*********************************************************************//**
Initialize the online log following subsytem. */
UNIV_INTERN
void
log_online_read_init()
/*==================*/
{
- char buf[FN_REFLEN];
ibool success;
ib_uint64_t tracking_start_lsn
- = ut_max(log_sys->last_checkpoint_lsn, MIN_TRACKED_LSN);
+ = ut_max_uint64(log_sys->last_checkpoint_lsn, MIN_TRACKED_LSN);
+ os_file_dir_t bitmap_dir;
+ 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 */
@@ -424,82 +573,120 @@ log_online_read_init()
log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys));
- ut_snprintf(buf, FN_REFLEN, "%s%s%d", srv_data_home,
- modified_page_stem, 1);
- log_bmp_sys->out_name = ut_malloc(strlen(buf) + 1);
- ut_strcpy(log_bmp_sys->out_name, buf);
+ /* 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. */
+ log_bmp_sys->out.name[0] = '\0';
+ log_bmp_sys->out_seq_num = 0;
+
+ bitmap_dir = os_file_opendir(srv_data_home, TRUE);
+ ut_a(bitmap_dir);
+ while (!os_file_readdir_next_file(srv_data_home, bitmap_dir,
+ &bitmap_dir_file_info)) {
+
+ ulong file_seq_num;
+ ib_uint64_t file_start_lsn;
+
+ if (!log_online_is_bitmap_file(&bitmap_dir_file_info,
+ &file_seq_num,
+ &file_start_lsn)) {
+ continue;
+ }
+
+ if (file_seq_num > log_bmp_sys->out_seq_num
+ && bitmap_dir_file_info.size > 0) {
+ log_bmp_sys->out_seq_num = file_seq_num;
+ last_file_start_lsn = file_start_lsn;
+ /* No dir component (srv_data_home) here, because
+ that's the cwd */
+ strncpy(log_bmp_sys->out.name,
+ bitmap_dir_file_info.name, FN_REFLEN - 1);
+ log_bmp_sys->out.name[FN_REFLEN - 1] = '\0';
+ }
+ }
+
+ if (os_file_closedir(bitmap_dir)) {
+ os_file_get_last_error(TRUE);
+ fprintf(stderr, "InnoDB: Error: cannot close \'%s\'\n",
+ srv_data_home);
+ exit(1);
+ }
+
+ if (!log_bmp_sys->out_seq_num) {
+ log_bmp_sys->out_seq_num = 1;
+ log_online_make_bitmap_name(0);
+ }
log_bmp_sys->modified_pages = rbt_create(MODIFIED_PAGE_BLOCK_SIZE,
log_online_compare_bmp_keys);
log_bmp_sys->page_free_list = NULL;
- log_bmp_sys->out
+ log_bmp_sys->out.file
= os_file_create_simple_no_error_handling
- (innodb_file_bmp_key, log_bmp_sys->out_name, OS_FILE_OPEN,
+ (innodb_file_bmp_key, log_bmp_sys->out.name, OS_FILE_OPEN,
OS_FILE_READ_WRITE, &success);
if (!success) {
/* New file, tracking from scratch */
- log_bmp_sys->out
- = 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 (!success) {
-
- /* The following call prints an error message */
- os_file_get_last_error(TRUE);
- fprintf(stderr,
- "InnoDB: Error: Cannot create \'%s\'\n",
- log_bmp_sys->out_name);
- exit(1);
- }
-
- log_bmp_sys->out_offset = 0;
+ log_online_start_bitmap_file();
}
else {
- /* Old file, read last tracked LSN and continue from there */
+ /* Read the last tracked LSN from the last file */
ulint size_low;
ulint size_high;
ib_uint64_t last_tracked_lsn;
- success = os_file_get_size(log_bmp_sys->out, &size_low,
+ success = os_file_get_size(log_bmp_sys->out.file, &size_low,
&size_high);
ut_a(success);
- log_bmp_sys->out_offset
+ log_bmp_sys->out.size
= ((ib_uint64_t)size_high << 32) | size_low;
+ log_bmp_sys->out.offset = log_bmp_sys->out.size;
- if (log_bmp_sys->out_offset % MODIFIED_PAGE_BLOCK_SIZE != 0) {
+ if (log_bmp_sys->out.offset % MODIFIED_PAGE_BLOCK_SIZE != 0) {
fprintf(stderr,
"InnoDB: Warning: truncated block detected "
"in \'%s\' at offset %llu\n",
- log_bmp_sys->out_name,
- log_bmp_sys->out_offset);
- log_bmp_sys->out_offset -=
- log_bmp_sys->out_offset
+ log_bmp_sys->out.name,
+ log_bmp_sys->out.offset);
+ log_bmp_sys->out.offset -=
+ log_bmp_sys->out.offset
% MODIFIED_PAGE_BLOCK_SIZE;
}
last_tracked_lsn = log_online_read_last_tracked_lsn();
+ if (!last_tracked_lsn) {
+ last_tracked_lsn = last_file_start_lsn;
+ }
+
+ /* Start a new file. Choose the LSN value in its name based on
+ 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);
+ }
+ else {
+ log_online_rotate_bitmap_file(tracking_start_lsn);
+ }
if (last_tracked_lsn < tracking_start_lsn) {
- log_online_track_missing_on_startup(last_tracked_lsn,
- tracking_start_lsn);
+ log_online_track_missing_on_startup
+ (last_tracked_lsn, tracking_start_lsn);
return;
}
if (last_tracked_lsn > tracking_start_lsn) {
- fprintf(stderr, "InnoDB: last tracked LSN in \'%s\' "
- "is %llu, but last checkpoint LSN is %llu. "
+ fprintf(stderr, "InnoDB: last tracked LSN is %llu, "
+ "but last the checkpoint LSN is %llu. "
"The tracking-based incremental backups will "
"work only from the latter LSN!\n",
- log_bmp_sys->out_name, last_tracked_lsn,
- tracking_start_lsn);
+ last_tracked_lsn, tracking_start_lsn);
}
}
@@ -519,7 +706,7 @@ log_online_read_shutdown()
{
ib_rbt_node_t *free_list_node = log_bmp_sys->page_free_list;
- os_file_close(log_bmp_sys->out);
+ os_file_close(log_bmp_sys->out.file);
rbt_free(log_bmp_sys->modified_pages);
@@ -529,7 +716,6 @@ log_online_read_shutdown()
free_list_node = next;
}
- ut_free(log_bmp_sys->out_name);
ut_free(log_bmp_sys);
}
@@ -746,8 +932,8 @@ log_online_follow_log_seg(
/* The next parse LSN is inside the current block, skip
data preceding it. */
skip_already_parsed_len
- = log_bmp_sys->next_parse_lsn
- - block_start_lsn;
+ = (ulint)(log_bmp_sys->next_parse_lsn
+ - block_start_lsn);
}
else {
@@ -819,32 +1005,32 @@ log_online_write_bitmap_page(
{
ibool success;
- success = os_file_write(log_bmp_sys->out_name,log_bmp_sys->out,
+ 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 & 0xFFFFFFFF),
+ (ulint)(log_bmp_sys->out.offset << 32),
MODIFIED_PAGE_BLOCK_SIZE);
if (UNIV_UNLIKELY(!success)) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
fprintf(stderr, "InnoDB: Error: failed writing changed page "
- "bitmap file \'%s\'\n", log_bmp_sys->out_name);
+ "bitmap file \'%s\'\n", log_bmp_sys->out.name);
return;
}
- success = os_file_flush(log_bmp_sys->out, FALSE);
+ success = os_file_flush(log_bmp_sys->out.file, FALSE);
if (UNIV_UNLIKELY(!success)) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
fprintf(stderr, "InnoDB: Error: failed flushing "
"changed page bitmap file \'%s\'\n",
- log_bmp_sys->out_name);
+ log_bmp_sys->out.name);
return;
}
- log_bmp_sys->out_offset += MODIFIED_PAGE_BLOCK_SIZE;
+ log_bmp_sys->out.offset += MODIFIED_PAGE_BLOCK_SIZE;
}
/*********************************************************************//**
@@ -858,6 +1044,10 @@ log_online_write_bitmap()
ib_rbt_node_t *bmp_tree_node;
const ib_rbt_node_t *last_bmp_tree_node;
+ if (log_bmp_sys->out.offset >= srv_max_bitmap_file_size) {
+ log_online_rotate_bitmap_file(log_bmp_sys->start_lsn);
+ }
+
bmp_tree_node = (ib_rbt_node_t *)
rbt_first(log_bmp_sys->modified_pages);
last_bmp_tree_node = rbt_last(log_bmp_sys->modified_pages);
@@ -930,47 +1120,306 @@ log_online_follow_redo_log()
}
/*********************************************************************//**
-Initializes log bitmap iterator.
+List the bitmap files in srv_data_home and setup their range that contains the
+specified LSN interval. This range, if non-empty, will start with a file that
+has the greatest LSN equal to or less than the start LSN and will include all
+the files up to the one with the greatest LSN less than the end LSN. Caller
+must free bitmap_files->files when done if bitmap_files set to non-NULL and
+this function returned TRUE. Field bitmap_files->count might be set to a
+larger value than the actual count of the files, and space for the unused array
+slots will be allocated but cleared to zeroes.
+
+@return TRUE if succeeded
+*/
+static
+ibool
+log_online_setup_bitmap_file_range(
+/*===============================*/
+ log_online_bitmap_file_range_t *bitmap_files, /*!<in/out: bitmap file
+ range */
+ ib_uint64_t range_start, /*!<in: start LSN */
+ ib_uint64_t range_end) /*!<in: end LSN */
+{
+ os_file_dir_t bitmap_dir;
+ os_file_stat_t bitmap_dir_file_info;
+ ulong first_file_seq_num = ULONG_MAX;
+ ib_uint64_t first_file_start_lsn = IB_ULONGLONG_MAX;
+
+ bitmap_files->count = 0;
+ bitmap_files->files = NULL;
+
+ /* 1st pass: size the info array */
+
+ bitmap_dir = os_file_opendir(srv_data_home, FALSE);
+ if (!bitmap_dir) {
+ fprintf(stderr,
+ "InnoDB: Error: "
+ "failed to open bitmap directory \'%s\'\n",
+ srv_data_home);
+ return FALSE;
+ }
+
+ while (!os_file_readdir_next_file(srv_data_home, bitmap_dir,
+ &bitmap_dir_file_info)) {
+
+ ulong file_seq_num;
+ ib_uint64_t file_start_lsn;
+
+ if (!log_online_is_bitmap_file(&bitmap_dir_file_info,
+ &file_seq_num,
+ &file_start_lsn)
+ || file_start_lsn >= range_end) {
+
+ continue;
+ }
+
+ if (file_start_lsn >= range_start
+ || file_start_lsn == first_file_start_lsn
+ || first_file_start_lsn > range_start) {
+
+ /* A file that falls into the range */
+ bitmap_files->count++;
+ if (file_start_lsn < first_file_start_lsn) {
+
+ first_file_start_lsn = file_start_lsn;
+ }
+ if (file_seq_num < first_file_seq_num) {
+
+ first_file_seq_num = file_seq_num;
+ }
+ } else if (file_start_lsn > first_file_start_lsn) {
+
+ /* A file that has LSN closer to the range start
+ but smaller than it, replacing another such file */
+ first_file_start_lsn = file_start_lsn;
+ first_file_seq_num = file_seq_num;
+ }
+ }
+
+ ut_a(first_file_seq_num != ULONG_MAX || bitmap_files->count == 0);
+
+ if (os_file_closedir(bitmap_dir)) {
+ os_file_get_last_error(TRUE);
+ fprintf(stderr, "InnoDB: Error: cannot close \'%s\'\n",
+ srv_data_home);
+ return FALSE;
+ }
+
+ if (!bitmap_files->count) {
+ return TRUE;
+ }
+
+ /* 2nd pass: get the file names in the file_seq_num order */
+
+ bitmap_dir = os_file_opendir(srv_data_home, FALSE);
+ if (!bitmap_dir) {
+ fprintf(stderr, "InnoDB: Error: "
+ "failed to open bitmap directory \'%s\'\n",
+ srv_data_home);
+ return FALSE;
+ }
+
+ bitmap_files->files = ut_malloc(bitmap_files->count
+ * sizeof(bitmap_files->files[0]));
+ memset(bitmap_files->files, 0,
+ bitmap_files->count * sizeof(bitmap_files->files[0]));
+
+ while (!os_file_readdir_next_file(srv_data_home, bitmap_dir,
+ &bitmap_dir_file_info)) {
+
+ ulong file_seq_num;
+ ib_uint64_t file_start_lsn;
+ size_t array_pos;
+
+ if (!log_online_is_bitmap_file(&bitmap_dir_file_info,
+ &file_seq_num,
+ &file_start_lsn)
+ || file_start_lsn >= range_end
+ || file_start_lsn < first_file_start_lsn) {
+ continue;
+ }
+
+ array_pos = file_seq_num - first_file_seq_num;
+ if (file_seq_num > bitmap_files->files[array_pos].seq_num) {
+ bitmap_files->files[array_pos].seq_num = file_seq_num;
+ strncpy(bitmap_files->files[array_pos].name,
+ bitmap_dir_file_info.name, FN_REFLEN);
+ bitmap_files->files[array_pos].name[FN_REFLEN - 1]
+ = '\0';
+ bitmap_files->files[array_pos].start_lsn
+ = file_start_lsn;
+ }
+ }
+
+ if (os_file_closedir(bitmap_dir)) {
+ os_file_get_last_error(TRUE);
+ fprintf(stderr, "InnoDB: Error: cannot close \'%s\'\n",
+ srv_data_home);
+ free(bitmap_files->files);
+ return FALSE;
+ }
+
+#ifdef UNIV_DEBUG
+ ut_ad(bitmap_files->files[0].seq_num == first_file_seq_num);
+ ut_ad(bitmap_files->files[0].start_lsn == first_file_start_lsn);
+ {
+ size_t i;
+ for (i = 1; i < bitmap_files->count; i++) {
+ if (!bitmap_files->files[i].seq_num) {
+ break;
+ }
+ ut_ad(bitmap_files->files[i].seq_num
+ > bitmap_files->files[i - 1].seq_num);
+ ut_ad(bitmap_files->files[i].start_lsn
+ >= bitmap_files->files[i - 1].start_lsn);
+ }
+ }
+#endif
+
+ return TRUE;
+}
+
+/****************************************************************//**
+Open a bitmap file for reading.
+
+@return TRUE if opened successfully */
+static
+ibool
+log_online_open_bitmap_file_read_only(
+/*==================================*/
+ const char* name, /*!<in: bitmap file
+ name without directory,
+ which is assumed to be
+ srv_data_home */
+ log_online_bitmap_file_t* bitmap_file) /*!<out: opened bitmap
+ file */
+{
+ ibool success = FALSE;
+ ulint size_low;
+ ulint size_high;
+
+ ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name);
+ bitmap_file->file
+ = os_file_create_simple_no_error_handling(innodb_file_bmp_key,
+ bitmap_file->name,
+ OS_FILE_OPEN,
+ OS_FILE_READ_ONLY,
+ &success);
+ if (!success) {
+ /* Here and below assume that bitmap file names do not
+ contain apostrophes, thus no need for ut_print_filename(). */
+ fprintf(stderr,
+ "InnoDB: Warning: error opening the changed page "
+ "bitmap \'%s\'\n", bitmap_file->name);
+ return FALSE;
+ }
+
+ success = os_file_get_size(bitmap_file->file, &size_low, &size_high);
+ bitmap_file->size = (((ib_uint64_t)size_high) << 32) | size_low;
+ bitmap_file->offset = 0;
+
+#ifdef UNIV_LINUX
+ posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_SEQUENTIAL);
+ posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_NOREUSE);
+#endif
+
+ return TRUE;
+}
+
+/****************************************************************//**
+Diagnose one or both of the following situations if we read close to
+the end of bitmap file:
+1) Warn if the remainder of the file is less than one page.
+2) Error if we cannot read any more full pages but the last read page
+did not have the last-in-run flag set.
+
+@return FALSE for the error */
+static
+ibool
+log_online_diagnose_bitmap_eof(
+/*===========================*/
+ const log_online_bitmap_file_t* bitmap_file, /*!< in: bitmap file */
+ ibool last_page_in_run)/*!< in: "last page in
+ run" flag value in the
+ last read page */
+{
+ /* Check if we are too close to EOF to read a full page */
+ if ((bitmap_file->size < MODIFIED_PAGE_BLOCK_SIZE)
+ || (bitmap_file->offset
+ > bitmap_file->size - MODIFIED_PAGE_BLOCK_SIZE)) {
+
+ if (bitmap_file->offset != bitmap_file->size) {
+ /* If we are not at EOF and we have less than one page
+ to read, it's junk. This error is not fatal in
+ itself. */
+
+ fprintf(stderr,
+ "InnoDB: Warning: junk at the end of changed "
+ "page bitmap file \'%s\'.\n",
+ bitmap_file->name);
+ }
+
+ if (!last_page_in_run) {
+ /* We are at EOF but the last read page did not finish
+ a run */
+ /* It's a "Warning" here because it's not a fatal error
+ for the whole server */
+ fprintf(stderr,
+ "InnoDB: Warning: changed page bitmap "
+ "file \'%s\' does not contain a complete run "
+ "at the end.\n", bitmap_file->name);
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+/*********************************************************************//**
+Initialize the log bitmap iterator for a given range. The records are
+processed at a bitmap block granularity, i.e. all the records in the same block
+share the same start and end LSN values, the exact LSN of each record is
+unavailable (nor is it defined for blocks that are touched more than once in
+the LSN interval contained in the block). Thus min_lsn and max_lsn should be
+set at block boundaries or bigger, otherwise the records at the 1st and the
+last blocks will not be returned. Also note that there might be returned
+records with LSN < min_lsn, as min_lsn is used to select the correct starting
+file but not block.
+
@return TRUE if the iterator is initialized OK, FALSE otherwise. */
UNIV_INTERN
ibool
log_online_bitmap_iterator_init(
/*============================*/
- log_bitmap_iterator_t *i) /*!<in/out: iterator */
+ log_bitmap_iterator_t *i, /*!<in/out: iterator */
+ ib_uint64_t min_lsn,/*!< in: start LSN */
+ ib_uint64_t max_lsn)/*!< in: end LSN */
{
- ibool success;
-
ut_a(i);
- ut_snprintf(i->in_name, FN_REFLEN, "%s%s%d", srv_data_home,
- modified_page_stem, 1);
- i->in_offset = 0;
- /*
- Set up bit offset out of the reasonable limit
- to intiate reading block from file in
- log_online_bitmap_iterator_next()
- */
- i->bit_offset = MODIFIED_PAGE_BLOCK_BITMAP_LEN;
- i->in =
- os_file_create_simple_no_error_handling(innodb_file_bmp_key,
- i->in_name,
- OS_FILE_OPEN,
- OS_FILE_READ_ONLY,
- &success);
- if (!success) {
- /* The following call prints an error message */
- os_file_get_last_error(TRUE);
- fprintf(stderr,
- "InnoDB: Error: Cannot open \'%s\'\n",
- i->in_name);
+ if (!log_online_setup_bitmap_file_range(&i->in_files, min_lsn,
+ max_lsn)) {
+
return FALSE;
}
- i->page = ut_malloc(MODIFIED_PAGE_BLOCK_SIZE);
+ ut_a(i->in_files.count > 0);
+
+ /* Open the 1st bitmap file */
+ i->in_i = 0;
+ if (!log_online_open_bitmap_file_read_only(i->in_files.files[i->in_i].
+ name,
+ &i->in)) {
+ i->in_i = i->in_files.count;
+ free(i->in_files.files);
+ return FALSE;
+ }
+ i->page = ut_malloc(MODIFIED_PAGE_BLOCK_SIZE);
+ i->bit_offset = MODIFIED_PAGE_BLOCK_BITMAP_LEN;
i->start_lsn = i->end_lsn = 0;
i->space_id = 0;
i->first_page_id = 0;
+ i->last_page_in_run = TRUE;
i->changed = FALSE;
return TRUE;
@@ -985,7 +1434,11 @@ log_online_bitmap_iterator_release(
log_bitmap_iterator_t *i) /*!<in/out: iterator */
{
ut_a(i);
- os_file_close(i->in);
+
+ if (i->in_i < i->in_files.count) {
+ os_file_close(i->in.file);
+ }
+ ut_free(i->in_files.files);
ut_free(i->page);
}
@@ -1000,14 +1453,7 @@ log_online_bitmap_iterator_next(
/*============================*/
log_bitmap_iterator_t *i) /*!<in/out: iterator */
{
- ulint offset_low;
- ulint offset_high;
- ulint size_low;
- ulint size_high;
- ulint checksum = 0;
- ulint actual_checksum = !checksum;
-
- ibool success;
+ ibool checksum_ok = FALSE;
ut_a(i);
@@ -1020,66 +1466,51 @@ log_online_bitmap_iterator_next(
return TRUE;
}
- while (checksum != actual_checksum)
+ while (!checksum_ok)
{
- success = os_file_get_size(i->in,
- &size_low,
- &size_high);
- if (!success) {
- os_file_get_last_error(TRUE);
- fprintf(stderr,
- "InnoDB: Warning: can't get size of "
- "page bitmap file \'%s\'\n",
- i->in_name);
- return FALSE;
- }
-
- if (i->in_offset >=
- (ib_uint64_t)(size_low) +
- ((ib_uint64_t)(size_high) << 32))
- return FALSE;
-
- offset_high = (ulint)(i->in_offset >> 32);
- offset_low = (ulint)(i->in_offset & 0xFFFFFFFF);
+ while (i->in.size < MODIFIED_PAGE_BLOCK_SIZE
+ || (i->in.offset
+ > i->in.size - MODIFIED_PAGE_BLOCK_SIZE)) {
+
+ /* Advance file */
+ i->in_i++;
+ os_file_close(i->in.file);
+ log_online_diagnose_bitmap_eof(&i->in,
+ i->last_page_in_run);
+ if (i->in_i == i->in_files.count
+ || i->in_files.files[i->in_i].seq_num == 0) {
+
+ return FALSE;
+ }
- success = os_file_read(
- i->in,
- i->page,
- offset_low,
- offset_high,
- MODIFIED_PAGE_BLOCK_SIZE);
+ if (!log_online_open_bitmap_file_read_only(
+ i->in_files.files[i->in_i].name,
+ &i->in)) {
+ return FALSE;
+ }
+ }
- if (!success) {
+ if (!log_online_read_bitmap_page(&i->in, i->page,
+ &checksum_ok)) {
os_file_get_last_error(TRUE);
fprintf(stderr,
"InnoDB: Warning: failed reading "
"changed page bitmap file \'%s\'\n",
- i->in_name);
+ i->in_files.files[i->in_i].name);
return FALSE;
}
-
- checksum = mach_read_from_4(
- i->page + MODIFIED_PAGE_BLOCK_CHECKSUM);
-
- actual_checksum = log_online_calc_checksum(i->page);
-
- i->in_offset += MODIFIED_PAGE_BLOCK_SIZE;
}
- i->start_lsn =
- mach_read_from_8(i->page + MODIFIED_PAGE_START_LSN);
- i->end_lsn =
- mach_read_from_8(i->page + MODIFIED_PAGE_END_LSN);
- i->space_id =
- mach_read_from_4(i->page + MODIFIED_PAGE_SPACE_ID);
- i->first_page_id =
- mach_read_from_4(i->page + MODIFIED_PAGE_1ST_PAGE_ID);
- i->bit_offset =
- 0;
- i->changed =
- IS_BIT_SET(i->page + MODIFIED_PAGE_BLOCK_BITMAP,
- i->bit_offset);
+ i->start_lsn = mach_read_from_8(i->page + MODIFIED_PAGE_START_LSN);
+ i->end_lsn = mach_read_from_8(i->page + MODIFIED_PAGE_END_LSN);
+ i->space_id = mach_read_from_4(i->page + MODIFIED_PAGE_SPACE_ID);
+ i->first_page_id = mach_read_from_4(i->page
+ + MODIFIED_PAGE_1ST_PAGE_ID);
+ i->last_page_in_run = mach_read_from_4(i->page
+ + MODIFIED_PAGE_IS_LAST_BLOCK);
+ i->bit_offset = 0;
+ i->changed = IS_BIT_SET(i->page + MODIFIED_PAGE_BLOCK_BITMAP,
+ i->bit_offset);
return TRUE;
}
-
diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c
index 2555c010027..8e0516a84a9 100644
--- a/storage/xtradb/os/os0file.c
+++ b/storage/xtradb/os/os0file.c
@@ -2158,8 +2158,10 @@ os_file_set_eof_at(
ib_uint64_t new_len)/*!< in: new file length */
{
#ifdef __WIN__
- /* TODO: untested! */
- return(!_chsize_s(file, new_len));
+ LARGE_INTEGER li, li2;
+ li.QuadPart = new_len;
+ return(SetFilePointerEx(file, li, &li2,FILE_BEGIN)
+ && SetEndOfFile(file));
#else
/* TODO: works only with -D_FILE_OFFSET_BITS=64 ? */
return(!ftruncate(file, new_len));
diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c
index 3ae4c227ddc..61c3720fa2e 100644
--- a/storage/xtradb/row/row0ins.c
+++ b/storage/xtradb/row/row0ins.c
@@ -2012,7 +2012,10 @@ row_ins_index_entry_low(
the function will return in both low_match and up_match of the
cursor sensible values */
- if (dict_index_is_clust(index)) {
+ if (UNIV_UNLIKELY(thr_get_trx(thr)->fake_changes)) {
+ search_mode = (mode & BTR_MODIFY_TREE)
+ ? BTR_SEARCH_TREE : BTR_SEARCH_LEAF;
+ } else if (dict_index_is_clust(index)) {
search_mode = mode;
} else if (!(thr_get_trx(thr)->check_unique_secondary)) {
search_mode = mode | BTR_INSERT | BTR_IGNORE_SEC_UNIQUE;
@@ -2021,7 +2024,7 @@ row_ins_index_entry_low(
}
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
- thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : search_mode,
+ search_mode,
&cursor, 0, __FILE__, __LINE__, &mtr);
if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
diff --git a/storage/xtradb/row/row0mysql.c b/storage/xtradb/row/row0mysql.c
index 575160501c3..9ab85940760 100644
--- a/storage/xtradb/row/row0mysql.c
+++ b/storage/xtradb/row/row0mysql.c
@@ -1277,17 +1277,19 @@ run_again:
que_thr_stop_for_mysql_no_error(thr, trx);
- prebuilt->table->stat_n_rows++;
+ if (UNIV_LIKELY(!(trx->fake_changes))) {
- srv_n_rows_inserted++;
+ prebuilt->table->stat_n_rows++;
- if (prebuilt->table->stat_n_rows == 0) {
- /* Avoid wrap-over */
- prebuilt->table->stat_n_rows--;
+ if (prebuilt->table->stat_n_rows == 0) {
+ /* Avoid wrap-over */
+ prebuilt->table->stat_n_rows--;
+ }
+
+ srv_n_rows_inserted++;
+ row_update_statistics_if_needed(prebuilt->table);
}
- if (!(trx->fake_changes))
- row_update_statistics_if_needed(prebuilt->table);
trx->op_info = "";
return((int) err);
@@ -1534,6 +1536,11 @@ run_again:
que_thr_stop_for_mysql_no_error(thr, trx);
+ if (UNIV_UNLIKELY(trx->fake_changes)) {
+ trx->op_info = "";
+ return((int) err);
+ }
+
if (node->is_delete) {
if (prebuilt->table->stat_n_rows > 0) {
prebuilt->table->stat_n_rows--;
@@ -1548,7 +1555,6 @@ run_again:
that changes indexed columns, UPDATEs that change only non-indexed
columns would not affect statistics. */
if (node->is_delete || !(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
- if (!(trx->fake_changes))
row_update_statistics_if_needed(prebuilt->table);
}
@@ -1756,6 +1762,11 @@ run_again:
return(err);
}
+ if (UNIV_UNLIKELY((trx->fake_changes))) {
+
+ return(err);
+ }
+
if (node->is_delete) {
if (table->stat_n_rows > 0) {
table->stat_n_rows--;
@@ -1766,7 +1777,6 @@ run_again:
srv_n_rows_updated++;
}
- if (!(trx->fake_changes))
row_update_statistics_if_needed(table);
return(err);
diff --git a/storage/xtradb/row/row0upd.c b/storage/xtradb/row/row0upd.c
index 859b3d415ab..b2a0eb57669 100644
--- a/storage/xtradb/row/row0upd.c
+++ b/storage/xtradb/row/row0upd.c
@@ -2018,7 +2018,8 @@ row_upd_clust_rec(
the same transaction do not modify the record in the meantime.
Therefore we can assert that the restoration of the cursor succeeds. */
- ut_a(btr_pcur_restore_position(thr_get_trx(thr)->fake_changes ? BTR_SEARCH_LEAF : BTR_MODIFY_TREE,
+ ut_a(btr_pcur_restore_position(thr_get_trx(thr)->fake_changes
+ ? BTR_SEARCH_TREE : BTR_MODIFY_TREE,
pcur, mtr));
ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c
index 9d479ac6c87..6e210071746 100644
--- a/storage/xtradb/srv/srv0srv.c
+++ b/storage/xtradb/srv/srv0srv.c
@@ -179,8 +179,14 @@ UNIV_INTERN ibool srv_recovery_stats = FALSE;
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;
+/** When TRUE, fake change transcations take S rather than X row locks.
+ When FALSE, row locks are not taken at all. */
+UNIV_INTERN my_bool srv_fake_changes_locks = TRUE;
+
/* if TRUE, then we auto-extend the last data file */
UNIV_INTERN ibool srv_auto_extend_last_data_file = FALSE;
/* if != 0, this tells the max size auto-extending may increase the
diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c
index 65a775b56da..2faa68cb87c 100644
--- a/storage/xtradb/srv/srv0start.c
+++ b/storage/xtradb/srv/srv0start.c
@@ -1148,6 +1148,24 @@ skip_size_check:
return(DB_SUCCESS);
}
+/*********************************************************************//**
+Initializes the log tracking subsystem and starts its thread. */
+static
+void
+init_log_online(void)
+/*=================*/
+{
+ if (srv_track_changed_pages) {
+
+ log_online_read_init();
+
+ /* Create the thread that follows the redo log to output the
+ changed page bitmap */
+ os_thread_create(&srv_redo_log_follow_thread, NULL,
+ thread_ids + 5 + SRV_MAX_N_IO_THREADS);
+ }
+}
+
/********************************************************************
Starts InnoDB and creates a new database if database files
are not found and the user wants.
@@ -1794,6 +1812,8 @@ innobase_start_or_create_for_mysql(void)
trx_sys_file_format_init();
if (create_new_db) {
+ init_log_online();
+
mtr_start(&mtr);
fsp_header_init(0, sum_of_new_sizes, &mtr);
@@ -1893,6 +1913,8 @@ innobase_start_or_create_for_mysql(void)
return(DB_ERROR);
}
+ init_log_online();
+
/* Since the insert buffer init is in dict_boot, and the
insert buffer is needed in any disk i/o, first we call
dict_boot(). Note that trx_sys_init_at_db_start() only needs
@@ -2040,19 +2062,6 @@ innobase_start_or_create_for_mysql(void)
if (srv_auto_lru_dump && srv_blocking_lru_restore)
buf_LRU_file_restore();
- if (srv_track_changed_pages) {
-
- /* Initialize the log tracking subsystem here to block
- server startup until it's completed due to the potential
- need to re-read previous server run's log. */
- log_online_read_init();
-
- /* Create the thread that follows the redo log to output the
- changed page bitmap */
- os_thread_create(&srv_redo_log_follow_thread, NULL,
- thread_ids + 6 + SRV_MAX_N_IO_THREADS);
- }
-
srv_is_being_started = FALSE;
err = dict_create_or_check_foreign_constraint_tables();
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 52eaece5528..6ebbae8fb5a 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -46,9 +46,10 @@
#define LFACTOR1 ULL(10000000000)
#define LFACTOR2 ULL(100000000000)
+#if defined(HAVE_CHARSET_utf32) || defined(HAVE_CHARSET_mb2)
static unsigned long lfactor[9]=
{ 1L, 10L, 100L, 1000L, 10000L, 100000L, 1000000L, 10000000L, 100000000L };
-
+#endif
#ifdef HAVE_CHARSET_mb2_or_mb4
diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp
index 84651bdfac5..34f368c4373 100644
--- a/support-files/compiler_warnings.supp
+++ b/support-files/compiler_warnings.supp
@@ -138,6 +138,11 @@ lock_xt\.cc : uninitialized local variable .* used
restart_xt\.cc : dereferencing pointer .* does break strict-aliasing
#
+# oqgraph errors that are hard to fix
+#
+oqgraph/graphcore\.cc : may be used uninitialized in this function
+
+#
# I think these are due to mix of C and C++.
#
storage/pbxt/ : typedef.*was ignored in this declaration
@@ -153,6 +158,7 @@ include/runtime.hpp: .*pure_error.*
.*/extra/yassl/taocrypt/src/file\.cpp: ignoring return value
.*/extra/yassl/taocrypt/src/integer\.cpp: control reaches end of non-void function
mySTL/algorithm\.hpp: is used uninitialized in this function
+include/pwdbased\.hpp: comparison of unsigned expression
#
# OpenSSL
@@ -184,6 +190,7 @@ net_serv.cc : .*conversion from 'SOCKET' to 'int'.*
# Ignorable warnings from header files
#
backward_warning\.h : This file includes at least one
+/usr/include/i386-linux-gnu/bits/string3\.h: memset used with constant zero length parameter
# allow a little moving space for the warning below
mi_packrec\.c : .*result of 32-bit shift implicitly converted to 64 bits.* : 560-600
@@ -201,10 +208,9 @@ string3\.h : memset used with constant zero length parameter
# Wrong warning due to GCC bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29478
regexec\.c : passing argument 3 of.*matcher.* discards qualifiers from pointer target type
libmysql\.c: passing argument 2 of .*memcpy.* discards qualifiers from pointer target type : 3000-4000
-storage/xtradb/dict/dict0dict\.c : passing argument 1 of .*strcpy.* discards qualifiers from pointer target type : 2500-3500
-storage/xtradb/sync/sync0rw\.c : passing argument 1 of .*memset.* discards qualifiers from pointer target type : 200-300
-storage/innobase/dict/dict0dict\.c : passing argument 1 of .*strcpy.* discards qualifiers from pointer target type : 2500-3500
-storage/innobase/sync/sync0rw\.c : passing argument 1 of .*memset.* discards qualifiers from pointer target type : 200-300
+storage/.*/dict/dict0dict\.c : passing argument 1 of .*strcpy.* discards qualifiers from pointer target type : 2500-3500
+storage/.*/sync/sync0rw\.c : passing argument 1 of .*memset.* discards qualifiers from pointer target type : 200-300
+storage/.*/btr/btr0sea\.c : passing argument 2 of .*btr_cur_position.* discards qualifiers from pointer
#
# Strange things from autoconf that is probably safe to ignore
@@ -212,3 +218,4 @@ storage/innobase/sync/sync0rw\.c : passing argument 1 of .*memset.* discards qua
configure.in : warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
configure.in : config/ac-macros/character_sets.m4.*prefer named diversions
+warning: File listed twice
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 0d673e5b339..2d629c766e8 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
@@ -286,8 +286,9 @@ documentation and the manual for more information.
Summary: MySQL: a very fast and reliable SQL database server
Group: Applications/Databases
Requires: %{distro_requires}
-Provides: msqlormysql mysql MySQL mysql-server MySQL-server
-Obsoletes: mysql MySQL mysql-server MySQL-server
+Provides: msqlormysql MySQL MySQL-server
+Conflicts: mysql mysql-server mysql-advanced mysql-server-advanced
+Obsoletes: MySQL MySQL-server
Obsoletes: MySQL-server-classic MySQL-server-community MySQL-server-enterprise
Obsoletes: MySQL-server-advanced MySQL-server-advanced-gpl MySQL-server-enterprise-gpl
@@ -319,8 +320,9 @@ package "MySQL-client%{product_suffix}" as well!
%package -n MySQL-client%{product_suffix}
Summary: MySQL - Client
Group: Applications/Databases
-Provides: mysql-client MySQL-client
-Obsoletes: mysql-client MySQL-client
+Provides: MySQL-client
+Conflicts: mysql mysql-advanced
+Obsoletes: MySQL-client
Obsoletes: MySQL-client-classic MySQL-client-community MySQL-client-enterprise
Obsoletes: MySQL-client-advanced MySQL-client-advanced-gpl MySQL-client-enterprise-gpl
@@ -334,8 +336,9 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
Summary: MySQL - Test suite
Group: Applications/Databases
Requires: MySQL-client perl
-Provides: mysql-test MySQL-test
-Obsoletes: mysql-test MySQL-test
+Provides: MySQL-test
+Conflicts: mysql-test mysql-test-advanced
+Obsoletes: MySQL-test
Obsoletes: mysql-bench MySQL-bench
Obsoletes: MySQL-test-classic MySQL-test-community MySQL-test-enterprise
Obsoletes: MySQL-test-advanced MySQL-test-advanced-gpl MySQL-test-enterprise-gpl
@@ -350,8 +353,9 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
%package -n MySQL-devel%{product_suffix}
Summary: MySQL - Development header files and libraries
Group: Applications/Databases
-Provides: mysql-devel MySQL-devel
-Obsoletes: mysql-devel MySQL-devel
+Provides: MySQL-devel
+Conflicts: mysql-devel mysql-embedded-devel mysql-devel-advanced mysql-embedded-devel-advanced
+Obsoletes: MySQL-devel
Obsoletes: MySQL-devel-classic MySQL-devel-community MySQL-devel-enterprise
Obsoletes: MySQL-devel-advanced MySQL-devel-advanced-gpl MySQL-devel-enterprise-gpl
@@ -365,8 +369,9 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
%package -n MySQL-shared%{product_suffix}
Summary: MySQL - Shared libraries
Group: Applications/Databases
-Provides: mysql-shared MySQL-shared
-Obsoletes: mysql-shared MySQL-shared-standard MySQL-shared-pro
+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
Obsoletes: MySQL-shared-classic MySQL-shared-community MySQL-shared-enterprise
@@ -381,8 +386,9 @@ and applications need to dynamically load and use MySQL.
Summary: MySQL - Embedded library
Group: Applications/Databases
Requires: MySQL-devel
-Provides: mysql-embedded MySQL-embedded
-Obsoletes: mysql-embedded MySQL-embedded
+Provides: MySQL-embedded
+Conflicts: mysql-embedded mysql-embedded-advanced
+Obsoletes: MySQL-embedded
Obsoletes: MySQL-embedded-pro
Obsoletes: MySQL-embedded-classic MySQL-embedded-community MySQL-embedded-enterprise
Obsoletes: MySQL-embedded-advanced MySQL-embedded-advanced-gpl MySQL-embedded-enterprise-gpl
@@ -601,8 +607,13 @@ fi
# Check if we can safely upgrade. An upgrade is only safe if it's from one
# of our RPMs in the same version family.
+# Handle both ways of spelling the capability.
installed=`rpm -q --whatprovides mysql-server 2> /dev/null`
+if [ $? -ne 0 -o -z "$installed" ]; then
+ installed=`rpm -q --whatprovides MySQL-server 2> /dev/null`
+fi
if [ $? -eq 0 -a -n "$installed" ]; then
+ installed=`echo $installed | sed 's/\([^ ]*\) .*/\1/'` # Tests have shown duplicated package names
vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1`
version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1`
myoldvendor='%{mysql_old_vendor}'
@@ -1173,6 +1184,10 @@ echo "=====" >> $STATUS_HISTORY
this can be oveeridden via the command line by adding
--define "runselftest 0"
Failures of the test suite will NOT make the RPM build fail!
+
+* Mon Jun 11 2012 Joerg Bruehe <joerg.bruehe@oracle.com>
+
+- Make sure newly added "SPECIFIC-ULN/" directory does not disturb packaging.
* Wed Sep 28 2011 Joerg Bruehe <joerg.bruehe@oracle.com>
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 9869290a5bb..f348ec4515b 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -16040,6 +16040,7 @@ static void test_change_user()
const char *pw= "password";
const char *db= "mysqltest_user_test_database";
int rc;
+ MYSQL* conn;
DBUG_ENTER("test_change_user");
myheader("test_change_user");
@@ -16083,149 +16084,173 @@ static void test_change_user()
rc= mysql_query(mysql, buff);
myquery(rc);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
/* Try some combinations */
- rc= mysql_change_user(mysql, NULL, NULL, NULL);
+ rc= mysql_change_user(conn, NULL, NULL, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, "", NULL, NULL);
+ rc= mysql_change_user(conn, "", NULL, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, "", "", NULL);
+ rc= mysql_change_user(conn, "", "", NULL);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, "", "", "");
+ mysql_close(conn);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
+
+ rc= mysql_change_user(conn, "", "", "");
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, NULL, "", "");
+ rc= mysql_change_user(conn, NULL, "", "");
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, NULL, NULL, "");
+ rc= mysql_change_user(conn, NULL, NULL, "");
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
+
+ mysql_close(conn);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
- rc= mysql_change_user(mysql, "", NULL, "");
+ rc= mysql_change_user(conn, "", NULL, "");
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, user_pw, NULL, "");
+ rc= mysql_change_user(conn, user_pw, NULL, "");
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, user_pw, "", "");
+ rc= mysql_change_user(conn, user_pw, "", "");
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, user_pw, "", NULL);
+ mysql_close(conn);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
+
+ rc= mysql_change_user(conn, user_pw, "", NULL);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, user_pw, NULL, NULL);
+ rc= mysql_change_user(conn, user_pw, NULL, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, user_pw, "", db);
+ rc= mysql_change_user(conn, user_pw, "", db);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
+
+ mysql_close(conn);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
- rc= mysql_change_user(mysql, user_pw, NULL, db);
+ rc= mysql_change_user(conn, user_pw, NULL, db);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, user_pw, pw, db);
+ rc= mysql_change_user(conn, user_pw, pw, db);
myquery(rc);
- rc= mysql_change_user(mysql, user_pw, pw, NULL);
+ rc= mysql_change_user(conn, user_pw, pw, NULL);
myquery(rc);
- rc= mysql_change_user(mysql, user_pw, pw, "");
+ rc= mysql_change_user(conn, user_pw, pw, "");
myquery(rc);
- rc= mysql_change_user(mysql, user_no_pw, pw, db);
+ rc= mysql_change_user(conn, user_no_pw, pw, db);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, user_no_pw, pw, "");
+ rc= mysql_change_user(conn, user_no_pw, pw, "");
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, user_no_pw, pw, NULL);
+ mysql_close(conn);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
+
+ rc= mysql_change_user(conn, user_no_pw, pw, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, user_no_pw, "", NULL);
+ rc= mysql_change_user(conn, user_no_pw, "", NULL);
myquery(rc);
- rc= mysql_change_user(mysql, user_no_pw, "", "");
+ rc= mysql_change_user(conn, user_no_pw, "", "");
myquery(rc);
- rc= mysql_change_user(mysql, user_no_pw, "", db);
+ rc= mysql_change_user(conn, user_no_pw, "", db);
myquery(rc);
- rc= mysql_change_user(mysql, user_no_pw, NULL, db);
+ rc= mysql_change_user(conn, user_no_pw, NULL, db);
myquery(rc);
- rc= mysql_change_user(mysql, "", pw, db);
+ rc= mysql_change_user(conn, "", pw, db);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, "", pw, "");
+ rc= mysql_change_user(conn, "", pw, "");
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
+
+ mysql_close(conn);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
- rc= mysql_change_user(mysql, "", pw, NULL);
+ rc= mysql_change_user(conn, "", pw, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, NULL, pw, NULL);
+ rc= mysql_change_user(conn, NULL, pw, NULL);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, NULL, NULL, db);
+ rc= mysql_change_user(conn, NULL, NULL, db);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, NULL, "", db);
+ mysql_close(conn);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
+
+ rc= mysql_change_user(conn, NULL, "", db);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
- rc= mysql_change_user(mysql, "", "", db);
+ rc= mysql_change_user(conn, "", "", db);
DIE_UNLESS(rc);
if (! opt_silent)
- printf("Got error (as expected): %s\n", mysql_error(mysql));
+ printf("Got error (as expected): %s\n", mysql_error(conn));
/* Cleanup the environment */
- mysql_change_user(mysql, opt_user, opt_password, current_db);
+ mysql_change_user(conn, opt_user, opt_password, current_db);
+
+ mysql_close(conn);
sprintf(buff, "drop database %s", db);
rc= mysql_query(mysql, buff);
@@ -16888,29 +16913,35 @@ static void test_bug31669()
static char db[NAME_CHAR_LEN+1];
static char query[LARGE_BUFFER_SIZE*2];
#endif
+ MYSQL* conn;
DBUG_ENTER("test_bug31669");
myheader("test_bug31669");
- rc= mysql_change_user(mysql, NULL, NULL, NULL);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
+
+ rc= mysql_change_user(conn, NULL, NULL, NULL);
DIE_UNLESS(rc);
- rc= mysql_change_user(mysql, "", "", "");
+ rc= mysql_change_user(conn, "", "", "");
DIE_UNLESS(rc);
memset(buff, 'a', sizeof(buff));
- rc= mysql_change_user(mysql, buff, buff, buff);
+ mysql_close(conn);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
+
+ rc= mysql_change_user(conn, buff, buff, buff);
DIE_UNLESS(rc);
- rc = mysql_change_user(mysql, opt_user, opt_password, current_db);
+ rc = mysql_change_user(conn, opt_user, opt_password, current_db);
DIE_UNLESS(!rc);
#ifndef EMBEDDED_LIBRARY
memset(db, 'a', sizeof(db));
db[NAME_CHAR_LEN]= 0;
strxmov(query, "CREATE DATABASE IF NOT EXISTS ", db, NullS);
- rc= mysql_query(mysql, query);
+ rc= mysql_query(conn, query);
myquery(rc);
memset(user, 'b', sizeof(user));
@@ -16919,54 +16950,59 @@ static void test_bug31669()
buff[LARGE_BUFFER_SIZE]= 0;
strxmov(query, "GRANT ALL PRIVILEGES ON *.* TO '", user, "'@'%' IDENTIFIED BY "
"'", buff, "' WITH GRANT OPTION", NullS);
- rc= mysql_query(mysql, query);
+ rc= mysql_query(conn, query);
myquery(rc);
strxmov(query, "GRANT ALL PRIVILEGES ON *.* TO '", user, "'@'localhost' IDENTIFIED BY "
"'", buff, "' WITH GRANT OPTION", NullS);
- rc= mysql_query(mysql, query);
+ rc= mysql_query(conn, query);
myquery(rc);
- rc= mysql_query(mysql, "FLUSH PRIVILEGES");
+ rc= mysql_query(conn, "FLUSH PRIVILEGES");
myquery(rc);
- rc= mysql_change_user(mysql, user, buff, db);
+ rc= mysql_change_user(conn, user, buff, db);
DIE_UNLESS(!rc);
user[USERNAME_CHAR_LENGTH-1]= 'a';
- rc= mysql_change_user(mysql, user, buff, db);
+ rc= mysql_change_user(conn, user, buff, db);
DIE_UNLESS(rc);
user[USERNAME_CHAR_LENGTH-1]= 'b';
buff[LARGE_BUFFER_SIZE-1]= 'd';
- rc= mysql_change_user(mysql, user, buff, db);
+ rc= mysql_change_user(conn, user, buff, db);
DIE_UNLESS(rc);
buff[LARGE_BUFFER_SIZE-1]= 'c';
db[NAME_CHAR_LEN-1]= 'e';
- rc= mysql_change_user(mysql, user, buff, db);
+ rc= mysql_change_user(conn, user, buff, db);
DIE_UNLESS(rc);
+ mysql_close(conn);
+ conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
+
db[NAME_CHAR_LEN-1]= 'a';
- rc= mysql_change_user(mysql, user, buff, db);
+ rc= mysql_change_user(conn, user, buff, db);
DIE_UNLESS(!rc);
- rc= mysql_change_user(mysql, user + 1, buff + 1, db + 1);
+ rc= mysql_change_user(conn, user + 1, buff + 1, db + 1);
DIE_UNLESS(rc);
- rc = mysql_change_user(mysql, opt_user, opt_password, current_db);
+ rc = mysql_change_user(conn, opt_user, opt_password, current_db);
DIE_UNLESS(!rc);
strxmov(query, "DROP DATABASE ", db, NullS);
- rc= mysql_query(mysql, query);
+ rc= mysql_query(conn, query);
myquery(rc);
strxmov(query, "DELETE FROM mysql.user WHERE User='", user, "'", NullS);
- rc= mysql_query(mysql, query);
+ rc= mysql_query(conn, query);
myquery(rc);
- DIE_UNLESS(mysql_affected_rows(mysql) == 2);
+ DIE_UNLESS(mysql_affected_rows(conn) == 2);
#endif
+ mysql_close(conn);
+
DBUG_VOID_RETURN;
}
diff --git a/win/create_def_file.js b/win/create_def_file.js
index 019bb7471ab..461f4766a1d 100644
--- a/win/create_def_file.js
+++ b/win/create_def_file.js
@@ -169,6 +169,7 @@ function ScrubSymbol(symbol)
function IsCompilerDefinedSymbol(symbol)
{
return ((symbol.indexOf("__real@") != -1) ||
+ (symbol.indexOf("_xmm@") != -1) ||
(symbol.indexOf("_RTC_") != -1) ||
(symbol.indexOf("??_C@_") != -1) ||
(symbol.indexOf("??_R") != -1) ||