summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore3
-rw-r--r--BUILD/FINISH.sh3
-rwxr-xr-xBUILD/compile-amd64-debug-max3
-rwxr-xr-xBUILD/compile-amd64-max3
-rwxr-xr-xBUILD/compile-darwin-mwcc3
-rwxr-xr-xBUILD/compile-hpux11-parisc2-aCC3
-rwxr-xr-xBUILD/compile-irix-mips64-mipspro3
-rwxr-xr-xBUILD/compile-ndb-autotest2
-rwxr-xr-xBUILD/compile-pentium3
-rwxr-xr-xBUILD/compile-pentium-debug-max-no-embedded3
-rwxr-xr-xBUILD/compile-pentium-debug-max-no-ndb2
-rwxr-xr-xBUILD/compile-pentium-max3
-rwxr-xr-xBUILD/compile-ppc-debug3
-rwxr-xr-xBUILD/compile-ppc-debug-max3
-rwxr-xr-xBUILD/compile-ppc-debug-max-no-ndb3
-rwxr-xr-xBUILD/compile-ppc-max3
-rwxr-xr-xBUILD/compile-solaris-amd64-debug2
-rw-r--r--CMakeLists.txt2
-rw-r--r--VERSION2
-rw-r--r--client/client_priv.h2
-rw-r--r--client/completion_hash.h3
-rw-r--r--client/echo.c3
-rw-r--r--client/get_password.c3
-rw-r--r--client/mysql.cc22
-rw-r--r--client/mysqlbinlog.cc167
-rw-r--r--client/mysqlcheck.c90
-rw-r--r--client/mysqldump.c6
-rw-r--r--client/mysqltest.cc3
-rw-r--r--client/sql_string.cc.dontuse4
-rw-r--r--cmake/configure.pl2
-rw-r--r--cmake/cpack_rpm.cmake30
-rw-r--r--cmake/create_initial_db.cmake.in2
-rw-r--r--cmake/make_dist.cmake.in2
-rw-r--r--cmake/mysql_version.cmake2
-rw-r--r--cmake/os/Linux.cmake6
-rw-r--r--cmake/package_name.cmake2
-rw-r--r--cmake/plugin.cmake2
-rw-r--r--cmake/ssl.cmake2
-rw-r--r--cmake/zlib.cmake8
-rw-r--r--configure.cmake5
-rwxr-xr-xdebian/autobake-deb.sh4
-rw-r--r--debian/dist/Debian/control21
-rw-r--r--debian/dist/Ubuntu/control20
-rw-r--r--extra/charset2html.c3
-rw-r--r--extra/yassl/CMakeLists.txt2
-rw-r--r--extra/yassl/examples/client/client.cpp2
-rw-r--r--extra/yassl/examples/echoclient/echoclient.cpp2
-rw-r--r--extra/yassl/examples/echoserver/echoserver.cpp2
-rw-r--r--extra/yassl/examples/server/server.cpp2
-rw-r--r--extra/yassl/include/buffer.hpp2
-rw-r--r--extra/yassl/include/cert_wrapper.hpp3
-rw-r--r--extra/yassl/include/lock.hpp2
-rw-r--r--extra/yassl/include/openssl/prefix_ssl.h3
-rw-r--r--extra/yassl/include/socket_wrapper.hpp2
-rw-r--r--extra/yassl/include/yassl_error.hpp6
-rw-r--r--extra/yassl/include/yassl_imp.hpp3
-rw-r--r--extra/yassl/include/yassl_int.hpp2
-rw-r--r--extra/yassl/include/yassl_types.hpp9
-rw-r--r--extra/yassl/src/buffer.cpp3
-rw-r--r--extra/yassl/src/cert_wrapper.cpp3
-rw-r--r--extra/yassl/src/crypto_wrapper.cpp2
-rw-r--r--extra/yassl/src/handshake.cpp38
-rw-r--r--extra/yassl/src/lock.cpp2
-rwxr-xr-xextra/yassl/src/make.bat2
-rw-r--r--extra/yassl/src/socket_wrapper.cpp2
-rw-r--r--extra/yassl/src/ssl.cpp3
-rw-r--r--extra/yassl/src/template_instnt.cpp3
-rw-r--r--extra/yassl/src/yassl.cpp2
-rw-r--r--extra/yassl/src/yassl_error.cpp6
-rw-r--r--extra/yassl/src/yassl_imp.cpp192
-rw-r--r--extra/yassl/taocrypt/benchmark/benchmark.cpp18
-rwxr-xr-xextra/yassl/taocrypt/benchmark/make.bat2
-rw-r--r--extra/yassl/taocrypt/include/aes.hpp2
-rw-r--r--extra/yassl/taocrypt/include/asn.hpp3
-rw-r--r--extra/yassl/taocrypt/include/block.hpp3
-rw-r--r--extra/yassl/taocrypt/include/blowfish.hpp2
-rw-r--r--extra/yassl/taocrypt/include/des.hpp2
-rw-r--r--extra/yassl/taocrypt/include/hash.hpp2
-rw-r--r--extra/yassl/taocrypt/include/hc128.hpp2
-rw-r--r--extra/yassl/taocrypt/include/integer.hpp2
-rw-r--r--extra/yassl/taocrypt/include/kernelc.hpp2
-rw-r--r--extra/yassl/taocrypt/include/misc.hpp2
-rw-r--r--extra/yassl/taocrypt/include/modes.hpp3
-rw-r--r--extra/yassl/taocrypt/include/pwdbased.hpp2
-rw-r--r--extra/yassl/taocrypt/include/rabbit.hpp2
-rw-r--r--extra/yassl/taocrypt/include/rsa.hpp2
-rw-r--r--extra/yassl/taocrypt/include/runtime.hpp2
-rw-r--r--extra/yassl/taocrypt/include/types.hpp2
-rw-r--r--extra/yassl/taocrypt/mySTL/stdexcept.hpp2
-rw-r--r--extra/yassl/taocrypt/mySTL/vector.hpp2
-rw-r--r--extra/yassl/taocrypt/src/aes.cpp2
-rw-r--r--extra/yassl/taocrypt/src/aestables.cpp2
-rw-r--r--extra/yassl/taocrypt/src/algebra.cpp2
-rw-r--r--extra/yassl/taocrypt/src/arc4.cpp2
-rw-r--r--extra/yassl/taocrypt/src/blowfish.cpp2
-rw-r--r--extra/yassl/taocrypt/src/coding.cpp2
-rw-r--r--extra/yassl/taocrypt/src/dsa.cpp2
-rw-r--r--extra/yassl/taocrypt/src/hash.cpp2
-rw-r--r--extra/yassl/taocrypt/src/hc128.cpp2
-rwxr-xr-xextra/yassl/taocrypt/src/make.bat2
-rw-r--r--extra/yassl/taocrypt/src/md4.cpp2
-rw-r--r--extra/yassl/taocrypt/src/md5.cpp2
-rw-r--r--extra/yassl/taocrypt/src/misc.cpp2
-rw-r--r--extra/yassl/taocrypt/src/rabbit.cpp2
-rw-r--r--extra/yassl/taocrypt/src/random.cpp2
-rw-r--r--extra/yassl/taocrypt/src/ripemd.cpp2
-rw-r--r--extra/yassl/taocrypt/src/rsa.cpp2
-rw-r--r--extra/yassl/taocrypt/src/sha.cpp2
-rw-r--r--extra/yassl/taocrypt/src/template_instnt.cpp2
-rw-r--r--extra/yassl/taocrypt/src/twofish.cpp2
-rwxr-xr-xextra/yassl/taocrypt/test/make.bat2
-rw-r--r--extra/yassl/taocrypt/test/memory.cpp2
-rw-r--r--extra/yassl/taocrypt/test/test.cpp18
-rwxr-xr-xextra/yassl/testsuite/make.bat2
-rw-r--r--extra/yassl/testsuite/test.hpp2
-rw-r--r--extra/yassl/testsuite/testsuite.cpp2
-rw-r--r--include/atomic/x86-gcc.h6
-rw-r--r--include/base64.h3
-rw-r--r--include/ft_global.h2
-rw-r--r--include/m_ctype.h5
-rw-r--r--include/m_string.h11
-rw-r--r--include/my_global.h3
-rw-r--r--include/my_md5.h3
-rw-r--r--include/my_sys.h3
-rw-r--r--include/my_user.h3
-rw-r--r--include/my_xml.h3
-rw-r--r--include/myisamchk.h20
-rw-r--r--include/myisampack.h2
-rw-r--r--include/mysql.h3
-rw-r--r--include/mysql/plugin_audit.h46
-rw-r--r--include/mysql/plugin_audit.h.pp21
-rw-r--r--include/mysql/plugin_auth.h4
-rw-r--r--include/mysql/plugin_auth.h.pp4
-rw-r--r--include/mysql/plugin_auth_common.h2
-rw-r--r--include/mysql/service_my_snprintf.h2
-rw-r--r--include/mysql_com.h27
-rw-r--r--include/mysql_time.h3
-rw-r--r--include/mysql_version.h.in3
-rw-r--r--include/probes_mysql_nodtrace.h115
-rw-r--r--include/thread_pool_priv.h2
-rw-r--r--include/welcome_copyright_notice.h2
-rw-r--r--libmysql/get_password.c18
-rw-r--r--libmysql/libmysql.c9
-rw-r--r--libmysqld/lib_sql.cc15
-rw-r--r--mysql-test/collections/default.experimental1
-rw-r--r--mysql-test/disabled.def1
-rw-r--r--mysql-test/include/get_relay_log_pos.inc2
-rw-r--r--mysql-test/include/have_debug_sync.inc9
-rw-r--r--mysql-test/include/rpl_init.inc3
-rw-r--r--mysql-test/include/support_long_file_names.inc37
-rwxr-xr-xmysql-test/mysql-test-run.pl32
-rw-r--r--mysql-test/r/cache_temporal_4265.result10
-rw-r--r--mysql-test/r/cast.result38
-rw-r--r--mysql-test/r/create.result4
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result37
-rw-r--r--mysql-test/r/ctype_ucs2_query_cache.result19
-rw-r--r--mysql-test/r/ctype_utf8mb4.result18
-rw-r--r--mysql-test/r/date_formats.result2
-rw-r--r--mysql-test/r/dyncol.result91
-rw-r--r--mysql-test/r/empty_user_table.result8
-rw-r--r--mysql-test/r/fulltext_derived_4316.result8
-rw-r--r--mysql-test/r/func_compress.result4
-rw-r--r--mysql-test/r/func_date_add.result6
-rw-r--r--mysql-test/r/func_group.result39
-rw-r--r--mysql-test/r/func_group_innodb.result15
-rw-r--r--mysql-test/r/func_math.result8
-rw-r--r--mysql-test/r/func_sapdb.result4
-rw-r--r--mysql-test/r/func_str.result51
-rw-r--r--mysql-test/r/func_time.result18
-rw-r--r--mysql-test/r/func_time_hires.result4
-rw-r--r--mysql-test/r/gis-rtree.result20
-rw-r--r--mysql-test/r/gis.result143
-rw-r--r--mysql-test/r/grant_4332.result96
-rw-r--r--mysql-test/r/have_debug_sync.require2
-rw-r--r--mysql-test/r/innodb_ext_key.result122
-rw-r--r--mysql-test/r/join_nested.result24
-rw-r--r--mysql-test/r/join_nested_jcl6.result24
-rw-r--r--mysql-test/r/join_outer.result46
-rw-r--r--mysql-test/r/join_outer_innodb.result314
-rw-r--r--mysql-test/r/join_outer_jcl6.result46
-rw-r--r--mysql-test/r/keywords.result6
-rw-r--r--mysql-test/r/log_slow.result15
-rw-r--r--mysql-test/r/mdev316.result2
-rw-r--r--mysql-test/r/merge.result181
-rw-r--r--mysql-test/r/myisam-metadata.result3
-rw-r--r--mysql-test/r/partition.result4
-rw-r--r--mysql-test/r/partition_pruning.result3
-rw-r--r--mysql-test/r/plugin_auth.result2
-rw-r--r--mysql-test/r/plugin_auth_qa_2.result6
-rw-r--r--mysql-test/r/plugin_auth_qa_3.result2
-rw-r--r--mysql-test/r/ps_11bugs.result2
-rw-r--r--mysql-test/r/quick_select_4161.result31
-rw-r--r--mysql-test/r/select.result39
-rw-r--r--mysql-test/r/select_jcl6.result39
-rw-r--r--mysql-test/r/select_pkeycache.result39
-rw-r--r--mysql-test/r/show_check.result18
-rw-r--r--mysql-test/r/sp.result61
-rw-r--r--mysql-test/r/status_user.result2
-rw-r--r--mysql-test/r/subselect.result8
-rw-r--r--mysql-test/r/subselect4.result24
-rw-r--r--mysql-test/r/subselect_innodb.result2
-rw-r--r--mysql-test/r/subselect_mat.result14
-rw-r--r--mysql-test/r/subselect_no_mat.result10
-rw-r--r--mysql-test/r/subselect_no_opts.result8
-rw-r--r--mysql-test/r/subselect_no_scache.result8
-rw-r--r--mysql-test/r/subselect_no_semijoin.result8
-rw-r--r--mysql-test/r/subselect_sj.result42
-rw-r--r--mysql-test/r/subselect_sj2_mat.result2
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result42
-rw-r--r--mysql-test/r/subselect_sj_mat.result14
-rw-r--r--mysql-test/r/sum_distinct-big.result58
-rw-r--r--mysql-test/r/temporal_scale_4283.result12
-rw-r--r--mysql-test/r/type_date.result2
-rw-r--r--mysql-test/r/type_datetime.result33
-rw-r--r--mysql-test/r/user_var-binlog.result12
-rw-r--r--mysql-test/r/varbinary.result61
-rw-r--r--mysql-test/r/variables.result6
-rw-r--r--mysql-test/r/windows.result2
-rw-r--r--mysql-test/suite/binlog/disabled.def2
-rw-r--r--mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result1
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result4
-rw-r--r--mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test3
-rw-r--r--mysql-test/suite/federated/federated.result13
-rw-r--r--mysql-test/suite/federated/federated.test12
-rw-r--r--mysql-test/suite/federated/federatedx.test1
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result8
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is_embedded.result8
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result4
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_priv_ps.result4
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_val_no_prot.result2
-rw-r--r--mysql-test/suite/funcs_1/r/processlist_val_ps.result2
-rw-r--r--mysql-test/suite/funcs_1/r/storedproc.result11
-rw-r--r--mysql-test/suite/funcs_1/t/storedproc.test4
-rw-r--r--mysql-test/suite/handler/interface.result10
-rw-r--r--mysql-test/suite/handler/interface.test13
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug14147491.result19
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug12400341.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14147491.test52
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14676111-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug14676111.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug51920.test2
-rw-r--r--mysql-test/suite/maria/distinct.result25
-rw-r--r--mysql-test/suite/maria/distinct.test25
-rw-r--r--mysql-test/suite/maria/maria-autozerofill.result13
-rw-r--r--mysql-test/suite/maria/maria-autozerofill.test25
-rw-r--r--mysql-test/suite/maria/maria-recovery2.result6
-rw-r--r--mysql-test/suite/maria/maria-recovery2.test2
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result112
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_1_innodb.result64
-rw-r--r--mysql-test/suite/parts/r/partition_alter1_2_innodb.result160
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result80
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result80
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result80
-rw-r--r--mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result80
-rw-r--r--mysql-test/suite/parts/r/partition_alter4_innodb.result416
-rw-r--r--mysql-test/suite/parts/r/partition_basic_innodb.result128
-rw-r--r--mysql-test/suite/parts/r/partition_engine_innodb.result22
-rw-r--r--mysql-test/suite/parts/t/partition_basic_innodb.test2
-rw-r--r--mysql-test/suite/plugins/r/audit_null.result73
-rw-r--r--mysql-test/suite/plugins/r/audit_null_debug.result2
-rw-r--r--mysql-test/suite/plugins/r/auth_v0100.result18
-rw-r--r--mysql-test/suite/plugins/r/qc_info.result15
-rw-r--r--mysql-test/suite/plugins/r/qc_info_priv.result23
-rw-r--r--mysql-test/suite/plugins/t/audit_null.test29
-rw-r--r--mysql-test/suite/plugins/t/audit_null_debug.test4
-rw-r--r--mysql-test/suite/plugins/t/auth_v0100.test26
-rw-r--r--mysql-test/suite/plugins/t/qc_info.test8
-rw-r--r--mysql-test/suite/plugins/t/qc_info_init.inc12
-rw-r--r--mysql-test/suite/plugins/t/qc_info_init.opt2
-rw-r--r--mysql-test/suite/plugins/t/qc_info_priv.test15
-rw-r--r--mysql-test/suite/plugins/t/unix_socket.test3
-rw-r--r--mysql-test/suite/rpl/disabled.def1
-rw-r--r--mysql-test/suite/rpl/r/rpl_charset_sjis.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev382.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_password_boundaries.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_until.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp_effects.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_until.result15
-rw-r--r--mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_charset_sjis.test33
-rw-r--r--mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_password_boundaries.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_until.test75
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp_effects.test22
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until.test43
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_buffer_pool_evict_basic.result7
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_use_atomic_writes_basic.result21
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result21
-rw-r--r--mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result6
-rw-r--r--mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result6
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test15
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test22
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test22
-rw-r--r--mysql-test/t/cache_temporal_4265.test11
-rw-r--r--mysql-test/t/cast.test13
-rw-r--r--mysql-test/t/ctype_cp932_binlog_stm.test17
-rw-r--r--mysql-test/t/ctype_ucs2_query_cache-master.opt1
-rw-r--r--mysql-test/t/ctype_ucs2_query_cache.test19
-rw-r--r--mysql-test/t/ctype_utf8mb4.test15
-rw-r--r--mysql-test/t/dyncol.test57
-rw-r--r--mysql-test/t/empty_user_table.test20
-rw-r--r--mysql-test/t/fulltext_derived_4316.test14
-rw-r--r--mysql-test/t/func_date_add.test12
-rw-r--r--mysql-test/t/func_group.test34
-rw-r--r--mysql-test/t/func_group_innodb.test15
-rw-r--r--mysql-test/t/func_str.test48
-rw-r--r--mysql-test/t/func_time.test10
-rw-r--r--mysql-test/t/gis-rtree.test20
-rw-r--r--mysql-test/t/gis.test112
-rw-r--r--mysql-test/t/grant_4332.test108
-rw-r--r--mysql-test/t/innodb_ext_key.test123
-rw-r--r--mysql-test/t/join_nested.test24
-rw-r--r--mysql-test/t/join_outer.test48
-rw-r--r--mysql-test/t/join_outer_innodb.test230
-rw-r--r--mysql-test/t/keywords.test11
-rw-r--r--mysql-test/t/log_slow.test14
-rw-r--r--mysql-test/t/merge.test86
-rw-r--r--mysql-test/t/myisam-metadata.test8
-rw-r--r--mysql-test/t/mysql.test2
-rw-r--r--mysql-test/t/mysql_plugin.test66
-rw-r--r--mysql-test/t/mysqld--help.test7
-rw-r--r--mysql-test/t/mysqlshow.test9
-rw-r--r--mysql-test/t/partition_rename_longfilename.test1
-rw-r--r--mysql-test/t/quick_select_4161.test53
-rw-r--r--mysql-test/t/select.test39
-rw-r--r--mysql-test/t/sp.test63
-rw-r--r--mysql-test/t/subselect4.test13
-rw-r--r--mysql-test/t/subselect_sj.test53
-rw-r--r--mysql-test/t/subselect_sj_mat.test19
-rw-r--r--mysql-test/t/sum_distinct-big.test69
-rw-r--r--mysql-test/t/temporal_scale_4283.test13
-rw-r--r--mysql-test/t/type_datetime.test25
-rw-r--r--mysql-test/t/varbinary.test27
-rw-r--r--mysql-test/t/variables.test12
-rw-r--r--mysys/default.c2
-rw-r--r--mysys/errors.c2
-rw-r--r--mysys/mf_format.c2
-rw-r--r--mysys/mf_keycache.c3
-rw-r--r--mysys/my_lockmem.c2
-rw-r--r--mysys/my_malloc.c12
-rw-r--r--mysys/my_once.c2
-rw-r--r--mysys/my_thr_init.c2
-rw-r--r--mysys/my_write.c2
-rw-r--r--mysys/thr_alarm.c21
-rw-r--r--packaging/WiX/mysql_server.wxs.in7
-rw-r--r--packaging/rpm-uln/mysql.spec.sh29
-rw-r--r--plugin/audit_null/audit_null.c93
-rw-r--r--plugin/auth_examples/CMakeLists.txt2
-rw-r--r--plugin/auth_examples/auth_0x0100.c91
-rw-r--r--plugin/qc_info/CMakeLists.txt4
-rw-r--r--plugin/qc_info/qc_info.cc213
-rw-r--r--regex/my_regex.h2
-rw-r--r--regex/regcomp.c2
-rw-r--r--scripts/mysql_system_tables_data.sql15
-rw-r--r--sql-common/client.c17
-rw-r--r--sql/CMakeLists.txt14
-rw-r--r--sql/db.opt2
-rw-r--r--sql/event_db_repository.cc2
-rw-r--r--sql/filesort.cc5
-rw-r--r--sql/ha_partition.cc496
-rw-r--r--sql/ha_partition.h20
-rw-r--r--sql/handler.cc35
-rw-r--r--sql/handler.h3
-rw-r--r--sql/innodb_priv.h2
-rw-r--r--sql/item.cc74
-rw-r--r--sql/item.h135
-rw-r--r--sql/item_cmpfunc.cc9
-rw-r--r--sql/item_create.cc3
-rw-r--r--sql/item_func.cc49
-rw-r--r--sql/item_func.h26
-rw-r--r--sql/item_geofunc.cc29
-rw-r--r--sql/item_strfunc.cc82
-rw-r--r--sql/item_strfunc.h46
-rw-r--r--sql/item_subselect.cc25
-rw-r--r--sql/item_subselect.h5
-rw-r--r--sql/item_sum.cc61
-rw-r--r--sql/item_sum.h1
-rw-r--r--sql/item_timefunc.cc18
-rw-r--r--sql/item_timefunc.h1
-rw-r--r--sql/key.cc112
-rw-r--r--sql/key.h4
-rw-r--r--sql/log.cc29
-rw-r--r--sql/log_event.cc38
-rw-r--r--sql/log_event.h31
-rw-r--r--sql/multi_range_read.cc2
-rw-r--r--sql/mysql_install_db.cc16
-rw-r--r--sql/mysqld.cc90
-rw-r--r--sql/opt_range.cc145
-rw-r--r--sql/opt_range.h6
-rw-r--r--sql/opt_subselect.cc6
-rw-r--r--sql/opt_sum.cc2
-rw-r--r--sql/partition_element.h7
-rw-r--r--sql/partition_info.cc289
-rw-r--r--sql/partition_info.h17
-rw-r--r--sql/rpl_mi.h2
-rw-r--r--sql/rpl_rli.cc18
-rw-r--r--sql/rpl_utility.cc1
-rw-r--r--sql/set_var.cc19
-rw-r--r--sql/set_var.h10
-rw-r--r--sql/slave.cc35
-rw-r--r--sql/sp.cc2
-rw-r--r--sql/sp_head.cc9
-rw-r--r--sql/spatial.cc99
-rw-r--r--sql/spatial.h5
-rw-r--r--sql/sql_acl.cc50
-rw-r--r--sql/sql_admin.cc5
-rw-r--r--sql/sql_admin.h4
-rw-r--r--sql/sql_audit.cc32
-rw-r--r--sql/sql_audit.h91
-rw-r--r--sql/sql_base.cc5
-rw-r--r--sql/sql_binlog.cc2
-rw-r--r--sql/sql_cache.cc37
-rw-r--r--sql/sql_cache.h12
-rw-r--r--sql/sql_class.cc20
-rw-r--r--sql/sql_connect.cc2
-rw-r--r--sql/sql_const.h2
-rw-r--r--sql/sql_delete.cc2
-rw-r--r--sql/sql_error.cc8
-rw-r--r--sql/sql_error.h14
-rw-r--r--sql/sql_handler.cc10
-rw-r--r--sql/sql_insert.cc3
-rw-r--r--sql/sql_lex.cc3
-rw-r--r--sql/sql_lex.h3
-rw-r--r--sql/sql_parse.cc16
-rw-r--r--sql/sql_parse.h2
-rw-r--r--sql/sql_partition.cc221
-rw-r--r--sql/sql_partition.h6
-rw-r--r--sql/sql_partition_admin.cc4
-rw-r--r--sql/sql_plugin.cc4
-rw-r--r--sql/sql_plugin_compat.h65
-rw-r--r--sql/sql_prepare.cc9
-rw-r--r--sql/sql_repl.cc80
-rw-r--r--sql/sql_select.cc85
-rw-r--r--sql/sql_show.cc61
-rw-r--r--sql/sql_string.cc2
-rw-r--r--sql/sql_string.h10
-rw-r--r--sql/sql_table.cc23
-rw-r--r--sql/sql_time.cc3
-rw-r--r--sql/sql_trigger.cc3
-rw-r--r--sql/sql_view.cc12
-rw-r--r--sql/sql_yacc.yy63
-rw-r--r--sql/sys_vars.cc4
-rw-r--r--sql/sys_vars.h3
-rw-r--r--sql/table.cc4
-rw-r--r--sql/tztime.cc4
-rw-r--r--storage/csv/ha_tina.cc6
-rw-r--r--storage/federated/ha_federated.cc4
-rw-r--r--storage/federatedx/ha_federatedx.cc11
-rw-r--r--storage/innobase/btr/btr0cur.c43
-rw-r--r--storage/innobase/buf/buf0buf.c15
-rw-r--r--storage/innobase/buf/buf0rea.c10
-rw-r--r--storage/innobase/dict/dict0crea.c9
-rw-r--r--storage/innobase/dict/dict0dict.c16
-rw-r--r--storage/innobase/dyn/dyn0dyn.c8
-rw-r--r--storage/innobase/fil/fil0fil.c22
-rw-r--r--storage/innobase/handler/ha_innodb.cc160
-rw-r--r--storage/innobase/handler/i_s.cc3
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.c12
-rw-r--r--storage/innobase/include/db0err.h1
-rw-r--r--storage/innobase/include/dyn0dyn.h84
-rw-r--r--storage/innobase/include/dyn0dyn.ic141
-rw-r--r--storage/innobase/include/ha_prototypes.h11
-rw-r--r--storage/innobase/include/mtr0mtr.h10
-rw-r--r--storage/innobase/include/page0zip.ic6
-rw-r--r--storage/innobase/include/srv0srv.h5
-rw-r--r--storage/innobase/include/ut0dbg.h42
-rw-r--r--storage/innobase/lock/lock0lock.c5
-rw-r--r--storage/innobase/mtr/mtr0mtr.c149
-rw-r--r--storage/innobase/os/os0file.c71
-rw-r--r--storage/innobase/page/page0zip.c11
-rw-r--r--storage/innobase/plugin_exports2
-rw-r--r--storage/innobase/row/row0mysql.c2
-rw-r--r--storage/innobase/row/row0sel.c6
-rw-r--r--storage/innobase/srv/srv0srv.c44
-rw-r--r--storage/innobase/sync/sync0arr.c8
-rw-r--r--storage/innobase/sync/sync0sync.c4
-rw-r--r--storage/innobase/trx/trx0sys.c2
-rw-r--r--storage/innobase/ut/ut0dbg.c32
-rw-r--r--storage/innobase/ut/ut0ut.c2
-rw-r--r--storage/maria/ha_maria.cc35
-rw-r--r--storage/maria/ma_bitmap.c11
-rw-r--r--storage/maria/ma_blockrec.c75
-rw-r--r--storage/maria/ma_blockrec.h4
-rw-r--r--storage/maria/ma_check.c40
-rw-r--r--storage/maria/ma_checkpoint.c4
-rw-r--r--storage/maria/ma_delete.c1
-rw-r--r--storage/maria/ma_loghandler.c3
-rw-r--r--storage/maria/ma_open.c30
-rw-r--r--storage/maria/ma_pagecrc.c3
-rw-r--r--storage/maria/ma_recovery.c2
-rw-r--r--storage/maria/ma_rt_split.c12
-rw-r--r--storage/maria/ma_scan.c3
-rw-r--r--storage/maria/ma_search.c10
-rw-r--r--storage/maria/ma_state.c45
-rw-r--r--storage/maria/ma_state.h1
-rw-r--r--storage/maria/ma_test1.c3
-rw-r--r--storage/maria/ma_test2.c4
-rw-r--r--storage/maria/ma_test3.c2
-rw-r--r--storage/maria/ma_update.c1
-rw-r--r--storage/maria/ma_write.c1
-rw-r--r--storage/maria/maria_chk.c69
-rw-r--r--storage/maria/maria_def.h6
-rw-r--r--storage/maria/unittest/ma_test_recovery.expected384
-rw-r--r--storage/myisam/ha_myisam.cc2
-rw-r--r--storage/myisam/mi_write.c7
-rw-r--r--storage/myisam/myisampack.c3
-rw-r--r--storage/myisammrg/ha_myisammrg.cc16
-rw-r--r--storage/perfschema/pfs_engine_table.cc8
-rw-r--r--storage/perfschema/pfs_global.cc4
-rw-r--r--storage/perfschema/pfs_global.h4
-rw-r--r--storage/xtradb/btr/btr0btr.c38
-rw-r--r--storage/xtradb/btr/btr0cur.c111
-rw-r--r--storage/xtradb/btr/btr0pcur.c13
-rw-r--r--storage/xtradb/btr/btr0sea.c5
-rw-r--r--storage/xtradb/buf/buf0buf.c121
-rw-r--r--storage/xtradb/buf/buf0flu.c9
-rw-r--r--storage/xtradb/buf/buf0lru.c40
-rw-r--r--storage/xtradb/buf/buf0rea.c8
-rw-r--r--storage/xtradb/dict/dict0dict.c6
-rw-r--r--storage/xtradb/fil/fil0fil.c127
-rw-r--r--storage/xtradb/fsp/fsp0fsp.c45
-rw-r--r--storage/xtradb/handler/ha_innodb.cc88
-rw-r--r--storage/xtradb/handler/i_s.cc46
-rw-r--r--storage/xtradb/include/btr0btr.ic2
-rw-r--r--storage/xtradb/include/buf0buf.h1
-rw-r--r--storage/xtradb/include/buf0buf.ic9
-rw-r--r--storage/xtradb/include/buf0flu.ic2
-rw-r--r--storage/xtradb/include/buf0lru.h7
-rw-r--r--storage/xtradb/include/fut0fut.ic5
-rw-r--r--storage/xtradb/include/log0log.h16
-rw-r--r--storage/xtradb/include/log0log.ic23
-rw-r--r--storage/xtradb/include/mtr0mtr.h2
-rw-r--r--storage/xtradb/include/mtr0mtr.ic21
-rw-r--r--storage/xtradb/include/read0read.h33
-rw-r--r--storage/xtradb/include/read0read.ic41
-rw-r--r--storage/xtradb/include/srv0srv.h22
-rw-r--r--storage/xtradb/include/trx0purge.h1
-rw-r--r--storage/xtradb/include/trx0sys.h38
-rw-r--r--storage/xtradb/include/trx0sys.ic46
-rw-r--r--storage/xtradb/include/trx0trx.h43
-rw-r--r--storage/xtradb/include/trx0trx.ic8
-rw-r--r--storage/xtradb/include/univ.i2
-rw-r--r--storage/xtradb/lock/lock0lock.c22
-rw-r--r--storage/xtradb/log/log0log.c19
-rw-r--r--storage/xtradb/mtr/mtr0mtr.c39
-rw-r--r--storage/xtradb/os/os0file.c71
-rw-r--r--storage/xtradb/read/read0read.c188
-rw-r--r--storage/xtradb/row/row0ins.c9
-rw-r--r--storage/xtradb/row/row0merge.c6
-rw-r--r--storage/xtradb/row/row0sel.c23
-rw-r--r--storage/xtradb/row/row0vers.c6
-rw-r--r--storage/xtradb/srv/srv0srv.c8
-rw-r--r--storage/xtradb/sync/sync0sync.c4
-rw-r--r--storage/xtradb/trx/trx0purge.c16
-rw-r--r--storage/xtradb/trx/trx0roll.c8
-rw-r--r--storage/xtradb/trx/trx0sys.c11
-rw-r--r--storage/xtradb/trx/trx0trx.c243
-rw-r--r--strings/ctype-bin.c27
-rw-r--r--strings/ctype-mb.c51
-rw-r--r--strings/ctype-simple.c26
-rw-r--r--strings/ctype-uca.c24
-rw-r--r--strings/ctype-utf8.c38
-rw-r--r--strings/ctype.c2
-rw-r--r--strings/decimal.c6
-rw-r--r--support-files/MySQL-shared-compat.spec.sh2
-rw-r--r--support-files/compiler_warnings.supp2
-rw-r--r--support-files/mysql.spec.sh181
-rw-r--r--tests/mysql_client_test.c128
-rw-r--r--vio/viossl.c3
-rw-r--r--win/packaging/ca/CustomAction.cpp2
-rw-r--r--win/packaging/extra.wxs.in15
-rw-r--r--win/packaging/heidisql.cmake2
574 files changed, 10871 insertions, 3750 deletions
diff --git a/.bzrignore b/.bzrignore
index 32c14cab73d..8f44e83369a 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -1070,6 +1070,7 @@ vio/viotest.cpp
ylwrap
zlib/*.ds?
sql-bench/test-table-elimination
+sql/share/bulgarian
sql/share/czech
sql/share/danish
sql/share/dutch
@@ -1133,6 +1134,7 @@ cmd-line-utils/libedit/emacs.h
mysql-test/collections/default.release
support-files/plugins.files
client/mysql_plugin
+*.resource.txt
plugin/handler_socket/perl-Net-HandlerSocket/HandlerSocket.c
plugin/handler_socket/perl-Net-HandlerSocket/blib
plugin/handler_socket/perl-Net-HandlerSocket/pm_to_blib
@@ -1149,3 +1151,4 @@ sql/db.opt
./install_manifest_*.txt
typescript
mysql-test/collections/default.release.done
+sql/sql_yacc.hh
diff --git a/BUILD/FINISH.sh b/BUILD/FINISH.sh
index e29b6936849..86085fcc593 100644
--- a/BUILD/FINISH.sh
+++ b/BUILD/FINISH.sh
@@ -42,8 +42,7 @@ path=`dirname $0`
if [ -z "$just_clean" ]
then
commands="$commands
-CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" \
-$configure"
+CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" $configure"
fi
if [ -z "$just_configure" -a -z "$just_clean" ]
diff --git a/BUILD/compile-amd64-debug-max b/BUILD/compile-amd64-debug-max
index 273942df5f8..ebdf278b7d2 100755
--- a/BUILD/compile-amd64-debug-max
+++ b/BUILD/compile-amd64-debug-max
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2005 MySQL AB
+# Copyright (c) 2005, 2006 MySQL 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
diff --git a/BUILD/compile-amd64-max b/BUILD/compile-amd64-max
index c14f0d7104c..915129e1863 100755
--- a/BUILD/compile-amd64-max
+++ b/BUILD/compile-amd64-max
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2005 MySQL AB
+# Copyright (c) 2005, 2006 MySQL 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
diff --git a/BUILD/compile-darwin-mwcc b/BUILD/compile-darwin-mwcc
index 88747de77af..ad2990f2de1 100755
--- a/BUILD/compile-darwin-mwcc
+++ b/BUILD/compile-darwin-mwcc
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2005 MySQL AB
+# Copyright (c) 2005, 2006 MySQL 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
diff --git a/BUILD/compile-hpux11-parisc2-aCC b/BUILD/compile-hpux11-parisc2-aCC
index 5d0df465bc9..a4c9eb7abfa 100755
--- a/BUILD/compile-hpux11-parisc2-aCC
+++ b/BUILD/compile-hpux11-parisc2-aCC
@@ -1,6 +1,7 @@
#!/bin/sh
-# Copyright (C) 2004, 2005 MySQL AB
+# Copyright (c) 2004, 2005, 2007 MySQL 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
diff --git a/BUILD/compile-irix-mips64-mipspro b/BUILD/compile-irix-mips64-mipspro
index a8433c715ab..13df7ea2028 100755
--- a/BUILD/compile-irix-mips64-mipspro
+++ b/BUILD/compile-irix-mips64-mipspro
@@ -1,6 +1,7 @@
#!/bin/sh
-# Copyright (C) 2004, 2005 MySQL AB
+# Copyright (c) 2004, 2005, 2007 MySQL 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
diff --git a/BUILD/compile-ndb-autotest b/BUILD/compile-ndb-autotest
index e14855f1489..8002b4c5fad 100755
--- a/BUILD/compile-ndb-autotest
+++ b/BUILD/compile-ndb-autotest
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 2006 MySQL AB
+# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/BUILD/compile-pentium b/BUILD/compile-pentium
index 1da117541a4..fc3d070393d 100755
--- a/BUILD/compile-pentium
+++ b/BUILD/compile-pentium
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2000, 2002 MySQL AB
+# Copyright (c) 2000-2002, 2007 MySQL 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
diff --git a/BUILD/compile-pentium-debug-max-no-embedded b/BUILD/compile-pentium-debug-max-no-embedded
index 55aede7536f..e88542f5d24 100755
--- a/BUILD/compile-pentium-debug-max-no-embedded
+++ b/BUILD/compile-pentium-debug-max-no-embedded
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2004, 2005 MySQL AB
+# Copyright (c) 2004-2006 MySQL 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
diff --git a/BUILD/compile-pentium-debug-max-no-ndb b/BUILD/compile-pentium-debug-max-no-ndb
index cb8dbc7e364..3319307fc32 100755
--- a/BUILD/compile-pentium-debug-max-no-ndb
+++ b/BUILD/compile-pentium-debug-max-no-ndb
@@ -1,6 +1,6 @@
#! /bin/sh
-# Copyright (C) 2005, 2007 MySQL AB
+# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/BUILD/compile-pentium-max b/BUILD/compile-pentium-max
index 7bd063cd24a..77726735c79 100755
--- a/BUILD/compile-pentium-max
+++ b/BUILD/compile-pentium-max
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2001, 2005 MySQL AB
+# Copyright (c) 2001-2006 MySQL 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
diff --git a/BUILD/compile-ppc-debug b/BUILD/compile-ppc-debug
index 76b6bf65ce4..2ee49a9fda3 100755
--- a/BUILD/compile-ppc-debug
+++ b/BUILD/compile-ppc-debug
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2004 MySQL AB
+# Copyright (c) 2004, 2006 MySQL 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
diff --git a/BUILD/compile-ppc-debug-max b/BUILD/compile-ppc-debug-max
index b2c7ec18b3e..408f85f64e6 100755
--- a/BUILD/compile-ppc-debug-max
+++ b/BUILD/compile-ppc-debug-max
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2004, 2005 MySQL AB
+# Copyright (c) 2004-2006 MySQL 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
diff --git a/BUILD/compile-ppc-debug-max-no-ndb b/BUILD/compile-ppc-debug-max-no-ndb
index e77c517b302..958f6b09a11 100755
--- a/BUILD/compile-ppc-debug-max-no-ndb
+++ b/BUILD/compile-ppc-debug-max-no-ndb
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2005 MySQL AB
+# Copyright (c) 2005, 2006 MySQL 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
diff --git a/BUILD/compile-ppc-max b/BUILD/compile-ppc-max
index cd2ada87dd8..5aac6af60e9 100755
--- a/BUILD/compile-ppc-max
+++ b/BUILD/compile-ppc-max
@@ -1,6 +1,7 @@
#! /bin/sh
-# Copyright (C) 2004, 2005 MySQL AB
+# Copyright (c) 2004-2006 MySQL 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
diff --git a/BUILD/compile-solaris-amd64-debug b/BUILD/compile-solaris-amd64-debug
index 4d6d3f6fce4..770572bd1d7 100755
--- a/BUILD/compile-solaris-amd64-debug
+++ b/BUILD/compile-solaris-amd64-debug
@@ -20,7 +20,7 @@ path=`dirname $0`
extra_flags="$amd64_cflags -D__sun -m64 -mtune=athlon64 $debug_cflags"
extra_configs="$amd64_configs $debug_configs $max_configs --with-libevent"
-LDFLAGS="-lmtmalloc -R/usr/sfw/lib/64"
+LDFLAGS="-m64 -lmtmalloc -R/usr/sfw/lib/64"
export LDFLAGS
. "$path/FINISH.sh"
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10f32953f21..7b877e20a5e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -339,8 +339,8 @@ INCLUDE(cmake/abi_check.cmake)
INCLUDE(cmake/tags.cmake)
IF(WIN32)
- ADD_SUBDIRECTORY(win/packaging)
ADD_SUBDIRECTORY(win/upgrade_wizard)
+ ADD_SUBDIRECTORY(win/packaging)
ENDIF()
CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h)
diff --git a/VERSION b/VERSION
index 3c7056de633..a489ca65d7f 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5
-MYSQL_VERSION_PATCH=30
+MYSQL_VERSION_PATCH=31
MYSQL_VERSION_EXTRA=
diff --git a/client/client_priv.h b/client/client_priv.h
index 607bd3997c1..70a9d129433 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2001, 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
diff --git a/client/completion_hash.h b/client/completion_hash.h
index 8e1b2d6e453..50098e436b9 100644
--- a/client/completion_hash.h
+++ b/client/completion_hash.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000-2002 MySQL AB
+/* Copyright (c) 2000-2002, 2006 MySQL 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 Library General Public
diff --git a/client/echo.c b/client/echo.c
index e3d22edb3ae..cd61b23a826 100644
--- a/client/echo.c
+++ b/client/echo.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2007 MySQL 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
diff --git a/client/get_password.c b/client/get_password.c
index 09d307b5553..a73771b00d4 100644
--- a/client/get_password.c
+++ b/client/get_password.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2001, 2003, 2006, 2008 MySQL 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
diff --git a/client/mysql.cc b/client/mysql.cc
index ad792abc23f..3cd078ac1ce 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1635,7 +1635,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
{
switch(optid) {
case OPT_CHARSETS_DIR:
- strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir) - 1);
+ strmake_buf(mysql_charsets_dir, argument);
charsets_dir = mysql_charsets_dir;
break;
case OPT_DELIMITER:
@@ -1648,7 +1648,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
/* Check that delimiter does not contain a backslash */
if (!strstr(argument, "\\"))
{
- strmake(delimiter, argument, sizeof(delimiter) - 1);
+ strmake_buf(delimiter, argument);
}
else
{
@@ -1680,7 +1680,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (argument && strlen(argument))
{
default_pager_set= 1;
- strmake(pager, argument, sizeof(pager) - 1);
+ strmake_buf(pager, argument);
strmov(default_pager, pager);
}
else if (default_pager_set)
@@ -2961,7 +2961,7 @@ com_charset(String *buffer __attribute__((unused)), char *line)
{
char buff[256], *param;
CHARSET_INFO * new_cs;
- strmake(buff, line, sizeof(buff) - 1);
+ strmake_buf(buff, line);
param= get_arg(buff, 0);
if (!param || !*param)
{
@@ -3198,7 +3198,7 @@ static void init_tee(const char *file_name)
return;
}
OUTFILE = new_outfile;
- strmake(outfile, file_name, FN_REFLEN-1);
+ strmake_buf(outfile, file_name);
tee_fprintf(stdout, "Logging to file '%s'\n", file_name);
opt_outfile= 1;
return;
@@ -3827,7 +3827,7 @@ com_tee(String *buffer __attribute__((unused)),
/* eliminate the spaces before the parameters */
while (my_isspace(charset_info,*param))
param++;
- end= strmake(file_name, param, sizeof(file_name) - 1);
+ end= strmake_buf(file_name, param);
/* remove end space from command line */
while (end > file_name && (my_isspace(charset_info,end[-1]) ||
my_iscntrl(charset_info,end[-1])))
@@ -3888,7 +3888,7 @@ com_pager(String *buffer __attribute__((unused)),
}
else
{
- end= strmake(pager_name, param, sizeof(pager_name)-1);
+ end= strmake_buf(pager_name, param);
while (end > pager_name && (my_isspace(charset_info,end[-1]) ||
my_iscntrl(charset_info,end[-1])))
end--;
@@ -4101,7 +4101,7 @@ static int com_source(String *buffer __attribute__((unused)),
INFO_ERROR, 0);
while (my_isspace(charset_info,*param))
param++;
- end=strmake(source_name,param,sizeof(source_name)-1);
+ end=strmake_buf(source_name, param);
while (end > source_name && (my_isspace(charset_info,end[-1]) ||
my_iscntrl(charset_info,end[-1])))
end--;
@@ -4154,7 +4154,7 @@ com_delimiter(String *buffer __attribute__((unused)), char *line)
{
char buff[256], *tmp;
- strmake(buff, line, sizeof(buff) - 1);
+ strmake_buf(buff, line);
tmp= get_arg(buff, 0);
if (!tmp || !*tmp)
@@ -4171,7 +4171,7 @@ com_delimiter(String *buffer __attribute__((unused)), char *line)
return 0;
}
}
- strmake(delimiter, tmp, sizeof(delimiter) - 1);
+ strmake_buf(delimiter, tmp);
delimiter_length= (int)strlen(delimiter);
delimiter_str= delimiter;
return 0;
@@ -4185,7 +4185,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
int select_db;
bzero(buff, sizeof(buff));
- strmake(buff, line, sizeof(buff) - 1);
+ strmake_buf(buff, line);
tmp= get_arg(buff, 0);
if (!tmp || !*tmp)
{
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 2dae59af9ea..387413cc5aa 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -818,6 +818,88 @@ write_event_header_and_base64(Log_event *ev, FILE *result_file,
}
+static bool print_base64(PRINT_EVENT_INFO *print_event_info, Log_event *ev)
+{
+ /*
+ These events must be printed in base64 format, if printed.
+ base64 format requires a FD event to be safe, so if no FD
+ event has been printed, we give an error. Except if user
+ passed --short-form, because --short-form disables printing
+ row events.
+ */
+ if (!print_event_info->printed_fd_event && !short_form &&
+ opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
+ {
+ const char* type_str= ev->get_type_str();
+ if (opt_base64_output_mode == BASE64_OUTPUT_NEVER)
+ error("--base64-output=never specified, but binlog contains a "
+ "%s event which must be printed in base64.",
+ type_str);
+ else
+ error("malformed binlog: it does not contain any "
+ "Format_description_log_event. I now found a %s event, which "
+ "is not safe to process without a "
+ "Format_description_log_event.",
+ type_str);
+ return 1;
+ }
+ ev->print(result_file, print_event_info);
+ return print_event_info->head_cache.error == -1;
+}
+
+
+static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
+ ulong table_id, bool is_stmt_end)
+{
+ Table_map_log_event *ignored_map=
+ print_event_info->m_table_map_ignored.get_table(table_id);
+ bool skip_event= (ignored_map != NULL);
+
+ /*
+ end of statement check:
+ i) destroy/free ignored maps
+ ii) if skip event, flush cache now
+ */
+ if (is_stmt_end)
+ {
+ /*
+ Now is safe to clear ignored map (clear_tables will also
+ delete original table map events stored in the map).
+ */
+ if (print_event_info->m_table_map_ignored.count() > 0)
+ print_event_info->m_table_map_ignored.clear_tables();
+
+ /*
+ If there is a kept Annotate event and all corresponding
+ rbr-events were filtered away, the Annotate event was not
+ freed and it is just the time to do it.
+ */
+ free_annotate_event();
+
+ /*
+ One needs to take into account an event that gets
+ filtered but was last event in the statement. If this is
+ the case, previous rows events that were written into
+ IO_CACHEs still need to be copied from cache to
+ result_file (as it would happen in ev->print(...) if
+ event was not skipped).
+ */
+ if (skip_event)
+ {
+ if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) ||
+ copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file)))
+ return 1;
+ }
+ }
+
+ /* skip the event check */
+ if (skip_event)
+ return 0;
+
+ return print_base64(print_event_info, ev);
+}
+
+
/**
Print the given event, and either delete it or delegate the deletion
to someone else.
@@ -1130,86 +1212,29 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
error("Could not rewrite database name");
goto err;
}
+ if (print_base64(print_event_info, ev))
+ goto err;
+ break;
}
case WRITE_ROWS_EVENT:
case DELETE_ROWS_EVENT:
case UPDATE_ROWS_EVENT:
+ {
+ Rows_log_event *e= (Rows_log_event*) ev;
+ if (print_row_event(print_event_info, ev, e->get_table_id(),
+ e->get_flags(Rows_log_event::STMT_END_F)))
+ goto err;
+ break;
+ }
case PRE_GA_WRITE_ROWS_EVENT:
case PRE_GA_DELETE_ROWS_EVENT:
case PRE_GA_UPDATE_ROWS_EVENT:
{
- if (ev_type != TABLE_MAP_EVENT)
- {
- Rows_log_event *e= (Rows_log_event*) ev;
- Table_map_log_event *ignored_map=
- print_event_info->m_table_map_ignored.get_table(e->get_table_id());
- bool skip_event= (ignored_map != NULL);
-
- /*
- end of statement check:
- i) destroy/free ignored maps
- ii) if skip event, flush cache now
- */
- if (e->get_flags(Rows_log_event::STMT_END_F))
- {
- /*
- Now is safe to clear ignored map (clear_tables will also
- delete original table map events stored in the map).
- */
- if (print_event_info->m_table_map_ignored.count() > 0)
- print_event_info->m_table_map_ignored.clear_tables();
-
- /*
- If there is a kept Annotate event and all corresponding
- rbr-events were filtered away, the Annotate event was not
- freed and it is just the time to do it.
- */
- free_annotate_event();
-
- /*
- One needs to take into account an event that gets
- filtered but was last event in the statement. If this is
- the case, previous rows events that were written into
- IO_CACHEs still need to be copied from cache to
- result_file (as it would happen in ev->print(...) if
- event was not skipped).
- */
- if (skip_event)
- {
- if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) ||
- copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file)))
- goto err;
- }
- }
-
- /* skip the event check */
- if (skip_event)
- goto end;
- }
- /*
- These events must be printed in base64 format, if printed.
- base64 format requires a FD event to be safe, so if no FD
- event has been printed, we give an error. Except if user
- passed --short-form, because --short-form disables printing
- row events.
- */
- if (!print_event_info->printed_fd_event && !short_form &&
- opt_base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
- {
- const char* type_str= ev->get_type_str();
- if (opt_base64_output_mode == BASE64_OUTPUT_NEVER)
- error("--base64-output=never specified, but binlog contains a "
- "%s event which must be printed in base64.",
- type_str);
- else
- error("malformed binlog: it does not contain any "
- "Format_description_log_event. I now found a %s event, which "
- "is not safe to process without a "
- "Format_description_log_event.",
- type_str);
+ Old_rows_log_event *e= (Old_rows_log_event*) ev;
+ if (print_row_event(print_event_info, ev, e->get_table_id(),
+ e->get_flags(Old_rows_log_event::STMT_END_F)))
goto err;
- }
- /* FALL THROUGH */
+ break;
}
default:
print_skip_replication_statement(print_event_info, ev);
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 4218f2da62c..7462c7561f6 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -18,7 +18,7 @@
/* By Jani Tolonen, 2001-04-20, MySQL Development Team */
-#define CHECK_VERSION "2.7.0"
+#define CHECK_VERSION "2.7.1"
#include "client_priv.h"
#include <m_ctype.h>
@@ -32,6 +32,10 @@
#define EX_USAGE 1
#define EX_MYSQLERR 2
+/* ALTER instead of repair. */
+#define MAX_ALTER_STR_SIZE 128 * 1024
+#define KEY_PARTITIONING_CHANGED_STR "KEY () partitioning changed"
+
static MYSQL mysql_connection, *sock = 0;
static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_compress = 0, opt_databases = 0, opt_fast = 0,
@@ -47,7 +51,7 @@ static char *opt_password = 0, *current_user = 0,
*default_charset= 0, *current_host= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static int first_error = 0;
-DYNAMIC_ARRAY tables4repair, tables4rebuild;
+DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds;
static char *shared_memory_base_name=0;
static uint opt_protocol=0;
@@ -620,6 +624,17 @@ static int process_all_tables_in_db(char *database)
} /* process_all_tables_in_db */
+static int run_query(const char *query)
+{
+ if (mysql_query(sock, query))
+ {
+ fprintf(stderr, "Failed to %s\n", query);
+ fprintf(stderr, "Error: %s\n", mysql_error(sock));
+ return 1;
+ }
+ return 0;
+}
+
static int fix_table_storage_name(const char *name)
{
@@ -630,12 +645,7 @@ static int fix_table_storage_name(const char *name)
if (strncmp(name, "#mysql50#", 9))
DBUG_RETURN(1);
sprintf(qbuf, "RENAME TABLE `%s` TO `%s`", name, name + 9);
- if (mysql_query(sock, qbuf))
- {
- fprintf(stderr, "Failed to %s\n", qbuf);
- fprintf(stderr, "Error: %s\n", mysql_error(sock));
- rc= 1;
- }
+ rc= run_query(qbuf);
if (verbose)
printf("%-50s %s\n", name, rc ? "FAILED" : "OK");
DBUG_RETURN(rc);
@@ -650,12 +660,7 @@ static int fix_database_storage_name(const char *name)
if (strncmp(name, "#mysql50#", 9))
DBUG_RETURN(1);
sprintf(qbuf, "ALTER DATABASE `%s` UPGRADE DATA DIRECTORY NAME", name);
- if (mysql_query(sock, qbuf))
- {
- fprintf(stderr, "Failed to %s\n", qbuf);
- fprintf(stderr, "Error: %s\n", mysql_error(sock));
- rc= 1;
- }
+ rc= run_query(qbuf);
if (verbose)
printf("%-50s %s\n", name, rc ? "FAILED" : "OK");
DBUG_RETURN(rc);
@@ -726,15 +731,7 @@ static int use_db(char *database)
static int disable_binlog()
{
const char *stmt= "SET SQL_LOG_BIN=0";
- DBUG_ENTER("disable_binlog");
-
- if (mysql_query(sock, stmt))
- {
- fprintf(stderr, "Failed to %s\n", stmt);
- fprintf(stderr, "Error: %s\n", mysql_error(sock));
- DBUG_RETURN(1);
- }
- DBUG_RETURN(0);
+ return run_query(stmt);
}
static int handle_request_for_tables(char *tables, uint length)
@@ -821,6 +818,7 @@ static void print_result()
MYSQL_RES *res;
MYSQL_ROW row;
char prev[(NAME_LEN+9)*2+2];
+ char prev_alter[MAX_ALTER_STR_SIZE];
uint i;
my_bool found_error=0, table_rebuild=0;
DBUG_ENTER("print_result");
@@ -828,6 +826,7 @@ static void print_result()
res = mysql_use_result(sock);
prev[0] = '\0';
+ prev_alter[0]= 0;
for (i = 0; (row = mysql_fetch_row(res)); i++)
{
int changed = strcmp(prev, row[0]);
@@ -844,12 +843,18 @@ static void print_result()
strcmp(row[3],"OK"))
{
if (table_rebuild)
- insert_dynamic(&tables4rebuild, (uchar*) prev);
+ {
+ if (prev_alter[0])
+ insert_dynamic(&alter_table_cmds, (uchar*) prev_alter);
+ else
+ insert_dynamic(&tables4rebuild, (uchar*) prev);
+ }
else
insert_dynamic(&tables4repair, (uchar*) prev);
}
found_error=0;
table_rebuild=0;
+ prev_alter[0]= 0;
if (opt_silent)
continue;
}
@@ -866,11 +871,30 @@ static void print_result()
printf("%-50s %s", row[0], "Needs upgrade");
else
printf("%s\n%-9s: %s", row[0], row[2], row[3]);
- if (strcmp(row[2],"note"))
+ if (opt_auto_repair && strcmp(row[2],"note"))
{
- found_error=1;
- if (opt_auto_repair && strstr(row[3], "ALTER TABLE") != NULL)
+ const char *alter_txt= strstr(row[3], "ALTER TABLE");
+ found_error=1;
+ if (alter_txt)
+ {
table_rebuild=1;
+ if (!strncmp(row[3], KEY_PARTITIONING_CHANGED_STR,
+ strlen(KEY_PARTITIONING_CHANGED_STR)) &&
+ strstr(alter_txt, "PARTITION BY"))
+ {
+ if (strlen(alter_txt) >= MAX_ALTER_STR_SIZE)
+ {
+ printf("Error: Alter command too long (>= %d),"
+ " please do \"%s\" or dump/reload to fix it!\n",
+ MAX_ALTER_STR_SIZE,
+ alter_txt);
+ table_rebuild= 0;
+ prev_alter[0]= 0;
+ }
+ else
+ strcpy(prev_alter, alter_txt);
+ }
+ }
}
}
else
@@ -882,7 +906,12 @@ static void print_result()
if (found_error && opt_auto_repair && what_to_do != DO_REPAIR)
{
if (table_rebuild)
- insert_dynamic(&tables4rebuild, (uchar*) prev);
+ {
+ if (prev_alter[0])
+ insert_dynamic(&alter_table_cmds, (uchar*) prev_alter);
+ else
+ insert_dynamic(&tables4rebuild, (uchar*) prev);
+ }
else
insert_dynamic(&tables4repair, (uchar*) prev);
}
@@ -995,7 +1024,8 @@ int main(int argc, char **argv)
if (opt_auto_repair &&
(my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64) ||
- my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,64)))
+ my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,64) ||
+ my_init_dynamic_array(&alter_table_cmds, MAX_ALTER_STR_SIZE, 0, 1)))
goto end;
if (opt_alldbs)
@@ -1020,6 +1050,8 @@ int main(int argc, char **argv)
}
for (i = 0; i < tables4rebuild.elements ; i++)
rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i));
+ for (i = 0; i < alter_table_cmds.elements ; i++)
+ run_query((char*) dynamic_array_ptr(&alter_table_cmds, i));
}
ret= test(first_error);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 11bb74ae1d7..63e0dc04096 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
@@ -1914,9 +1914,7 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
const char *str_create)
{
uint i;
-#ifndef DBUG_OFF
- my_bool body_found= 0;
-#endif
+ my_bool body_found __attribute__((unused)) = 0;
char *create_stmt_ptr= NULL;
ulong create_stmt_len= 0;
MYSQL_FIELD *field;
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 8c6c1cb3408..2dde607a016 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -6335,8 +6335,7 @@ void do_delimiter(struct st_command* command)
if (!(*p))
die("Can't set empty delimiter");
- strmake(delimiter, p, sizeof(delimiter) - 1);
- delimiter_length= strlen(delimiter);
+ delimiter_length= strmake_buf(delimiter, p) - delimiter;
DBUG_PRINT("exit", ("delimiter: %s", delimiter));
command->last_argument= p + delimiter_length;
diff --git a/client/sql_string.cc.dontuse b/client/sql_string.cc.dontuse
index 64219886dd0..9679197b207 100644
--- a/client/sql_string.cc.dontuse
+++ b/client/sql_string.cc.dontuse
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2013, 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
@@ -691,7 +691,7 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length)
{
if (from->Alloced_length >= from_length)
return from;
- if (from->alloced || !to || from == to)
+ if ((from->alloced && (from->Alloced_length != 0)) || !to || from == to)
{
(void) from->realloc(from_length);
return from;
diff --git a/cmake/configure.pl b/cmake/configure.pl
index d39071b13bb..9f46a5668c9 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index d58b1095cf3..a111147dcb8 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -93,7 +93,7 @@ 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")
+SET(CPACK_RPM_client_PACKAGE_PROVIDES "MySQL-client mysql-client")
# this is a workaround for CPackRPM.cmake (as of 2.8.8) bug.
# If a package group does not specify OBSOLETES/REQUIRES the values of the
@@ -102,10 +102,10 @@ SET(CPACK_RPM_common_PACKAGE_OBSOLETES "MySQL-common")
SET(CPACK_RPM_common_PACKAGE_PROVIDES "MariaDB-common")
SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MySQL-devel MySQL-OurDelta-devel")
-SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MariaDB-devel MySQL-devel mysql-devel")
+SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MySQL-devel mysql-devel")
-SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB mysql mysql-server MySQL-server MySQL-OurDelta-server")
-SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql(x86-32) mysql(x86-64) mysql-server")
+SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB MySQL mysql-server MySQL-server MySQL-OurDelta-server")
+SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MySQL MySQL-server msqlormysql mysql-server")
SET(CPACK_RPM_server_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} galera")
SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)
SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh)
@@ -113,12 +113,30 @@ SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/
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 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_PACKAGE_PROVIDES "MySQL-shared mysql-shared")
+
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)
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")
+SET(CPACK_RPM_test_PACKAGE_PROVIDES "MySQL-test mysql-test")
+
+# Argh! Different distributions call packages differently, to be a drop-in replacement
+# we have to fake distribution-speficic dependencies
+MACRO(ALTERNATIVE_NAME real alt)
+ SET(p "CPACK_RPM_${real}_PACKAGE_PROVIDES")
+ SET(${p} "${${p}} ${alt} ${alt}(x86-32) ${alt}(x86-64) config(${alt})")
+ENDMACRO(ALTERNATIVE_NAME)
+
+IF(RPM MATCHES "(rhel|centos)5")
+ ALTERNATIVE_NAME("shared" "mysql")
+ELSEIF(RPM MATCHES "(rhel|centos)6")
+ ALTERNATIVE_NAME("client" "mysql")
+ ALTERNATIVE_NAME("shared" "mysql-libs")
+ELSEIF(RPM MATCHES "fedora")
+ ALTERNATIVE_NAME("client" "mysql")
+ ALTERNATIVE_NAME("shared" "mysql-libs")
+ENDIF()
# 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_cases) perl(mtr_io.pl) perl(mtr_match) perl(mtr_misc.pl) perl(mtr_report) perl(mtr_results) perl(mtr_unique)")
diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake.in
index 9888a7df7a2..ce638b14e39 100644
--- a/cmake/create_initial_db.cmake.in
+++ b/cmake/create_initial_db.cmake.in
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in
index 1b347e41836..ada27c36926 100644
--- a/cmake/make_dist.cmake.in
+++ b/cmake/make_dist.cmake.in
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake
index 021e7ab4ae8..1d49db07df2 100644
--- a/cmake/mysql_version.cmake
+++ b/cmake/mysql_version.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake
index 108e06cf7b0..36d7ade66a7 100644
--- a/cmake/os/Linux.cmake
+++ b/cmake/os/Linux.cmake
@@ -47,9 +47,3 @@ IF(HAVE_DECL_SHM_HUGETLB)
SET(HAVE_LARGE_PAGE_OPTION 1)
ENDIF()
-IF(CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR MATCHES "86")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
- SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -march=i686")
-ENDIF()
-
diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake
index df6822493cb..b4125e873d6 100644
--- a/cmake/package_name.cmake
+++ b/cmake/package_name.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 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
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 2978fb1a13c..b06d6ac9ca3 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index cabff530b47..ca950229129 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake
index 3ede3aba228..83597357aba 100644
--- a/cmake/zlib.cmake
+++ b/cmake/zlib.cmake
@@ -57,13 +57,17 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
INCLUDE(CheckFunctionExists)
SET(CMAKE_REQUIRED_LIBRARIES z)
CHECK_FUNCTION_EXISTS(crc32 HAVE_CRC32)
+ CHECK_FUNCTION_EXISTS(compressBound HAVE_COMPRESSBOUND)
+ CHECK_FUNCTION_EXISTS(deflateBound HAVE_DEFLATEBOUND)
SET(CMAKE_REQUIRED_LIBRARIES)
- IF(HAVE_CRC32)
+ IF(HAVE_CRC32 AND HAVE_COMPRESSBOUND AND HAVE_DEFLATEBOUND)
SET(ZLIB_LIBRARY z CACHE INTERNAL "System zlib library")
- SET(WITH_ZLIB "system" CACHE STRING "Which zlib to use (possible values are 'bundled' or 'system')")
+ SET(WITH_ZLIB "system" CACHE STRING
+ "Which zlib to use (possible values are 'bundled' or 'system')")
SET(ZLIB_SOURCES "")
ELSE()
SET(ZLIB_FOUND FALSE CACHE INTERNAL "Zlib found but not usable")
+ MESSAGE(STATUS "system zlib found but not usable")
ENDIF()
ENDIF()
IF(NOT ZLIB_FOUND)
diff --git a/configure.cmake b/configure.cmake
index 812baf2c35e..db2779a2bf9 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -1,5 +1,5 @@
-# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -959,12 +959,15 @@ CHECK_CXX_SOURCE_COMPILES("
# they are silently ignored. For those OS's we will not attempt
# to use SO_SNDTIMEO and SO_RCVTIMEO even if it is said to work.
# See Bug#29093 for the problem with SO_SND/RCVTIMEO on HP/UX.
+# Solaris11 has a similar problem
# To use alarm is simple, simply avoid setting anything.
IF(WIN32)
SET(HAVE_SOCKET_TIMEOUT 1)
ELSEIF(CMAKE_SYSTEM MATCHES "HP-UX")
SET(HAVE_SOCKET_TIMEOUT 0)
+ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ SET(HAVE_SOCKET_TIMEOUT 0)
ELSEIF(CMAKE_CROSSCOMPILING)
SET(HAVE_SOCKET_TIMEOUT 0)
ELSE()
diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index 339d27bff00..5376ed58974 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -21,8 +21,8 @@ source ./VERSION
UPSTREAM="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}"
RELEASE_EXTRA=""
-RELEASE_NAME=mariadb
-PATCHLEVEL=""
+RELEASE_NAME=""
+PATCHLEVEL="+maria"
LOGSTRING="MariaDB build"
# Look up distro-version specific stuff.
diff --git a/debian/dist/Debian/control b/debian/dist/Debian/control
index 3a5510650d1..d2962c0cd7a 100644
--- a/debian/dist/Debian/control
+++ b/debian/dist/Debian/control
@@ -39,7 +39,7 @@ Description: MariaDB database server with Galera cluster binaries
Package: mariadb-galera-server
Section: database
Architecture: all
-Depends: mariadb-galera-server-5.5, ${misc:Depends}
+Depends: mariadb-galera-server-5.5 (= ${source:Version}), ${misc:Depends}
Description: MariaDB database server with Galera cluster
(metapackage depending on the latest version)
This is an empty package that depends on the current "best" version of
@@ -52,3 +52,22 @@ Description: MariaDB database server with Galera cluster
server. SQL (Structured Query Language) is the most popular database query
language in the world. The main goals of MariaDB are speed, robustness and
ease of use.
+
+Package: mariadb-client
+Section: database
+Architecture: all
+Depends: mariadb-client-5.5 (= ${source:Version}), ${misc:Depends}
+Description: MariaDB database client (metapackage depending on the latest version)
+ This is an empty package that depends on the current "best" version of
+ mariadb-client (currently mariadb-client-5.5), as determined by the MariaDB
+ maintainers. Install this package if in doubt about which MariaDB version
+ you want, as this is the one we consider to be in the best shape.
+
+Package: mariadb-test
+Section: database
+Architecture: all
+Depends: mariadb-test-5.5 (= ${source:Version})
+Description: MariaDB database regression test suite (metapackage depending on the latest version)
+ This is an empty package that depends on the current "best" version of
+ mariadb-test (currently mariadb-test-5.5), as determined by the MariaDB
+ maintainers.
diff --git a/debian/dist/Ubuntu/control b/debian/dist/Ubuntu/control
index 8ad7471815c..d1cf8531932 100644
--- a/debian/dist/Ubuntu/control
+++ b/debian/dist/Ubuntu/control
@@ -39,7 +39,7 @@ Description: MariaDB database server with Galera cluster binaries
Package: mariadb-galera-server
Section: database
Architecture: all
-Depends: mariadb-galera-server-5.5, ${misc:Depends}
+Depends: mariadb-galera-server-5.5 (= ${source:Version}), ${misc:Depends}
Description: MariaDB database with Galera cluster server (metapackage depending on the latest version)
This is an empty package that depends on the current "best" version of
mariadb-server (currently mariadb-server-5.5), as determined by the MariaDB
@@ -52,3 +52,21 @@ Description: MariaDB database with Galera cluster server (metapackage depending
language in the world. The main goals of MariaDB are speed, robustness and
ease of use.
+Package: mariadb-client
+Section: database
+Architecture: all
+Depends: mariadb-client-5.5 (= ${source:Version}), ${misc:Depends}
+Description: MariaDB database client (metapackage depending on the latest version)
+ This is an empty package that depends on the current "best" version of
+ mariadb-client (currently mariadb-client-5.5), as determined by the MariaDB
+ maintainers. Install this package if in doubt about which MariaDB version
+ you want, as this is the one we consider to be in the best shape.
+
+Package: mariadb-test
+Section: database
+Architecture: all
+Depends: mariadb-test-5.5 (= ${source:Version})
+Description: MariaDB database regression test suite (metapackage depending on the latest version)
+ This is an empty package that depends on the current "best" version of
+ mariadb-test (currently mariadb-test-5.5), as determined by the MariaDB
+ maintainers.
diff --git a/extra/charset2html.c b/extra/charset2html.c
index 8dcfa0c8990..834f54f125b 100644
--- a/extra/charset2html.c
+++ b/extra/charset2html.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2002-2004, 2007, 2008 MySQL 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
diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt
index 46e1abbc08e..b8432f06ac6 100644
--- a/extra/yassl/CMakeLists.txt
+++ b/extra/yassl/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
diff --git a/extra/yassl/examples/client/client.cpp b/extra/yassl/examples/client/client.cpp
index d05c31d4d63..fc05b66aaf7 100644
--- a/extra/yassl/examples/client/client.cpp
+++ b/extra/yassl/examples/client/client.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2006 MySQL AB
+ Copyright (c) 2006, 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
diff --git a/extra/yassl/examples/echoclient/echoclient.cpp b/extra/yassl/examples/echoclient/echoclient.cpp
index c2b8ff66ac9..fabcfbec29e 100644
--- a/extra/yassl/examples/echoclient/echoclient.cpp
+++ b/extra/yassl/examples/echoclient/echoclient.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2006 MySQL AB
+ Copyright (c) 2006, 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
diff --git a/extra/yassl/examples/echoserver/echoserver.cpp b/extra/yassl/examples/echoserver/echoserver.cpp
index bd044e70e8b..82696568ace 100644
--- a/extra/yassl/examples/echoserver/echoserver.cpp
+++ b/extra/yassl/examples/echoserver/echoserver.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2006 MySQL AB
+ Copyright (c) 2006, 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
diff --git a/extra/yassl/examples/server/server.cpp b/extra/yassl/examples/server/server.cpp
index 3fac40e88c4..173ce8fb548 100644
--- a/extra/yassl/examples/server/server.cpp
+++ b/extra/yassl/examples/server/server.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2006 MySQL AB
+ Copyright (c) 2006, 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
diff --git a/extra/yassl/include/buffer.hpp b/extra/yassl/include/buffer.hpp
index 2d7817a7ca2..27f71199093 100644
--- a/extra/yassl/include/buffer.hpp
+++ b/extra/yassl/include/buffer.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/include/cert_wrapper.hpp b/extra/yassl/include/cert_wrapper.hpp
index d07e5b627b0..8be0f3b3e6a 100644
--- a/extra/yassl/include/cert_wrapper.hpp
+++ b/extra/yassl/include/cert_wrapper.hpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2008 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/include/lock.hpp b/extra/yassl/include/lock.hpp
index 487bedfcc70..5273f92f151 100644
--- a/extra/yassl/include/lock.hpp
+++ b/extra/yassl/include/lock.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/include/openssl/prefix_ssl.h b/extra/yassl/include/openssl/prefix_ssl.h
index 024cb0a9aff..22b3f4de34b 100644
--- a/extra/yassl/include/openssl/prefix_ssl.h
+++ b/extra/yassl/include/openssl/prefix_ssl.h
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2006, 2007 MySQL AB, 2008 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2006, 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
diff --git a/extra/yassl/include/socket_wrapper.hpp b/extra/yassl/include/socket_wrapper.hpp
index 2372e64e56c..c9f1e3af09c 100644
--- a/extra/yassl/include/socket_wrapper.hpp
+++ b/extra/yassl/include/socket_wrapper.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/include/yassl_error.hpp b/extra/yassl/include/yassl_error.hpp
index 8efc7f72e87..a4b29ae2e8c 100644
--- a/extra/yassl/include/yassl_error.hpp
+++ b/extra/yassl/include/yassl_error.hpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2010 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
@@ -53,7 +52,8 @@ enum YasslError {
badVersion_error = 117,
compress_error = 118,
decompress_error = 119,
- pms_version_error = 120
+ pms_version_error = 120,
+ sanityCipher_error = 121
// !!!! add error message to .cpp !!!!
diff --git a/extra/yassl/include/yassl_imp.hpp b/extra/yassl/include/yassl_imp.hpp
index 04e85c16a04..a952da0d3d9 100644
--- a/extra/yassl/include/yassl_imp.hpp
+++ b/extra/yassl/include/yassl_imp.hpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2008 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp
index e5ee00bc21c..f93727aa9f3 100644
--- a/extra/yassl/include/yassl_int.hpp
+++ b/extra/yassl/include/yassl_int.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/include/yassl_types.hpp b/extra/yassl/include/yassl_types.hpp
index a9e22833eb1..6a8c3f6c075 100644
--- a/extra/yassl/include/yassl_types.hpp
+++ b/extra/yassl/include/yassl_types.hpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2008 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
@@ -220,7 +219,11 @@ const int DEFAULT_TIMEOUT = 500; // Default Session timeout in seconds
const int MAX_RECORD_SIZE = 16384; // 2^14, max size by standard
const int COMPRESS_EXTRA = 1024; // extra compression possible addition
const int SESSION_FLUSH_COUNT = 256; // when to flush session cache
-
+const int MAX_PAD_SIZE = 256; // max TLS padding size
+const int COMPRESS_CONSTANT = 13; // compression calculation constant
+const int COMPRESS_UPPER = 55; // compression calculation numerator
+const int COMPRESS_LOWER = 64; // compression calculation denominator
+const int COMPRESS_DUMMY_SIZE = 64; // compression dummy round size
typedef uint8 Cipher; // first byte is always 0x00 for SSLv3 & TLS
diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp
index d885c953207..ec35f1760e7 100644
--- a/extra/yassl/src/buffer.cpp
+++ b/extra/yassl/src/buffer.cpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/src/cert_wrapper.cpp b/extra/yassl/src/cert_wrapper.cpp
index 917cfa1a8fb..639f0996d7e 100644
--- a/extra/yassl/src/cert_wrapper.cpp
+++ b/extra/yassl/src/cert_wrapper.cpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp
index afb492c83c5..03e69ee1520 100644
--- a/extra/yassl/src/crypto_wrapper.cpp
+++ b/extra/yassl/src/crypto_wrapper.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/src/handshake.cpp b/extra/yassl/src/handshake.cpp
index c7dbaf86071..d0f6827e862 100644
--- a/extra/yassl/src/handshake.cpp
+++ b/extra/yassl/src/handshake.cpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2008 MySQL AB, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
@@ -221,12 +220,45 @@ void buildSHA(SSL& ssl, Finished& fin, const opaque* sender)
}
+// sanity checks on encrypted message size
+static int sanity_check_message(SSL& ssl, uint msgSz)
+{
+ uint minSz = 0;
+
+ if (ssl.getSecurity().get_parms().cipher_type_ == block) {
+ uint blockSz = ssl.getCrypto().get_cipher().get_blockSize();
+ if (msgSz % blockSz)
+ return -1;
+
+ minSz = ssl.getSecurity().get_parms().hash_size_ + 1; // pad byte too
+ if (blockSz > minSz)
+ minSz = blockSz;
+
+ if (ssl.isTLSv1_1())
+ minSz += blockSz; // explicit IV
+ }
+ else { // stream
+ minSz = ssl.getSecurity().get_parms().hash_size_;
+ }
+
+ if (msgSz < minSz)
+ return -1;
+
+ return 0;
+}
+
+
// decrypt input message in place, store size in case needed later
void decrypt_message(SSL& ssl, input_buffer& input, uint sz)
{
input_buffer plain(sz);
opaque* cipher = input.get_buffer() + input.get_current();
+ if (sanity_check_message(ssl, sz) != 0) {
+ ssl.SetError(sanityCipher_error);
+ return;
+ }
+
ssl.useCrypto().use_cipher().decrypt(plain.get_buffer(), cipher, sz);
memcpy(cipher, plain.get_buffer(), sz);
ssl.useSecurity().use_parms().encrypt_size_ = sz;
@@ -774,6 +806,8 @@ int DoProcessReply(SSL& ssl)
return 0;
}
decrypt_message(ssl, buffer, hdr.length_);
+ if (ssl.GetError())
+ return 0;
}
mySTL::auto_ptr<Message> msg(mf.CreateObject(hdr.type_));
diff --git a/extra/yassl/src/lock.cpp b/extra/yassl/src/lock.cpp
index d603440757f..c74ea1c6b76 100644
--- a/extra/yassl/src/lock.cpp
+++ b/extra/yassl/src/lock.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/src/make.bat b/extra/yassl/src/make.bat
index cccd11dbd17..42f49ee4c0a 100755
--- a/extra/yassl/src/make.bat
+++ b/extra/yassl/src/make.bat
@@ -1,4 +1,4 @@
-REM Copyright (C) 2006, 2007 MySQL AB
+REM Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
REM
REM This program is free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
diff --git a/extra/yassl/src/socket_wrapper.cpp b/extra/yassl/src/socket_wrapper.cpp
index d88df13c08e..7afd4d41d1d 100644
--- a/extra/yassl/src/socket_wrapper.cpp
+++ b/extra/yassl/src/socket_wrapper.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp
index 6c839bc2f79..becc4e5ba83 100644
--- a/extra/yassl/src/ssl.cpp
+++ b/extra/yassl/src/ssl.cpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2008-2010 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/src/template_instnt.cpp b/extra/yassl/src/template_instnt.cpp
index fe3a251b865..f0f0f095f99 100644
--- a/extra/yassl/src/template_instnt.cpp
+++ b/extra/yassl/src/template_instnt.cpp
@@ -1,5 +1,6 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ Copyright (c) 2000-2008 MySQL 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
diff --git a/extra/yassl/src/yassl.cpp b/extra/yassl/src/yassl.cpp
index 99a1da5371b..b6b9a87e09a 100644
--- a/extra/yassl/src/yassl.cpp
+++ b/extra/yassl/src/yassl.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp
index f48fbdc925e..2d42e82ab4a 100644
--- a/extra/yassl/src/yassl_error.cpp
+++ b/extra/yassl/src/yassl_error.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2011, Oracle and/or its affiliates
+ Copyright (c) 2005, 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
@@ -144,6 +144,10 @@ void SetErrorString(YasslError error, char* buffer)
strncpy(buffer, "bad PreMasterSecret version error", max);
break;
+ case sanityCipher_error :
+ strncpy(buffer, "sanity check on cipher text size error", max);
+ break;
+
// openssl errors
case SSL_ERROR_WANT_READ :
strncpy(buffer, "the read operation would block", max);
diff --git a/extra/yassl/src/yassl_imp.cpp b/extra/yassl/src/yassl_imp.cpp
index c0ef23a4e94..d943775101b 100644
--- a/extra/yassl/src/yassl_imp.cpp
+++ b/extra/yassl/src/yassl_imp.cpp
@@ -972,30 +972,193 @@ output_buffer& operator<<(output_buffer& output, const Data& data)
}
+// check all bytes for equality
+static int constant_compare(const byte* a, const byte* b, int len)
+{
+ int good = 0;
+ int bad = 0;
+
+ for (int i = 0; i < len; i++) {
+ if (a[i] == b[i])
+ good++;
+ else
+ bad++;
+ }
+
+ if (good == len)
+ return 0;
+ else
+ return 0 - bad; // failure
+}
+
+
+// check bytes for pad value
+static int pad_check(const byte* input, byte pad, int len)
+{
+ int good = 0;
+ int bad = 0;
+
+ for (int i = 0; i < len; i++) {
+ if (input[i] == pad)
+ good++;
+ else
+ bad++;
+ }
+
+ if (good == len)
+ return 0;
+ else
+ return 0 - bad; // failure
+}
+
+
+// get number of compression rounds
+static inline int get_rounds(int pLen, int padLen, int t)
+{
+ int roundL1 = 1; // round ups
+ int roundL2 = 1;
+
+ int L1 = COMPRESS_CONSTANT + pLen - t;
+ int L2 = COMPRESS_CONSTANT + pLen - padLen - 1 - t;
+
+ L1 -= COMPRESS_UPPER;
+ L2 -= COMPRESS_UPPER;
+
+ if ( (L1 % COMPRESS_LOWER) == 0)
+ roundL1 = 0;
+ if ( (L2 % COMPRESS_LOWER) == 0)
+ roundL2 = 0;
+
+ L1 /= COMPRESS_LOWER;
+ L2 /= COMPRESS_LOWER;
+
+ L1 += roundL1;
+ L2 += roundL2;
+
+ return L1 - L2;
+}
+
+
+// do compression rounds on dummy data
+static inline void compress_rounds(SSL& ssl, int rounds, const byte* dummy)
+{
+ if (rounds) {
+ Digest* digest = NULL;
+
+ MACAlgorithm ma = ssl.getSecurity().get_parms().mac_algorithm_;
+ if (ma == sha)
+ digest = NEW_YS SHA;
+ else if (ma == md5)
+ digest = NEW_YS MD5;
+ else if (ma == rmd)
+ digest = NEW_YS RMD;
+ else
+ return;
+
+ for (int i = 0; i < rounds; i++)
+ digest->update(dummy, COMPRESS_LOWER);
+
+ ysDelete(digest);
+ }
+}
+
+
+// timing resistant pad verification
+static int timing_verify(SSL& ssl, const byte* input, int padLen, int t,
+ int pLen)
+{
+ byte verify[SHA_LEN];
+ byte dummy[MAX_PAD_SIZE];
+
+ memset(dummy, 1, sizeof(dummy));
+
+ if ( (t + padLen + 1) > pLen) {
+ pad_check(dummy, (byte)padLen, MAX_PAD_SIZE);
+ if (ssl.isTLS())
+ TLS_hmac(ssl, verify, input, pLen - t, application_data, 1);
+ else
+ hmac(ssl, verify, input, pLen - t, application_data, 1);
+ constant_compare(verify, input + pLen - t, t);
+
+ return -1;
+ }
+
+ if (pad_check(input + pLen - (padLen + 1), (byte)padLen, padLen + 1) != 0) {
+ pad_check(dummy, (byte)padLen, MAX_PAD_SIZE - padLen - 1);
+ if (ssl.isTLS())
+ TLS_hmac(ssl, verify, input, pLen - t, application_data, 1);
+ else
+ hmac(ssl, verify, input, pLen - t, application_data, 1);
+ constant_compare(verify, input + pLen - t, t);
+
+ return -1;
+ }
+
+ pad_check(dummy, (byte)padLen, MAX_PAD_SIZE - padLen - 1);
+ if (ssl.isTLS())
+ TLS_hmac(ssl, verify, input, pLen - padLen - 1 - t, application_data,1);
+ else
+ hmac(ssl, verify, input, pLen - padLen - 1 - t, application_data, 1);
+
+ compress_rounds(ssl, get_rounds(pLen, padLen, t), dummy);
+
+ if (constant_compare(verify, input + (pLen - padLen - 1 - t), t) != 0)
+ return -1;
+
+ return 0;
+}
+
+
// Process handler for Data
void Data::Process(input_buffer& input, SSL& ssl)
{
int msgSz = ssl.getSecurity().get_parms().encrypt_size_;
int pad = 0, padSz = 0;
int ivExtra = 0;
+ int digestSz = ssl.getCrypto().get_digest().get_digestSize();
+ const byte* rawData = input.get_buffer() + input.get_current();
+ opaque verify[SHA_LEN];
if (ssl.getSecurity().get_parms().cipher_type_ == block) {
if (ssl.isTLSv1_1()) // IV
ivExtra = ssl.getCrypto().get_cipher().get_blockSize();
pad = *(input.get_buffer() + input.get_current() + msgSz -ivExtra - 1);
padSz = 1;
+
+ if (ssl.isTLS()) {
+ if (timing_verify(ssl, rawData, pad,digestSz, msgSz-ivExtra) != 0) {
+ ssl.SetError(verify_error);
+ return;
+ }
+ }
+ else { // SSLv3, some don't do this padding right
+ int sz3 = msgSz - digestSz - pad - 1;
+ hmac(ssl, verify, rawData, sz3, application_data, true);
+ if (constant_compare(verify, rawData + sz3, digestSz) != 0) {
+ ssl.SetError(verify_error);
+ return;
+ }
+ }
}
- int digestSz = ssl.getCrypto().get_digest().get_digestSize();
+ else { // stream
+ int streamSz = msgSz - digestSz;
+ if (ssl.isTLS())
+ TLS_hmac(ssl, verify, rawData, streamSz, application_data, true);
+ else
+ hmac(ssl, verify, rawData, streamSz, application_data, true);
+ if (constant_compare(verify, rawData + streamSz, digestSz) != 0) {
+ ssl.SetError(verify_error);
+ return;
+ }
+ }
+
int dataSz = msgSz - ivExtra - digestSz - pad - padSz;
- opaque verify[SHA_LEN];
if (dataSz < 0) {
ssl.SetError(bad_input);
return;
}
- const byte* rawData = input.get_buffer() + input.get_current();
-
// read data
if (dataSz) { // could be compressed
if (ssl.CompressionOn()) {
@@ -1013,27 +1176,10 @@ void Data::Process(input_buffer& input, SSL& ssl)
input.read(data->get_buffer(), dataSz);
data->add_size(dataSz);
}
-
- if (ssl.isTLS())
- TLS_hmac(ssl, verify, rawData, dataSz, application_data, true);
- else
- hmac(ssl, verify, rawData, dataSz, application_data, true);
}
- // read mac and skip fill
- opaque mac[SHA_LEN];
- input.read(mac, digestSz);
- input.set_current(input.get_current() + pad + padSz);
-
- // verify
- if (dataSz) {
- if (memcmp(mac, verify, digestSz)) {
- ssl.SetError(verify_error);
- return;
- }
- }
- else
- ssl.get_SEQIncrement(true); // even though no data, increment verify
+ // advance past mac and fill
+ input.set_current(input.get_current() + digestSz + pad + padSz);
}
diff --git a/extra/yassl/taocrypt/benchmark/benchmark.cpp b/extra/yassl/taocrypt/benchmark/benchmark.cpp
index 6ed7351a56b..834f340b651 100644
--- a/extra/yassl/taocrypt/benchmark/benchmark.cpp
+++ b/extra/yassl/taocrypt/benchmark/benchmark.cpp
@@ -1,3 +1,21 @@
+/*
+ Copyright (c) 2006, 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
+ 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.
+*/
+
// benchmark.cpp
// TaoCrypt benchmark
diff --git a/extra/yassl/taocrypt/benchmark/make.bat b/extra/yassl/taocrypt/benchmark/make.bat
index 1457521bce9..e9156e0c8af 100755
--- a/extra/yassl/taocrypt/benchmark/make.bat
+++ b/extra/yassl/taocrypt/benchmark/make.bat
@@ -1,4 +1,4 @@
-REM Copyright (C) 2006, 2007 MySQL AB
+REM Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
REM
REM This program is free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
diff --git a/extra/yassl/taocrypt/include/aes.hpp b/extra/yassl/taocrypt/include/aes.hpp
index e2041fc9350..01763033156 100644
--- a/extra/yassl/taocrypt/include/aes.hpp
+++ b/extra/yassl/taocrypt/include/aes.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/include/asn.hpp b/extra/yassl/taocrypt/include/asn.hpp
index c20387d86c7..fee2f26fb73 100644
--- a/extra/yassl/taocrypt/include/asn.hpp
+++ b/extra/yassl/taocrypt/include/asn.hpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2010 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp
index 77017e9d5e4..601d9dbce57 100644
--- a/extra/yassl/taocrypt/include/block.hpp
+++ b/extra/yassl/taocrypt/include/block.hpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/include/blowfish.hpp b/extra/yassl/taocrypt/include/blowfish.hpp
index e868872d3cf..347cf05de4b 100644
--- a/extra/yassl/taocrypt/include/blowfish.hpp
+++ b/extra/yassl/taocrypt/include/blowfish.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006, 2010, Oracle and/or its affiliates
+ Copyright (c) 2006, 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
diff --git a/extra/yassl/taocrypt/include/des.hpp b/extra/yassl/taocrypt/include/des.hpp
index 2bc41fc2628..d88e9ef2f46 100644
--- a/extra/yassl/taocrypt/include/des.hpp
+++ b/extra/yassl/taocrypt/include/des.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/include/hash.hpp b/extra/yassl/taocrypt/include/hash.hpp
index 4ebc82e073d..4d2f7dd35a1 100644
--- a/extra/yassl/taocrypt/include/hash.hpp
+++ b/extra/yassl/taocrypt/include/hash.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/include/hc128.hpp b/extra/yassl/taocrypt/include/hc128.hpp
index d1cf5f075f2..0449b28d8c7 100644
--- a/extra/yassl/taocrypt/include/hc128.hpp
+++ b/extra/yassl/taocrypt/include/hc128.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/include/integer.hpp b/extra/yassl/taocrypt/include/integer.hpp
index 256573cf622..e1a2ed5f426 100644
--- a/extra/yassl/taocrypt/include/integer.hpp
+++ b/extra/yassl/taocrypt/include/integer.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/include/kernelc.hpp b/extra/yassl/taocrypt/include/kernelc.hpp
index 5bdf1cffa3f..0840b3f2740 100644
--- a/extra/yassl/taocrypt/include/kernelc.hpp
+++ b/extra/yassl/taocrypt/include/kernelc.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp
index c58713855dd..4c8926483e2 100644
--- a/extra/yassl/taocrypt/include/misc.hpp
+++ b/extra/yassl/taocrypt/include/misc.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/include/modes.hpp b/extra/yassl/taocrypt/include/modes.hpp
index 5fd36b80d3e..bfe8c6ec5d4 100644
--- a/extra/yassl/taocrypt/include/modes.hpp
+++ b/extra/yassl/taocrypt/include/modes.hpp
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc.
- Use is subject to license terms.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/include/pwdbased.hpp b/extra/yassl/taocrypt/include/pwdbased.hpp
index 58bd5902a58..9b1b62fea45 100644
--- a/extra/yassl/taocrypt/include/pwdbased.hpp
+++ b/extra/yassl/taocrypt/include/pwdbased.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/include/rabbit.hpp b/extra/yassl/taocrypt/include/rabbit.hpp
index 1e7276dd8ec..fb4e12c66bc 100644
--- a/extra/yassl/taocrypt/include/rabbit.hpp
+++ b/extra/yassl/taocrypt/include/rabbit.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/include/rsa.hpp b/extra/yassl/taocrypt/include/rsa.hpp
index 11a4ccfd039..ee3e378a69f 100644
--- a/extra/yassl/taocrypt/include/rsa.hpp
+++ b/extra/yassl/taocrypt/include/rsa.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/include/runtime.hpp b/extra/yassl/taocrypt/include/runtime.hpp
index 328c8e9e978..29c4d2db236 100644
--- a/extra/yassl/taocrypt/include/runtime.hpp
+++ b/extra/yassl/taocrypt/include/runtime.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/include/types.hpp b/extra/yassl/taocrypt/include/types.hpp
index 5d8bc9f0683..973e1d19893 100644
--- a/extra/yassl/taocrypt/include/types.hpp
+++ b/extra/yassl/taocrypt/include/types.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/mySTL/stdexcept.hpp b/extra/yassl/taocrypt/mySTL/stdexcept.hpp
index 15533eebc02..79ae6de3380 100644
--- a/extra/yassl/taocrypt/mySTL/stdexcept.hpp
+++ b/extra/yassl/taocrypt/mySTL/stdexcept.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/mySTL/vector.hpp b/extra/yassl/taocrypt/mySTL/vector.hpp
index 35b92610942..f3702b75125 100644
--- a/extra/yassl/taocrypt/mySTL/vector.hpp
+++ b/extra/yassl/taocrypt/mySTL/vector.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/aes.cpp b/extra/yassl/taocrypt/src/aes.cpp
index 3b09c5280bf..f976650e028 100644
--- a/extra/yassl/taocrypt/src/aes.cpp
+++ b/extra/yassl/taocrypt/src/aes.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/src/aestables.cpp b/extra/yassl/taocrypt/src/aestables.cpp
index 05c2c3b8e62..60795a549e4 100644
--- a/extra/yassl/taocrypt/src/aestables.cpp
+++ b/extra/yassl/taocrypt/src/aestables.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp
index 29754b27b5e..9a37219543e 100644
--- a/extra/yassl/taocrypt/src/algebra.cpp
+++ b/extra/yassl/taocrypt/src/algebra.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/src/arc4.cpp b/extra/yassl/taocrypt/src/arc4.cpp
index 4630adcb11a..a76a37904f9 100644
--- a/extra/yassl/taocrypt/src/arc4.cpp
+++ b/extra/yassl/taocrypt/src/arc4.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/blowfish.cpp b/extra/yassl/taocrypt/src/blowfish.cpp
index e1c7c852d19..864f8bac260 100644
--- a/extra/yassl/taocrypt/src/blowfish.cpp
+++ b/extra/yassl/taocrypt/src/blowfish.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006, 2010, Oracle and/or its affiliates
+ Copyright (c) 2006, 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
diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp
index 0512ea9c889..8f317a484d8 100644
--- a/extra/yassl/taocrypt/src/coding.cpp
+++ b/extra/yassl/taocrypt/src/coding.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/src/dsa.cpp b/extra/yassl/taocrypt/src/dsa.cpp
index 7b882b10cd1..72221441b2b 100644
--- a/extra/yassl/taocrypt/src/dsa.cpp
+++ b/extra/yassl/taocrypt/src/dsa.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/hash.cpp b/extra/yassl/taocrypt/src/hash.cpp
index b36a486368c..c176e6a68d0 100644
--- a/extra/yassl/taocrypt/src/hash.cpp
+++ b/extra/yassl/taocrypt/src/hash.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/hc128.cpp b/extra/yassl/taocrypt/src/hc128.cpp
index aac92f0abb4..8934c318781 100644
--- a/extra/yassl/taocrypt/src/hc128.cpp
+++ b/extra/yassl/taocrypt/src/hc128.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/src/make.bat b/extra/yassl/taocrypt/src/make.bat
index ecd3023f5ab..a8c00f8ee0d 100755
--- a/extra/yassl/taocrypt/src/make.bat
+++ b/extra/yassl/taocrypt/src/make.bat
@@ -1,4 +1,4 @@
-REM Copyright (C) 2006, 2007 MySQL AB
+REM Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
REM
REM This program is free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
diff --git a/extra/yassl/taocrypt/src/md4.cpp b/extra/yassl/taocrypt/src/md4.cpp
index 54820f4c944..9364a1c23b1 100644
--- a/extra/yassl/taocrypt/src/md4.cpp
+++ b/extra/yassl/taocrypt/src/md4.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/md5.cpp b/extra/yassl/taocrypt/src/md5.cpp
index 4d0a8bd03be..ee0d64acc17 100644
--- a/extra/yassl/taocrypt/src/md5.cpp
+++ b/extra/yassl/taocrypt/src/md5.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/misc.cpp b/extra/yassl/taocrypt/src/misc.cpp
index 1a4dd4a52d3..e410cfe1946 100644
--- a/extra/yassl/taocrypt/src/misc.cpp
+++ b/extra/yassl/taocrypt/src/misc.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/src/rabbit.cpp b/extra/yassl/taocrypt/src/rabbit.cpp
index 0ea4146618a..071a25191f8 100644
--- a/extra/yassl/taocrypt/src/rabbit.cpp
+++ b/extra/yassl/taocrypt/src/rabbit.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/src/random.cpp b/extra/yassl/taocrypt/src/random.cpp
index aa9be7f1985..084871c5447 100644
--- a/extra/yassl/taocrypt/src/random.cpp
+++ b/extra/yassl/taocrypt/src/random.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 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
diff --git a/extra/yassl/taocrypt/src/ripemd.cpp b/extra/yassl/taocrypt/src/ripemd.cpp
index e012db43de5..f77010ca94d 100644
--- a/extra/yassl/taocrypt/src/ripemd.cpp
+++ b/extra/yassl/taocrypt/src/ripemd.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/rsa.cpp b/extra/yassl/taocrypt/src/rsa.cpp
index 576146377a3..69c59402e48 100644
--- a/extra/yassl/taocrypt/src/rsa.cpp
+++ b/extra/yassl/taocrypt/src/rsa.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/sha.cpp b/extra/yassl/taocrypt/src/sha.cpp
index 1ae42d94e4c..f67a4f55067 100644
--- a/extra/yassl/taocrypt/src/sha.cpp
+++ b/extra/yassl/taocrypt/src/sha.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/template_instnt.cpp b/extra/yassl/taocrypt/src/template_instnt.cpp
index b472d18236f..de0137dda7c 100644
--- a/extra/yassl/taocrypt/src/template_instnt.cpp
+++ b/extra/yassl/taocrypt/src/template_instnt.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2000-2007 MySQL AB
+ 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
diff --git a/extra/yassl/taocrypt/src/twofish.cpp b/extra/yassl/taocrypt/src/twofish.cpp
index 4ae493624dc..bf57f5dde44 100644
--- a/extra/yassl/taocrypt/src/twofish.cpp
+++ b/extra/yassl/taocrypt/src/twofish.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006, 2010, Oracle and/or its affiliates
+ Copyright (c) 2006, 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
diff --git a/extra/yassl/taocrypt/test/make.bat b/extra/yassl/taocrypt/test/make.bat
index d6d62b984a8..51f266a1ee6 100755
--- a/extra/yassl/taocrypt/test/make.bat
+++ b/extra/yassl/taocrypt/test/make.bat
@@ -1,4 +1,4 @@
-REM Copyright (C) 2006, 2007 MySQL AB
+REM Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
REM
REM This program is free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
diff --git a/extra/yassl/taocrypt/test/memory.cpp b/extra/yassl/taocrypt/test/memory.cpp
index a9b21f94902..053d79688a2 100644
--- a/extra/yassl/taocrypt/test/memory.cpp
+++ b/extra/yassl/taocrypt/test/memory.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2006, 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
diff --git a/extra/yassl/taocrypt/test/test.cpp b/extra/yassl/taocrypt/test/test.cpp
index 807f91f32ae..00547d0f963 100644
--- a/extra/yassl/taocrypt/test/test.cpp
+++ b/extra/yassl/taocrypt/test/test.cpp
@@ -1,3 +1,21 @@
+/*
+ Copyright (c) 2006, 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
+ 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.
+*/
+
// test.cpp
// test taocrypt functionality
diff --git a/extra/yassl/testsuite/make.bat b/extra/yassl/testsuite/make.bat
index 941e499d7e6..e056f3fed53 100755
--- a/extra/yassl/testsuite/make.bat
+++ b/extra/yassl/testsuite/make.bat
@@ -1,4 +1,4 @@
-REM Copyright (C) 2006, 2007 MySQL AB
+REM Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
REM
REM This program is free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
diff --git a/extra/yassl/testsuite/test.hpp b/extra/yassl/testsuite/test.hpp
index 559ebe54f1b..33f398ae269 100644
--- a/extra/yassl/testsuite/test.hpp
+++ b/extra/yassl/testsuite/test.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006, 2010, Oracle and/or its affiliates.
+ Copyright (c) 2006, 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
diff --git a/extra/yassl/testsuite/testsuite.cpp b/extra/yassl/testsuite/testsuite.cpp
index fa8c997e7c2..7973a3704e1 100644
--- a/extra/yassl/testsuite/testsuite.cpp
+++ b/extra/yassl/testsuite/testsuite.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2006, 2007 MySQL AB
+ Copyright (c) 2006, 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
diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h
index 2238347d419..173e32e790c 100644
--- a/include/atomic/x86-gcc.h
+++ b/include/atomic/x86-gcc.h
@@ -124,10 +124,10 @@
asm volatile ("push %%ebx;" \
"movl (%%ecx), %%ebx;" \
"movl 4(%%ecx), %%ecx;" \
- LOCK_prefix "; cmpxchg8b %0;" \
+ LOCK_prefix "; cmpxchg8b (%%esi);" \
"setz %2; pop %%ebx" \
- : "=m" (*a), "+A" (*cmp), "=c" (ret) \
- : "c" (&set), "m" (*a) \
+ : "+S" (a), "+A" (*cmp), "=c" (ret) \
+ : "c" (&set) \
: "memory", "esp")
#endif
diff --git a/include/base64.h b/include/base64.h
index 4ac0aa72ad8..e19da8762cb 100644
--- a/include/base64.h
+++ b/include/base64.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2003 MySQL AB
+/* Copyright (c) 2003-2006 MySQL 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
diff --git a/include/ft_global.h b/include/ft_global.h
index 8a1069d6e62..73726018d0a 100644
--- a/include/ft_global.h
+++ b/include/ft_global.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000-2007 MySQL AB, 2009 Sun Microsystems, Inc.
+/* Copyright (c) 2000-2005, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 969cb0058ac..001884afe81 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -1,5 +1,4 @@
-/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2013, 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
@@ -172,6 +171,8 @@ enum my_lex_states
struct charset_info_st;
+extern int (*my_string_stack_guard)(int);
+
/* See strings/CHARSET_INFO.txt for information about this structure */
struct my_collation_handler_st
{
diff --git a/include/m_string.h b/include/m_string.h
index 9efa0376942..1f59fd06084 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2011, 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
@@ -108,6 +108,15 @@ extern char *strcend(const char *, pchar);
extern char *strfill(char * s,size_t len,pchar fill);
extern char *strmake(char *dst,const char *src,size_t length);
+#if !defined(__GNUC__) || (__GNUC__ < 4)
+#define strmake_buf(D,S) strmake(D, S, sizeof(D) - 1)
+#else
+#define strmake_buf(D,S) ({ \
+ compile_time_assert(sizeof(D) != sizeof(char*)); \
+ strmake(D, S, sizeof(D) - 1); \
+ })
+#endif
+
#ifndef strmov
extern char *strmov(char *dst,const char *src);
#endif
diff --git a/include/my_global.h b/include/my_global.h
index 09a3a0a6efd..fcfc052d191 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -390,7 +390,8 @@ C_MODE_END
#define compile_time_assert(X) \
do \
{ \
- typedef char compile_time_assert[(X) ? 1 : -1]; \
+ typedef char compile_time_assert[(X) ? 1 : -1] \
+ __attribute__((unused)); \
} while(0)
#endif
diff --git a/include/my_md5.h b/include/my_md5.h
index 782bef8a27a..7328661eb71 100644
--- a/include/my_md5.h
+++ b/include/my_md5.h
@@ -1,7 +1,8 @@
#ifndef MY_MD5_INCLUDED
#define MY_MD5_INCLUDED
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2001, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
+ 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
diff --git a/include/my_sys.h b/include/my_sys.h
index f0f5d7666fc..2281d014c85 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000-2003 MySQL AB
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/include/my_user.h b/include/my_user.h
index 44eebf1551d..067425a2b47 100644
--- a/include/my_user.h
+++ b/include/my_user.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2005 MySQL AB
+/* Copyright (c) 2005-2007 MySQL 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
diff --git a/include/my_xml.h b/include/my_xml.h
index 6a453ee90be..e97232c7039 100644
--- a/include/my_xml.h
+++ b/include/my_xml.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (c) 2000, 2002, 2003, 2005, 2007 MySQL 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
diff --git a/include/myisamchk.h b/include/myisamchk.h
index 0ee03c03c49..19c2bf47ddb 100644
--- a/include/myisamchk.h
+++ b/include/myisamchk.h
@@ -31,27 +31,27 @@
#define T_AUTO_REPAIR 2 /* QQ to be removed */
#define T_BACKUP_DATA 4
#define T_CALC_CHECKSUM 8
-#define T_CHECK 16 /* QQ to be removed */
-#define T_CHECK_ONLY_CHANGED 32 /* QQ to be removed */
+#define T_CHECK 16
+#define T_CHECK_ONLY_CHANGED 32
#define T_CREATE_MISSING_KEYS 64
#define T_DESCRIPT 128
#define T_DONT_CHECK_CHECKSUM 256
#define T_EXTEND 512
-#define T_FAST (1L << 10) /* QQ to be removed */
-#define T_FORCE_CREATE (1L << 11) /* QQ to be removed */
+#define T_FAST (1L << 10)
+#define T_FORCE_CREATE (1L << 11)
#define T_FORCE_UNIQUENESS (1L << 12)
#define T_INFO (1L << 13)
#define T_MEDIUM (1L << 14)
-#define T_QUICK (1L << 15) /* QQ to be removed */
-#define T_READONLY (1L << 16) /* QQ to be removed */
+#define T_QUICK (1L << 15)
+#define T_READONLY (1L << 16)
#define T_REP (1L << 17)
-#define T_REP_BY_SORT (1L << 18) /* QQ to be removed */
-#define T_REP_PARALLEL (1L << 19) /* QQ to be removed */
+#define T_REP_BY_SORT (1L << 18)
+#define T_REP_PARALLEL (1L << 19)
#define T_RETRY_WITHOUT_QUICK (1L << 20)
#define T_SAFE_REPAIR (1L << 21)
#define T_SILENT (1L << 22)
-#define T_SORT_INDEX (1L << 23) /* QQ to be removed */
-#define T_SORT_RECORDS (1L << 24) /* QQ to be removed */
+#define T_SORT_INDEX (1L << 23)
+#define T_SORT_RECORDS (1L << 24)
#define T_STATISTICS (1L << 25)
#define T_UNPACK (1L << 26)
#define T_UPDATE_STATE (1L << 27)
diff --git a/include/myisampack.h b/include/myisampack.h
index a065de378d8..0795455dc3e 100644
--- a/include/myisampack.h
+++ b/include/myisampack.h
@@ -1,7 +1,7 @@
#ifndef MYISAMPACK_INCLUDED
#define MYISAMPACK_INCLUDED
-/* Copyright (c) 2000-2002, 2004, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
+/* Copyright (c) 2000-2002, 2004 MySQL AB, 2009 Sun Microsystems, Inc.
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
diff --git a/include/mysql.h b/include/mysql.h
index fa62026b44a..4d1fa437407 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -1,5 +1,6 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2012, 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
diff --git a/include/mysql/plugin_audit.h b/include/mysql/plugin_audit.h
index eee32a9e523..86b6dea5668 100644
--- a/include/mysql/plugin_audit.h
+++ b/include/mysql/plugin_audit.h
@@ -25,7 +25,7 @@
#define MYSQL_AUDIT_CLASS_MASK_SIZE 1
-#define MYSQL_AUDIT_INTERFACE_VERSION 0x0300
+#define MYSQL_AUDIT_INTERFACE_VERSION 0x0301
/*************************************************************************
@@ -97,6 +97,50 @@ struct mysql_event_connection
unsigned int database_length;
};
+/*
+ AUDIT CLASS : TABLE
+
+ LOCK occurs when a connection "locks" (this does not necessarily mean a table
+ lock and also happens for row-locking engines) the table at the beginning of
+ a statement. This event is generated at the beginning of every statement for
+ every affected table, unless there's a LOCK TABLES statement in effect (in
+ which case it is generated once for LOCK TABLES and then is suppressed until
+ the tables are unlocked).
+
+ CREATE/DROP/RENAME occur when a table is created, dropped, or renamed.
+*/
+
+#define MYSQL_AUDIT_TABLE_CLASS 15
+#define MYSQL_AUDIT_TABLE_CLASSMASK (1 << MYSQL_AUDIT_TABLE_CLASS)
+#define MYSQL_AUDIT_TABLE_LOCK 0
+#define MYSQL_AUDIT_TABLE_CREATE 1
+#define MYSQL_AUDIT_TABLE_DROP 2
+#define MYSQL_AUDIT_TABLE_RENAME 3
+#define MYSQL_AUDIT_TABLE_ALTER 4
+
+struct mysql_event_table
+{
+ unsigned int event_subclass;
+ unsigned long thread_id;
+ const char *user;
+ const char *priv_user;
+ const char *priv_host;
+ const char *external_user;
+ const char *proxy_user;
+ const char *host;
+ const char *ip;
+ const char *database;
+ unsigned int database_length;
+ const char *table;
+ unsigned int table_length;
+ /* for MYSQL_AUDIT_TABLE_LOCK, true if read-only, false if read/write */
+ int read_only;
+ /* for MYSQL_AUDIT_TABLE_RENAME */
+ const char *new_database;
+ unsigned int new_database_length;
+ const char *new_table;
+ unsigned int new_table_length;
+};
/*************************************************************************
Here we define the descriptor structure, that is referred from
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index f19d5fe797c..cb8435a1ec7 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -279,6 +279,27 @@ struct mysql_event_connection
const char *database;
unsigned int database_length;
};
+struct mysql_event_table
+{
+ unsigned int event_subclass;
+ unsigned long thread_id;
+ const char *user;
+ const char *priv_user;
+ const char *priv_host;
+ const char *external_user;
+ const char *proxy_user;
+ const char *host;
+ const char *ip;
+ const char *database;
+ unsigned int database_length;
+ const char *table;
+ unsigned int table_length;
+ int read_only;
+ const char *new_database;
+ unsigned int new_database_length;
+ const char *new_table;
+ unsigned int new_table_length;
+};
struct st_mysql_audit
{
int interface_version;
diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h
index 75e7fba5266..156fb386aae 100644
--- a/include/mysql/plugin_auth.h
+++ b/include/mysql/plugin_auth.h
@@ -27,7 +27,7 @@
#include <mysql/plugin.h>
-#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100
+#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0200
#include <mysql/plugin_auth_common.h>
@@ -78,7 +78,7 @@ typedef struct st_mysql_server_auth_info
Not used by the server.
Available through the @@EXTERNAL_USER variable.
*/
- char external_user[512];
+ char external_user[MYSQL_USERNAME_LENGTH+1];
/**
This only affects the "Authentication failed. Password used: %s"
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 23153198a7d..55b6055ef2f 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -266,8 +266,8 @@ typedef struct st_mysql_server_auth_info
unsigned int user_name_length;
const char *auth_string;
unsigned long auth_string_length;
- char authenticated_as[48 +1];
- char external_user[512];
+ char authenticated_as[512 +1];
+ char external_user[512 +1];
int password_used;
const char *host_or_ip;
unsigned int host_or_ip_length;
diff --git a/include/mysql/plugin_auth_common.h b/include/mysql/plugin_auth_common.h
index 820d299bf88..c0b61730d0d 100644
--- a/include/mysql/plugin_auth_common.h
+++ b/include/mysql/plugin_auth_common.h
@@ -28,7 +28,7 @@
#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
/** the max allowed length for a user name */
-#define MYSQL_USERNAME_LENGTH 48
+#define MYSQL_USERNAME_LENGTH 512
/**
return values of the plugin authenticate_user() method.
diff --git a/include/mysql/service_my_snprintf.h b/include/mysql/service_my_snprintf.h
index a7fd3e8a2c6..d4ce97076e6 100644
--- a/include/mysql/service_my_snprintf.h
+++ b/include/mysql/service_my_snprintf.h
@@ -1,5 +1,5 @@
#ifndef MYSQL_SERVICE_MY_SNPRINTF_INCLUDED
-/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/include/mysql_com.h b/include/mysql_com.h
index c0f350d2bcf..fdd75556033 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -24,7 +24,7 @@
#define HOSTNAME_LENGTH 60
#define SYSTEM_CHARSET_MBMAXLEN 3
#define NAME_CHAR_LEN 64 /* Field/table name length */
-#define USERNAME_CHAR_LENGTH 16
+#define USERNAME_CHAR_LENGTH 128
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
@@ -34,6 +34,31 @@
#define MYSQL50_TABLE_NAME_PREFIX_LENGTH (sizeof(MYSQL50_TABLE_NAME_PREFIX)-1)
#define SAFE_NAME_LEN (NAME_LEN + MYSQL50_TABLE_NAME_PREFIX_LENGTH)
+/*
+ MDEV-4088
+
+ MySQL (and MariaDB 5.x before the fix) was using the first character of the
+ server version string (as sent in the first handshake protocol packet) to
+ decide on the replication event formats. And for 10.x the first character
+ is "1", which the slave thought comes from some ancient 1.x version
+ (ignoring the fact that the first ever MySQL version was 3.x).
+
+ To support replication to these old clients, we fake the version in the
+ first handshake protocol packet to start from "5.5.5-" (for example,
+ it might be "5.5.5-10.0.1-MariaDB-debug-log".
+
+ On the client side we remove this fake version prefix to restore the
+ correct server version. The version "5.5.5" did not support
+ pluggable authentication, so any version starting from "5.5.5-" and
+ claiming to support pluggable auth, must be using this fake prefix.
+*/
+#ifdef EMBEDDED_LIBRARY
+#define RPL_VERSION_HACK ""
+#else
+/* this version must be the one that *does not* support pluggable auth */
+#define RPL_VERSION_HACK "5.5.5-"
+#endif
+
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
#define LIST_PROCESS_HOST_LEN 64
diff --git a/include/mysql_time.h b/include/mysql_time.h
index 0a3f17a81fb..c92267232a1 100644
--- a/include/mysql_time.h
+++ b/include/mysql_time.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 2004 MySQL AB
+/* Copyright (c) 2004, 2006 MySQL 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
diff --git a/include/mysql_version.h.in b/include/mysql_version.h.in
index 18c61040c22..56b2fe50ec0 100644
--- a/include/mysql_version.h.in
+++ b/include/mysql_version.h.in
@@ -1,4 +1,5 @@
-/* Copyright Abandoned 1996, 1999, 2001 MySQL AB
+/* Copyright (c) 1996, 1999-2004, 2007 MySQL AB
+ Use is subject to license terms
This file is public domain and comes with NO WARRANTY of any kind */
/* Version numbers for protocol & mysqld */
diff --git a/include/probes_mysql_nodtrace.h b/include/probes_mysql_nodtrace.h
index bc3b65a00e5..a84bf7726c3 100644
--- a/include/probes_mysql_nodtrace.h
+++ b/include/probes_mysql_nodtrace.h
@@ -6,121 +6,124 @@
#define _PROBES_MYSQL_D
#ifdef __cplusplus
+#define MYSQL_PROBES_FALSE false
extern "C" {
+#else
+#define MYSQL_PROBES_FALSE 0
#endif
#define MYSQL_CONNECTION_START(arg0, arg1, arg2)
-#define MYSQL_CONNECTION_START_ENABLED() (0)
+#define MYSQL_CONNECTION_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_CONNECTION_DONE(arg0, arg1)
-#define MYSQL_CONNECTION_DONE_ENABLED() (0)
+#define MYSQL_CONNECTION_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_COMMAND_START(arg0, arg1, arg2, arg3)
-#define MYSQL_COMMAND_START_ENABLED() (0)
+#define MYSQL_COMMAND_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_COMMAND_DONE(arg0)
-#define MYSQL_COMMAND_DONE_ENABLED() (0)
+#define MYSQL_COMMAND_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_START(arg0, arg1, arg2, arg3, arg4)
-#define MYSQL_QUERY_START_ENABLED() (0)
+#define MYSQL_QUERY_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_DONE(arg0)
-#define MYSQL_QUERY_DONE_ENABLED() (0)
+#define MYSQL_QUERY_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_PARSE_START(arg0)
-#define MYSQL_QUERY_PARSE_START_ENABLED() (0)
+#define MYSQL_QUERY_PARSE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_PARSE_DONE(arg0)
-#define MYSQL_QUERY_PARSE_DONE_ENABLED() (0)
+#define MYSQL_QUERY_PARSE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_CACHE_HIT(arg0, arg1)
-#define MYSQL_QUERY_CACHE_HIT_ENABLED() (0)
+#define MYSQL_QUERY_CACHE_HIT_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_CACHE_MISS(arg0)
-#define MYSQL_QUERY_CACHE_MISS_ENABLED() (0)
+#define MYSQL_QUERY_CACHE_MISS_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_EXEC_START(arg0, arg1, arg2, arg3, arg4, arg5)
-#define MYSQL_QUERY_EXEC_START_ENABLED() (0)
+#define MYSQL_QUERY_EXEC_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_QUERY_EXEC_DONE(arg0)
-#define MYSQL_QUERY_EXEC_DONE_ENABLED() (0)
+#define MYSQL_QUERY_EXEC_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_ROW_START(arg0, arg1)
-#define MYSQL_INSERT_ROW_START_ENABLED() (0)
+#define MYSQL_INSERT_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_ROW_DONE(arg0)
-#define MYSQL_INSERT_ROW_DONE_ENABLED() (0)
+#define MYSQL_INSERT_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_ROW_START(arg0, arg1)
-#define MYSQL_UPDATE_ROW_START_ENABLED() (0)
+#define MYSQL_UPDATE_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_ROW_DONE(arg0)
-#define MYSQL_UPDATE_ROW_DONE_ENABLED() (0)
+#define MYSQL_UPDATE_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_ROW_START(arg0, arg1)
-#define MYSQL_DELETE_ROW_START_ENABLED() (0)
+#define MYSQL_DELETE_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_ROW_DONE(arg0)
-#define MYSQL_DELETE_ROW_DONE_ENABLED() (0)
+#define MYSQL_DELETE_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_READ_ROW_START(arg0, arg1, arg2)
-#define MYSQL_READ_ROW_START_ENABLED() (0)
+#define MYSQL_READ_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_READ_ROW_DONE(arg0)
-#define MYSQL_READ_ROW_DONE_ENABLED() (0)
+#define MYSQL_READ_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INDEX_READ_ROW_START(arg0, arg1)
-#define MYSQL_INDEX_READ_ROW_START_ENABLED() (0)
+#define MYSQL_INDEX_READ_ROW_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INDEX_READ_ROW_DONE(arg0)
-#define MYSQL_INDEX_READ_ROW_DONE_ENABLED() (0)
+#define MYSQL_INDEX_READ_ROW_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_RDLOCK_START(arg0, arg1)
-#define MYSQL_HANDLER_RDLOCK_START_ENABLED() (0)
+#define MYSQL_HANDLER_RDLOCK_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_WRLOCK_START(arg0, arg1)
-#define MYSQL_HANDLER_WRLOCK_START_ENABLED() (0)
+#define MYSQL_HANDLER_WRLOCK_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_UNLOCK_START(arg0, arg1)
-#define MYSQL_HANDLER_UNLOCK_START_ENABLED() (0)
+#define MYSQL_HANDLER_UNLOCK_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_RDLOCK_DONE(arg0)
-#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() (0)
+#define MYSQL_HANDLER_RDLOCK_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_WRLOCK_DONE(arg0)
-#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() (0)
+#define MYSQL_HANDLER_WRLOCK_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_HANDLER_UNLOCK_DONE(arg0)
-#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() (0)
+#define MYSQL_HANDLER_UNLOCK_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_FILESORT_START(arg0, arg1)
-#define MYSQL_FILESORT_START_ENABLED() (0)
+#define MYSQL_FILESORT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_FILESORT_DONE(arg0, arg1)
-#define MYSQL_FILESORT_DONE_ENABLED() (0)
+#define MYSQL_FILESORT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_SELECT_START(arg0)
-#define MYSQL_SELECT_START_ENABLED() (0)
+#define MYSQL_SELECT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_SELECT_DONE(arg0, arg1)
-#define MYSQL_SELECT_DONE_ENABLED() (0)
+#define MYSQL_SELECT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_START(arg0)
-#define MYSQL_INSERT_START_ENABLED() (0)
+#define MYSQL_INSERT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_DONE(arg0, arg1)
-#define MYSQL_INSERT_DONE_ENABLED() (0)
+#define MYSQL_INSERT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_SELECT_START(arg0)
-#define MYSQL_INSERT_SELECT_START_ENABLED() (0)
+#define MYSQL_INSERT_SELECT_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_INSERT_SELECT_DONE(arg0, arg1)
-#define MYSQL_INSERT_SELECT_DONE_ENABLED() (0)
+#define MYSQL_INSERT_SELECT_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_START(arg0)
-#define MYSQL_UPDATE_START_ENABLED() (0)
+#define MYSQL_UPDATE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_UPDATE_DONE(arg0, arg1, arg2)
-#define MYSQL_UPDATE_DONE_ENABLED() (0)
+#define MYSQL_UPDATE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_UPDATE_START(arg0)
-#define MYSQL_MULTI_UPDATE_START_ENABLED() (0)
+#define MYSQL_MULTI_UPDATE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_UPDATE_DONE(arg0, arg1, arg2)
-#define MYSQL_MULTI_UPDATE_DONE_ENABLED() (0)
+#define MYSQL_MULTI_UPDATE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_START(arg0)
-#define MYSQL_DELETE_START_ENABLED() (0)
+#define MYSQL_DELETE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_DELETE_DONE(arg0, arg1)
-#define MYSQL_DELETE_DONE_ENABLED() (0)
+#define MYSQL_DELETE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_DELETE_START(arg0)
-#define MYSQL_MULTI_DELETE_START_ENABLED() (0)
+#define MYSQL_MULTI_DELETE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_MULTI_DELETE_DONE(arg0, arg1)
-#define MYSQL_MULTI_DELETE_DONE_ENABLED() (0)
+#define MYSQL_MULTI_DELETE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_READ_START()
-#define MYSQL_NET_READ_START_ENABLED() (0)
+#define MYSQL_NET_READ_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_READ_DONE(arg0, arg1)
-#define MYSQL_NET_READ_DONE_ENABLED() (0)
+#define MYSQL_NET_READ_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_WRITE_START(arg0)
-#define MYSQL_NET_WRITE_START_ENABLED() (0)
+#define MYSQL_NET_WRITE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_NET_WRITE_DONE(arg0)
-#define MYSQL_NET_WRITE_DONE_ENABLED() (0)
+#define MYSQL_NET_WRITE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_START(arg0, arg1, arg2, arg3)
-#define MYSQL_KEYCACHE_READ_START_ENABLED() (0)
+#define MYSQL_KEYCACHE_READ_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_BLOCK(arg0)
-#define MYSQL_KEYCACHE_READ_BLOCK_ENABLED() (0)
+#define MYSQL_KEYCACHE_READ_BLOCK_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_HIT()
-#define MYSQL_KEYCACHE_READ_HIT_ENABLED() (0)
+#define MYSQL_KEYCACHE_READ_HIT_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_MISS()
-#define MYSQL_KEYCACHE_READ_MISS_ENABLED() (0)
+#define MYSQL_KEYCACHE_READ_MISS_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_READ_DONE(arg0, arg1)
-#define MYSQL_KEYCACHE_READ_DONE_ENABLED() (0)
+#define MYSQL_KEYCACHE_READ_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_WRITE_START(arg0, arg1, arg2, arg3)
-#define MYSQL_KEYCACHE_WRITE_START_ENABLED() (0)
+#define MYSQL_KEYCACHE_WRITE_START_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_WRITE_BLOCK(arg0)
-#define MYSQL_KEYCACHE_WRITE_BLOCK_ENABLED() (0)
+#define MYSQL_KEYCACHE_WRITE_BLOCK_ENABLED() (MYSQL_PROBES_FALSE)
#define MYSQL_KEYCACHE_WRITE_DONE(arg0, arg1)
-#define MYSQL_KEYCACHE_WRITE_DONE_ENABLED() (0)
+#define MYSQL_KEYCACHE_WRITE_DONE_ENABLED() (MYSQL_PROBES_FALSE)
#ifdef __cplusplus
}
diff --git a/include/thread_pool_priv.h b/include/thread_pool_priv.h
index 84c7faa2e2b..9a9c65af6da 100644
--- a/include/thread_pool_priv.h
+++ b/include/thread_pool_priv.h
@@ -1,6 +1,6 @@
#error don't use
/*
- 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
diff --git a/include/welcome_copyright_notice.h b/include/welcome_copyright_notice.h
index 9878ab1c07d..302f623e377 100644
--- a/include/welcome_copyright_notice.h
+++ b/include/welcome_copyright_notice.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, 2013, Oracle and/or its affiliates.
+/* Copyright (c) 2011, 2012, Oracle and/or its affiliates.
Copyright (c) 2011, 2012, Monty Program Ab
This program is free software; you can redistribute it and/or modify
diff --git a/libmysql/get_password.c b/libmysql/get_password.c
index e65bd6de2f6..e704aec8337 100644
--- a/libmysql/get_password.c
+++ b/libmysql/get_password.c
@@ -62,13 +62,14 @@
/* were just going to fake it here and get input from the keyboard */
void get_tty_password_buff(const char *opt_message, char *to, size_t length)
{
- HANDLE consoleinput;
+ HANDLE consoleinput;
DWORD oldstate;
char *pos=to,*end=to+length-1;
int i=0;
- consoleinput= GetStdHandle(STD_INPUT_HANDLE);
- if (!consoleinput)
+ consoleinput= CreateFile("CONIN$", GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ ,
+ NULL, OPEN_EXISTING, 0, NULL);
+ if (consoleinput == NULL || consoleinput == INVALID_HANDLE_VALUE)
{
/* This is a GUI application or service without console input, bail out. */
*to= 0;
@@ -76,11 +77,11 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length)
}
_cputs(opt_message ? opt_message : "Enter password: ");
- /*
- Switch to raw mode (no line input, no echo input).
- Allow Ctrl-C handler with ENABLE_PROCESSED_INPUT.
- */
- GetConsoleMode(consoleinput, &oldstate);
+ /*
+ Switch to raw mode (no line input, no echo input).
+ Allow Ctrl-C handler with ENABLE_PROCESSED_INPUT.
+ */
+ GetConsoleMode(consoleinput, &oldstate);
SetConsoleMode(consoleinput, ENABLE_PROCESSED_INPUT);
for (;;)
{
@@ -108,6 +109,7 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length)
}
/* Reset console mode after password input. */
SetConsoleMode(consoleinput, oldstate);
+ CloseHandle(consoleinput);
*pos=0;
_cputs("\n");
}
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index f90cc96a90f..6d2582ad9a4 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -2130,7 +2130,14 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
DBUG_RETURN(1);
}
- net_clear(net, 1); /* Sets net->write_pos */
+ if (net->vio)
+ net_clear(net, 1); /* Sets net->write_pos */
+ else
+ {
+ set_stmt_errmsg(stmt, net);
+ DBUG_RETURN(1);
+ }
+
/* Reserve place for null-marker bytes */
null_count= (stmt->param_count+7) /8;
if (my_realloc_str(net, null_count + 1))
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index b454fc0d2e0..e73fe4b8b77 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -90,7 +90,7 @@ void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data)
NET *net= &mysql->net;
struct embedded_query_result *ei= data->embedded_info;
net->last_errno= ei->last_errno;
- strmake(net->last_error, ei->info, sizeof(net->last_error)-1);
+ strmake_buf(net->last_error, ei->info);
memcpy(net->sqlstate, ei->sqlstate, sizeof(net->sqlstate));
mysql->server_status= ei->server_status;
my_free(data);
@@ -440,7 +440,7 @@ static MYSQL_RES * emb_store_result(MYSQL *mysql)
int emb_read_change_user_result(MYSQL *mysql)
{
mysql->net.read_pos= (uchar*)""; // fake an OK packet
- return mysql_errno(mysql) ? packet_error : 1 /* length of the OK packet */;
+ return mysql_errno(mysql) ? (int)packet_error : 1 /* length of the OK packet */;
}
MYSQL_METHODS embedded_methods=
@@ -703,8 +703,8 @@ int check_embedded_connection(MYSQL *mysql, const char *db)
thd->update_charset();
Security_context *sctx= thd->security_ctx;
sctx->host_or_ip= sctx->host= (char*) my_localhost;
- strmake(sctx->priv_host, (char*) my_localhost, MAX_HOSTNAME-1);
- strmake(sctx->priv_user, mysql->user, USERNAME_LENGTH-1);
+ strmake_buf(sctx->priv_host, (char*) my_localhost);
+ strmake_buf(sctx->priv_user, mysql->user);
sctx->user= my_strdup(mysql->user, MYF(0));
sctx->proxy_user[0]= 0;
sctx->master_access= GLOBAL_ACLS; // Full rights
@@ -772,7 +772,7 @@ int check_embedded_connection(MYSQL *mysql, const char *db)
return 0;
err:
- strmake(net->last_error, thd->main_da.message(), sizeof(net->last_error)-1);
+ strmake_buf(net->last_error, thd->main_da.message());
memcpy(net->sqlstate,
mysql_errno_to_sqlstate(thd->main_da.sql_errno()),
sizeof(net->sqlstate)-1);
@@ -1119,8 +1119,7 @@ net_send_ok(THD *thd,
data->embedded_info->affected_rows= affected_rows;
data->embedded_info->insert_id= id;
if (message)
- strmake(data->embedded_info->info, message,
- sizeof(data->embedded_info->info)-1);
+ strmake_buf(data->embedded_info->info, message);
bool error= write_eof_packet(thd, server_status, statement_warn_count);
thd->cur_data= 0;
@@ -1171,7 +1170,7 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err,
err, strlen(err),
system_charset_info, &error);
/* Converted error message is always null-terminated. */
- strmake(ei->info, converted_err, sizeof(ei->info)-1);
+ strmake_buf(ei->info, converted_err);
strmov(ei->sqlstate, sqlstate);
ei->server_status= thd->server_status;
thd->cur_data= 0;
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index 56b8feb6739..dca07e1a388 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -6,6 +6,7 @@ binlog.binlog_multi_engine # joro : NDB tests marked as experiment
funcs_1.charset_collation_1 # depends on compile-time decisions
main.func_math @freebsd # Bug#11751977 2010-05-04 alik main.func_math fails on FreeBSD in PB2
+main.kill @solaris # Bug#16064876 2013-01-02 prthirum main.kill fails on sol10 sparc64
main.lock_multi_bug38499 # Bug#11755645 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
main.outfile_loaddata @solaris # Bug#11755168 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
main.signal_demo3 @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
diff --git a/mysql-test/disabled.def b/mysql-test/disabled.def
index 37b4626e6db..3d33be79473 100644
--- a/mysql-test/disabled.def
+++ b/mysql-test/disabled.def
@@ -13,7 +13,6 @@ tablespace : disabled in MariaDB (no TABLESPACE table attribute)
events_time_zone : Test is not predictable as it depends on precise timing.
lowercase_table3 : Bug#11762269 2010-06-30 alik main.lowercase_table3 on Mac OSX
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
-sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836
diff --git a/mysql-test/include/get_relay_log_pos.inc b/mysql-test/include/get_relay_log_pos.inc
index 61ee07fc655..47a74c9bd41 100644
--- a/mysql-test/include/get_relay_log_pos.inc
+++ b/mysql-test/include/get_relay_log_pos.inc
@@ -40,7 +40,6 @@ CREATE TEMPORARY TABLE mysqlbinlog_events(c1 INT AUTO_INCREMENT KEY, c2 varchar(
# '# .... end_log_pos 46'
eval LOAD DATA LOCAL INFILE '$_tmp_file' INTO TABLE mysqlbinlog_events
LINES STARTING BY '#' (c2) SET c1 = NULL;
---enable_warnings
# Event pos in relay log file is inserted into table events_at
CREATE TEMPORARY TABLE events_at(c1 INT AUTO_INCREMENT KEY, c2 varchar(256))
@@ -49,6 +48,7 @@ CREATE TEMPORARY TABLE events_at(c1 INT AUTO_INCREMENT KEY, c2 varchar(256))
# Event pos in master log file is inserted into table events_pos
CREATE TEMPORARY TABLE events_pos(c1 INT AUTO_INCREMENT KEY, c2 varchar(256))
SELECT c2 FROM mysqlbinlog_events WHERE c2 LIKE '% end_log_pos %' ORDER BY c1;
+--enable_warnings
# events_at events_pos
# c1------c2-------------------------- c1------c2------------------------
diff --git a/mysql-test/include/have_debug_sync.inc b/mysql-test/include/have_debug_sync.inc
index 7aa5baf3342..dbe6dfddd26 100644
--- a/mysql-test/include/have_debug_sync.inc
+++ b/mysql-test/include/have_debug_sync.inc
@@ -1,5 +1,4 @@
---require r/have_debug_sync.require
-disable_query_log;
-let $value= query_get_value(SHOW VARIABLES LIKE 'debug_sync', Value, 1);
-eval SELECT ('$value' LIKE 'ON %') AS debug_sync;
-enable_query_log;
+if (`select count(*) = 0 from information_schema.session_variables where variable_name = 'debug_sync' and variable_value like 'on %'`)
+{
+ skip debug_sync is not available;
+}
diff --git a/mysql-test/include/rpl_init.inc b/mysql-test/include/rpl_init.inc
index e608a1223a5..f8b0cb46f1a 100644
--- a/mysql-test/include/rpl_init.inc
+++ b/mysql-test/include/rpl_init.inc
@@ -7,7 +7,6 @@
# well as extra connections server_1_1, server_2_1, ...,
# server_N_1. server_I and server_I_1 are connections to the same
# server.
-# - Sets up @@auto_increment_increment and @@auto_increment_increment.
# - Verifies that @@server_id of all servers are different.
# - Calls RESET MASTER, RESET SLAVE, USE test, CHANGE MASTER, START SLAVE.
# - Sets the connection to server_1 before exiting.
@@ -179,8 +178,6 @@ while ($_rpl_server)
RESET MASTER;
RESET SLAVE;
}
- eval SET auto_increment_increment= $rpl_server_count;
- eval SET auto_increment_offset= $_rpl_server;
--dec $_rpl_server
}
diff --git a/mysql-test/include/support_long_file_names.inc b/mysql-test/include/support_long_file_names.inc
new file mode 100644
index 00000000000..1f5b3d7be08
--- /dev/null
+++ b/mysql-test/include/support_long_file_names.inc
@@ -0,0 +1,37 @@
+--error 0,3
+--perl
+my $n = 254 - length($ENV{MYSQLTEST_VARDIR});
+my $name = $ENV{MYSQLTEST_VARDIR} . '/' . sprintf("%0${n}d", $$);
+if (!open(LONG_NAME,">$name"))
+{
+ # We cannot rely either on a particular error code, or error string
+ # to check that we indeed hit "File name too long".
+ # Instead, we will try to create a file with a short name
+ # the same way, in the same location. If it goes all right,
+ # we will assume the problem was with the file name length
+
+ open(SHORT_NAME,">$ENV{MYSQLTEST_VARDIR}/$$") ||
+ # Even a shorter name could not be created, something else is wrong
+ die "Could not create file $ENV{MYSQLTEST_VARDIR}/$$: $!";
+ close(SHORT_NAME);
+ unlink("$ENV{MYSQLTEST_VARDIR}/$$");
+ exit(3);
+} else {
+ close(LONG_NAME);
+ unlink($name);
+ exit(0);
+}
+EOF
+
+# If perl exited with error code 0, the check has passed,
+# so the calling test will be executed.
+# If perl exited with error code 3, it will be caught by
+# --error above, and processed by the check below.
+# If perl exited with some other error code, something went wrong,
+# so the test will fail.
+
+if ($errno)
+{
+ --skip Long file names are not supported
+}
+
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 1001769e4e2..3f2d359eb98 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -524,7 +524,7 @@ sub main {
}
}
- if ( not defined @$completed ) {
+ if ( not @$completed ) {
mtr_error("Test suite aborted");
}
@@ -736,9 +736,11 @@ sub run_test_server ($$$) {
mtr_report("\nRetrying test $tname, ".
"attempt($retries/$opt_retry)...\n");
#saving the log file as filename.failed in case of retry
- my $worker_logdir= $result->{savedir};
- my $log_file_name=dirname($worker_logdir)."/".$result->{shortname}.".log";
- rename $log_file_name,$log_file_name.".failed";
+ if ( $result->is_failed() ) {
+ my $worker_logdir= $result->{savedir};
+ my $log_file_name=dirname($worker_logdir)."/".$result->{shortname}.".log";
+ rename $log_file_name,$log_file_name.".failed";
+ }
delete($result->{result});
$result->{retries}= $retries+1;
$result->write_test($sock, 'TESTCASE');
@@ -4140,6 +4142,7 @@ sub resfile_report_test ($) {
sub run_testcase ($$) {
my ($tinfo, $server_socket)= @_;
+ my $print_freq=20;
mtr_verbose("Running test:", $tinfo->{name});
resfile_report_test($tinfo) if $opt_resfile;
@@ -4323,6 +4326,7 @@ sub run_testcase ($$) {
my $test= $tinfo->{suite}->start_test($tinfo);
# Set only when we have to keep waiting after expectedly died server
my $keep_waiting_proc = 0;
+ my $print_timeout= start_timer($print_freq * 60);
while (1)
{
@@ -4347,7 +4351,22 @@ sub run_testcase ($$) {
}
if (! $keep_waiting_proc)
{
- $proc= My::SafeProcess->wait_any_timeout($test_timeout);
+ if($test_timeout > $print_timeout)
+ {
+ $proc= My::SafeProcess->wait_any_timeout($print_timeout);
+ if ( $proc->{timeout} )
+ {
+ #print out that the test is still on
+ mtr_print("Test still running: $tinfo->{name}");
+ #reset the timer
+ $print_timeout= start_timer($print_freq * 60);
+ next;
+ }
+ }
+ else
+ {
+ $proc= My::SafeProcess->wait_any_timeout($test_timeout);
+ }
}
# Will be restored if we need to keep waiting
@@ -4772,6 +4791,9 @@ sub extract_warning_lines ($$) {
qr|Warning: io_setup\(\) failed|,
qr|Warning: io_setup\(\) attempt|,
qr|setrlimit could not change the size of core files to 'infinity';|,
+ qr|feedback plugin: failed to retrieve the MAC address|,
+ qr|Plugin 'FEEDBACK' init function returned error|,
+ qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|,
);
my $matched_lines= [];
diff --git a/mysql-test/r/cache_temporal_4265.result b/mysql-test/r/cache_temporal_4265.result
new file mode 100644
index 00000000000..1b4b3c2c4aa
--- /dev/null
+++ b/mysql-test/r/cache_temporal_4265.result
@@ -0,0 +1,10 @@
+create table t1 (a date);
+insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
+set debug_dbug='d,str_to_datetime_warn';
+select * from t1 where a > date_add('2000-01-01', interval 5 day);
+a
+2001-02-03
+2002-03-04
+Warnings:
+Note 1003 2000-01-01
+drop table t1;
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 23417b16698..625791a7c4b 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -268,37 +268,37 @@ cast(010203101112.121314 as datetime)
0001-02-03 10:11:12
select cast(120010203101112.121314 as datetime);
cast(120010203101112.121314 as datetime)
-NULL
+0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '120010203101112.121314'
select cast(cast(1.1 as decimal) as datetime);
cast(cast(1.1 as decimal) as datetime)
-NULL
+0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '1'
select cast(cast(-1.1 as decimal) as datetime);
cast(cast(-1.1 as decimal) as datetime)
-NULL
+0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '-1'
select cast('0' as date);
cast('0' as date)
-NULL
+0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '0'
select cast('' as date);
cast('' as date)
-NULL
+0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: ''
select cast('0' as datetime);
cast('0' as datetime)
-NULL
+0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '0'
select cast('' as datetime);
cast('' as datetime)
-NULL
+0000-00-00 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: ''
select cast('0' as time);
@@ -306,7 +306,7 @@ cast('0' as time)
00:00:00
select cast('' as time);
cast('' as time)
-NULL
+00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: ''
select cast(NULL as DATE);
@@ -323,13 +323,13 @@ cast(NULL as BINARY)
NULL
select cast(cast(120010203101112.121314 as double) as datetime);
cast(cast(120010203101112.121314 as double) as datetime)
-NULL
+0000-00-00 00:00:00
select cast(cast(1.1 as double) as datetime);
cast(cast(1.1 as double) as datetime)
0000-00-00 00:00:01
select cast(cast(-1.1 as double) as datetime);
cast(cast(-1.1 as double) as datetime)
-NULL
+0000-00-00 00:00:00
explain extended select cast(10 as double(5,2));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
@@ -737,6 +737,24 @@ WHERE CAST(a as BINARY)=x'62736D697468'
AND CAST(a AS BINARY)=x'65736D697468';
a
DROP TABLE t1;
+#
+# Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH
+# LONGTEXT, UNION, USER VARIABLE
+# Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
+#
+CREATE TABLE t1 AS SELECT CONCAT(CAST(REPEAT('9', 1000) AS SIGNED)),
+CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED));
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'
+Warning 1292 Truncated incorrect INTEGER value: '99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `CONCAT(CAST(REPEAT('9', 1000) AS SIGNED))` varchar(21) NOT NULL DEFAULT '',
+ `CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED))` varchar(21) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+# End of test for Bug#13581962, Bug#14096619
End of 5.1 tests
select cast("2101-00-01 02:03:04" as datetime);
cast("2101-00-01 02:03:04" as datetime)
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 4cb14aabb2c..751dd939361 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1752,7 +1752,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ID` bigint(4) NOT NULL DEFAULT '0',
- `USER` varchar(16) NOT NULL DEFAULT '',
+ `USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
@@ -1770,7 +1770,7 @@ show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`ID` bigint(4) NOT NULL DEFAULT '0',
- `USER` varchar(16) NOT NULL DEFAULT '',
+ `USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index 1e62787835f..deca926a69c 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -10,7 +10,7 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(0x8300)
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(X'8300')
master-bin.000001 # Query # # COMMIT
SELECT HEX(f1) FROM t1;
HEX(f1)
@@ -44,7 +44,7 @@ BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
+master-bin.000001 # Query # # use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 X'466F6F2773206120426172' COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 X'ED40ED41ED42' COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP PROCEDURE bug18293
master-bin.000001 # Query # # use `test`; DROP TABLE `t4` /* generated by server */
@@ -19491,5 +19491,38 @@ EFBFA4 FA55
EFBFA5 818F
DROP TABLE t1;
#
+# Bug#MDEV-4489 Replication of big5, cp932, gbk, sjis strings makes wrong values on slave
+#
+SET NAMES cp932;
+CREATE TABLE t1 (a INT);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (0x31);
+INSERT INTO t1 VALUES (X'31');
+PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (?)';
+SET @a='1';
+SELECT charset(@a);
+charset(@a)
+cp932
+EXECUTE stmt USING @a;
+DROP PREPARE stmt;
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (0x31)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (X'31')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # BEGIN
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 (a) VALUES (X'31')
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_ucs2_query_cache.result b/mysql-test/r/ctype_ucs2_query_cache.result
new file mode 100644
index 00000000000..c5f1ef5918d
--- /dev/null
+++ b/mysql-test/r/ctype_ucs2_query_cache.result
@@ -0,0 +1,19 @@
+#
+# Start of 5.5 tests
+#
+#
+# Bug#MDEV-4518 Server crashes in is_white_space when it's run
+# with query cache, charset ucs2 and collation ucs2_unicode_ci
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+SELECT * FROM t1;
+a
+1
+2
+3
+4
+DROP TABLE t1;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/ctype_utf8mb4.result b/mysql-test/r/ctype_utf8mb4.result
index a956a474ef7..d8642955b89 100644
--- a/mysql-test/r/ctype_utf8mb4.result
+++ b/mysql-test/r/ctype_utf8mb4.result
@@ -2539,6 +2539,24 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
#
+# Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH
+# LONGTEXT, UNION, USER VARIABLE
+# Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
+#
+CREATE TABLE t1(f1 LONGTEXT CHARACTER SET utf8mb4);
+INSERT INTO t1 VALUES ('a');
+SELECT @a:= CAST(f1 AS SIGNED) FROM t1
+UNION ALL
+SELECT CAST(f1 AS SIGNED) FROM t1;
+@a:= CAST(f1 AS SIGNED)
+0
+0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+Warning 1292 Truncated incorrect INTEGER value: 'a'
+DROP TABLE t1;
+# End of test for Bug#13581962,Bug#14096619
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index 7f69fd1a5a4..3bbd25cbbcc 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -521,7 +521,7 @@ TIME_FORMAT("25:00:00", '%l %p')
1 AM
SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896)
-NULL
+1151414896
Warnings:
Warning 1292 Incorrect datetime value: '%Y-%m-%d %H:%i:%s'
select str_to_date('04 /30/2004', '%m /%d/%Y');
diff --git a/mysql-test/r/dyncol.result b/mysql-test/r/dyncol.result
index 13543223ad8..2411f1070d9 100644
--- a/mysql-test/r/dyncol.result
+++ b/mysql-test/r/dyncol.result
@@ -182,13 +182,13 @@ select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(column_get(column_create(1,1212 AS unsigned int),1) as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int)`
+Note 1003 select column_get(column_create(1,1212 AS unsigned int),1 as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned int)`
explain extended
select column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(column_get(column_create(1,1212 AS unsigned int),1) as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned)`
+Note 1003 select column_get(column_create(1,1212 AS unsigned int),1 as unsigned) AS `column_get(column_create(1, 1212 AS unsigned int), 1 as unsigned)`
select column_get(column_create(1, 1212 AS decimal), 1 as unsigned int);
column_get(column_create(1, 1212 AS decimal), 1 as unsigned int)
1212
@@ -261,13 +261,13 @@ select column_get(column_create(1, 1212 AS int), 1 as int);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(column_get(column_create(1,1212 AS int),1) as signed) AS `column_get(column_create(1, 1212 AS int), 1 as int)`
+Note 1003 select column_get(column_create(1,1212 AS int),1 as signed) AS `column_get(column_create(1, 1212 AS int), 1 as int)`
explain extended
select column_get(column_create(1, 1212 AS int), 1 as signed int);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(column_get(column_create(1,1212 AS int),1) as signed) AS `column_get(column_create(1, 1212 AS int), 1 as signed int)`
+Note 1003 select column_get(column_create(1,1212 AS int),1 as signed) AS `column_get(column_create(1, 1212 AS int), 1 as signed int)`
select column_get(column_create(1, -1212 AS int), 1 as int);
column_get(column_create(1, -1212 AS int), 1 as int)
-1212
@@ -368,7 +368,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(column_get(column_create(1,'1212' AS char charset utf8 ),1) as char charset utf8) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8)`
+Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 ),1 as char charset utf8) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset utf8)`
select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8);
column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8)
1212
@@ -428,7 +428,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(column_get(column_create(1,'1212' AS char charset utf8 ),1) as char charset binary) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary)`
+Note 1003 select column_get(column_create(1,'1212' AS char charset utf8 ),1 as char charset binary) AS `column_get(column_create(1, "1212" AS char charset utf8), 1 as char charset binary)`
#
# column get real
#
@@ -440,13 +440,13 @@ select column_get(column_create(1, 1212.12 AS double), 1 as double);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as double) AS `column_get(column_create(1, 1212.12 AS double), 1 as double)`
+Note 1003 select column_get(column_create(1,1212.12 AS double),1 as double) AS `column_get(column_create(1, 1212.12 AS double), 1 as double)`
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as double(6,2));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as double(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as double(6,2))`
+Note 1003 select column_get(column_create(1,1212.12 AS double),1 as double(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as double(6,2))`
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double);
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as double)
1.8446744073709552e19
@@ -521,13 +521,13 @@ select column_get(column_create(1, 1212.12 AS double), 1 as decimal);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as decimal(10,0)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal)`
+Note 1003 select column_get(column_create(1,1212.12 AS double),1 as decimal(10,0)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal)`
explain extended
select column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(column_get(column_create(1,1212.12 AS double),1) as decimal(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2))`
+Note 1003 select column_get(column_create(1,1212.12 AS double),1 as decimal(6,2)) AS `column_get(column_create(1, 1212.12 AS double), 1 as decimal(6,2))`
select column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0));
column_get(column_create(1, 18446744073709551615 AS unsigned int), 1 as decimal(20,0))
18446744073709551615
@@ -1335,3 +1335,74 @@ hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal))
select hex(COLUMN_CREATE(0, 0.0 as decimal));
hex(COLUMN_CREATE(0, 0.0 as decimal))
000100000004
+#
+# MDEV-4292: parse error when selecting on views using dynamic column
+#
+create table t1 (i int, d blob);
+create view v1 as select i, column_get(d, 1 as binary) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as char charset binary) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as int) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as signed) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as unsigned int) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as unsigned) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as date) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as date) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as time) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as time) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as datetime) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as datetime) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as decimal) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as decimal(10,0)) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as double) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as double) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+create view v1 as select i, column_get(d, 1 as char) as a from t1;
+select * from v1;
+i a
+show create view v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i`,column_get(`t1`.`d`,1 as char charset latin1) AS `a` from `t1` latin1 latin1_swedish_ci
+drop view v1;
+drop table t1;
+#
+# end of 5.3 tests
+#
diff --git a/mysql-test/r/empty_user_table.result b/mysql-test/r/empty_user_table.result
new file mode 100644
index 00000000000..b93596ab59a
--- /dev/null
+++ b/mysql-test/r/empty_user_table.result
@@ -0,0 +1,8 @@
+create table t1 as select * from mysql.user;
+truncate table mysql.user;
+flush privileges;
+connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
+Got one of the listed errors
+insert mysql.user select * from t1;
+drop table t1;
+flush privileges;
diff --git a/mysql-test/r/fulltext_derived_4316.result b/mysql-test/r/fulltext_derived_4316.result
new file mode 100644
index 00000000000..141202c9842
--- /dev/null
+++ b/mysql-test/r/fulltext_derived_4316.result
@@ -0,0 +1,8 @@
+create table t1 (ft text) engine=myisam;
+insert into t1 values ('test1'),('test2');
+select distinct match(ft) against("test1" in boolean mode) from
+(select distinct ft from t1) as t;
+match(ft) against("test1" in boolean mode)
+1
+0
+drop table t1;
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 02284186c76..c2f1e5bf273 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -11,7 +11,7 @@ explain extended select uncompress(compress(@test_compress_string));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select uncompress(compress((@test_compress_string))) AS `uncompress(compress(@test_compress_string))`
+Note 1003 select uncompress(compress((@`test_compress_string`))) AS `uncompress(compress(@test_compress_string))`
select uncompressed_length(compress(@test_compress_string))=length(@test_compress_string);
uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)
1
@@ -19,7 +19,7 @@ explain extended select uncompressed_length(compress(@test_compress_string))=len
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (uncompressed_length(compress((@test_compress_string))) = length((@test_compress_string))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
+Note 1003 select (uncompressed_length(compress((@`test_compress_string`))) = length((@`test_compress_string`))) AS `uncompressed_length(compress(@test_compress_string))=length(@test_compress_string)`
select uncompressed_length(compress(@test_compress_string));
uncompressed_length(compress(@test_compress_string))
117
diff --git a/mysql-test/r/func_date_add.result b/mysql-test/r/func_date_add.result
index a7f2383848d..e8fbba786a4 100644
--- a/mysql-test/r/func_date_add.result
+++ b/mysql-test/r/func_date_add.result
@@ -96,3 +96,9 @@ b + interval a day
2002-02-04
drop table t1;
End of 5.0 tests
+create table t1 (a varchar(10));
+insert t1 values ('2000-12-03'),('2008-05-03');
+select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end;
+a
+drop table t1;
+End of 5.5 tests
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index f1884df2452..38aa3f49c4d 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1837,10 +1837,10 @@ INSERT INTO t2 VALUES
EXPLAIN EXTENDED
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10;
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 range a a 4 NULL 4 100.00 Using where; Using index
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where (<cache>(<in_optimizer>((1,2),<exists>(select 3,4 having (((1 = 3) or isnull(3)) and ((2 = 4) or isnull(4)) and <is_not_null_test>(3) and <is_not_null_test>(4))))) and (`test`.`t1`.`a` < 10))
+Note 1003 select max(`test`.`t1`.`a`) AS `MAX(a)` from `test`.`t1` where 0
SELECT MAX(a) FROM t1 WHERE (1,2) IN (SELECT 3,4) AND a<10;
MAX(a)
NULL
@@ -2090,6 +2090,41 @@ set @@optimizer_switch=@save_optimizer_switch;
# Cleanup for BUG#46680
#
DROP TABLE IF EXISTS t1,t2,t3,empty1;
+create table t1 (i int, d date);
+insert into t1 values (1, '2008-10-02'), (2, '2010-12-12');
+select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d order by i;
+avg(export_set( 3, 'y', sha(i))) group_concat(d)
+0 2008-10-02
+0 2010-12-12
+drop table t1;
+#
+# MDEV-4290: crash in st_select_lex::mark_as_dependent
+#
+create table `t1`(`a` int);
+select 1 from t1 v1 right join t1 on count(*);
+ERROR HY000: Invalid use of group function
+select 1 from t1 order by
+(
+select 1 from
+(
+select 1 from t1 v1 right join t1 on count(*)
+) v
+);
+ERROR HY000: Invalid use of group function
+insert into t1 values (1),(1),(2),(2);
+select count(*) from t1;
+count(*)
+4
+select z from (select count(*) as z from t1) v;
+z
+4
+# next is how it implemented now (may be changed in case of dependent
+# derived tables)
+select z from (select count(*) as z from t1) v group by 1;
+z
+4
+drop table t1;
+# end of 5.3 tests
#
# Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
# file .\item_sum.cc, line 587
diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result
index 67ea44f187a..9489960d28c 100644
--- a/mysql-test/r/func_group_innodb.result
+++ b/mysql-test/r/func_group_innodb.result
@@ -217,7 +217,20 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
member_id_to COUNT(*)
518491 2
DROP TABLE t1;
-# End of test BUG#12713907
+#
+# MDEV-4269: crash when grouping by values()
+#
+SELECT @@storage_engine INTO @old_engine;
+set storage_engine=innodb;
+create table y select 1 b;
+select 1 from y group by b;
+1
+1
+select 1 from y group by values(b);
+1
+1
+drop table y;
+SET storage_engine=@old_engine;
#
# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
#
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 67f3f664ad8..04e71a715ce 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -666,13 +666,13 @@ ERROR 22003: BIGINT value is out of range in '-(9223372036854775809)'
DROP TABLE t1;
SET @a:=999999999999999999999999999999999999999999999999999999999999999999999999999999999;
SELECT @a + @a;
-ERROR 22003: DECIMAL value is out of range in '((@a) + (@a))'
+ERROR 22003: DECIMAL value is out of range in '((@`a`) + (@`a`))'
SELECT @a * @a;
-ERROR 22003: DECIMAL value is out of range in '((@a) * (@a))'
+ERROR 22003: DECIMAL value is out of range in '((@`a`) * (@`a`))'
SELECT -@a - @a;
-ERROR 22003: DECIMAL value is out of range in '(-((@a)) - (@a))'
+ERROR 22003: DECIMAL value is out of range in '(-((@`a`)) - (@`a`))'
SELECT @a / 0.5;
-ERROR 22003: DECIMAL value is out of range in '((@a) / 0.5)'
+ERROR 22003: DECIMAL value is out of range in '((@`a`) / 0.5)'
SELECT COT(1/0);
COT(1/0)
NULL
diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
index fa3d37c08c2..1f20ddc6cbb 100644
--- a/mysql-test/r/func_sapdb.result
+++ b/mysql-test/r/func_sapdb.result
@@ -168,7 +168,7 @@ date("1997-12-31 23:59:59.000001")
1997-12-31
select date("1997-13-31 23:59:59.000001");
date("1997-13-31 23:59:59.000001")
-NULL
+0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '1997-13-31 23:59:59.000001'
select time("1997-12-31 23:59:59.000001");
@@ -176,7 +176,7 @@ time("1997-12-31 23:59:59.000001")
23:59:59.000001
select time("1997-12-31 25:59:59.000001");
time("1997-12-31 25:59:59.000001")
-NULL
+00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: '1997-12-31 25:59:59.000001'
select microsecond("1997-12-31 23:59:59.000001");
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 80729545902..ad5d640b402 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2634,6 +2634,31 @@ SELECT * FROM t1;
a
aaaaaaaaaaaaaa
DROP TABLE t1;
+SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
+SUBSTRING('1', DAY(FROM_UNIXTIME(-1)))
+NULL
+SELECT LEFT('1', DAY(FROM_UNIXTIME(-1)));
+LEFT('1', DAY(FROM_UNIXTIME(-1)))
+NULL
+SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1)));
+RIGHT('1', DAY(FROM_UNIXTIME(-1)))
+NULL
+SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1)));
+REPEAT('1', DAY(FROM_UNIXTIME(-1)))
+NULL
+SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
+RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?')
+NULL
+SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
+LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?')
+NULL
+create table t1 (i int);
+insert into t1 values (null),(8);
+select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field;
+group_concat( i ) field
+NULL NULL
+8
+drop table t1;
End of 5.1 tests
Start of 5.4 tests
SELECT format(12345678901234567890.123, 3);
@@ -2864,9 +2889,6 @@ sha1('P'),
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]'
SET @@global.max_allowed_packet:= @tmp_max;
-#
-# End of 5.5 tests
-#
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
1048576
@@ -2880,3 +2902,26 @@ NULL
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
SET @@global.max_allowed_packet:= @tmp_max;
+#
+# MDEV-4272: DIV operator crashes in Item_func_int_div::val_int
+# (incorrect NULL value handling by convert)
+#
+create table t1(a int) select null;
+select 1 div convert(a using utf8) from t1;
+1 div convert(a using utf8)
+NULL
+drop table t1;
+create table t1 (a int);
+create table t2 (a int);
+create procedure foo (var char(100))
+select replace(var, '00000000', table_name)
+from information_schema.tables where table_schema='test';
+call foo('(( 00000000 ++ 00000000 ))');
+replace(var, '00000000', table_name)
+(( t1 ++ t1 ))
+(( t2 ++ t2 ))
+drop procedure foo;
+drop table t1,t2;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index a5491c9c839..38a547843ad 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1781,7 +1781,7 @@ Warnings:
Warning 1441 Datetime function: time field overflow
select cast('131415.123e0' as time);
cast('131415.123e0' as time)
-NULL
+00:00:00
Warnings:
Warning 1292 Truncated incorrect time value: '131415.123e0'
select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04';
@@ -1801,12 +1801,12 @@ unix_timestamp(null)
NULL
select truncate(date('2010-40-10'), 6);
truncate(date('2010-40-10'), 6)
-NULL
+0.000000
Warnings:
Warning 1292 Incorrect datetime value: '2010-40-10'
select extract(month from '2010-40-50');
extract(month from '2010-40-50')
-NULL
+0
Warnings:
Warning 1292 Incorrect datetime value: '2010-40-50'
select subtime('0000-00-10 10:10:10', '30 10:00:00');
@@ -1924,3 +1924,15 @@ microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
123456 10
select now(258);
ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6.
+SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
+1
+SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
+1
+SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12'));
+1
+SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12'));
+1
+SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12'));
+1
+SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12'));
+1
diff --git a/mysql-test/r/func_time_hires.result b/mysql-test/r/func_time_hires.result
index 73b82a6ac1f..4aa0333c4b4 100644
--- a/mysql-test/r/func_time_hires.result
+++ b/mysql-test/r/func_time_hires.result
@@ -156,12 +156,12 @@ explain extended select cast(cast(@a as datetime(4)) as time(0));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select cast(cast((@a) as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))`
+Note 1003 select cast(cast((@`a`) as datetime(4)) as time) AS `cast(cast(@a as datetime(4)) as time(0))`
select cast(cast(@a as time(2)) as time(6));
cast(cast(@a as time(2)) as time(6))
12:13:14.120000
select CAST(@a AS DATETIME(7));
-ERROR 42000: Too big precision 7 specified for '(@a)'. Maximum is 6.
+ERROR 42000: Too big precision 7 specified for '(@`a`)'. Maximum is 6.
SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00')
2011-01-02 15:00:00
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index c394aec8851..22c30479125 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -1576,3 +1576,23 @@ a ASTEXT(b)
0 POINT(1 1)
DROP TABLE t1;
End of 5.1 tests
+CREATE TABLE t1 (
+l LINESTRING NOT NULL,
+SPATIAL KEY(l)
+) ENGINE = myisam;
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(0 0, 1 1)'));
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(1 1, 2 2)'));
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
+COUNT(*)
+1
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+COUNT(*)
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 906ed3f9338..eb9f1a57c32 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -406,20 +406,20 @@ FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second
first second w c o e d t i r
120 120 1 1 0 1 0 1 1 0
120 121 0 0 1 0 0 0 1 0
-120 122 0 1 NULL 0 NULL 0 NULL 0
-120 123 0 1 NULL 0 NULL 0 NULL 0
+120 122 NULL NULL NULL NULL NULL NULL NULL NULL
+120 123 NULL NULL NULL NULL NULL NULL NULL NULL
121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 1 1 0
-121 122 0 1 NULL 0 NULL 0 NULL 0
-121 123 0 1 NULL 0 NULL 0 NULL 0
-122 120 1 0 NULL 0 NULL 0 NULL 0
-122 121 1 0 NULL 0 NULL 0 NULL 0
-122 122 1 1 NULL 1 NULL 0 NULL 0
-122 123 1 1 NULL 1 NULL 0 NULL 0
-123 120 1 0 NULL 0 NULL 0 NULL 0
-123 121 1 0 NULL 0 NULL 0 NULL 0
-123 122 1 1 NULL 1 NULL 0 NULL 0
-123 123 1 1 NULL 1 NULL 0 NULL 0
+121 122 NULL NULL NULL NULL NULL NULL NULL NULL
+121 123 NULL NULL NULL NULL NULL NULL NULL NULL
+122 120 NULL NULL NULL NULL NULL NULL NULL NULL
+122 121 NULL NULL NULL NULL NULL NULL NULL NULL
+122 122 NULL NULL NULL NULL NULL NULL NULL NULL
+122 123 NULL NULL NULL NULL NULL NULL NULL NULL
+123 120 NULL NULL NULL NULL NULL NULL NULL NULL
+123 121 NULL NULL NULL NULL NULL NULL NULL NULL
+123 122 NULL NULL NULL NULL NULL NULL NULL NULL
+123 123 NULL NULL NULL NULL NULL NULL NULL NULL
explain extended SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
@@ -1063,6 +1063,84 @@ create table t1(a char(32) not null) engine=myisam;
create spatial index i on t1 (a);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
drop table t1;
+CREATE TABLE t0 (a BINARY(32) NOT NULL);
+CREATE SPATIAL INDEX i on t0 (a);
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+INSERT INTO t0 VALUES (1);
+CREATE TABLE t1(
+col0 BINARY NOT NULL,
+col2 TIMESTAMP,
+SPATIAL INDEX i1 (col0)
+) ENGINE=MyISAM;
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+CREATE TABLE t1 (
+col0 BINARY NOT NULL,
+col2 TIMESTAMP
+) ENGINE=MyISAM;
+CREATE SPATIAL INDEX idx0 ON t1(col0);
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+CREATE TABLE t2 (
+col0 INTEGER NOT NULL,
+col1 POINT,
+col2 POINT
+);
+CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+CREATE TABLE t3 (
+col0 INTEGER NOT NULL,
+col1 POINT,
+col2 LINESTRING,
+SPATIAL INDEX i1 (col1, col2)
+);
+ERROR HY000: Incorrect arguments to SPATIAL INDEX
+DROP TABLE t0, t1, t2;
+#
+# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
+#
+SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
+ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
+NULL
+#
+# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
+# GEOMETRY FUNCTION ARGUMENTS
+#
+SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
+ERROR 22007: Illegal non geometric '' value found during parsing
+#
+# MDEV-4252 geometry query crashes server
+#
+select astext(0x0100000000030000000100000000000010);
+astext(0x0100000000030000000100000000000010)
+NULL
+select astext(st_centroid(0x0100000000030000000100000000000010));
+astext(st_centroid(0x0100000000030000000100000000000010))
+NULL
+select astext(st_exteriorring(0x0100000000030000000100000000000010));
+astext(st_exteriorring(0x0100000000030000000100000000000010))
+NULL
+select envelope(0x0100000000030000000100000000000010);
+envelope(0x0100000000030000000100000000000010)
+NULL
+select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
+geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1)
+NULL
+select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
+geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1)
+NULL
+#
+# MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
+#
+SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
+Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )))
+NULL
+#
+# MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
+#
+SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
+Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))))
+NULL
End of 5.1 tests
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'));
ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))'))
@@ -1428,6 +1506,7 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
count(*)
1
DROP DATABASE gis_ogs;
+USE test;
#
# BUG #1043845 st_distance() results are incorrect depending on variable order
#
@@ -1451,20 +1530,23 @@ geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.
0.008148695928146028
-USE test;
#
-# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
+# MDEV-4310 geometry function equals hangs forever.
#
-SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
-ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
+create table t1(a geometry not null)engine=myisam;
+insert into t1 values(geomfromtext("POINT(0 0)"));
+insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
+insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
+select equals(`a`,convert(`a` using utf8)) from `t1`;
+equals(`a`,convert(`a` using utf8))
+1
NULL
-#
-# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
-# GEOMETRY FUNCTION ARGUMENTS
-#
-SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
-ERROR 22007: Illegal non geometric '' value found during parsing
-End of 5.1 tests
+NULL
+Warnings:
+Warning 1300 Invalid utf8 character string: 'E043'
+Warning 1300 Invalid utf8 character string: 'E043'
+drop table t1;
+End of 5.3 tests
#
# Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
#
@@ -1498,19 +1580,4 @@ create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1
drop table t1;
-#
-# TODO-424 geometry query crashes server
-#
-select astext(0x0100000000030000000100000000000010);
-astext(0x0100000000030000000100000000000010)
-NULL
-select st_area(0x0100000000030000000100000000000010);
-st_area(0x0100000000030000000100000000000010)
-NULL
-select astext(st_exteriorring(0x0100000000030000000100000000000010));
-astext(st_exteriorring(0x0100000000030000000100000000000010))
-NULL
-select astext(st_centroid(0x0100000000030000000100000000000010));
-astext(st_centroid(0x0100000000030000000100000000000010))
-NULL
End of 5.5 tests
diff --git a/mysql-test/r/grant_4332.result b/mysql-test/r/grant_4332.result
new file mode 100644
index 00000000000..ef92b62ab32
--- /dev/null
+++ b/mysql-test/r/grant_4332.result
@@ -0,0 +1,96 @@
+select user();
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def user() 253 77 14 N 1 31 8
+user()
+root@localhost
+create user a17aaaaaaaaaaaaa0@localhost;
+ERROR HY000: String 'a17aaaaaaaaaaaaa0' is too long for user name (should be no longer than 16)
+alter table mysql.user modify User char(80) binary not null default '';
+alter table mysql.db modify User char(80) binary not null default '';
+alter table mysql.tables_priv modify User char(80) binary not null default '';
+alter table mysql.columns_priv modify User char(80) binary not null default '';
+alter table mysql.procs_priv modify User char(80) binary not null default '';
+alter table mysql.proc modify definer char(141) collate utf8_bin not null default '';
+alter table mysql.event modify definer char(141) collate utf8_bin not null default '';
+set global event_scheduler = on;
+select user();
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def user() 253 141 14 N 1 31 8
+user()
+root@localhost
+create user a17aaaaaaaaaaaaa0@localhost;
+grant usage on *.* to a17aaaaaaaaaaaaa0@localhost;
+grant select on mysql.user to b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost;
+grant select(User) on mysql.tables_priv to c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost;
+select user(), current_user();
+user() current_user()
+a17aaaaaaaaaaaaa0@localhost a17aaaaaaaaaaaaa0@localhost
+show grants;
+Grants for a17aaaaaaaaaaaaa0@localhost
+GRANT USAGE ON *.* TO 'a17aaaaaaaaaaaaa0'@'localhost'
+select user(), current_user();
+user() current_user()
+b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost
+show grants;
+Grants for b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost
+GRANT USAGE ON *.* TO 'b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0'@'localhost'
+GRANT SELECT ON `mysql`.`user` TO 'b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0'@'localhost'
+select user,host from mysql.user where user like '%0';
+user host
+a17aaaaaaaaaaaaa0 localhost
+b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0 localhost
+c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0 localhost
+select user,host from mysql.db;
+ERROR 42000: SELECT command denied to user 'b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'@'localhost' for table 'db'
+select user(), current_user();
+user() current_user()
+c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost
+show grants;
+Grants for c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost
+GRANT USAGE ON *.* TO 'c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0'@'localhost'
+GRANT SELECT (User) ON `mysql`.`tables_priv` TO 'c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0'@'localhost'
+select user from mysql.tables_priv;
+user
+b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0
+c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0
+select user,host from mysql.tables_priv;
+ERROR 42000: SELECT command denied to user 'c80ccccccccccccccccccccccccccccccccccccccccccccc'@'localhost' for column 'host' in table 'tables_priv'
+create procedure test.p1() select user(), current_user(), user from mysql.tables_priv;
+show create procedure test.p1;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+p1 CREATE DEFINER=`c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0`@`localhost` PROCEDURE `p1`()
+select user(), current_user(), user from mysql.tables_priv latin1 latin1_swedish_ci latin1_swedish_ci
+create table test.t1 (a text);
+create event e1 on schedule every 1 second
+do insert test.t1 values (concat(user(), ' ', current_user()));
+call test.p1();
+user() current_user() user
+root@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0
+root@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0
+select * from t1 limit 1;
+a
+event_scheduler@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost
+grant usage on *.* to d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost;
+ERROR HY000: String 'd81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd' is too long for user name (should be no longer than 80)
+drop user d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost;
+ERROR HY000: String 'd81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd' is too long for user name (should be no longer than 80)
+drop user c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost;
+drop user b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost;
+drop user a17aaaaaaaaaaaaa0@localhost;
+set global event_scheduler = off;
+drop event e1;
+drop procedure test.p1;
+drop table t1;
+alter table mysql.user modify User char(16) binary not null default '';
+alter table mysql.db modify User char(16) binary not null default '';
+alter table mysql.tables_priv modify User char(16) binary not null default '';
+alter table mysql.columns_priv modify User char(16) binary not null default '';
+alter table mysql.procs_priv modify User char(16) binary not null default '';
+alter table mysql.proc modify definer char(77) collate utf8_bin not null default '';
+alter table mysql.event modify definer char(77) collate utf8_bin not null default '';
+flush privileges;
+select user();
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def user() 253 77 14 N 1 31 8
+user()
+root@localhost
diff --git a/mysql-test/r/have_debug_sync.require b/mysql-test/r/have_debug_sync.require
deleted file mode 100644
index c2090bc5657..00000000000
--- a/mysql-test/r/have_debug_sync.require
+++ /dev/null
@@ -1,2 +0,0 @@
-debug_sync
-1
diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result
index 0da4feaf26f..4a6b902e869 100644
--- a/mysql-test/r/innodb_ext_key.result
+++ b/mysql-test/r/innodb_ext_key.result
@@ -865,6 +865,128 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
1 SIMPLE t3 ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # Using index
drop table t1,t2,t3;
+#
+# Bug mdev-4340: performance regression with extended_keys=on
+#
+set @save_optimizer_switch=@@optimizer_switch;
+CREATE TABLE t1 (
+page_id int(8) unsigned NOT NULL AUTO_INCREMENT,
+page_namespace int(11) NOT NULL DEFAULT '0',
+page_title varbinary(255) NOT NULL DEFAULT '',
+page_restrictions tinyblob NOT NULL,
+page_counter bigint(20) unsigned NOT NULL DEFAULT '0',
+page_is_redirect tinyint(1) unsigned NOT NULL DEFAULT '0',
+page_is_new tinyint(1) unsigned NOT NULL DEFAULT '0',
+page_random double unsigned NOT NULL DEFAULT '0',
+page_touched varbinary(14) NOT NULL DEFAULT '',
+page_latest int(8) unsigned NOT NULL DEFAULT '0',
+page_len int(8) unsigned NOT NULL DEFAULT '0',
+PRIMARY KEY (page_id),
+UNIQUE KEY name_title (page_namespace,page_title),
+KEY page_random (page_random),
+KEY page_len (page_len),
+KEY page_redirect_namespace_len (page_is_redirect,page_namespace,page_len)
+) ENGINE=InnoDB AUTO_INCREMENT=38929100 DEFAULT CHARSET=binary;
+INSERT INTO t1 VALUES
+(38928077,0,'Sandbox','',0,0,0,0,'',0,0),(38928078,1,'Sandbox','',0,0,0,1,'',0,0),
+(38928079,2,'Sandbox','',0,0,0,2,'',0,0),(38928080,3,'Sandbox','',0,0,0,3,'',0,0),
+(38928081,4,'Sandbox','',0,0,0,4,'',0,0),(38928082,5,'Sandbox','',0,0,0,5,'',0,0);
+CREATE TABLE t2 (
+rev_id int(8) unsigned NOT NULL AUTO_INCREMENT,
+rev_page int(8) unsigned NOT NULL DEFAULT '0',
+rev_text_id int(8) unsigned NOT NULL DEFAULT '0',
+rev_comment varbinary(255) DEFAULT NULL,
+rev_user int(5) unsigned NOT NULL DEFAULT '0',
+rev_user_text varbinary(255) NOT NULL DEFAULT '',
+rev_timestamp varbinary(14) NOT NULL DEFAULT '',
+rev_minor_edit tinyint(1) unsigned NOT NULL DEFAULT '0',
+rev_deleted tinyint(1) unsigned NOT NULL DEFAULT '0',
+rev_len int(8) unsigned DEFAULT NULL,
+rev_parent_id int(8) unsigned DEFAULT NULL,
+rev_sha1 varbinary(32) NOT NULL DEFAULT '',
+PRIMARY KEY (rev_page,rev_id),
+UNIQUE KEY rev_id (rev_id),
+KEY rev_timestamp (rev_timestamp),
+KEY page_timestamp (rev_page,rev_timestamp),
+KEY user_timestamp (rev_user,rev_timestamp),
+KEY usertext_timestamp (rev_user_text,rev_timestamp,rev_user,rev_deleted,rev_minor_edit,rev_text_id,rev_comment)
+) ENGINE=InnoDB DEFAULT CHARSET=binary;
+INSERT INTO t2 VALUES
+(547116222,20,0,NULL,3,'','',0,0,NULL,NULL,''),(547117245,20,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118268,20,0,NULL,5,'','',0,0,NULL,NULL,''),(547114177,21,0,NULL,1,'','',0,0,NULL,NULL,''),
+(547115200,21,0,NULL,2,'','',0,0,NULL,NULL,''),(547116223,21,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547117246,21,0,NULL,4,'','',0,0,NULL,NULL,''),(547118269,21,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547114178,22,0,NULL,1,'','',0,0,NULL,NULL,''),(547115201,22,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547116224,22,0,NULL,3,'','',0,0,NULL,NULL,''),(547117247,22,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547116226,24,0,NULL,3,'','',0,0,NULL,NULL,''),(547117249,24,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118272,24,0,NULL,5,'','',0,0,NULL,NULL,''),(547114181,25,0,NULL,1,'','',0,0,NULL,NULL,''),
+(547115204,25,0,NULL,2,'','',0,0,NULL,NULL,''),(547116227,25,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547116157,978,0,NULL,2,'','',0,0,NULL,NULL,''),(547117180,978,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547118203,978,0,NULL,4,'','',0,0,NULL,NULL,''),(547119226,978,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115135,979,0,NULL,1,'','',0,0,NULL,NULL,''),(547116158,979,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547116173,994,0,NULL,2,'','',0,0,NULL,NULL,''),(547117196,994,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547118219,994,0,NULL,4,'','',0,0,NULL,NULL,''),(547119242,994,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115151,995,0,NULL,1,'','',0,0,NULL,NULL,''),(547116174,995,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547117197,995,0,NULL,3,'','',0,0,NULL,NULL,''),(547118220,995,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118223,998,0,NULL,4,'','',0,0,NULL,NULL,''),(547119246,998,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115155,999,0,NULL,1,'','',0,0,NULL,NULL,''),(547116178,999,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547117201,999,0,NULL,3,'','',0,0,NULL,NULL,''),(547118224,999,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547119271,38928081,0,NULL,10,'','',0,0,NULL,NULL,''),(547119272,38928081,0,NULL,11,'','',0,0,NULL,NULL,''),
+(547119273,38928081,0,NULL,12,'','',0,0,NULL,NULL,''),(547119274,38928081,0,NULL,13,'','',0,0,NULL,NULL,''),
+(547119275,38928081,0,NULL,14,'','',0,0,NULL,NULL,''),(547119276,38928081,0,NULL,15,'','',0,0,NULL,NULL,''),
+(547119277,38928081,0,NULL,16,'','',0,0,NULL,NULL,''),(547119278,38928081,0,NULL,17,'','',0,0,NULL,NULL,''),
+(547119279,38928081,0,NULL,18,'','',0,0,NULL,NULL,''),(547119280,38928081,0,NULL,19,'','',0,0,NULL,NULL,'');
+CREATE TABLE t3 (
+old_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+old_text mediumblob NOT NULL,
+old_flags tinyblob NOT NULL,
+PRIMARY KEY (old_id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t3 VALUES
+(1,'text-0',''),(2,'text-1000',''),(3,'text-2000',''),(4,'text-3000',''),
+(5,'text-4000',''),(6,'text-5000',''),(7,'text-6000',''),(8,'text-7000',''),
+(9,'text-8000',''),(10,'text-9000',''),(11,'text-1',''),(12,'text-1001',''),
+(13,'text-2001',''),(14,'text-3001',''),(15,'text-4001',''),(16,'text-5001',''),
+(17,'text-6001',''),(18,'text-7001',''),(19,'text-8001',''),(20,'text-9001',''),
+(21,'text-2',''),(22,'text-1002',''),(23,'text-2002',''),(24,'text-3002',''),
+(25,'text-4002',''),(26,'text-5002',''),(27,'text-6002',''),(28,'text-7002',''),
+(29,'text-8002',''),(30,'text-9002',''),(31,'text-3',''),(32,'text-1003',''),
+(33,'text-2003',''),(34,'text-3003',''),(35,'text-4003',''),(36,'text-5003',''),
+(37,'text-6003',''),(38,'text-7003',''),(39,'text-8003',''),(40,'text-9003',''),
+(41,'text-4',''),(42,'text-1004',''),(43,'text-2004',''),(44,'text-3004',''),
+(45,'text-4004',''),(46,'text-5004',''),(47,'text-6004',''),(48,'text-7004',''),
+(49,'text-8004',''),(50,'text-9004',''),(51,'text-5',''),(52,'text-1005',''),
+(53,'text-2005',''),(54,'text-3005',''),(55,'text-4005',''),(56,'text-5005',''),
+(57,'text-6005',''),(58,'text-7005',''),(59,'text-8005',''),(60,'text-9005',''),
+(61,'text-6',''),(62,'text-1006',''),(63,'text-2006',''),(64,'text-3006',''),
+(65,'text-4006',''),(66,'text-5006',''),(67,'text-6006',''),(68,'text-7006',''),
+(69,'text-8006',''),(70,'text-9006',''),(71,'text-7',''),(72,'text-1007',''),
+(73,'text-2007',''),(74,'text-3007',''),(75,'text-4007',''),(76,'text-5007',''),
+(77,'text-6007',''),(78,'text-7007',''),(79,'text-8007',''),(80,'text-9007',''),
+(81,'text-8',''),(82,'text-1008',''),(83,'text-2008',''),(84,'text-3008',''),
+(85,'text-4008',''),(86,'text-5008',''),(87,'text-6008',''),(88,'text-7008',''),
+(89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''),
+(93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''),
+(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
+set optimizer_switch='extended_keys=off';
+EXPLAIN
+SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
+WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
+ORDER BY rev_timestamp ASC LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY,name_title name_title 261 const,const 1
+1 SIMPLE t2 ref page_timestamp page_timestamp 4 const 10 Using where
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.rev_text_id 1
+set optimizer_switch='extended_keys=on';
+EXPLAIN
+SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
+WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
+ORDER BY rev_timestamp ASC LIMIT 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY,name_title name_title 261 const,const 1
+1 SIMPLE t2 ref page_timestamp page_timestamp 4 const 10 Using where
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.rev_text_id 1
+DROP TABLE t1,t2,t3;
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch=@save_ext_key_optimizer_switch;
SET SESSION STORAGE_ENGINE=DEFAULT;
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result
index 255714a7236..84b6ff640e9 100644
--- a/mysql-test/r/join_nested.result
+++ b/mysql-test/r/join_nested.result
@@ -1847,3 +1847,27 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` A
DROP TABLE t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch;
End of 5.0 tests
+#
+# MDEV-621: LP:693329 - Assertion `!is_interleave_error' failed on low optimizer_search_depth
+#
+set @tmp_mdev621= @@optimizer_search_depth;
+SET SESSION optimizer_search_depth = 4;
+CREATE TABLE t1 (f1 int,f2 int,f3 int,f4 int) ;
+INSERT IGNORE INTO t1 VALUES (0,0,2,0),(NULL,0,2,0);
+CREATE TABLE t2 (f1 int) ;
+CREATE TABLE t3 (f3 int,PRIMARY KEY (f3)) ;
+CREATE TABLE t4 (f5 int) ;
+CREATE TABLE t5 (f2 int) ;
+SELECT alias2.f4 FROM t1 AS alias1
+LEFT JOIN t1 AS alias2
+LEFT JOIN t2 AS alias3
+LEFT JOIN t3 AS alias4 ON alias3.f1 = alias4.f3
+ON alias2.f1
+LEFT JOIN t4 AS alias5
+JOIN t5 ON alias5.f5
+ON alias2.f3 ON alias1.f2;
+f4
+NULL
+NULL
+DROP TABLE t1,t2,t3,t4,t5;
+set optimizer_search_depth= @tmp_mdev621;
diff --git a/mysql-test/r/join_nested_jcl6.result b/mysql-test/r/join_nested_jcl6.result
index c744df9e2fe..6b5a50ba978 100644
--- a/mysql-test/r/join_nested_jcl6.result
+++ b/mysql-test/r/join_nested_jcl6.result
@@ -1858,6 +1858,30 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` A
DROP TABLE t1,t2,t3,t4;
SET optimizer_switch=@save_optimizer_switch;
End of 5.0 tests
+#
+# MDEV-621: LP:693329 - Assertion `!is_interleave_error' failed on low optimizer_search_depth
+#
+set @tmp_mdev621= @@optimizer_search_depth;
+SET SESSION optimizer_search_depth = 4;
+CREATE TABLE t1 (f1 int,f2 int,f3 int,f4 int) ;
+INSERT IGNORE INTO t1 VALUES (0,0,2,0),(NULL,0,2,0);
+CREATE TABLE t2 (f1 int) ;
+CREATE TABLE t3 (f3 int,PRIMARY KEY (f3)) ;
+CREATE TABLE t4 (f5 int) ;
+CREATE TABLE t5 (f2 int) ;
+SELECT alias2.f4 FROM t1 AS alias1
+LEFT JOIN t1 AS alias2
+LEFT JOIN t2 AS alias3
+LEFT JOIN t3 AS alias4 ON alias3.f1 = alias4.f3
+ON alias2.f1
+LEFT JOIN t4 AS alias5
+JOIN t5 ON alias5.f5
+ON alias2.f3 ON alias1.f2;
+f4
+NULL
+NULL
+DROP TABLE t1,t2,t3,t4,t5;
+set optimizer_search_depth= @tmp_mdev621;
CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t7 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index c28887d4ff2..8920539ef2e 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1853,6 +1853,38 @@ WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
GROUP BY t2.f1, t2.f2;
f1 f1 f2
DROP TABLE t1,t2;
+#
+# Bug#13068506 - QUERY WITH GROUP BY ON NON-AGGR COLUMN RETURNS
+# WRONG RESULT
+#
+CREATE TABLE t1 (i1 int);
+INSERT INTO t1 VALUES (100), (101);
+CREATE TABLE t2 (i2 int, i3 int);
+INSERT INTO t2 VALUES (20,1),(10,2);
+CREATE TABLE t3 (i4 int(11));
+INSERT INTO t3 VALUES (1),(2);
+
+SELECT (
+SELECT MAX( t2.i2 )
+FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
+WHERE t2.i3 <> t1.i1
+) AS field1
+FROM t1;;
+field1
+20
+20
+
+SELECT (
+SELECT MAX( t2.i2 )
+FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
+WHERE t2.i3 <> t1.i1
+) AS field1
+FROM t1 GROUP BY field1;;
+field1
+20
+
+drop table t1,t2,t3;
+# End of test for Bug#13068506
End of 5.1 tests
#
# LP BUG#994392: Wrong result with RIGHT/LEFT JOIN and ALL subquery
@@ -2071,4 +2103,18 @@ b c d
5 8 88
5 8 81
DROP TABLE t1,t2;
+#
+# Bug mdev-4336: LEFT JOIN with disjunctive
+# <non-nullable datetime field> IS NULL in WHERE
+# causes a hang and eventual crash
+#
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+modified datetime NOT NULL,
+PRIMARY KEY (id)
+);
+SELECT a.* FROM t1 a LEFT JOIN t1 b ON a.id = b.id
+WHERE a.modified > b.modified or b.modified IS NULL;
+id modified
+DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/join_outer_innodb.result b/mysql-test/r/join_outer_innodb.result
index 650946d8b06..1081fc0eed3 100644
--- a/mysql-test/r/join_outer_innodb.result
+++ b/mysql-test/r/join_outer_innodb.result
@@ -183,6 +183,318 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t4 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 1 Using join buffer (incremental, BNL join)
1 SIMPLE t5 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
-1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t6b ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join)
drop table t1,t2,t3,t4,t5,t6;
+#
+Bug mdev-4318: view over a complex query with outer joins
+#
+CREATE TABLE t1 (
+a1 int NOT NULL, a2 int NOT NULL, a3 int DEFAULT NULL, a4 tinyint NOT NULL,
+a5 int NOT NULL, a6 tinyint NOT NULL, a7 tinyint(4) DEFAULT NULL,
+a8 smallint(6) DEFAULT NULL, a9 smallint(6) DEFAULT NULL, a10 tinyint NOT NULL,
+PRIMARY KEY (a1), KEY a2 (a2), KEY a3 (a3), KEY a4 (a4), KEY a6 (a6),
+KEY a5 (a5), KEY a7 (a7), KEY a8 (a8), KEY a9 (a9)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(3360,5684,2219,1,316832,1,0,NULL,NULL,NULL),
+(3362,2754,597,2,316844,1,0,NULL,NULL,NULL),
+(3363,369,NULL,1,317295,1,0,NULL,NULL,NULL);
+Warnings:
+Warning 1048 Column 'a10' cannot be null
+Warning 1048 Column 'a10' cannot be null
+Warning 1048 Column 'a10' cannot be null
+CREATE TABLE t2 (
+b1 int NOT NULL, b2 int NOT NULL, PRIMARY KEY (b1,b2), KEY b2 (b2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t3 (
+c1 int NOT NULL, PRIMARY KEY (c1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t3 VALUES
+(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),
+(1000),(1001),(1002),(1003),(9999);
+CREATE TABLE t4 (
+d1 int NOT NULL, PRIMARY KEY (d1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t4 VALUES (5674),(5676),(5680),(5684),(5685);
+CREATE TABLE t5 (
+e1 int NOT NULL, e2 varchar(64) NOT NULL, PRIMARY KEY (e1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t5 VALUES
+(5684,'51a5de7a9f56314e082094d78f58be082c3cf0c1'),
+(5685,'754dc8292cb9f5eb9ade126fe7e961c62412a349'),
+(5686,'75eeb33f1c819bac21f6d023b4c5b24185eeda5c');
+CREATE TABLE t6 (
+f1 int NOT NULL, PRIMARY KEY (f1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t6 VALUES (5542),(5620),(5686);
+CREATE TABLE t7 (
+g1 tinyint NOT NULL DEFAULT '0', g2 varchar(20) NOT NULL, PRIMARY KEY (g1)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t7 VALUES
+(1,'60feec2b20ed19f55ad0'),(3,'9ddb18bff7fcbd1e3133'),
+(5,'a05599df9222bb160d11'),(7,'e31bae372f7d01df0589'),
+(9,'8f8372dd7fc8eb46c8a3'),(11,'f8d0e28529e990a09309');
+CREATE TABLE t8 (
+h1 tinyint NOT NULL, h2 varchar(128) DEFAULT NULL, PRIMARY KEY (h1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t8 VALUES (1,'b'),(2,'c'),(3,'d'),(4,'e');
+CREATE TABLE t9 (
+i1 tinyint NOT NULL, i2 varchar(7) NOT NULL, i3 varchar(128) NOT NULL,
+PRIMARY KEY (i1,i2), KEY i2 (i2), KEY i3 (i3)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t9 VALUES
+(2,'a','07630d223c7e5f7b1feb19b3caafb0833fd028eb'),
+(3,'b','1ca53dcc50b68af86f4b1b4676dbed917b543c30'),
+(1,'b','2c01ac36c1ce9a7de66be89f85d8aa5f0052e2e8'),
+(4,'a','496c486b3a9edc439477fef7d34cbefdebba86df'),
+(3,'a','98bf72d8d467201058a5f69bd7709bfc74a8637e'),
+(2,'b','9a45425f6160fb59d7f8a02c721498d4ce945302'),
+(4,'b','9c9a7300f3e708f8e430f9f3376d966f5951f583'),
+(1,'a','c0af3f076b905f31cbb51af304b9c7ad539e0861');
+CREATE TABLE t10 (
+j1 tinyint NOT NULL, j2 varchar(20) NOT NULL, PRIMARY KEY (j1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t10 VALUES (1,'b'),(2,'c'),(3,'d');
+CREATE TABLE t11 (
+k1 int NOT NULL, k2 datetime DEFAULT NULL, k3 int DEFAULT NULL,
+k4 int DEFAULT NULL, PRIMARY KEY (k1), KEY k3 (k3), KEY k4 (k4)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t11 VALUES
+(317422,'2013-03-18 11:43:03',1,NULL),(317423,'2013-03-18 11:43:11',1,NULL),
+(317424,'2013-03-18 11:52:01',1,1),(317425,'2013-03-18 11:52:01',1,1),
+(317426,'2013-03-18 11:56:38',1,1),(317427,'2013-03-18 12:18:25',1,NULL),
+(317428,'2013-03-18 12:46:28',1,NULL),(317429,'2013-03-18 12:46:28',1,NULL),
+(317430,'2013-03-18 12:46:28',1,NULL),(317431,'2013-03-18 12:46:28',1,NULL),
+(317432,'2013-03-18 12:46:28',1,NULL),(317433,'2013-03-18 12:46:28',1,NULL),
+(317434,'2013-03-18 12:46:28',1,NULL),(317435,'2013-03-18 12:46:28',1,NULL),
+(317436,'2013-03-18 12:46:28',1,NULL),(317437,'2013-03-18 12:46:28',1,NULL),
+(317438,'2013-03-18 12:46:28',1,NULL),(317439,'2013-03-18 12:46:28',1,NULL),
+(317440,'2013-03-18 12:55:20',1,NULL),(317441,'2013-03-18 12:58:29',1,NULL),
+(317442,'2013-03-18 13:06:02',1,NULL),(317443,'2013-03-18 15:23:18',21,NULL);
+CREATE TABLE t12 (
+l1 int NOT NULL, l2 varchar(64) NOT NULL, PRIMARY KEY (l1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t12 VALUES
+(552,'59a498252ef59f96fbdc13a414abe244d8e8bc30'),
+(554,'c6025c7cb2d9dfb1be7ce4a61f35b45bb9e61ba3'),
+(555,'b245bcc672082bb6d10794b2b4ac972dd14b1cf5');
+CREATE TABLE t13 (
+m1 int NOT NULL, m2 int NOT NULL, m3 int NOT NULL,
+PRIMARY KEY (m1,m2,m3), KEY m3 (m3), KEY m2 (m2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t13 VALUES (3324,43,4),(3332,263,1),(3348,27,3);
+CREATE TABLE t14 (
+n1 smallint NOT NULL, n2 varchar(64) NOT NULL, PRIMARY KEY (n1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t14 VALUES
+(21,'685bf7ca576af964c7cff564d5e4473b81499b8b'),
+(23,'b8e42dab1ab952406b3accfb47089c61478138a8'),
+(25,'3fea441e411db8c70bf039b50c8f18f59515be53'),
+(27,'998aecc30fd0e0b8a1cac6590e5eccc2d7822223');
+CREATE TABLE t15 (
+o1 smallint NOT NULL, PRIMARY KEY (o1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t15 VALUES (1),(3);
+CREATE TABLE t16 (
+p1 smallint NOT NULL, p2 varchar(7) NOT NULL, p3 varchar(64) NOT NULL,
+PRIMARY KEY (p1,p2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t16 VALUES
+(1,'a','66bdbb389456f3ae97206da115a7b397c31400e8'),
+(1,'b','66bdbb389456f3ae97206da115a7b397c31400e8'),
+(3,'a','386c10e454278c6e27feb16258089166422f79b4'),
+(3,'b','386c10e454278c6e27feb16258089166422f79b4');
+create view v1 as select t3.c1,t5.e2,t1.a1,t14.n2,t16.p3,t10.j2,t7.g2,t11.k2,l3.l2,
+t9.i3,t12.l2 AS l_l2,l2.l2 AS l2_l2,l4.l1 AS l4_l1,t6.f1
+from
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+t1
+left join t2 on t1.a1 = t2.b1
+)
+left join t3 on t2.b2 = t3.c1
+)
+left join t4 on t1.a2 = t4.d1
+)
+left join t5 on t4.d1 = t5.e1
+)
+left join t6 on t1.a3 = t6.f1
+)
+left join t5 e2 on t6.f1 = e2.e1
+)
+join t7 on t1.a7 = t7.g1
+)
+join t8 on t1.a4 = t8.h1
+)
+join t9 on t8.h1 = t9.i1
+)
+join t10 on t1.a6 = t10.j1
+)
+join t11 on t1.a5 = t11.k1
+)
+left join t12 on t11.k3 = t12.l1
+)
+left join t12 l2 on t11.k4 = l2.l1
+)
+left join t13 on t1.a1 = t13.m1 and t13.m3 = 4
+)
+left join t12 l4 on l4.l1 = t13.m2
+)
+left join t13 m2 on t1.a1 = m2.m1 and m2.m3 = 3
+)
+left join t12 l3 on l3.l1 = m2.m2
+)
+left join t14 on t1.a8 = t14.n1
+)
+left join t15 on t1.a9 = t15.o1
+)
+left join t16 on t15.o1 = t16.p1
+where t1.a10 = 1;
+explain select t3.c1,t5.e2,t1.a1,t14.n2,t16.p3,t10.j2,t7.g2,t11.k2,l3.l2,
+t9.i3,t12.l2 AS l_l2,l2.l2 AS l2_l2,l4.l1 AS l4_l1,t6.f1
+from
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+(
+t1
+left join t2 on t1.a1 = t2.b1
+)
+left join t3 on t2.b2 = t3.c1
+)
+left join t4 on t1.a2 = t4.d1
+)
+left join t5 on t4.d1 = t5.e1
+)
+left join t6 on t1.a3 = t6.f1
+)
+left join t5 e2 on t6.f1 = e2.e1
+)
+join t7 on t1.a7 = t7.g1
+)
+join t8 on t1.a4 = t8.h1
+)
+join t9 on t8.h1 = t9.i1
+)
+join t10 on t1.a6 = t10.j1
+)
+join t11 on t1.a5 = t11.k1
+)
+left join t12 on t11.k3 = t12.l1
+)
+left join t12 l2 on t11.k4 = l2.l1
+)
+left join t13 on t1.a1 = t13.m1 and t13.m3 = 4
+)
+left join t12 l4 on l4.l1 = t13.m2
+)
+left join t13 m2 on t1.a1 = m2.m1 and m2.m3 = 3
+)
+left join t12 l3 on l3.l1 = m2.m2
+)
+left join t14 on t1.a8 = t14.n1
+)
+left join t15 on t1.a9 = t15.o1
+)
+left join t16 on t15.o1 = t16.p1
+where t1.a10 = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index
+1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where
+1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index
+1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index
+1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1
+1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1
+1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1
+1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where
+1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where
+1 SIMPLE t13 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
+1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index
+1 SIMPLE m2 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
+1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where
+1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where
+1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index
+1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where
+1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+explain select * from v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where
+1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index
+1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where
+1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index
+1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index
+1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1
+1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1
+1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1
+1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where
+1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where
+1 SIMPLE t13 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
+1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index
+1 SIMPLE m2 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index
+1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where
+1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where
+1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index
+1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where
+1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join)
+drop view v1;
+drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
+#
+# MDEV-4270: crash in fix_semijoin_strategies_for_picked_join_order
+#
+drop table if exists t1,t2,t3;
+Warnings:
+Note 1051 Unknown table 't1'
+Note 1051 Unknown table 't2'
+Note 1051 Unknown table 't3'
+create table t2(a int,unique key (a)) engine=innodb;
+create table t3(b int) engine=innodb;
+create table t1(a int,b int)engine=innodb;
+set @mdev4270_opl= @@optimizer_prune_level;
+set @mdev4270_osd= @@optimizer_search_depth;
+set optimizer_prune_level=0;
+set optimizer_search_depth=2;
+select 1 from t1 join t2 a
+natural left join t2 b
+natural right outer join t3;
+1
+drop table t1,t2,t3;
+set optimizer_prune_level=@mdev4270_opl;
+set optimizer_search_depth=@mdev4270_osd;
diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result
index 4efb6126cba..43443aa2fef 100644
--- a/mysql-test/r/join_outer_jcl6.result
+++ b/mysql-test/r/join_outer_jcl6.result
@@ -1864,6 +1864,38 @@ WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
GROUP BY t2.f1, t2.f2;
f1 f1 f2
DROP TABLE t1,t2;
+#
+# Bug#13068506 - QUERY WITH GROUP BY ON NON-AGGR COLUMN RETURNS
+# WRONG RESULT
+#
+CREATE TABLE t1 (i1 int);
+INSERT INTO t1 VALUES (100), (101);
+CREATE TABLE t2 (i2 int, i3 int);
+INSERT INTO t2 VALUES (20,1),(10,2);
+CREATE TABLE t3 (i4 int(11));
+INSERT INTO t3 VALUES (1),(2);
+
+SELECT (
+SELECT MAX( t2.i2 )
+FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
+WHERE t2.i3 <> t1.i1
+) AS field1
+FROM t1;;
+field1
+20
+20
+
+SELECT (
+SELECT MAX( t2.i2 )
+FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
+WHERE t2.i3 <> t1.i1
+) AS field1
+FROM t1 GROUP BY field1;;
+field1
+20
+
+drop table t1,t2,t3;
+# End of test for Bug#13068506
End of 5.1 tests
#
# LP BUG#994392: Wrong result with RIGHT/LEFT JOIN and ALL subquery
@@ -2082,6 +2114,20 @@ b c d
5 8 88
5 8 81
DROP TABLE t1,t2;
+#
+# Bug mdev-4336: LEFT JOIN with disjunctive
+# <non-nullable datetime field> IS NULL in WHERE
+# causes a hang and eventual crash
+#
+CREATE TABLE t1 (
+id int(11) NOT NULL,
+modified datetime NOT NULL,
+PRIMARY KEY (id)
+);
+SELECT a.* FROM t1 a LEFT JOIN t1 b ON a.id = b.id
+WHERE a.modified > b.modified or b.modified IS NULL;
+id modified
+DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
set join_cache_level=default;
show variables like 'join_cache_level';
diff --git a/mysql-test/r/keywords.result b/mysql-test/r/keywords.result
index 58cb7430563..a1d8e40eae3 100644
--- a/mysql-test/r/keywords.result
+++ b/mysql-test/r/keywords.result
@@ -269,3 +269,9 @@ call p2();
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP TABLE t1;
+create table option (option int not null);
+drop table option;
+set option=1;
+ERROR 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 '=1' at line 1
+set option option=1;
+ERROR HY000: Unknown system variable 'option'
diff --git a/mysql-test/r/log_slow.result b/mysql-test/r/log_slow.result
index 75e92e7a0b5..89846dc698c 100644
--- a/mysql-test/r/log_slow.result
+++ b/mysql-test/r/log_slow.result
@@ -13,6 +13,7 @@ log_slow_filter admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,
log_slow_queries ON
log_slow_rate_limit 1
log_slow_verbosity
+set @org_slow_query_log= @@global.slow_query_log;
set @@log_slow_filter= "filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk,admin";
select @@log_slow_filter;
@@log_slow_filter
@@ -56,5 +57,19 @@ insert_id int(11) NO NULL
server_id int(10) unsigned NO NULL
sql_text mediumtext NO NULL
flush slow logs;
+set long_query_time=0.1;
+set log_slow_filter='';
+set global slow_query_log=1;
+set global log_output='TABLE';
+select sleep(0.5);
+sleep(0.5)
+0
+select count(*) FROM mysql.slow_log;
+count(*)
+1
+truncate mysql.slow_log;
+set @@long_query_time=default;
+set global slow_query_log= @org_slow_query_log;
set @@log_slow_filter=default;
set @@log_slow_verbosity=default;
+set global log_output= default;
diff --git a/mysql-test/r/mdev316.result b/mysql-test/r/mdev316.result
index 43082769872..78272549e81 100644
--- a/mysql-test/r/mdev316.result
+++ b/mysql-test/r/mdev316.result
@@ -16,7 +16,7 @@ cast(convert(0x0030 using ucs2) as decimal(5.2)) cast(concat(convert(0x0030 usin
0 0
select cast(convert(_ucs2 0x0030 using latin1) as date), cast(concat(convert(_ucs2 0x0030 using latin1)) as date);
cast(convert(_ucs2 0x0030 using latin1) as date) cast(concat(convert(_ucs2 0x0030 using latin1)) as date)
-NULL NULL
+0000-00-00 0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index b5c85555ed8..de376dc187d 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -580,25 +580,25 @@ select max(b) from t1 where a = 2;
max(b)
1
drop table t3,t1,t2;
-CREATE TABLE t1 (c1 INT NOT NULL);
-CREATE TABLE t2 (c1 INT NOT NULL);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-CREATE TEMPORARY TABLE t3 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t1,t2);
-SELECT * FROM t3;
-c1
+create table t1 (a int not null);
+create table t2 (a int not null);
+insert into t1 values (1);
+insert into t2 values (2);
+create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
+select * from t3;
+a
1
2
-CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL);
-CREATE TEMPORARY TABLE t5 (c1 INT NOT NULL);
-INSERT INTO t4 VALUES (4);
-INSERT INTO t5 VALUES (5);
-CREATE TEMPORARY TABLE t6 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t4,t5);
-SELECT * FROM t6;
-c1
-4
-5
-DROP TABLE t6, t3, t1, t2, t4, t5;
+create temporary table t4 (a int not null);
+create temporary table t5 (a int not null);
+insert into t4 values (1);
+insert into t5 values (2);
+create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5);
+select * from t6;
+a
+1
+2
+drop table t6, t3, t1, t2, t4, t5;
create temporary table t1 (a int not null);
create temporary table t2 (a int not null);
insert into t1 values (1);
@@ -996,11 +996,6 @@ m1 CREATE TABLE `m1` (
`a` int(11) DEFAULT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, m1;
-CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
-SELECT MAX(a) FROM t1;
-MAX(a)
-NULL
-DROP TABLE t1;
CREATE TABLE t1(a INT);
CREATE TABLE t2(a VARCHAR(10));
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
@@ -1935,9 +1930,9 @@ ALTER TABLE t2 UNION=(t3,t1);
SELECT * FROM t2;
ERROR HY000: Table 't3' is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE t1, t2, t3;
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2);
+CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
+CREATE TABLE t2 (c1 INT) ENGINE= MyISAM;
+CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
SELECT * FROM t3;
@@ -2400,6 +2395,142 @@ Table Op Msg_type Msg_text
test.m1 repair note The storage engine for the table doesn't support repair
DROP TABLE m1, t1;
End of 5.1 tests
+#
+# MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg
+#
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 ( i int ) engine=myisam;
+insert into t2 values (1),(2);
+create table t3 (a int, b int, filler char(100), key(a), key(b)) engine=myisam;
+create table t4 like t3;
+insert into t3
+select A.a+10*B.a+100*C.a,
+A.a+10*B.a+100*C.a,
+'filler-data-FILLER-DATA-qqq'
+from t1 A, t1 B, t1 C where C.a < 5;
+insert into t4
+select A.a+10*B.a+100*C.a,
+A.a+10*B.a+100*C.a,
+'filler-data-FILLER-DATA-qqq'
+from t1 A, t1 B, t1 C where C.a >= 5;
+create table t5 like t3;
+alter table t5 engine=merge;
+alter table t5 union(t3, t4);
+update t5 set b=999, a=999 where b>950;
+explain
+select * from t2, t5 where t5.a=999 and t5.b=999;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2
+1 SIMPLE t5 index_merge a,b a,b 5,5 NULL 6 Using intersect(a,b); Using where; Using join buffer (flat, BNL join)
+select * from t2, t5 where t5.a=999 and t5.b=999;
+i a b filler
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+1 999 999 filler-data-FILLER-DATA-qqq
+2 999 999 filler-data-FILLER-DATA-qqq
+drop table t5;
+drop table t1,t2,t3,t4;
+End of 5.3 tests
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
+SELECT MAX(a) FROM t1;
+MAX(a)
+NULL
+DROP TABLE t1;
#
# An additional test case for Bug#27430 Crash in subquery code
# when in PS and table DDL changed after PREPARE
diff --git a/mysql-test/r/myisam-metadata.result b/mysql-test/r/myisam-metadata.result
index 5192253d5d1..4d49bac9436 100644
--- a/mysql-test/r/myisam-metadata.result
+++ b/mysql-test/r/myisam-metadata.result
@@ -5,7 +5,10 @@ a VARCHAR(100),
INDEX(a)
) ENGINE=MyISAM;
ALTER TABLE t1 DISABLE KEYS;
+SET debug_sync= 'myisam_after_repair_by_sort SIGNAL waiting WAIT_FOR go';
ALTER TABLE t1 ENABLE KEYS;
+SET debug_sync= 'now WAIT_FOR waiting';
+SET debug_sync= 'now SIGNAL go';
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Dynamic 100000 27 # # # 0 NULL # # # latin1_swedish_ci NULL
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 86425825601..c1cbbffdbfa 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1764,13 +1764,13 @@ engine=MEMORY
partition by key (a);
REPAIR TABLE t1;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note The storage engine for the table doesn't support optimize
CHECK TABLE t1;
Table Op Msg_type Msg_text
-test.t1 check note The storage engine for the table doesn't support check
+test.t1 check status OK
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze note The storage engine for the table doesn't support analyze
diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result
index ec7fd798d4c..f4d473c00d5 100644
--- a/mysql-test/r/partition_pruning.result
+++ b/mysql-test/r/partition_pruning.result
@@ -2235,9 +2235,10 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL);
# test with an invalid date, which lead to item->null_value is set.
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME);
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+1 SIMPLE t1 p20090401 ALL NULL NULL NULL NULL 2 Using where
Warnings:
Warning 1292 Incorrect datetime value: '2009-04-99'
+Warning 1292 Incorrect datetime value: '2009-04-99'
DROP TABLE t1;
CREATE TABLE t1
(a INT NOT NULL AUTO_INCREMENT,
diff --git a/mysql-test/r/plugin_auth.result b/mysql-test/r/plugin_auth.result
index f8ebf65c0c5..356ac76962a 100644
--- a/mysql-test/r/plugin_auth.result
+++ b/mysql-test/r/plugin_auth.result
@@ -224,7 +224,7 @@ NULL
# in connection plug_con
SELECT @@LOCAL.external_user;
@@LOCAL.external_user
-'plug'@'%'
+plug_dest
# in connection default
## cleanup
DROP USER plug;
diff --git a/mysql-test/r/plugin_auth_qa_2.result b/mysql-test/r/plugin_auth_qa_2.result
index f300ea332cb..aa3a59b4f25 100644
--- a/mysql-test/r/plugin_auth_qa_2.result
+++ b/mysql-test/r/plugin_auth_qa_2.result
@@ -44,7 +44,7 @@ SELECT @@external_user;
NULL
exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
-authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' 'qa_test_2_user'@'%'
+authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' externaluser
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
user plugin authentication_string
authenticated_as
@@ -60,7 +60,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_3_dest identified by 'dest_pas
GRANT PROXY ON qa_test_3_dest TO qa_test_3_user;
exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_3_user --password=qa_test_3_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
-qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' 'qa_test_3_user'@'%'
+qa_test_3_dest@% qa_test_3_user@localhost 'qa_test_3_user'@'%' qa_test_3_dest
DROP USER qa_test_3_user;
DROP USER qa_test_3_dest;
=== Assign too low values for *length, which should have no effect ====
@@ -70,7 +70,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_4_dest identified by 'dest_pas
GRANT PROXY ON qa_test_4_dest TO qa_test_4_user;
exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_4_user --password=qa_test_4_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
-qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' 'qa_test_4_user'@'%'
+qa_test_4_dest@% qa_test_4_user@localhost 'qa_test_4_user'@'%' qa_test_4_dest
DROP USER qa_test_4_user;
DROP USER qa_test_4_dest;
=== Assign empty string especially to authenticated_as (in plugin) ====
diff --git a/mysql-test/r/plugin_auth_qa_3.result b/mysql-test/r/plugin_auth_qa_3.result
index 656975aca30..dd4fb76ff8d 100644
--- a/mysql-test/r/plugin_auth_qa_3.result
+++ b/mysql-test/r/plugin_auth_qa_3.result
@@ -4,7 +4,7 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_11_dest identified by 'dest_pa
GRANT PROXY ON qa_test_11_dest TO qa_test_11_user;
exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_11_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
current_user() user() @@local.proxy_user @@local.external_user
-qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' 'qa_test_11_user'@'%'
+qa_test_11_dest@% qa_test_11_user@localhost 'qa_test_11_user'@'%' NULL
exec MYSQL --default_auth=qa_auth_client -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_11_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1
ERROR 1045 (28000): Access denied for user 'qa_test_2_user'@'localhost' (using password: NO)
DROP USER qa_test_11_user, qa_test_11_dest;
diff --git a/mysql-test/r/ps_11bugs.result b/mysql-test/r/ps_11bugs.result
index 56894302505..3bc7039583b 100644
--- a/mysql-test/r/ps_11bugs.result
+++ b/mysql-test/r/ps_11bugs.result
@@ -120,7 +120,7 @@ create table t1 (a int primary key);
insert into t1 values (1);
explain select * from t1 where 3 in (select (1+1) union select 1);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
diff --git a/mysql-test/r/quick_select_4161.result b/mysql-test/r/quick_select_4161.result
new file mode 100644
index 00000000000..862be6055ce
--- /dev/null
+++ b/mysql-test/r/quick_select_4161.result
@@ -0,0 +1,31 @@
+CREATE TABLE t1 (
+event_date date DEFAULT '0000-00-00' NOT NULL,
+type int(11) DEFAULT '0' NOT NULL,
+event_id int(11) DEFAULT '0' NOT NULL,
+PRIMARY KEY (event_date,type,event_id)
+);
+INSERT INTO t1 VALUES ('1999-07-10',100100,24), ('1999-07-11',100100,25),
+('1999-07-13',100600,0), ('1999-07-13',100600,4), ('1999-07-13',100600,26),
+('1999-07-14',100600,10), ('1999-07-15',100600,16), ('1999-07-15',100800,45),
+('1999-07-15',101000,47), ('1999-07-16',100800,46), ('1999-07-20',100600,5),
+('1999-07-20',100600,27), ('1999-07-21',100600,11), ('1999-07-22',100600,17),
+('1999-07-23',100100,39), ('1999-07-24',100100,39), ('1999-07-24',100500,40),
+('1999-07-25',100100,39), ('1999-07-27',100600,1), ('1999-07-27',100600,6),
+('1999-07-27',100600,28), ('1999-07-28',100600,12), ('1999-07-29',100500,41),
+('1999-07-29',100600,18), ('1999-07-30',100500,41), ('1999-07-31',100500,41),
+('1999-08-01',100700,34), ('1999-08-03',100600,7), ('1999-08-03',100600,29),
+('1999-08-04',100600,13), ('1999-08-05',100500,42), ('1999-08-05',100600,19),
+('1999-08-06',100500,42), ('1999-08-07',100500,42), ('1999-08-08',100500,42),
+('1999-08-10',100600,2), ('1999-08-10',100600,9), ('1999-08-10',100600,30),
+('1999-08-11',100600,14), ('1999-08-12',100600,20), ('1999-08-17',100500,8),
+('1999-08-17',100600,31), ('1999-08-18',100600,15), ('1999-08-19',100600,22),
+('1999-08-24',100600,3), ('1999-08-24',100600,32), ('1999-08-27',100500,43),
+('1999-08-31',100600,33), ('1999-09-17',100100,37), ('1999-09-18',100100,37),
+('1999-09-19',100100,37), ('2000-12-18',100700,38);
+set debug_sync='inside_make_join_statistics signal killme wait_for done';
+select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
+set debug_sync='now wait_for killme';
+kill %connection%;
+set debug_sync='now signal done';
+Got one of the listed errors
+drop table t1;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 3d16d37c5f1..c086a62275a 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2921,8 +2921,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
DROP TABLE t1,t2;
-select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
-x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0
+select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0;
+x'3136' + 0 X'3136' + 0 b'10' + 0 B'10' + 0
16 16 2 2
create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY (f3,f4));
@@ -5119,6 +5119,7 @@ SELECT 1 FROM t1 GROUP BY 1;
1
1
drop table t1;
+set sql_buffer_result= 0;
#
# Bug #58422: Incorrect result when OUTER JOIN'ing
# with an empty table
@@ -5322,4 +5323,38 @@ AND Time_zone_id = Time_zone_id
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
Time_zone_id Use_leap_seconds
+#
+# Bug mdev-4274: result of simplification of OR badly merged
+# into embedding AND
+#
+CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8,8);
+CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8), (9);
+EXPLAIN EXTENDED
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system idx NULL NULL NULL 1 100.00
+1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index
+Warnings:
+Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 8) and 1)
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+a b c
+8 8 8
+DROP TABLE t1,t2;
+#
+# Bug mdev-4413: another manifestations of bug mdev-2474
+# (valgrind complains)
+#
+CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,1);
+CREATE TABLE t2 (c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0), (8);
+SELECT * FROM t1, t2
+WHERE c = a AND
+( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );
+a b c
+DROP TABLE t1, t2;
End of 5.3 tests
diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result
index 467f940c85d..00b356fc1c0 100644
--- a/mysql-test/r/select_jcl6.result
+++ b/mysql-test/r/select_jcl6.result
@@ -2932,8 +2932,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t1 hash_ALL NULL #hash#$hj 5 test.t2.a 5 Using where; Using join buffer (flat, BNLH join)
DROP TABLE t1,t2;
-select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
-x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0
+select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0;
+x'3136' + 0 X'3136' + 0 b'10' + 0 B'10' + 0
16 16 2 2
create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY (f3,f4));
@@ -5130,6 +5130,7 @@ SELECT 1 FROM t1 GROUP BY 1;
1
1
drop table t1;
+set sql_buffer_result= 0;
#
# Bug #58422: Incorrect result when OUTER JOIN'ing
# with an empty table
@@ -5333,6 +5334,40 @@ AND Time_zone_id = Time_zone_id
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
Time_zone_id Use_leap_seconds
+#
+# Bug mdev-4274: result of simplification of OR badly merged
+# into embedding AND
+#
+CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8,8);
+CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8), (9);
+EXPLAIN EXTENDED
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system idx NULL NULL NULL 1 100.00
+1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index
+Warnings:
+Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 8) and 1)
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+a b c
+8 8 8
+DROP TABLE t1,t2;
+#
+# Bug mdev-4413: another manifestations of bug mdev-2474
+# (valgrind complains)
+#
+CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,1);
+CREATE TABLE t2 (c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0), (8);
+SELECT * FROM t1, t2
+WHERE c = a AND
+( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );
+a b c
+DROP TABLE t1, t2;
End of 5.3 tests
set join_cache_level=default;
show variables like 'join_cache_level';
diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result
index 3d16d37c5f1..c086a62275a 100644
--- a/mysql-test/r/select_pkeycache.result
+++ b/mysql-test/r/select_pkeycache.result
@@ -2921,8 +2921,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
DROP TABLE t1,t2;
-select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
-x'10' + 0 X'10' + 0 b'10' + 0 B'10' + 0
+select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0;
+x'3136' + 0 X'3136' + 0 b'10' + 0 B'10' + 0
16 16 2 2
create table t1 (f1 varchar(6) default NULL, f2 int(6) primary key not null);
create table t2 (f3 varchar(5) not null, f4 varchar(5) not null, UNIQUE KEY UKEY (f3,f4));
@@ -5119,6 +5119,7 @@ SELECT 1 FROM t1 GROUP BY 1;
1
1
drop table t1;
+set sql_buffer_result= 0;
#
# Bug #58422: Incorrect result when OUTER JOIN'ing
# with an empty table
@@ -5322,4 +5323,38 @@ AND Time_zone_id = Time_zone_id
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
Time_zone_id Use_leap_seconds
+#
+# Bug mdev-4274: result of simplification of OR badly merged
+# into embedding AND
+#
+CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8,8);
+CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8), (9);
+EXPLAIN EXTENDED
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 system idx NULL NULL NULL 1 100.00
+1 SIMPLE t2 ref idx idx 5 const 1 100.00 Using index
+Warnings:
+Note 1003 select 8 AS `a`,8 AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 8) and 1)
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+WHERE 1 IS NULL OR b < 33 AND b = c;
+a b c
+8 8 8
+DROP TABLE t1,t2;
+#
+# Bug mdev-4413: another manifestations of bug mdev-2474
+# (valgrind complains)
+#
+CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,1);
+CREATE TABLE t2 (c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0), (8);
+SELECT * FROM t1, t2
+WHERE c = a AND
+( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );
+a b c
+DROP TABLE t1, t2;
End of 5.3 tests
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 166ad11b6ae..a215566a90c 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -15,7 +15,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 27 Y 0 31 8
+def Msg_text 250 393216 27 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status Table is already up to date
check table t1 fast;
@@ -23,7 +23,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 27 Y 0 31 8
+def Msg_text 250 393216 27 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status Table is already up to date
check table t1 changed;
@@ -31,7 +31,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status OK
insert into t1 values (5,5,5);
@@ -40,7 +40,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status OK
check table t1 medium;
@@ -48,7 +48,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status OK
check table t1 extended;
@@ -56,7 +56,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 5 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 check status OK
show index from t1;
@@ -88,7 +88,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 8 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 optimize status OK
optimize table t1;
@@ -160,7 +160,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 7 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 analyze status OK
show index from t1;
@@ -177,7 +177,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def Table 253 128 7 Y 0 31 8
def Op 253 10 6 Y 0 31 8
def Msg_type 253 10 6 Y 0 31 8
-def Msg_text 253 255 2 Y 0 31 8
+def Msg_text 250 393216 2 Y 0 31 8
Table Op Msg_type Msg_text
test.t1 repair status OK
show index from t1;
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index defd3955f6c..a0f21b434d1 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -7916,4 +7916,65 @@ DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
DROP FUNCTION f4;
+
+Stored procedures and a condition handler in a nested procedure call
+doesn't suppress the condition from being passed on to the calling
+procedure
+
+drop procedure if exists p1;
+drop procedure if exists p0;
+create table t1 (id int);
+create procedure p1 () begin
+declare i int default 0;
+declare continue handler for not found begin
+select "You should see this message and the warning that generated this" as "message";
+show warnings;
+end;
+select id into i from t1;
+end$$
+create procedure p0 () begin
+declare continue handler for not found begin
+select "You should NOT see this message" as "message";
+end;
+call p1();
+end$$
+call p0();
+message
+You should see this message and the warning that generated this
+Level Code Message
+Warning 1329 No data - zero rows fetched, selected, or processed
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+drop procedure p1;
+drop procedure p0;
+drop table t1;
+
+Test if stored procedures propagates errors
+
+create table t1 (id int primary key);
+create procedure p1 () begin
+insert into t1 values(1);
+insert into t1 values(2);
+insert into t1 values(2);
+insert into t1 values(3);
+end$$
+create procedure p2 () begin
+declare x int;
+select id into x from t1 where id=5;
+end$$
+call p1();
+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry '2' for key 'PRIMARY'
+select * from t1;
+id
+1
+2
+call p2();
+Warnings:
+Warning 1329 No data - zero rows fetched, selected, or processed
+drop procedure p1;
+drop procedure p2;
+drop table t1;
# End of 5.5 test
diff --git a/mysql-test/r/status_user.result b/mysql-test/r/status_user.result
index f43e217b8a5..39579799431 100644
--- a/mysql-test/r/status_user.result
+++ b/mysql-test/r/status_user.result
@@ -27,7 +27,7 @@ ACCESS_DENIED bigint(21) NO 0
EMPTY_QUERIES bigint(21) NO 0
show columns from information_schema.user_statistics;
Field Type Null Key Default Extra
-USER varchar(48) NO
+USER varchar(128) NO
TOTAL_CONNECTIONS int(11) NO 0
CONCURRENT_CONNECTIONS int(11) NO 0
CONNECTED_TIME int(11) NO 0
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 1977fbaccee..8273bee6117 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -429,7 +429,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (1 = (select 1 union select 1))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -558,10 +558,10 @@ Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -1371,7 +1371,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ref salary salary 5 const 0 0.00 Using where
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 2814e5a6dcd..11b27e76782 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -869,7 +869,7 @@ NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
f1 f2
@@ -960,7 +960,7 @@ NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2);
f1 f2
@@ -1055,7 +1055,7 @@ NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
f1 f2
@@ -1146,7 +1146,7 @@ NULL
EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
f1 f2
@@ -2012,7 +2012,7 @@ FROM t2 JOIN t3 ON t3.f4 = t2.f4
WHERE t3.f1 = 8
GROUP BY 1, 2;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t3 system NULL NULL NULL NULL 1 Using temporary; Using filesort
+1 PRIMARY t3 system NULL NULL NULL NULL 1 Using filesort
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
@@ -2325,5 +2325,19 @@ ORDER BY alias1.b;
pk b pk b
1 1 1 1
drop table t1, t2, t3;
+#
+# MDEV-4144 simple subquery causes full scan instead of range scan
+#
+CREATE TABLE t1 (id int not null auto_increment, x int not null, primary key(id));
+INSERT INTO t1 (x) VALUES (0),(0),(0);
+EXPLAIN
+SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
+x
+0
+drop table t1;
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index a6967527a2d..6f8350c791f 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -331,7 +331,7 @@ SELECT SUM( c )
FROM t2
WHERE (SELECT DISTINCT b FROM t3) > 0);
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 Using where; Using index
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
3 SUBQUERY t3 ALL NULL NULL NULL NULL 1 Using temporary
SELECT *
diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result
index 53334dbc32b..0a98efb5c0e 100644
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@ -1999,6 +1999,20 @@ b b v v
b b s s
b b y y
DROP TABLE t1,t2;
+#
+# MDEV-4465: Reproducible crash (mysqld got signal 11) in multi_delete::initialize_tables with semijoin+materialization
+#
+CREATE TABLE t1 (
+id int(11) NOT NULL
+);
+CREATE TABLE t2 (
+id int(11) NOT NULL,
+a_id int(11) DEFAULT NULL
+);
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 1), (2, 1), (3, 1), (4, 2), (5, 3), (6, 3), (7, 3);
+delete t2 from t2 where a_id in (select * from (select t1.id from t1 limit 2) as x);
+drop table t1,t2;
# This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index feaeff50f7d..882a4da9854 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -436,7 +436,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (1 = (select 1 union select 1))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -565,10 +565,10 @@ Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -1378,7 +1378,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ref salary salary 5 const 0 0.00 Using where
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
@@ -6913,7 +6913,7 @@ INSERT INTO t2 VALUES (1),(2);
EXPLAIN
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
3 SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT * FROM t1 WHERE 4 IN (SELECT MAX(b) FROM t2 WHERE EXISTS (SELECT * FROM t1));
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index d1590b0df51..afff6acccef 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -432,7 +432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (1 = (select 1 union select 1))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -561,10 +561,10 @@ Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -1374,7 +1374,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ref salary salary 5 const 0 0.00 Using where
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index 2fd58c075d2..8c589bbb669 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -435,7 +435,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (1 = (select 1 union select 1))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -564,10 +564,10 @@ Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -1377,7 +1377,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ref salary salary 5 const 0 0.00 Using where
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index 34cdb17e23e..eb92936e85d 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -432,7 +432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
Warnings:
-Note 1003 select 1 AS `1` from `test`.`t1` where (1 = (select 1 union select 1))
+Note 1003 select 1 AS `1` from `test`.`t1` where 1
drop table t1;
CREATE TABLE `t1` (
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
@@ -561,10 +561,10 @@ Warnings:
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1')
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using where; Using index
+1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
-Note 1003 select `test`.`t1`.`numreponse` AS `numreponse` from `test`.`t1` where ((`test`.`t1`.`numeropost` = '1') and (`test`.`t1`.`numreponse` = (select max(`test`.`t1`.`numreponse`) from `test`.`t1` where (`test`.`t1`.`numeropost` = '1'))))
+Note 1003 select 3 AS `numreponse` from `test`.`t1` where ((1 = '1'))
drop table t1;
CREATE TABLE t1 (a int(1));
INSERT INTO t1 VALUES (1);
@@ -1374,7 +1374,7 @@ create table t1 (id int not null auto_increment primary key, salary int, key(sal
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
-1 PRIMARY t1 ref salary salary 5 const 0 0.00 Using where
+1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
Warnings:
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) from `test`.`t1`))
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index a4e4922474e..56c3044c4e4 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -2783,6 +2783,16 @@ a b
deallocate prepare stmt;
drop table t1,t2;
#
+# MDEV-4335: Unexpected results when selecting on information_schema
+#
+CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL);
+INSERT INTO t1 VALUES ('mysql'),('information_schema');
+SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA);
+db
+mysql
+information_schema
+DROP TABLE t1;
+#
# MySQL Bug#13340270: assertion table->sort.record_pointers == __null
#
CREATE TABLE t1 (
@@ -2842,4 +2852,36 @@ field1
o
o
DROP TABLE t1, t2;
+#
+# MDEV-389: Wrong result (missing row) with semijoin, join_cache_level>4, LEFT JOIN...
+# (testcase only)
+#
+SET join_cache_level = 5;
+SET optimizer_switch = 'semijoin=on';
+CREATE TABLE t1 (a INT NOT NULL, b CHAR(1), KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'p'),(1,'q'),(8,'e');
+CREATE TABLE t2 (c INT, d CHAR(1), KEY(c), KEY(d)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4,'f'),(2,'i'),(5,'h'),(3,'q'),(1,'g');
+SELECT a, COUNT(*) AS cnt
+FROM t1 LEFT JOIN t2 ON (d = b)
+WHERE a IN ( SELECT c FROM t2 WHERE b > 'k' )
+GROUP BY a ORDER BY a, cnt LIMIT 2;
+a cnt
+1 1
+4 1
+drop table t1, t2;
+#
+# MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
+#
+CREATE TABLE t1 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,'v'),(0,'s');
+CREATE TABLE t2 (a INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0),(8);
+SELECT c, SUM( DISTINCT b ) AS sm FROM t1
+WHERE ( 5, 108 ) IN ( SELECT MIN(a), MAX(a) FROM t2 )
+GROUP BY b
+HAVING c <> ( SELECT MAX( c ) FROM t1 )
+ORDER BY sm;
+c sm
+DROP TABLE t1,t2;
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result
index c91ee67a717..1af507668da 100644
--- a/mysql-test/r/subselect_sj2_mat.result
+++ b/mysql-test/r/subselect_sj2_mat.result
@@ -1377,7 +1377,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 Using where
2 MATERIALIZED t3 hash_ALL NULL #hash#$hj 5 test.t2.i2 3 100.00 Using where; Using join buffer (flat, BNLH join)
Warnings:
-Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`) and (`test`.`t3`.`i3` > 0))
+Note 1003 select `test`.`t1`.`i1` AS `i1` from `test`.`t1` semi join (`test`.`t2` join `test`.`t3`) where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`i1` = `test`.`t2`.`i2`) and (`test`.`t2`.`i2` > 0))
SELECT * FROM t1
WHERE i1 IN (SELECT i3 FROM t2, t3 WHERE i3 > 0 AND i3 = i2 OR 1=2);
i1
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index 4e67c1cc01c..7be29201c63 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -2797,6 +2797,16 @@ a b
deallocate prepare stmt;
drop table t1,t2;
#
+# MDEV-4335: Unexpected results when selecting on information_schema
+#
+CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL);
+INSERT INTO t1 VALUES ('mysql'),('information_schema');
+SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA);
+db
+information_schema
+mysql
+DROP TABLE t1;
+#
# MySQL Bug#13340270: assertion table->sort.record_pointers == __null
#
CREATE TABLE t1 (
@@ -2856,6 +2866,38 @@ field1
o
o
DROP TABLE t1, t2;
+#
+# MDEV-389: Wrong result (missing row) with semijoin, join_cache_level>4, LEFT JOIN...
+# (testcase only)
+#
+SET join_cache_level = 5;
+SET optimizer_switch = 'semijoin=on';
+CREATE TABLE t1 (a INT NOT NULL, b CHAR(1), KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'p'),(1,'q'),(8,'e');
+CREATE TABLE t2 (c INT, d CHAR(1), KEY(c), KEY(d)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4,'f'),(2,'i'),(5,'h'),(3,'q'),(1,'g');
+SELECT a, COUNT(*) AS cnt
+FROM t1 LEFT JOIN t2 ON (d = b)
+WHERE a IN ( SELECT c FROM t2 WHERE b > 'k' )
+GROUP BY a ORDER BY a, cnt LIMIT 2;
+a cnt
+1 1
+4 1
+drop table t1, t2;
+#
+# MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
+#
+CREATE TABLE t1 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,'v'),(0,'s');
+CREATE TABLE t2 (a INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0),(8);
+SELECT c, SUM( DISTINCT b ) AS sm FROM t1
+WHERE ( 5, 108 ) IN ( SELECT MIN(a), MAX(a) FROM t2 )
+GROUP BY b
+HAVING c <> ( SELECT MAX( c ) FROM t1 )
+ORDER BY sm;
+c sm
+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
diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result
index 549282c9dbe..4e8d1697b83 100644
--- a/mysql-test/r/subselect_sj_mat.result
+++ b/mysql-test/r/subselect_sj_mat.result
@@ -2039,6 +2039,20 @@ b b v v
b b s s
b b y y
DROP TABLE t1,t2;
+#
+# MDEV-4465: Reproducible crash (mysqld got signal 11) in multi_delete::initialize_tables with semijoin+materialization
+#
+CREATE TABLE t1 (
+id int(11) NOT NULL
+);
+CREATE TABLE t2 (
+id int(11) NOT NULL,
+a_id int(11) DEFAULT NULL
+);
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 1), (2, 1), (3, 1), (4, 2), (5, 3), (6, 3), (7, 3);
+delete t2 from t2 where a_id in (select * from (select t1.id from t1 limit 2) as x);
+drop table t1,t2;
# This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
diff --git a/mysql-test/r/sum_distinct-big.result b/mysql-test/r/sum_distinct-big.result
index d4933b31f80..2d350826ac8 100644
--- a/mysql-test/r/sum_distinct-big.result
+++ b/mysql-test/r/sum_distinct-big.result
@@ -1,4 +1,8 @@
DROP TABLE IF EXISTS t1, t2;
+set @save_tmp_table_size=@@tmp_table_size;
+set @save_max_heap_table_size=@@max_heap_table_size;
+set @save_storage_engine=@@storage_engine;
+set storage_engine=MYISAM;
CREATE TABLE t1 (id INTEGER);
CREATE TABLE t2 (id INTEGER);
INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
@@ -120,3 +124,57 @@ sm
536887296
DROP TABLE t1;
DROP TABLE t2;
+SET @@tmp_table_size=@save_tmp_table_size;
+SET @@max_heap_table_size=@save_max_heap_table_size;
+#
+# Bug mdev-4311: COUNT(DISTINCT...) requiring a file for Unique
+# (bug #68749)
+#
+set @save_storage_engine=@@storage_engine;
+set storage_engine=INNODB;
+CREATE TABLE t1 (id INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (id INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 SELECT id+1 FROM t1;
+INSERT INTO t1 SELECT id+2 FROM t1;
+INSERT INTO t1 SELECT id+4 FROM t1;
+INSERT INTO t1 SELECT id+8 FROM t1;
+INSERT INTO t1 SELECT id+16 FROM t1;
+INSERT INTO t1 SELECT id+32 FROM t1;
+INSERT INTO t1 SELECT id+64 FROM t1;
+INSERT INTO t1 SELECT id+128 FROM t1;
+INSERT INTO t1 SELECT id+256 FROM t1;
+INSERT INTO t1 SELECT id+512 FROM t1;
+INSERT INTO t1 SELECT id+1024 FROM t1;
+INSERT INTO t1 SELECT id+2048 FROM t1;
+INSERT INTO t1 SELECT id+4096 FROM t1;
+INSERT INTO t1 SELECT id+8192 FROM t1;
+INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+INSERT INTO t2 VALUE(NULL);
+# With default tmp_table_size / max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+set @@tmp_table_size=1024*256;
+# With reduced tmp_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+set @@tmp_table_size=@save_tmp_table_size;
+SET @@max_heap_table_size=1024*256;
+# With reduced max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+SET @@max_heap_table_size=@save_max_heap_table_size;
+# Back to default tmp_table_size / max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+sm
+16384
+DROP TABLE t1,t2;
+set storage_engine=@save_storage_engine;
diff --git a/mysql-test/r/temporal_scale_4283.result b/mysql-test/r/temporal_scale_4283.result
new file mode 100644
index 00000000000..685a6192a97
--- /dev/null
+++ b/mysql-test/r/temporal_scale_4283.result
@@ -0,0 +1,12 @@
+create table t1 (a int);
+insert into t1 values (4),(8);
+select distinct 100 mod timestampadd( week, a, '2002-05-20' ) from t1;
+100 mod timestampadd( week, a, '2002-05-20' )
+100
+drop table t1;
+create table t1 (i int);
+insert into t1 values (2),(4);
+select distinct convert_tz( '2001-03-21', 'utc', 'met' ) mod i from t1;
+convert_tz( '2001-03-21', 'utc', 'met' ) mod i
+0
+drop table t1;
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 8a85cd53b2a..2d4a290751f 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -136,7 +136,7 @@ select @d:=1311;
1311
select year(@d), month(@d), day(@d), cast(@d as date);
year(@d) month(@d) day(@d) cast(@d as date)
-NULL NULL NULL NULL
+0 0 0 0000-00-00
Warnings:
Warning 1292 Incorrect datetime value: '1311'
Warning 1292 Incorrect datetime value: '1311'
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 811fbacaf59..d6676bbf16b 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -573,7 +573,7 @@ CAST('NULL' AS DATE) < CAST('2008-01-01' AS DATE) n7,
CAST('2008-01-01' AS DATE) < CAST('NULL' AS DATE) n8,
CAST('NULL' AS DATE) < CAST('NULL' AS DATE) n9;
n1 n2 n3 n4 n5 n6 n7 n8 n9
-0 0 1 NULL NULL NULL NULL NULL NULL
+0 0 1 1 1 0 1 0 0
Warnings:
Warning 1292 Incorrect datetime value: 'NULL'
Warning 1292 Incorrect datetime value: 'NULL'
@@ -585,6 +585,8 @@ Warning 1292 Incorrect datetime value: 'NULL'
Warning 1292 Incorrect datetime value: 'NULL'
Warning 1292 Incorrect datetime value: 'NULL'
Warning 1292 Incorrect datetime value: 'NULL'
+Warning 1292 Incorrect datetime value: 'NULL'
+Warning 1292 Incorrect datetime value: 'NULL'
End of 5.0 tests
set @org_mode=@@sql_mode;
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
@@ -651,6 +653,35 @@ SELECT * FROM t1;
dt1
DROP TABLE t1;
End of 5.1 tests
+create table t1 (d date, t time) engine=myisam;
+insert into t1 values ('2000-12-03','22:55:23'),('2008-05-03','10:19:31');
+select case when d = '2012-12-12' then d else t end as cond, group_concat( d ) from t1 group by cond;
+cond group_concat( d )
+0000-00-00 00:00:00 2000-12-03
+0000-00-00 00:00:00 2008-05-03
+Warnings:
+Warning 1292 Incorrect datetime value: '22:55:23'
+Warning 1292 Incorrect datetime value: '10:19:31'
+Warning 1292 Incorrect datetime value: '22:55:23'
+Warning 1292 Incorrect datetime value: '10:19:31'
+drop table t1;
+#
+# Semantics of the condition <non-nullable datetime field> IS NULL
+# when the field belongs to an inner table of an outer join
+#
+create table t1 (a int, b date not null);
+insert t1 values (1, 0), (2, '1999-01-02');
+create table t2 (c int);
+insert t2 values (1),(3);
+select * from t2 left join t1 on t1.a=t2.c where t1.a is null;
+c a b
+3 NULL NULL
+select * from t2 left join t1 on t1.a=t2.c where t1.b is null;
+c a b
+1 1 0000-00-00
+3 NULL NULL
+drop table t1,t2;
+End of 5.3 tests
#
# Start of 5.5 tests
#
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index ae4bd68a435..8aae1bca4f6 100644
--- a/mysql-test/r/user_var-binlog.result
+++ b/mysql-test/r/user_var-binlog.result
@@ -9,12 +9,12 @@ insert into t1 values (@var1),(@var2);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # User var # # @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
+master-bin.000001 # User var # # @`a b`=_latin1 X'68656C6C6F' COLLATE latin1_swedish_ci
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(@`a b`)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # User var # # @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
-master-bin.000001 # User var # # @`var2`=_binary 0x61 COLLATE binary
+master-bin.000001 # User var # # @`var1`=_latin1 X'273B616161' COLLATE latin1_swedish_ci
+master-bin.000001 # User var # # @`var2`=_binary X'61' COLLATE binary
master-bin.000001 # Query # # use `test`; insert into t1 values (@var1),(@var2)
master-bin.000001 # Query # # COMMIT
flush logs;
@@ -34,7 +34,7 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;
+SET @`a b`:=_latin1 X'68656C6C6F' COLLATE `latin1_swedish_ci`/*!*/;
use `test`/*!*/;
SET TIMESTAMP=10000/*!*/;
INSERT INTO t1 VALUES(@`a b`)
@@ -45,8 +45,8 @@ COMMIT
SET TIMESTAMP=10000/*!*/;
BEGIN
/*!*/;
-SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/;
-SET @`var2`:=_binary 0x61 COLLATE `binary`/*!*/;
+SET @`var1`:=_latin1 X'273B616161' COLLATE `latin1_swedish_ci`/*!*/;
+SET @`var2`:=_binary X'61' COLLATE `binary`/*!*/;
SET TIMESTAMP=10000/*!*/;
insert into t1 values (@var1),(@var2)
/*!*/;
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index 065abbb9c00..689db16b5d4 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -5,9 +5,62 @@ A 65 9223372036854775807 18446744073709551615
select 0x31+1,concat(0x31)+1,-0xf;
0x31+1 concat(0x31)+1 -0xf
50 2 -15
-select x'31',X'ffff'+0;
-x'31' X'ffff'+0
+select x'31',0xffff+0;
+x'31' 0xffff+0
1 65535
+select X'FFFF'+0;
+X'FFFF'+0
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: '\xFF\xFF'
+SELECT x'31'+0, 0x31+0;
+x'31'+0 0x31+0
+1 49
+SELECT x'31'+0.1e0, 0x31+0.1e0;
+x'31'+0.1e0 0x31+0.1e0
+1.1 49.1
+SELECT x'312E39'+0e0, 0x312E39+0e0;
+x'312E39'+0e0 0x312E39+0e0
+1.9 3223097
+SELECT CAST(x'31' AS SIGNED), CAST(0x31 AS SIGNED);
+CAST(x'31' AS SIGNED) CAST(0x31 AS SIGNED)
+1 49
+SELECT CAST(x'31' AS DECIMAL(10,1)), CAST(0x31 AS DECIMAL(10,1));
+CAST(x'31' AS DECIMAL(10,1)) CAST(0x31 AS DECIMAL(10,1))
+1.0 49.0
+SELECT CAST(x'312E39' AS SIGNED), CAST(0x312E39 AS SIGNED);
+CAST(x'312E39' AS SIGNED) CAST(0x312E39 AS SIGNED)
+1 3223097
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1.9'
+SELECT CAST(x'312E39' AS DECIMAL(10,1)), CAST(0x312E39 AS DECIMAL(10,1));
+CAST(x'312E39' AS DECIMAL(10,1)) CAST(0x312E39 AS DECIMAL(10,1))
+1.9 3223097.0
+EXPLAIN EXTENDED SELECT X'FFFF', 0xFFFF;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+Warnings:
+Note 1003 select X'ffff' AS `X'FFFF'`,0xffff AS `0xFFFF`
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (X'31'),(0x31);
+INSERT INTO t1 VALUES (X'312E39'),(0x312E39);
+SELECT * FROM t1;
+a
+1
+49
+2
+3223097
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(10,1));
+INSERT INTO t1 VALUES (X'31'),(0x31);
+INSERT INTO t1 VALUES (X'312E39'),(0x312E39);
+SELECT * FROM t1;
+a
+1.0
+49.0
+1.9
+3223097.0
+DROP TABLE t1;
create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) );
insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
@@ -104,8 +157,8 @@ A
select b'01000001';
b'01000001'
A
-select x'41', 0+x'41';
-x'41' 0+x'41'
+select x'41', 0+x'3635';
+x'41' 0+x'3635'
A 65
select N'abc', length(N'abc');
abc length(N'abc')
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index e055a333faf..38d0170c7a9 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -78,7 +78,7 @@ explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`
+Note 1003 select (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@`t1`) AS `@t1`,(@`t2`) AS `@t2`,(@`t3`) AS `@t3`
select @t5;
@t5
1.23456
@@ -1796,4 +1796,8 @@ set session collation_connection=2048;
ERROR HY000: Unknown collation: '2048'
set session collation_database=2048;
ERROR HY000: Unknown collation: '2048'
+set session rand_seed1=DEFAULT;
+ERROR 42000: Variable 'rand_seed1' doesn't have a default value
+set autocommit = values(v);
+ERROR 42S22: Unknown column 'v' in 'field list'
End of 5.5 tests
diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result
index dc624a07f4f..d0cdd858d4a 100644
--- a/mysql-test/r/windows.result
+++ b/mysql-test/r/windows.result
@@ -16,7 +16,7 @@ CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,1);
EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 system NULL NULL NULL NULL 1
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
DROP TABLE t1;
CREATE DATABASE `TESTDB`;
diff --git a/mysql-test/suite/binlog/disabled.def b/mysql-test/suite/binlog/disabled.def
index 1abc9951322..424e5549541 100644
--- a/mysql-test/suite/binlog/disabled.def
+++ b/mysql-test/suite/binlog/disabled.def
@@ -10,4 +10,4 @@
#
##############################################################################
binlog_truncate_innodb : BUG#11764459 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
-binlog_spurious_ddl_errors : BUG#11761680 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled
+binlog_spurious_ddl_errors : BUG#11761680 2013-01-18 astha Fixed on mysql-5.6 and trunk
diff --git a/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result b/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result
index 17a473ff062..1a81eee1a58 100644
--- a/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result
+++ b/mysql-test/suite/binlog/r/binlog_spurious_ddl_errors.result
@@ -48,6 +48,7 @@ DROP TABLE t_stmt;
################################################################################
# CLEAN UP #
################################################################################
+flush tables;
UNINSTALL PLUGIN example;
SET @@global.binlog_format = @old_binlog_format;
SET @@session.binlog_format = @old_binlog_format;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
index 3a5c3ac4b02..fba725bb80e 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
@@ -6,7 +6,7 @@ insert into t2 values (@v);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
-master-bin.000001 # User var # # @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
+master-bin.000001 # User var # # @`v`=_ucs2 X'006100620063' COLLATE ucs2_general_ci
master-bin.000001 # Query # # use `test`; insert into t2 values (@v)
master-bin.000001 # Query # # COMMIT
flush logs;
@@ -26,7 +26,7 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
-SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;
+SET @`v`:=_ucs2 X'006100620063' COLLATE `ucs2_general_ci`/*!*/;
use `test`/*!*/;
SET TIMESTAMP=10000/*!*/;
insert into t2 values (@v)
diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
index 978b045d599..c10aa7abd05 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
@@ -946,10 +946,10 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=10
-master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
+master-bin.000001 # User var # # @`b`=_latin1 X'3135' COLLATE latin1_swedish_ci
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
-master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
+master-bin.000001 # User var # # @`b`=_latin1 X'3135' COLLATE latin1_swedish_ci
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, @`b`) SET `b`= @b + bug27417(2) ;file_id=#
master-bin.000001 # Query # # ROLLBACK
drop trigger trg_del_t2;
diff --git a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test
index 6514ff1f712..e64e7838a31 100644
--- a/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test
+++ b/mysql-test/suite/binlog/t/binlog_spurious_ddl_errors.test
@@ -26,7 +26,7 @@
--source include/have_log_bin.inc
SET @old_binlog_format= @@global.binlog_format;
-INSTALL PLUGIN example SONAME 'ha_example.so';
+INSTALL PLUGIN example SONAME 'ha_example';
--echo ################################################################################
--echo # Verifies if ER_BINLOG_STMT_MODE_AND_ROW_ENGINE happens by setting the binlog
@@ -90,6 +90,7 @@ DROP TABLE t_stmt;
--echo ################################################################################
--echo # CLEAN UP #
--echo ################################################################################
+flush tables;
UNINSTALL PLUGIN example;
SET @@global.binlog_format = @old_binlog_format;
SET @@session.binlog_format = @old_binlog_format;
diff --git a/mysql-test/suite/federated/federated.result b/mysql-test/suite/federated/federated.result
new file mode 100644
index 00000000000..6dcd6b1721b
--- /dev/null
+++ b/mysql-test/suite/federated/federated.result
@@ -0,0 +1,13 @@
+CREATE DATABASE federated;
+CREATE DATABASE federated;
+CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='non_existing';
+ERROR HY000: server name: 'non_existing' doesn't exist!
+SHOW WARNINGS;
+Level Code Message
+Error 1 server name: 'non_existing' doesn't exist!
+Error 1 Can't create/write to file 'non_existing' (Errcode: 14)
+Error 1005 Can't create table 'test.t1' (errno: 1)
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
+DROP TABLE IF EXISTS federated.t1;
+DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/suite/federated/federated.test b/mysql-test/suite/federated/federated.test
new file mode 100644
index 00000000000..88d20817996
--- /dev/null
+++ b/mysql-test/suite/federated/federated.test
@@ -0,0 +1,12 @@
+source include/federated.inc;
+
+connection master;
+#
+# MDEV-388 Creating a federated table with a non-existing server returns a random error code
+#
+--error 1
+CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='non_existing';
+SHOW WARNINGS;
+
+source include/federated_cleanup.inc;
+
diff --git a/mysql-test/suite/federated/federatedx.test b/mysql-test/suite/federated/federatedx.test
index 15fdd47c4da..cfe6a425944 100644
--- a/mysql-test/suite/federated/federatedx.test
+++ b/mysql-test/suite/federated/federatedx.test
@@ -1999,4 +1999,5 @@ connection slave;
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
connection default;
+
source include/federated_cleanup.inc;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index 526d69fe4c9..b4ff242db4b 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -230,7 +230,7 @@ def information_schema PROCESSLIST STAGE 10 0 NO tinyint NULL NULL 3 0 NULL NULL
def information_schema PROCESSLIST STATE 7 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PROCESSLIST TIME 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(7) select
def information_schema PROCESSLIST TIME_MS 9 0.000 NO decimal NULL NULL 22 3 NULL NULL NULL decimal(22,3) select
-def information_schema PROCESSLIST USER 2 NO varchar 16 48 NULL NULL NULL utf8 utf8_general_ci varchar(16) select
+def information_schema PROCESSLIST USER 2 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select
def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG 1 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -398,7 +398,7 @@ def information_schema USER_STATISTICS ROWS_UPDATED 14 0 NO bigint NULL NULL 19
def information_schema USER_STATISTICS SELECT_COMMANDS 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select
def information_schema USER_STATISTICS TOTAL_CONNECTIONS 2 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) select
def information_schema USER_STATISTICS UPDATE_COMMANDS 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select
-def information_schema USER_STATISTICS USER 1 NO varchar 48 144 NULL NULL NULL utf8 utf8_general_ci varchar(48) select
+def information_schema USER_STATISTICS USER 1 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select
def information_schema VIEWS CHARACTER_SET_CLIENT 9 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL NULL utf8 utf8_general_ci varchar(8) select
def information_schema VIEWS COLLATION_CONNECTION 10 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select
@@ -688,7 +688,7 @@ NULL information_schema PARTITIONS CHECKSUM bigint NULL NULL NULL NULL bigint(21
3.0000 information_schema PLUGINS PLUGIN_MATURITY varchar 12 36 utf8 utf8_general_ci varchar(12)
3.0000 information_schema PLUGINS PLUGIN_AUTH_VERSION varchar 80 240 utf8 utf8_general_ci varchar(80)
NULL information_schema PROCESSLIST ID bigint NULL NULL NULL NULL bigint(4)
-3.0000 information_schema PROCESSLIST USER varchar 16 48 utf8 utf8_general_ci varchar(16)
+3.0000 information_schema PROCESSLIST USER varchar 128 384 utf8 utf8_general_ci varchar(128)
3.0000 information_schema PROCESSLIST HOST varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema PROCESSLIST DB varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema PROCESSLIST COMMAND varchar 16 48 utf8 utf8_general_ci varchar(16)
@@ -844,7 +844,7 @@ NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime
3.0000 information_schema USER_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema USER_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema USER_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3)
-3.0000 information_schema USER_STATISTICS USER varchar 48 144 utf8 utf8_general_ci varchar(48)
+3.0000 information_schema USER_STATISTICS USER varchar 128 384 utf8 utf8_general_ci varchar(128)
NULL information_schema USER_STATISTICS TOTAL_CONNECTIONS int NULL NULL NULL NULL int(11)
NULL information_schema USER_STATISTICS CONCURRENT_CONNECTIONS int NULL NULL NULL NULL int(11)
NULL information_schema USER_STATISTICS CONNECTED_TIME int NULL NULL NULL NULL int(11)
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
index 3fb4d97748c..323e5fea518 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
@@ -231,7 +231,7 @@ def information_schema PROCESSLIST STAGE 10 0 NO tinyint NULL NULL 3 0 NULL NULL
def information_schema PROCESSLIST STATE 7 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema PROCESSLIST TIME 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(7)
def information_schema PROCESSLIST TIME_MS 9 0.000 NO decimal NULL NULL 22 3 NULL NULL NULL decimal(22,3)
-def information_schema PROCESSLIST USER 2 NO varchar 16 48 NULL NULL NULL utf8 utf8_general_ci varchar(16)
+def information_schema PROCESSLIST USER 2 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128)
def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG 1 NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512)
def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
def information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA 2 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64)
@@ -399,7 +399,7 @@ def information_schema USER_STATISTICS ROWS_UPDATED 14 0 NO bigint NULL NULL 19
def information_schema USER_STATISTICS SELECT_COMMANDS 15 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21)
def information_schema USER_STATISTICS TOTAL_CONNECTIONS 2 0 NO int NULL NULL 10 0 NULL NULL NULL int(11)
def information_schema USER_STATISTICS UPDATE_COMMANDS 16 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21)
-def information_schema USER_STATISTICS USER 1 NO varchar 48 144 NULL NULL NULL utf8 utf8_general_ci varchar(48)
+def information_schema USER_STATISTICS USER 1 NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128)
def information_schema VIEWS CHARACTER_SET_CLIENT 9 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32)
def information_schema VIEWS CHECK_OPTION 5 NO varchar 8 24 NULL NULL NULL utf8 utf8_general_ci varchar(8)
def information_schema VIEWS COLLATION_CONNECTION 10 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32)
@@ -693,7 +693,7 @@ NULL information_schema PARTITIONS CHECKSUM bigint NULL NULL NULL NULL bigint(21
3.0000 information_schema PLUGINS PLUGIN_MATURITY varchar 12 36 utf8 utf8_general_ci varchar(12)
3.0000 information_schema PLUGINS PLUGIN_AUTH_VERSION varchar 80 240 utf8 utf8_general_ci varchar(80)
NULL information_schema PROCESSLIST ID bigint NULL NULL NULL NULL bigint(4)
-3.0000 information_schema PROCESSLIST USER varchar 16 48 utf8 utf8_general_ci varchar(16)
+3.0000 information_schema PROCESSLIST USER varchar 128 384 utf8 utf8_general_ci varchar(128)
3.0000 information_schema PROCESSLIST HOST varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema PROCESSLIST DB varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema PROCESSLIST COMMAND varchar 16 48 utf8 utf8_general_ci varchar(16)
@@ -849,7 +849,7 @@ NULL information_schema TRIGGERS CREATED datetime NULL NULL NULL NULL datetime
3.0000 information_schema USER_PRIVILEGES TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema USER_PRIVILEGES PRIVILEGE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema USER_PRIVILEGES IS_GRANTABLE varchar 3 9 utf8 utf8_general_ci varchar(3)
-3.0000 information_schema USER_STATISTICS USER varchar 48 144 utf8 utf8_general_ci varchar(48)
+3.0000 information_schema USER_STATISTICS USER varchar 128 384 utf8 utf8_general_ci varchar(128)
NULL information_schema USER_STATISTICS TOTAL_CONNECTIONS int NULL NULL NULL NULL int(11)
NULL information_schema USER_STATISTICS CONCURRENT_CONNECTIONS int NULL NULL NULL NULL int(11)
NULL information_schema USER_STATISTICS CONNECTED_TIME int NULL NULL NULL NULL int(11)
diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
index 2112da6761e..17009f79662 100644
--- a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
+++ b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result
@@ -23,7 +23,7 @@ SHOW CREATE TABLE processlist;
Table Create Table
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
`ID` bigint(4) NOT NULL DEFAULT '0',
- `USER` varchar(16) NOT NULL DEFAULT '',
+ `USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
@@ -96,7 +96,7 @@ SHOW CREATE TABLE processlist;
Table Create Table
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
`ID` bigint(4) NOT NULL DEFAULT '0',
- `USER` varchar(16) NOT NULL DEFAULT '',
+ `USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result
index 421636f3d92..52ed7a4d0ac 100644
--- a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result
+++ b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result
@@ -23,7 +23,7 @@ SHOW CREATE TABLE processlist;
Table Create Table
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
`ID` bigint(4) NOT NULL DEFAULT '0',
- `USER` varchar(16) NOT NULL DEFAULT '',
+ `USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
@@ -96,7 +96,7 @@ SHOW CREATE TABLE processlist;
Table Create Table
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
`ID` bigint(4) NOT NULL DEFAULT '0',
- `USER` varchar(16) NOT NULL DEFAULT '',
+ `USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
diff --git a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
index 0893fa3ca20..4f174318f58 100644
--- a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
+++ b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result
@@ -13,7 +13,7 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.PROCESSLIST;
Table Create Table
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
`ID` bigint(4) NOT NULL DEFAULT '0',
- `USER` varchar(16) NOT NULL DEFAULT '',
+ `USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
diff --git a/mysql-test/suite/funcs_1/r/processlist_val_ps.result b/mysql-test/suite/funcs_1/r/processlist_val_ps.result
index b64afa84279..c3112bc573c 100644
--- a/mysql-test/suite/funcs_1/r/processlist_val_ps.result
+++ b/mysql-test/suite/funcs_1/r/processlist_val_ps.result
@@ -13,7 +13,7 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.PROCESSLIST;
Table Create Table
PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` (
`ID` bigint(4) NOT NULL DEFAULT '0',
- `USER` varchar(16) NOT NULL DEFAULT '',
+ `USER` varchar(128) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result
index 179d0cd814e..f9cdbb13d61 100644
--- a/mysql-test/suite/funcs_1/r/storedproc.result
+++ b/mysql-test/suite/funcs_1/r/storedproc.result
@@ -2490,8 +2490,7 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE option()
SELECT * from t1 where f2=f1;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option()
-SELECT * from t1 where f2=f1' at line 1
+DROP PROCEDURE option;
CREATE PROCEDURE optionally()
SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'optionally()
@@ -8548,8 +8547,6 @@ CREATE PROCEDURE sp1()
BEGIN
declare option char;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option char;
-END' at line 3
DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1()
BEGIN
@@ -10773,11 +10770,7 @@ BEGIN
declare option condition for sqlstate '02000';
declare exit handler for option set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option condition for sqlstate '02000';
-declare exit handler for option set @var2' at line 3
DROP PROCEDURE IF EXISTS sp1;
-Warnings:
-Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( )
BEGIN
declare optionally condition for sqlstate '02000';
@@ -12957,7 +12950,7 @@ CREATE PROCEDURE sp1( )
BEGIN
declare option handler for sqlstate '02000' set @var2 = 1;
END//
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'option handler for sqlstate '02000' set @var2 = 1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'handler for sqlstate '02000' set @var2 = 1;
END' at line 3
DROP PROCEDURE IF EXISTS sp1;
Warnings:
diff --git a/mysql-test/suite/funcs_1/t/storedproc.test b/mysql-test/suite/funcs_1/t/storedproc.test
index 3bd3199da4e..69406a57a00 100644
--- a/mysql-test/suite/funcs_1/t/storedproc.test
+++ b/mysql-test/suite/funcs_1/t/storedproc.test
@@ -1507,9 +1507,9 @@ CREATE PROCEDURE on()
CREATE PROCEDURE optimize()
SELECT * from t1 where f2=f1;
---error ER_PARSE_ERROR
CREATE PROCEDURE option()
SELECT * from t1 where f2=f1;
+DROP PROCEDURE option;
--error ER_PARSE_ERROR
CREATE PROCEDURE optionally()
@@ -10171,7 +10171,6 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings
delimiter //;
---error ER_PARSE_ERROR
CREATE PROCEDURE sp1()
BEGIN
declare option char;
@@ -12755,7 +12754,6 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1;
delimiter //;
---error ER_PARSE_ERROR
CREATE PROCEDURE sp1( )
BEGIN
declare option condition for sqlstate '02000';
diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result
index 96d21e7373a..fb633bb94c4 100644
--- a/mysql-test/suite/handler/interface.result
+++ b/mysql-test/suite/handler/interface.result
@@ -294,3 +294,13 @@ ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema
USE test;
PREPARE h_r FROM 'HANDLER t1 READ `PRIMARY` LAST';
ERROR 42S02: Unknown table 't1' in HANDLER
+create view v as select 1;
+create temporary table v as select 2;
+handler v open;
+prepare stmt from 'create table if not exists v as select 3';
+execute stmt;
+Warnings:
+Note 1050 Table 'v' already exists
+handler v read next;
+ERROR 42S02: Unknown table 'v' in HANDLER
+drop view v;
diff --git a/mysql-test/suite/handler/interface.test b/mysql-test/suite/handler/interface.test
index e4e854b2515..2ef617c3ce7 100644
--- a/mysql-test/suite/handler/interface.test
+++ b/mysql-test/suite/handler/interface.test
@@ -377,3 +377,16 @@ USE test;
#
--error ER_UNKNOWN_TABLE
PREPARE h_r FROM 'HANDLER t1 READ `PRIMARY` LAST';
+
+#
+# MySQL Bug#16385711: HANDLER, CREATE TABLE IF NOT EXISTS, PROBLEM AFTER MYSQL_HA_FIND
+#
+create view v as select 1;
+create temporary table v as select 2;
+handler v open;
+prepare stmt from 'create table if not exists v as select 3';
+execute stmt;
+--error ER_UNKNOWN_TABLE
+handler v read next;
+drop view v;
+
diff --git a/mysql-test/suite/innodb/r/innodb_bug14147491.result b/mysql-test/suite/innodb/r/innodb_bug14147491.result
index 6279f85f676..faf922ca5f8 100644
--- a/mysql-test/suite/innodb/r/innodb_bug14147491.result
+++ b/mysql-test/suite/innodb/r/innodb_bug14147491.result
@@ -4,14 +4,25 @@ CALL mtr.add_suppression("InnoDB: Warning: database page corruption or a failed"
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
INSERT INTO t1 (b) VALUES ('corrupt me');
INSERT INTO t1 (b) VALUES ('corrupt me');
-# Restart server to flush buffers
+# Write file to make mysql-test-run.pl expect the "crash", but don't
+# start it until it's told to
+# We give 30 seconds to do a clean shutdown because we do not want
+# to redo apply the pages of t1.ibd at the time of recovery.
+# We want SQL to initiate the first access to t1.ibd.
+# Wait until disconnected.
+# Backup the t1.ibd before corrupting
# Corrupt the table
Munged a string.
Munged a string.
-# Write file to make mysql-test-run.pl expect crash and restart
+# Write file to make mysql-test-run.pl start up the server again
+SET DEBUG_DBUG = '+d,innodb_page_corruption_retries';
+# Write file to make mysql-test-run.pl expect the "crash", but don't
+# start it until it's told to
+# The below SELECT query will crash the server because some pages
+# on the disk are corrupted
SELECT * FROM t1;
ERROR HY000: Lost connection to MySQL server during query
-# Turn on reconnect
-# Wait for server to fully start
+# Restore the original t1.ibd
+# Write file to make mysql-test-run.pl start up the server again
# Cleanup
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_bug12400341.test b/mysql-test/suite/innodb/t/innodb_bug12400341.test
index 2ab1be81f6d..ab69e20c495 100644
--- a/mysql-test/suite/innodb/t/innodb_bug12400341.test
+++ b/mysql-test/suite/innodb/t/innodb_bug12400341.test
@@ -7,6 +7,10 @@ if (`select count(*)=0 from information_schema.global_variables where variable_n
--skip Test requires InnoDB built with UNIV_DEBUG definition.
}
+# Don't test under valgrind, undo slots of the previous test might exist still
+# and cause unstable result.
+--source include/not_valgrind.inc
+
call mtr.add_suppression("InnoDB: Warning: cannot find a free slot for an undo log. Do you have too");
--disable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb_bug14147491.test b/mysql-test/suite/innodb/t/innodb_bug14147491.test
index ee3519c53fc..050f7fbdd73 100644
--- a/mysql-test/suite/innodb/t/innodb_bug14147491.test
+++ b/mysql-test/suite/innodb/t/innodb_bug14147491.test
@@ -10,6 +10,8 @@ source include/not_crashrep.inc;
source include/not_embedded.inc;
# Require InnoDB
source include/have_innodb.inc;
+# Require Debug for SET DEBUG
+source include/have_debug.inc;
CALL mtr.add_suppression("InnoDB: Error: Unable to read tablespace .* page no .* into the buffer pool after 100 attempts");
CALL mtr.add_suppression("InnoDB: Warning: database page corruption or a failed");
@@ -27,13 +29,26 @@ while ($i)
--enable_query_log
INSERT INTO t1 (b) VALUES ('corrupt me');
---echo # Restart server to flush buffers
-source include/restart_mysqld.inc;
-
---echo # Corrupt the table
let $MYSQLD_DATADIR=`select @@datadir`;
let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
+--echo # Write file to make mysql-test-run.pl expect the "crash", but don't
+--echo # start it until it's told to
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--echo # We give 30 seconds to do a clean shutdown because we do not want
+--echo # to redo apply the pages of t1.ibd at the time of recovery.
+--echo # We want SQL to initiate the first access to t1.ibd.
+shutdown_server 30;
+
+--echo # Wait until disconnected.
+--source include/wait_until_disconnected.inc
+
+--echo # Backup the t1.ibd before corrupting
+--copy_file $t1_IBD $MYSQLD_DATADIR/test/t1.ibd.backup
+
+--echo # Corrupt the table
+
perl;
use strict;
use warnings;
@@ -59,17 +74,38 @@ while ($len = sysread IBD_FILE, $chunk, 1024)
close IBD_FILE;
EOF
---echo # Write file to make mysql-test-run.pl expect crash and restart
+--echo # Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+SET DEBUG_DBUG = '+d,innodb_page_corruption_retries';
+--echo # Write file to make mysql-test-run.pl expect the "crash", but don't
+--echo # start it until it's told to
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--echo # The below SELECT query will crash the server because some pages
+--echo # on the disk are corrupted
--error 2013
SELECT * FROM t1;
---echo # Turn on reconnect
---enable_reconnect
+# The below mtr command --remove_file fails randomly on windows with
+# error number 13 which is permission denied on nix systems. We sleep
+# 1 second hoping that any process holding lock on t1.ibd is released.
+SLEEP 1;
---echo # Wait for server to fully start
+--echo # Restore the original t1.ibd
+--remove_file $MYSQLD_DATADIR/test/t1.ibd
+--move_file $MYSQLD_DATADIR/test/t1.ibd.backup $MYSQLD_DATADIR/test/t1.ibd
+
+--echo # Write file to make mysql-test-run.pl start up the server again
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
--source include/wait_until_connected_again.inc
+# Note SET DEBUG = '-d,innodb_page_corruption_retries' is not required
+# because the session information is lost after server restart
+
--echo # Cleanup
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111-master.opt b/mysql-test/suite/innodb/t/innodb_bug14676111-master.opt
new file mode 100644
index 00000000000..e16b9b0b895
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug14676111-master.opt
@@ -0,0 +1 @@
+--loose-innodb-purge-threads=0
diff --git a/mysql-test/suite/innodb/t/innodb_bug14676111.test b/mysql-test/suite/innodb/t/innodb_bug14676111.test
index fadd111fdc9..41862b8105e 100644
--- a/mysql-test/suite/innodb/t/innodb_bug14676111.test
+++ b/mysql-test/suite/innodb/t/innodb_bug14676111.test
@@ -3,6 +3,11 @@
-- source include/have_innodb.inc
-- source include/have_debug.inc
+# Note that this test needs to be able to manipulate how/when purge is done
+# using @@innodb_limit_optimistic_insert_debug. This does not work with
+# background purge threads, so we disabled them in the -master.opt (they are
+# off by default in normal 5.5 innodb but on by default in xtradb)
+
if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG'`)
{
--skip Test requires InnoDB built with UNIV_DEBUG definition.
diff --git a/mysql-test/suite/innodb/t/innodb_bug51920.test b/mysql-test/suite/innodb/t/innodb_bug51920.test
index 0d4715712b0..c83e00db22a 100644
--- a/mysql-test/suite/innodb/t/innodb_bug51920.test
+++ b/mysql-test/suite/innodb/t/innodb_bug51920.test
@@ -36,7 +36,7 @@ let $wait_condition =
# depending on platform.
#
connection con1;
--- error 1317, 2006, 2013
+-- error 1317, 2006, 2013, ER_CONNECTION_KILLED
reap;
connection default;
DROP TABLE bug51920;
diff --git a/mysql-test/suite/maria/distinct.result b/mysql-test/suite/maria/distinct.result
new file mode 100644
index 00000000000..7963e7b72ff
--- /dev/null
+++ b/mysql-test/suite/maria/distinct.result
@@ -0,0 +1,25 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT, b INT) ENGINE=Aria;
+INSERT t1 VALUES (3,2004),(2,2006),(1,2007),(3,2008),(2,2005),(2,2001);
+SELECT GROUP_CONCAT(a) FROM t1 GROUP BY b;
+GROUP_CONCAT(a)
+2
+3
+2
+2
+1
+3
+SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b;
+GROUP_CONCAT(a)
+2
+3
+1
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,'q'),(2,NULL),(7,'g'),(6,'x');
+SELECT DISTINCT MAX( a ) FROM t1 GROUP BY b ORDER BY MD5( b );
+MAX( a )
+2
+7
+6
+DROP TABLE t1;
diff --git a/mysql-test/suite/maria/distinct.test b/mysql-test/suite/maria/distinct.test
new file mode 100644
index 00000000000..c71a172597c
--- /dev/null
+++ b/mysql-test/suite/maria/distinct.test
@@ -0,0 +1,25 @@
+#
+# MDEV-4280:
+# Assertion `empty_size == empty_size_on_page' failure in ma_blockrec.c or
+# ER_NOT_KEYFILE on query with DISTINCT and GROUP BY
+#
+# This issue was a bug in how we delete row during duplicate removal when
+# we use Aria for internal temporary table.
+#
+
+-- source include/have_maria.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT, b INT) ENGINE=Aria;
+INSERT t1 VALUES (3,2004),(2,2006),(1,2007),(3,2008),(2,2005),(2,2001);
+SELECT GROUP_CONCAT(a) FROM t1 GROUP BY b;
+SELECT DISTINCT GROUP_CONCAT(a) FROM t1 GROUP BY b;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INT, b VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,'q'),(2,NULL),(7,'g'),(6,'x');
+SELECT DISTINCT MAX( a ) FROM t1 GROUP BY b ORDER BY MD5( b );
+DROP TABLE t1;
diff --git a/mysql-test/suite/maria/maria-autozerofill.result b/mysql-test/suite/maria/maria-autozerofill.result
index 22856fe54b0..ef9e2f77345 100644
--- a/mysql-test/suite/maria/maria-autozerofill.result
+++ b/mysql-test/suite/maria/maria-autozerofill.result
@@ -12,6 +12,8 @@ create table t4 (a int) engine=aria;
INSERT INTO t4 VALUES (1),(2);
create table t5 (a int) engine=aria;
INSERT INTO t5 VALUES (1),(2);
+create table t6 (a int) engine=aria;
+INSERT INTO t6 VALUES (1),(2);
flush tables;
create_rename_lsn has non-magic value
* shut down mysqld, removed logs, restarted it
@@ -25,6 +27,10 @@ Status: changed,sorted index pages,zerofilled
insert into t1 values(2);
flush table t1;
create_rename_lsn has non-magic value
+#
+# BUG#44422 "mysql_upgrade destroys Maria tables?"
+# Check repair and optimize of moved table
+#
check table t2;
Table Op Msg_type Msg_text
mysqltest.t2 check error Table is from another system and must be zerofilled or repaired to be usable on this system
@@ -59,4 +65,11 @@ mysqltest.t5 repair status OK
check table t5;
Table Op Msg_type Msg_text
mysqltest.t5 check status OK
+select * from t6;
+a
+1
+2
+check table t6;
+Table Op Msg_type Msg_text
+mysqltest.t6 check status OK
drop database mysqltest;
diff --git a/mysql-test/suite/maria/maria-autozerofill.test b/mysql-test/suite/maria/maria-autozerofill.test
index 9bb2782105a..e56f71d2c5f 100644
--- a/mysql-test/suite/maria/maria-autozerofill.test
+++ b/mysql-test/suite/maria/maria-autozerofill.test
@@ -33,11 +33,13 @@ create table t4 (a int) engine=aria;
INSERT INTO t4 VALUES (1),(2);
create table t5 (a int) engine=aria;
INSERT INTO t5 VALUES (1),(2);
+create table t6 (a int) engine=aria;
+INSERT INTO t6 VALUES (1),(2);
flush tables;
# Check that table is not zerofilled, not movable
let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
+--exec $MARIA_CHK -dv --ignore-control-file $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
perl;
use strict;
use warnings;
@@ -62,7 +64,7 @@ enable_ps_protocol;
flush table t1;
# Check that table is auto-zerofilled, movable
---exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
+--exec $MARIA_CHK -dv --ignore-control-file $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
perl;
use strict;
use warnings;
@@ -79,7 +81,7 @@ insert into t1 values(2);
flush table t1;
# Check that table is not zerofilled, not movable
---exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
+--exec $MARIA_CHK -dv --ignore-control-file $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
perl;
use strict;
use warnings;
@@ -91,10 +93,13 @@ perl;
close FILE;
EOF
-#
-# BUG#44422 "mysql_upgrade destroys Maria tables?"
-# Check repair and optimize of moved table
-#
+--echo #
+--echo # BUG#44422 "mysql_upgrade destroys Maria tables?"
+--echo # Check repair and optimize of moved table
+--echo #
+
+# Table t2 is regarded as it would be from another server as we removed
+# the aria control file earlier
check table t2;
check table t2;
repair table t2;
@@ -108,4 +113,10 @@ check table t5;
repair table t5;
check table t5;
+# Check that if we zerofill with aria_chk, we should not get any warnings when
+# accessing the table
+--exec $MARIA_CHK --zerofill $MYSQLD_DATADIR/mysqltest/t6 >$MYSQLTEST_VARDIR/tmp/ariachk.txt
+select * from t6;
+check table t6;
+
drop database mysqltest;
diff --git a/mysql-test/suite/maria/maria-recovery2.result b/mysql-test/suite/maria/maria-recovery2.result
index 149ce5a01af..1dcb476af42 100644
--- a/mysql-test/suite/maria/maria-recovery2.result
+++ b/mysql-test/suite/maria/maria-recovery2.result
@@ -107,6 +107,9 @@ flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 read;
delete from t1 limit 1;
+select count(*) from t1;
+count(*)
+0
insert into t1 select * from t2;
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash";
* crashing mysqld intentionally
@@ -123,6 +126,9 @@ use mysqltest;
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 1 a 1 a A 1 NULL NULL YES BTREE
+select count(*) from t1;
+count(*)
+1
drop table t1;
* TEST of recovery when OPTIMIZE has replaced the index file and crash
create table t_corrupted1 (a varchar(100), key(a)) engine=aria;
diff --git a/mysql-test/suite/maria/maria-recovery2.test b/mysql-test/suite/maria/maria-recovery2.test
index 8d27d9aaaac..21944026cf6 100644
--- a/mysql-test/suite/maria/maria-recovery2.test
+++ b/mysql-test/suite/maria/maria-recovery2.test
@@ -130,9 +130,11 @@ insert into t1 values(30);
lock tables t1 write, t2 read;
delete from t1 limit 1;
# 127 rows in t2, >100, so this will use repair-at-end
+select count(*) from t1;
insert into t1 select * from t2;
-- source include/maria_verify_recovery.inc
show keys from t1; # should be enabled
+select count(*) from t1;
drop table t1;
--echo * TEST of recovery when OPTIMIZE has replaced the index file and crash
diff --git a/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result
index 8dbb9b44e2f..3ef62f2b050 100644
--- a/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter1_1_2_innodb.result
@@ -531,7 +531,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1023,7 +1023,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1530,7 +1530,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2031,7 +2031,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2530,7 +2530,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3040,7 +3040,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3552,7 +3552,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4052,7 +4052,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4545,7 +4545,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5037,7 +5037,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5544,7 +5544,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6045,7 +6045,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6544,7 +6544,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7054,7 +7054,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7566,7 +7566,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8066,7 +8066,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8576,7 +8576,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9084,7 +9084,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9607,7 +9607,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10124,7 +10124,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10639,7 +10639,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11165,7 +11165,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11693,7 +11693,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12209,7 +12209,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12718,7 +12718,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13226,7 +13226,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13749,7 +13749,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14266,7 +14266,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14781,7 +14781,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15307,7 +15307,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15835,7 +15835,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16351,7 +16351,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16846,7 +16846,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17339,7 +17339,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17847,7 +17847,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18349,7 +18349,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18849,7 +18849,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19360,7 +19360,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19873,7 +19873,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20374,7 +20374,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20868,7 +20868,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -21361,7 +21361,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -21869,7 +21869,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -22371,7 +22371,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -22871,7 +22871,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -23382,7 +23382,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -23895,7 +23895,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -24396,7 +24396,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -24890,7 +24890,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -25383,7 +25383,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -25891,7 +25891,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -26393,7 +26393,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -26893,7 +26893,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -27404,7 +27404,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -27917,7 +27917,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -28418,7 +28418,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
diff --git a/mysql-test/suite/parts/r/partition_alter1_1_innodb.result b/mysql-test/suite/parts/r/partition_alter1_1_innodb.result
index 075346cfe94..66d84768b5e 100644
--- a/mysql-test/suite/parts/r/partition_alter1_1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter1_1_innodb.result
@@ -849,7 +849,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1341,7 +1341,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1848,7 +1848,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2349,7 +2349,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2850,7 +2850,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3360,7 +3360,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3872,7 +3872,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4372,7 +4372,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4865,7 +4865,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5357,7 +5357,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5864,7 +5864,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6365,7 +6365,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6866,7 +6866,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7376,7 +7376,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7888,7 +7888,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8388,7 +8388,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8898,7 +8898,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9406,7 +9406,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9929,7 +9929,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10446,7 +10446,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10963,7 +10963,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11489,7 +11489,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12017,7 +12017,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12533,7 +12533,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13042,7 +13042,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13550,7 +13550,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14073,7 +14073,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14590,7 +14590,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15107,7 +15107,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15633,7 +15633,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16161,7 +16161,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16677,7 +16677,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
diff --git a/mysql-test/suite/parts/r/partition_alter1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter1_2_innodb.result
index b25ed98c355..f1a1aeecb66 100644
--- a/mysql-test/suite/parts/r/partition_alter1_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter1_2_innodb.result
@@ -478,7 +478,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -918,7 +918,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1373,7 +1373,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1822,7 +1822,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2271,7 +2271,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2729,7 +2729,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3189,7 +3189,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3637,7 +3637,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4078,7 +4078,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4518,7 +4518,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4973,7 +4973,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5422,7 +5422,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5871,7 +5871,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6329,7 +6329,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6789,7 +6789,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7237,7 +7237,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7694,7 +7694,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8150,7 +8150,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8621,7 +8621,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9086,7 +9086,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9551,7 +9551,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10025,7 +10025,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10501,7 +10501,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10965,7 +10965,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11410,7 +11410,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11850,7 +11850,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12305,7 +12305,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12754,7 +12754,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13201,7 +13201,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13659,7 +13659,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14119,7 +14119,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14567,7 +14567,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15008,7 +15008,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15448,7 +15448,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15903,7 +15903,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16352,7 +16352,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16799,7 +16799,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17257,7 +17257,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17717,7 +17717,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18165,7 +18165,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18623,7 +18623,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19079,7 +19079,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19550,7 +19550,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20015,7 +20015,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20478,7 +20478,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20952,7 +20952,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -21428,7 +21428,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -21892,7 +21892,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -22349,7 +22349,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -22805,7 +22805,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -23276,7 +23276,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -23741,7 +23741,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -24204,7 +24204,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -24678,7 +24678,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -25154,7 +25154,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -25618,7 +25618,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -26060,7 +26060,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -26500,7 +26500,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -26955,7 +26955,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -27404,7 +27404,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -27851,7 +27851,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -28309,7 +28309,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -28769,7 +28769,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -29217,7 +29217,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -29658,7 +29658,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -30098,7 +30098,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -30553,7 +30553,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -31002,7 +31002,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -31449,7 +31449,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -31907,7 +31907,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -32367,7 +32367,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -32815,7 +32815,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -33272,7 +33272,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -33728,7 +33728,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -34199,7 +34199,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -34664,7 +34664,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -35127,7 +35127,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -35601,7 +35601,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -36077,7 +36077,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -36541,7 +36541,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
diff --git a/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result b/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result
index 1b08b2f74fd..314044044bb 100644
--- a/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_1_1_innodb.result
@@ -495,7 +495,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -951,7 +951,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1422,7 +1422,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1887,7 +1887,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2352,7 +2352,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2826,7 +2826,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3302,7 +3302,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3766,7 +3766,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4260,7 +4260,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4752,7 +4752,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5259,7 +5259,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5760,7 +5760,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6261,7 +6261,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6771,7 +6771,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7283,7 +7283,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7783,7 +7783,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8276,7 +8276,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8768,7 +8768,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9275,7 +9275,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9776,7 +9776,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10277,7 +10277,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10787,7 +10787,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11299,7 +11299,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11799,7 +11799,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12309,7 +12309,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12817,7 +12817,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13340,7 +13340,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13857,7 +13857,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14374,7 +14374,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14900,7 +14900,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15428,7 +15428,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15944,7 +15944,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16453,7 +16453,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16961,7 +16961,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17484,7 +17484,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18001,7 +18001,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18518,7 +18518,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19044,7 +19044,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19572,7 +19572,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20088,7 +20088,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
diff --git a/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result b/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result
index b69fcee1b1f..e824cf45ce9 100644
--- a/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_1_2_innodb.result
@@ -491,7 +491,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -947,7 +947,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1418,7 +1418,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1883,7 +1883,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2346,7 +2346,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2820,7 +2820,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3296,7 +3296,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3760,7 +3760,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4254,7 +4254,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4746,7 +4746,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5253,7 +5253,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5754,7 +5754,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6253,7 +6253,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6763,7 +6763,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7275,7 +7275,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7775,7 +7775,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8268,7 +8268,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8760,7 +8760,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9267,7 +9267,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9768,7 +9768,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10267,7 +10267,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10777,7 +10777,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11289,7 +11289,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11789,7 +11789,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12299,7 +12299,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12807,7 +12807,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13330,7 +13330,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13847,7 +13847,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14362,7 +14362,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14888,7 +14888,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15416,7 +15416,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15932,7 +15932,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16441,7 +16441,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16949,7 +16949,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17472,7 +17472,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17989,7 +17989,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18504,7 +18504,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19030,7 +19030,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19558,7 +19558,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20074,7 +20074,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
diff --git a/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result b/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result
index 1ff53af9111..faba21b41f7 100644
--- a/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_2_1_innodb.result
@@ -497,7 +497,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -955,7 +955,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1428,7 +1428,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1893,7 +1893,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2360,7 +2360,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2834,7 +2834,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3312,7 +3312,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3778,7 +3778,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4273,7 +4273,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4767,7 +4767,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5276,7 +5276,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5777,7 +5777,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6280,7 +6280,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6790,7 +6790,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7304,7 +7304,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7806,7 +7806,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8301,7 +8301,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8795,7 +8795,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9304,7 +9304,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9805,7 +9805,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10308,7 +10308,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10818,7 +10818,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11332,7 +11332,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11834,7 +11834,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12346,7 +12346,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12856,7 +12856,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13381,7 +13381,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13898,7 +13898,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14417,7 +14417,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14943,7 +14943,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15473,7 +15473,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15991,7 +15991,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16502,7 +16502,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17012,7 +17012,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17537,7 +17537,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18054,7 +18054,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18573,7 +18573,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19099,7 +19099,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19629,7 +19629,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20147,7 +20147,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
diff --git a/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result b/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result
index 1859859b24f..2557cd5a219 100644
--- a/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter2_2_2_innodb.result
@@ -493,7 +493,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -952,7 +952,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1426,7 +1426,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1896,7 +1896,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2364,7 +2364,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2843,7 +2843,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3322,7 +3322,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3789,7 +3789,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4286,7 +4286,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4781,7 +4781,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5291,7 +5291,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5797,7 +5797,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6301,7 +6301,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6816,7 +6816,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7331,7 +7331,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7834,7 +7834,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8330,7 +8330,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8825,7 +8825,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9335,7 +9335,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9841,7 +9841,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10345,7 +10345,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10860,7 +10860,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11375,7 +11375,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11878,7 +11878,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12391,7 +12391,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12902,7 +12902,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13428,7 +13428,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13950,7 +13950,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14470,7 +14470,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15001,7 +15001,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15532,7 +15532,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16051,7 +16051,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16563,7 +16563,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17074,7 +17074,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17600,7 +17600,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18122,7 +18122,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18642,7 +18642,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19173,7 +19173,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19704,7 +19704,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20223,7 +20223,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
diff --git a/mysql-test/suite/parts/r/partition_alter4_innodb.result b/mysql-test/suite/parts/r/partition_alter4_innodb.result
index b0f340664b7..46f3ed3c974 100644
--- a/mysql-test/suite/parts/r/partition_alter4_innodb.result
+++ b/mysql-test/suite/parts/r/partition_alter4_innodb.result
@@ -497,7 +497,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -959,7 +959,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1432,7 +1432,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1899,7 +1899,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2366,7 +2366,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2842,7 +2842,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3320,7 +3320,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3786,7 +3786,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4247,7 +4247,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4709,7 +4709,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5182,7 +5182,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5649,7 +5649,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6116,7 +6116,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6592,7 +6592,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7070,7 +7070,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7536,7 +7536,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7997,7 +7997,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8459,7 +8459,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8932,7 +8932,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9399,7 +9399,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9866,7 +9866,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10342,7 +10342,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10820,7 +10820,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11286,7 +11286,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11747,7 +11747,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12209,7 +12209,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12682,7 +12682,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13149,7 +13149,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13616,7 +13616,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14092,7 +14092,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14570,7 +14570,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15036,7 +15036,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15497,7 +15497,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15959,7 +15959,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16432,7 +16432,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16899,7 +16899,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17366,7 +17366,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17842,7 +17842,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18320,7 +18320,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18786,7 +18786,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19250,7 +19250,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19712,7 +19712,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20185,7 +20185,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20652,7 +20652,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -21119,7 +21119,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -21595,7 +21595,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -22073,7 +22073,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -22539,7 +22539,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -23000,7 +23000,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -23462,7 +23462,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -23935,7 +23935,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -24402,7 +24402,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -24869,7 +24869,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -25345,7 +25345,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -25823,7 +25823,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -26289,7 +26289,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -26750,7 +26750,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -27212,7 +27212,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -27685,7 +27685,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -28152,7 +28152,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -28619,7 +28619,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -29095,7 +29095,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -29573,7 +29573,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -30039,7 +30039,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -30500,7 +30500,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -30962,7 +30962,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -31435,7 +31435,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -31902,7 +31902,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -32369,7 +32369,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -32845,7 +32845,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -33323,7 +33323,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -33789,7 +33789,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -34250,7 +34250,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -34712,7 +34712,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -35185,7 +35185,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -35652,7 +35652,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -36119,7 +36119,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -36595,7 +36595,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -37073,7 +37073,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -37539,7 +37539,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -38004,7 +38004,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -38467,7 +38467,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -38941,7 +38941,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -39409,7 +39409,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -39877,7 +39877,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -40354,7 +40354,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -40833,7 +40833,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -41300,7 +41300,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -41762,7 +41762,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -42225,7 +42225,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -42699,7 +42699,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -43167,7 +43167,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -43635,7 +43635,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -44112,7 +44112,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -44591,7 +44591,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -45058,7 +45058,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -45519,7 +45519,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -45981,7 +45981,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -46454,7 +46454,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -46921,7 +46921,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -47388,7 +47388,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -47864,7 +47864,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -48342,7 +48342,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -48808,7 +48808,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -49269,7 +49269,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -49731,7 +49731,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -50204,7 +50204,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -50671,7 +50671,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -51138,7 +51138,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -51614,7 +51614,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -52092,7 +52092,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -52558,7 +52558,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -53020,7 +53020,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -53483,7 +53483,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -53957,7 +53957,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -54425,7 +54425,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -54893,7 +54893,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -55370,7 +55370,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -55849,7 +55849,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -56316,7 +56316,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -56778,7 +56778,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -57238,7 +57238,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -57709,7 +57709,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -58174,7 +58174,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -58639,7 +58639,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -59113,7 +59113,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -59589,7 +59589,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -60053,7 +60053,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -60512,7 +60512,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -60972,7 +60972,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -61443,7 +61443,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -61908,7 +61908,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -62373,7 +62373,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -62847,7 +62847,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -63323,7 +63323,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -63787,7 +63787,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -64566,7 +64566,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -65026,7 +65026,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -65497,7 +65497,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -65962,7 +65962,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -66427,7 +66427,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -66901,7 +66901,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -67377,7 +67377,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -67841,7 +67841,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -67868,7 +67868,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -68305,7 +68305,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -68327,7 +68327,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -68767,7 +68767,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -68797,7 +68797,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -69240,7 +69240,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -69268,7 +69268,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -69707,7 +69707,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -69733,7 +69733,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -70174,7 +70174,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -70204,7 +70204,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -70650,7 +70650,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -70680,7 +70680,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -71128,7 +71128,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -71154,7 +71154,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -71594,7 +71594,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -71618,7 +71618,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -72055,7 +72055,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -72077,7 +72077,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -72517,7 +72517,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -72547,7 +72547,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -72990,7 +72990,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -73018,7 +73018,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -73457,7 +73457,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -73483,7 +73483,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -73924,7 +73924,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -73954,7 +73954,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -74400,7 +74400,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -74430,7 +74430,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -74878,7 +74878,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -74904,7 +74904,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION part_1,part_2;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -75344,7 +75344,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -75805,7 +75805,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -76267,7 +76267,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -76740,7 +76740,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -77207,7 +77207,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -77674,7 +77674,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -78150,7 +78150,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -78628,7 +78628,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -79094,7 +79094,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -79555,7 +79555,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -80017,7 +80017,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -80490,7 +80490,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -80957,7 +80957,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -81424,7 +81424,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -81900,7 +81900,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -82378,7 +82378,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -82844,7 +82844,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -82868,7 +82868,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -83305,7 +83305,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -83327,7 +83327,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -83767,7 +83767,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -83797,7 +83797,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -84240,7 +84240,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -84268,7 +84268,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -84707,7 +84707,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -84733,7 +84733,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -85174,7 +85174,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -85204,7 +85204,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -85650,7 +85650,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -85680,7 +85680,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -86128,7 +86128,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -86154,7 +86154,7 @@ SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN 1 AND @max_row_div2 - 1;
ALTER TABLE t1 REPAIR PARTITION ALL;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template
WHERE f_int1 BETWEEN @max_row_div2 AND @max_row;
@@ -86594,7 +86594,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
diff --git a/mysql-test/suite/parts/r/partition_basic_innodb.result b/mysql-test/suite/parts/r/partition_basic_innodb.result
index 21c5d70e6e3..ea5a53fc5f4 100644
--- a/mysql-test/suite/parts/r/partition_basic_innodb.result
+++ b/mysql-test/suite/parts/r/partition_basic_innodb.result
@@ -498,7 +498,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -953,7 +953,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1423,7 +1423,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1887,7 +1887,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2351,7 +2351,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2824,7 +2824,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3303,7 +3303,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3766,7 +3766,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4223,7 +4223,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4678,7 +4678,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5148,7 +5148,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5612,7 +5612,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6074,7 +6074,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -6547,7 +6547,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7022,7 +7022,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7485,7 +7485,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -7983,7 +7983,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8475,7 +8475,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -8982,7 +8982,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9483,7 +9483,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -9984,7 +9984,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -10494,7 +10494,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11010,7 +11010,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -11510,7 +11510,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12003,7 +12003,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -12495,7 +12495,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13002,7 +13002,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -13503,7 +13503,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14004,7 +14004,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -14514,7 +14514,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15030,7 +15030,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -15530,7 +15530,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16039,7 +16039,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -16547,7 +16547,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17070,7 +17070,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -17587,7 +17587,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18104,7 +18104,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -18630,7 +18630,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19162,7 +19162,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -19678,7 +19678,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20176,7 +20176,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -20668,7 +20668,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -21175,7 +21175,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -21676,7 +21676,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -22175,7 +22175,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -22685,7 +22685,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -23197,7 +23197,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -23697,7 +23697,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -24190,7 +24190,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -24682,7 +24682,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -25189,7 +25189,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -25690,7 +25690,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -26189,7 +26189,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -26699,7 +26699,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -27211,7 +27211,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -27711,7 +27711,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -28220,7 +28220,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -28728,7 +28728,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -29251,7 +29251,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -29768,7 +29768,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -30283,7 +30283,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -30809,7 +30809,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -31337,7 +31337,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -31853,7 +31853,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
diff --git a/mysql-test/suite/parts/r/partition_engine_innodb.result b/mysql-test/suite/parts/r/partition_engine_innodb.result
index c033ea36351..5335983b560 100644
--- a/mysql-test/suite/parts/r/partition_engine_innodb.result
+++ b/mysql-test/suite/parts/r/partition_engine_innodb.result
@@ -489,7 +489,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -947,7 +947,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1409,7 +1409,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -1934,7 +1934,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2435,7 +2435,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -2897,7 +2897,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3356,7 +3356,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -3818,7 +3818,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4283,7 +4283,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -4737,7 +4737,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
@@ -5192,7 +5192,7 @@ test.t1 optimize status OK
# check layout success: 1
REPAIR TABLE t1 EXTENDED;
Table Op Msg_type Msg_text
-test.t1 repair note The storage engine for the table doesn't support repair
+test.t1 repair status OK
# check layout success: 1
TRUNCATE t1;
diff --git a/mysql-test/suite/parts/t/partition_basic_innodb.test b/mysql-test/suite/parts/t/partition_basic_innodb.test
index 8240257f087..398f62dab28 100644
--- a/mysql-test/suite/parts/t/partition_basic_innodb.test
+++ b/mysql-test/suite/parts/t/partition_basic_innodb.test
@@ -22,7 +22,7 @@
# any of the variables.
#
---source include/long_test.inc
+--source include/big_test.inc
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
diff --git a/mysql-test/suite/plugins/r/audit_null.result b/mysql-test/suite/plugins/r/audit_null.result
index 4cf648510e6..76aef454b94 100644
--- a/mysql-test/suite/plugins/r/audit_null.result
+++ b/mysql-test/suite/plugins/r/audit_null.result
@@ -1,5 +1,6 @@
set @old_global_general_log=@@global.general_log;
set global general_log=OFF;
+grant select on *.* to testuser@localhost;
install plugin audit_null soname 'adt_null';
select 1;
1
@@ -18,12 +19,82 @@ concat("test1", x)
test1-12
show status like 'audit_null%';
Variable_name Value
-Audit_null_called 19
+Audit_null_called 21
Audit_null_general_error 1
Audit_null_general_log 7
Audit_null_general_result 5
+create table t1 (a int);
+insert t1 values (1), (2);
+select * from t1;
+a
+1
+2
+rename table t1 to t2;
+alter table t2 add column b int;
+create definer=testuser@localhost view v1 as select t2.a+1, t2_copy.a+2 from t2, t2 as t2_copy;
+select * from v1;
+t2.a+1 t2_copy.a+2
+2 3
+3 3
+2 4
+3 4
+drop view v1;
+create temporary table t2 (a date);
+insert t2 values ('2020-10-09');
+select * from t2;
+a
+2020-10-09
+drop table t2;
+explain select distinct * from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using temporary
+select distinct * from t2;
+a b
+1 NULL
+2 NULL
+drop table t2;
uninstall plugin audit_null;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
drop procedure au1;
+drop user testuser@localhost;
set global general_log=@old_global_general_log;
+root[root] @ localhost [] >> select 1
+root[root] @ localhost [] >> select foobar
+root[root] @ localhost [] >> show status like 'audit_null%'
+root[root] @ localhost [] >> create procedure au1(x char(16)) select concat("test1", x)
+root[root] @ localhost [] mysql.proc : write
+root[root] @ localhost [] >> call au1("-12")
+root[root] @ localhost [] mysql.proc : read
+root[root] @ localhost [] >> select concat("test1", NAME_CONST('x',_latin1'-12' COLLATE 'latin1_swedish_ci'))
+root[root] @ localhost [] >> show status like 'audit_null%'
+root[root] @ localhost [] >> create table t1 (a int)
+root[root] @ localhost [] test.t1 : create
+root[root] @ localhost [] >> insert t1 values (1), (2)
+root[root] @ localhost [] test.t1 : write
+root[root] @ localhost [] >> select * from t1
+root[root] @ localhost [] test.t1 : read
+root[root] @ localhost [] >> rename table t1 to t2
+root[root] @ localhost [] test.t1 : rename to test.t2
+root[root] @ localhost [] >> alter table t2 add column b int
+root[root] @ localhost [] test.t2 : alter
+root[root] @ localhost [] test.t2 : read
+root[root] @ localhost [] >> create definer=testuser@localhost view v1 as select t2.a+1, t2_copy.a+2 from t2, t2 as t2_copy
+root[root] @ localhost [] test.t2 : read
+root[root] @ localhost [] test.t2 : read
+root[root] @ localhost [] >> select * from v1
+root[root] @ localhost [] test.t2 : read
+root[root] @ localhost [] test.t2 : read
+root[root] @ localhost [] >> drop view v1
+root[root] @ localhost [] >> create temporary table t2 (a date)
+root[root] @ localhost [] >> insert t2 values ('2020-10-09')
+root[root] @ localhost [] >> select * from t2
+root[root] @ localhost [] >> drop table t2
+root[root] @ localhost [] >> explain select distinct * from t2
+root[root] @ localhost [] test.t2 : read
+root[root] @ localhost [] >> select distinct * from t2
+root[root] @ localhost [] test.t2 : read
+root[root] @ localhost [] >> drop table t2
+root[root] @ localhost [] test.t2 : drop
+root[root] @ localhost [] >> uninstall plugin audit_null
+root[root] @ localhost [] mysql.plugin : write
diff --git a/mysql-test/suite/plugins/r/audit_null_debug.result b/mysql-test/suite/plugins/r/audit_null_debug.result
index 2b5fa291f24..86a22135852 100644
--- a/mysql-test/suite/plugins/r/audit_null_debug.result
+++ b/mysql-test/suite/plugins/r/audit_null_debug.result
@@ -1,4 +1,4 @@
-call mtr.add_suppression("mysql/plugin.MYI");
+call mtr.add_suppression("Incorrect key file for table.*mysql.plugin.MYI");
SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage';
install plugin audit_null soname 'adt_null';
ERROR HY000: Incorrect key file for table './mysql/plugin.MYI'; try to repair it
diff --git a/mysql-test/suite/plugins/r/auth_v0100.result b/mysql-test/suite/plugins/r/auth_v0100.result
new file mode 100644
index 00000000000..53affc94947
--- /dev/null
+++ b/mysql-test/suite/plugins/r/auth_v0100.result
@@ -0,0 +1,18 @@
+install soname 'auth_0x0100';
+select plugin_name, plugin_type_version from information_schema.plugins where plugin_type='authentication' order by plugin_name;
+plugin_name plugin_type_version
+auth_0x0100 1.0
+mysql_native_password 2.0
+mysql_old_password 2.0
+create user tt identified via auth_0x0100;
+grant select on test.* to zzzzzzzzzzzzzzzz;
+connect(localhost,tt,,test,MASTER_MYPORT,MASTER_MYSOCK);
+ERROR 28000: Access denied for user 'tt'@'localhost' (using password: YES)
+grant proxy on zzzzzzzzzzzzzzzz to tt;
+select user(), current_user(), @@external_user;
+user() tt@localhost
+current_user() zzzzzzzzzzzzzzzz@%
+@@external_user oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.
+drop user tt;
+drop user zzzzzzzzzzzzzzzz;
+uninstall plugin auth_0x0100;
diff --git a/mysql-test/suite/plugins/r/qc_info.result b/mysql-test/suite/plugins/r/qc_info.result
new file mode 100644
index 00000000000..3e967d55f43
--- /dev/null
+++ b/mysql-test/suite/plugins/r/qc_info.result
@@ -0,0 +1,15 @@
+set global query_cache_size=1355776;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
+statement_schema statement_text result_blocks_count result_blocks_size
+test select * from t1 1 512
+drop table t1;
+select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
+statement_schema statement_text result_blocks_count result_blocks_size
+set global query_cache_size= default;
diff --git a/mysql-test/suite/plugins/r/qc_info_priv.result b/mysql-test/suite/plugins/r/qc_info_priv.result
new file mode 100644
index 00000000000..c723eca1ec0
--- /dev/null
+++ b/mysql-test/suite/plugins/r/qc_info_priv.result
@@ -0,0 +1,23 @@
+set global query_cache_size=1355776;
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+a
+1
+2
+3
+select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
+statement_schema statement_text result_blocks_count result_blocks_size
+test select * from t1 1 512
+create user mysqltest;
+select a from t1;
+a
+1
+2
+3
+select count(*) from information_schema.query_cache_info;
+count(*)
+0
+drop user mysqltest;
+drop table t1;
+set global query_cache_size= default;
diff --git a/mysql-test/suite/plugins/t/audit_null.test b/mysql-test/suite/plugins/t/audit_null.test
index 428fd0c276e..60883bbe4f9 100644
--- a/mysql-test/suite/plugins/t/audit_null.test
+++ b/mysql-test/suite/plugins/t/audit_null.test
@@ -8,6 +8,8 @@ if (!$ADT_NULL_SO) {
set @old_global_general_log=@@global.general_log;
set global general_log=OFF;
+grant select on *.* to testuser@localhost;
+
--disable_ps_protocol
install plugin audit_null soname 'adt_null';
@@ -22,9 +24,36 @@ call au1("-12");
show status like 'audit_null%';
+create table t1 (a int);
+insert t1 values (1), (2);
+select * from t1;
+rename table t1 to t2;
+alter table t2 add column b int;
+
+create definer=testuser@localhost view v1 as select t2.a+1, t2_copy.a+2 from t2, t2 as t2_copy;
+select * from v1;
+drop view v1;
+
+# temp table generates no audit events
+create temporary table t2 (a date);
+insert t2 values ('2020-10-09');
+select * from t2;
+drop table t2;
+
+# internal temp table generates no audit events
+explain select distinct * from t2;
+select distinct * from t2;
+
+drop table t2;
+
uninstall plugin audit_null;
--enable_ps_protocol
drop procedure au1;
+drop user testuser@localhost;
set global general_log=@old_global_general_log;
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ /#sql2-[-0-9a-f_]*/#sql2-temporary/ /::1// /127.0.0.1//
+cat_file $MYSQLD_DATADIR/audit_null_tables.log;
+
diff --git a/mysql-test/suite/plugins/t/audit_null_debug.test b/mysql-test/suite/plugins/t/audit_null_debug.test
index d9e6cad5524..bd0495843db 100644
--- a/mysql-test/suite/plugins/t/audit_null_debug.test
+++ b/mysql-test/suite/plugins/t/audit_null_debug.test
@@ -5,19 +5,21 @@ if (!$ADT_NULL_SO) {
skip No NULL_AUDIT plugin;
}
-call mtr.add_suppression("mysql/plugin.MYI");
+call mtr.add_suppression("Incorrect key file for table.*mysql.plugin.MYI");
#
# MySQL BUG#14485479 - INSTALL AUDIT PLUGIN HANGS IF WE TRY TO DISABLE AND ENABLED DURING DDL OPERATION
# (a.k.a. audit event caused by the table access during audit plugin initialization)
#
SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage';
+--replace_result \\ /
--error 126
install plugin audit_null soname 'adt_null';
SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage';
install plugin audit_null soname 'adt_null';
SET debug_dbug='+d,myisam_pretend_crashed_table_on_usage';
+--replace_result \\ /
--error 126
uninstall plugin audit_null;
SET debug_dbug='-d,myisam_pretend_crashed_table_on_usage';
diff --git a/mysql-test/suite/plugins/t/auth_v0100.test b/mysql-test/suite/plugins/t/auth_v0100.test
new file mode 100644
index 00000000000..3cf93ba67f2
--- /dev/null
+++ b/mysql-test/suite/plugins/t/auth_v0100.test
@@ -0,0 +1,26 @@
+--source include/not_embedded.inc
+
+if (!$AUTH_0X0100_SO) {
+ skip No auth_0x0100 plugin;
+}
+
+install soname 'auth_0x0100';
+
+select plugin_name, plugin_type_version from information_schema.plugins where plugin_type='authentication' order by plugin_name;
+
+create user tt identified via auth_0x0100;
+grant select on test.* to zzzzzzzzzzzzzzzz;
+
+--replace_result $MASTER_MYSOCK MASTER_MYSOCK $MASTER_MYPORT MASTER_MYPORT
+--error ER_ACCESS_DENIED_ERROR
+connect (c0,localhost,tt);
+
+grant proxy on zzzzzzzzzzzzzzzz to tt;
+connect (c1,localhost,tt);
+connection c1;
+
+--query_vertical select user(), current_user(), @@external_user
+connection default;
+drop user tt;
+drop user zzzzzzzzzzzzzzzz;
+uninstall plugin auth_0x0100;
diff --git a/mysql-test/suite/plugins/t/qc_info.test b/mysql-test/suite/plugins/t/qc_info.test
new file mode 100644
index 00000000000..fc6c9d5af3a
--- /dev/null
+++ b/mysql-test/suite/plugins/t/qc_info.test
@@ -0,0 +1,8 @@
+--source qc_info_init.inc
+
+drop table t1;
+# the query was invalidated
+select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
+
+set global query_cache_size= default;
+
diff --git a/mysql-test/suite/plugins/t/qc_info_init.inc b/mysql-test/suite/plugins/t/qc_info_init.inc
new file mode 100644
index 00000000000..9422bd7f141
--- /dev/null
+++ b/mysql-test/suite/plugins/t/qc_info_init.inc
@@ -0,0 +1,12 @@
+if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'query_cache_info' and plugin_status='active'`)
+{
+ --skip QUERY_CACHE_INFO plugin is not active
+}
+
+set global query_cache_size=1355776;
+
+create table t1 (a int not null);
+insert into t1 values (1),(2),(3);
+select * from t1;
+select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
+
diff --git a/mysql-test/suite/plugins/t/qc_info_init.opt b/mysql-test/suite/plugins/t/qc_info_init.opt
new file mode 100644
index 00000000000..663de4da7d7
--- /dev/null
+++ b/mysql-test/suite/plugins/t/qc_info_init.opt
@@ -0,0 +1,2 @@
+--loose-query_cache_info
+--plugin-load=$QUERY_CACHE_INFO_SO
diff --git a/mysql-test/suite/plugins/t/qc_info_priv.test b/mysql-test/suite/plugins/t/qc_info_priv.test
new file mode 100644
index 00000000000..31c394107c1
--- /dev/null
+++ b/mysql-test/suite/plugins/t/qc_info_priv.test
@@ -0,0 +1,15 @@
+--source include/not_embedded.inc
+--source qc_info_init.inc
+
+# try an unprivileged user
+create user mysqltest;
+connect (conn1,localhost,mysqltest,,);
+connection conn1;
+select a from t1;
+select count(*) from information_schema.query_cache_info;
+connection default;
+drop user mysqltest;
+drop table t1;
+
+set global query_cache_size= default;
+
diff --git a/mysql-test/suite/plugins/t/unix_socket.test b/mysql-test/suite/plugins/t/unix_socket.test
index fc2e6c5b3c6..72106fab46d 100644
--- a/mysql-test/suite/plugins/t/unix_socket.test
+++ b/mysql-test/suite/plugins/t/unix_socket.test
@@ -1,4 +1,7 @@
--source include/not_embedded.inc
+# If we run this as root, $USER gets authenticated as the `root' user, and we
+# get .result differences from CURRENT_USER().
+--source include/not_as_root.inc
if (!$AUTH_SOCKET_SO) {
skip No auth_socket plugin;
diff --git a/mysql-test/suite/rpl/disabled.def b/mysql-test/suite/rpl/disabled.def
index 9eb5f57c7be..f9af9c30f5c 100644
--- a/mysql-test/suite/rpl/disabled.def
+++ b/mysql-test/suite/rpl/disabled.def
@@ -13,4 +13,3 @@
rpl_row_create_table : Bug#11759274 2010-02-27 andrei failed different way than earlier with bug#45576
rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock
-rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
diff --git a/mysql-test/suite/rpl/r/rpl_charset_sjis.result b/mysql-test/suite/rpl/r/rpl_charset_sjis.result
index b31bad28a59..ff6296987f8 100644
--- a/mysql-test/suite/rpl/r/rpl_charset_sjis.result
+++ b/mysql-test/suite/rpl/r/rpl_charset_sjis.result
@@ -20,4 +20,36 @@ hex(a)
965C
drop table t1;
drop procedure p1;
+#
+# Start of 5.5 tests
+#
+#
+# Bug#MDEV-4489 Replication of big5, cp932, gbk, sjis strings makes wrong values on slave
+#
+--- on master ---
+SET NAMES sjis;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0x31),(X'31'),('1');
+PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (?)';
+SET @a='1';
+EXECUTE stmt USING @a;
+DROP PREPARE stmt;
+SELECT * FROM t1;
+a
+49
+1
+1
+1
+--- on slave ---
+SELECT * FROM t1;
+a
+49
+1
+1
+1
+--- on master ---
+DROP TABLE t1;
+#
+# End of 5.5 tests
+#
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
index f9c5b48e227..af2d4de0489 100644
--- a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
+++ b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
@@ -1,6 +1,18 @@
*** Set up circular replication on four servers ***
include/rpl_init.inc [topology=1->2->3->4->1]
+[connection server_4]
+SET auto_increment_increment= 4;
+SET auto_increment_offset= 4;
+[connection server_3]
+SET auto_increment_increment= 4;
+SET auto_increment_offset= 3;
+[connection server_2]
+SET auto_increment_increment= 4;
+SET auto_increment_offset= 2;
+[connection server_1]
+SET auto_increment_increment= 4;
+SET auto_increment_offset= 1;
*** Preparing data ***
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM;
CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB;
diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result
index f904561b722..e2b7d084a3f 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev382.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev382.result
@@ -245,7 +245,7 @@ master-bin.000001 # User var # # @`a``3`=9223372036854775807
master-bin.000001 # User var # # @`a``4`=18446744073709551615
master-bin.000001 # User var # # @`b```=-1.234560123456789e125
master-bin.000001 # User var # # @```c`=-1234501234567890123456789012345678901234567890123456789.0123456789
-master-bin.000001 # User var # # @```d```=_latin1 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878 COLLATE latin1_swedish_ci
+master-bin.000001 # User var # # @```d```=_latin1 X'78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878' COLLATE latin1_swedish_ci
master-bin.000001 # Query # # use `db1``; select 'oops!'`; INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98))
master-bin.000001 # Query # # COMMIT
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
@@ -283,7 +283,7 @@ SET @`a``3`:=9223372036854775807/*!*/;
SET @`a``4`:=18446744073709551615/*!*/;
SET @`b```:=-1.2345601234568e+125/*!*/;
SET @```c`:=-1234501234567890123456789012345678901234567890123456789.0123456789/*!*/;
-SET @```d```:=_latin1 0x78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878 COLLATE `latin1_swedish_ci`/*!*/;
+SET @```d```:=_latin1 X'78787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878787878' COLLATE `latin1_swedish_ci`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98))
/*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_password_boundaries.result b/mysql-test/suite/rpl/r/rpl_password_boundaries.result
index 71f32f492a2..a0ccc0ce33c 100644
--- a/mysql-test/suite/rpl/r/rpl_password_boundaries.result
+++ b/mysql-test/suite/rpl/r/rpl_password_boundaries.result
@@ -24,10 +24,10 @@ set sql_log_bin=1;
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_user='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
+ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long for MASTER_USER (should be no longer than 128)
change master to master_host='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
-ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbb' is too long for MASTER_HOST (should be no longer than 180)
+ERROR HY000: String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbb' is too long for MASTER_HOST (should be no longer than 60)
[ on master ]
set sql_log_bin=0;
grant replication slave on *.* to rpl16cyr@127.0.0.1 identified by 'воттакойужпарольвоттакойужпарольвоттакойужпароль';
diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result
index 5629f5c8cdd..a09d44227a3 100644
--- a/mysql-test/suite/rpl/r/rpl_row_until.result
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result
@@ -27,13 +27,6 @@ n
3
4
include/check_slave_param.inc [Exec_Master_Log_Pos]
-START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2
-include/wait_for_slave_sql_to_stop.inc
-SELECT * FROM t2;
-n
-1
-2
-include/check_slave_param.inc [Exec_Master_Log_Pos]
START SLAVE;
include/wait_for_slave_to_start.inc
include/stop_slave.inc
@@ -51,10 +44,19 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER_LOG_POS;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-START SLAVE;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
-Warnings:
-Note 1254 Slave is already running
include/stop_slave.inc
RESET SLAVE;
+include/start_slave.inc
+include/rpl_reset.inc
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+include/stop_slave_sql.inc
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+include/sync_slave_io_with_master.inc
+include/wait_for_slave_sql_to_stop.inc
+include/assert.inc [table t1 should have two rows.]
+include/start_slave.inc
+DROP TABLE t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_sp_effects.result b/mysql-test/suite/rpl/r/rpl_sp_effects.result
index a6e3ae03963..413ff41879d 100644
--- a/mysql-test/suite/rpl/r/rpl_sp_effects.result
+++ b/mysql-test/suite/rpl/r/rpl_sp_effects.result
@@ -273,5 +273,21 @@ drop table t2;
drop procedure sp_bug26199;
drop function sf_bug26199;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
+set names utf8;
+CREATE FUNCTION f() RETURNS timestamp DETERMINISTIC
+BEGIN RETURN '2012-12-21 12:12:12'; END |
+CREATE PROCEDURE p(t timestamp)
+BEGIN
+SET @t = t;
+PREPARE stmt FROM "
+ UPDATE t1 SET a = @t WHERE '2012-12-31 08:00:00' < f() ";
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+END |
+create table t1 (a timestamp);
+call p('2012-12-31 08:00:00');
+drop table t1;
+drop procedure p;
+drop function f;
end of the tests
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result
index 9047825d565..7557f37b283 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_until.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result
@@ -1,6 +1,7 @@
include/master-slave.inc
[connection master]
include/rpl_reset.inc
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
[on slave]
include/stop_slave.inc
==== Create some events on master ====
@@ -94,18 +95,4 @@ one
1
drop table t1;
start slave;
-include/rpl_reset.inc
-flush logs;
-drop table if exists t1;
-stop slave;
-flush logs;
-flush logs;
-reset slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS; /* to stop right before DROP */;
-include/wait_for_slave_sql_to_stop.inc
-show tables /* t1 must exist */;
-Tables_in_test
-t1
-drop table t1;
-stop slave;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test
index 86ee64b5e73..a97801f9ab0 100644
--- a/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test
+++ b/mysql-test/suite/rpl/t/rpl_cant_read_event_incident.test
@@ -67,7 +67,9 @@ stop slave;
reset slave;
# Table was created from binlog, it may not be created if SQL thread is running
# slowly and IO thread reaches incident before SQL thread applies it.
+--disable_warnings
drop table if exists t;
+--enable_warnings
reset master;
--echo End of the tests
diff --git a/mysql-test/suite/rpl/t/rpl_charset_sjis.test b/mysql-test/suite/rpl/t/rpl_charset_sjis.test
index a3a3de8c1d0..7d3d21cf9a0 100644
--- a/mysql-test/suite/rpl/t/rpl_charset_sjis.test
+++ b/mysql-test/suite/rpl/t/rpl_charset_sjis.test
@@ -23,4 +23,37 @@ sync_slave_with_master;
connection master;
# End of 5.0 tests
+
+--echo #
+--echo # Start of 5.5 tests
+--echo #
+
+--echo #
+--echo # Bug#MDEV-4489 Replication of big5, cp932, gbk, sjis strings makes wrong values on slave
+--echo #
+
+connection master;
+--echo --- on master ---
+SET NAMES sjis;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0x31),(X'31'),('1');
+PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (?)';
+SET @a='1';
+EXECUTE stmt USING @a;
+DROP PREPARE stmt;
+SELECT * FROM t1;
+sync_slave_with_master;
+connection slave;
+--echo --- on slave ---
+SELECT * FROM t1;
+connection master;
+--echo --- on master ---
+DROP TABLE t1;
+sync_slave_with_master;
+connection master;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
index 7d4b538c8a6..ec64c94b9c0 100644
--- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
+++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
@@ -23,6 +23,18 @@ let $keep_connection= 1;
--source include/rpl_init.inc
--echo
+#set auto inc variables at each server
+--let $_rpl_server= $rpl_server_count
+while ($_rpl_server)
+{
+ --let $rpl_connection_name= server_$_rpl_server
+ --source include/rpl_connection.inc
+ eval SET auto_increment_increment= $rpl_server_count;
+ eval SET auto_increment_offset= $_rpl_server;
+
+ --dec $_rpl_server
+}
+
# Preparing data.
--echo *** Preparing data ***
--connection server_1
diff --git a/mysql-test/suite/rpl/t/rpl_password_boundaries.test b/mysql-test/suite/rpl/t/rpl_password_boundaries.test
index cf8abfbda11..d812ab5efc8 100644
--- a/mysql-test/suite/rpl/t/rpl_password_boundaries.test
+++ b/mysql-test/suite/rpl/t/rpl_password_boundaries.test
@@ -53,7 +53,7 @@ change master to master_user='rpl33',master_password='0123456789abcdef0123456789
# Check also master_user and master_host
--error ER_WRONG_STRING_LENGTH
-change master to master_user='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
+change master to master_user='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
--error ER_WRONG_STRING_LENGTH
change master to master_host='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test
index b861bb8c8ec..6b8f6183cc7 100644
--- a/mysql-test/suite/rpl/t/rpl_row_until.test
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -2,7 +2,13 @@
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
-# Note: The test is dependent on binlog positions
+##############################################################################
+# The test is dependent on binlog positions. The test is divided into two
+# sections. The first section checks START SLAVE UNTIL MASTER_LOG_FILE =
+# 'log_name', MASTER_LOG_POS = log_pos followed by a couple of failure
+# scenarios. The second section checks START SLAVE UNTIL RELAY_LOG_FILE =
+# 'log_name', RELAY_LOG_POS = log_pos.
+##############################################################################
# Create some events on master
connection master;
@@ -24,13 +30,6 @@ CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
INSERT INTO t2 VALUES (1),(2);
# Save master log position for query INSERT INTO t2 VALUES (1),(2);
let $master_pos_insert1_t2= query_get_value(SHOW MASTER STATUS, Position, 1);
-sync_slave_with_master;
-#show binlog events;
-
-# Save relay log position for query INSERT INTO t2 VALUES (1),(2);
-let $relay_pos_insert1_t2= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
-
-connection master;
INSERT INTO t2 VALUES (3),(4);
DROP TABLE t2;
# Save master log position for query DROP TABLE t2;
@@ -71,18 +70,6 @@ SELECT * FROM t1;
--let $slave_param_value= $master_pos_drop_t1
--source include/check_slave_param.inc
-# Try replicate all up to and not including the second insert to t2;
-echo START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2;
---disable_query_log
-eval START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=$relay_pos_insert1_t2;
---enable_query_log
---source include/wait_for_slave_sql_to_stop.inc
-SELECT * FROM t2;
-
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_pos_insert1_t2
---source include/check_slave_param.inc
-
# clean up
START SLAVE;
--source include/wait_for_slave_to_start.inc
@@ -118,14 +105,54 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009';
--replace_result 561 MASTER_LOG_POS
--error 1277
START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
-# Warning should be given for second command
-START SLAVE;
--replace_result 740 MASTER_LOG_POS
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
--source include/stop_slave.inc
-# Clear slave IO error.
RESET SLAVE;
+--source include/start_slave.inc
---let $rpl_only_running_threads= 1
+##############################################################################
+# The second section - checks START SLAVE UNTIL RELAY_LOG_FILE =# 'log_name',
+# RELAY_LOG_POS = log_pos. This section of the test does the following:
+# 1) At master, create a table and inserts a value. Let slave replicate this.
+# 2) Stop slave sql thread.
+# 3) Insert some more values at master. Note that io thread copies this insert
+# 4) Use start slave until to start the sql thread and check if it
+# stops at the correct position.
+##############################################################################
+
+--source include/rpl_reset.inc
+
+--connection master
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+
+--sync_slave_with_master
+--source include/stop_slave_sql.inc
+
+--connection master
+INSERT INTO t1 VALUES (2);
+--let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
+INSERT INTO t1 VALUES (3);
+
+--source include/sync_slave_io_with_master.inc
+
+--let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File,1)
+--source include/get_relay_log_pos.inc
+
+--disable_query_log
+--eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos
+--enable_query_log
+--source include/wait_for_slave_sql_to_stop.inc
+
+--let $assert_cond= COUNT(*) = 2 FROM t1
+--let $assert_text= table t1 should have two rows.
+--source include/assert.inc
+
+#cleanup
+--source include/start_slave.inc
+--connection master
+DROP TABLE t1;
+--sync_slave_with_master
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_sp_effects.test b/mysql-test/suite/rpl/t/rpl_sp_effects.test
index df13ff253b1..82d61d94bd4 100644
--- a/mysql-test/suite/rpl/t/rpl_sp_effects.test
+++ b/mysql-test/suite/rpl/t/rpl_sp_effects.test
@@ -260,5 +260,27 @@ SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creato
sync_slave_with_master;
+#
+# Bug#16056537: MYSQLD CRASHES IN ITEM_FUNC_GET_USER_VAR::FIX_LENGTH_AND_DEC()
+#
+set names utf8;
+--delimiter |
+CREATE FUNCTION f() RETURNS timestamp DETERMINISTIC
+BEGIN RETURN '2012-12-21 12:12:12'; END |
+CREATE PROCEDURE p(t timestamp)
+BEGIN
+ SET @t = t;
+ PREPARE stmt FROM "
+ UPDATE t1 SET a = @t WHERE '2012-12-31 08:00:00' < f() ";
+ EXECUTE stmt;
+ DEALLOCATE PREPARE stmt;
+END |
+--delimiter ;
+create table t1 (a timestamp);
+call p('2012-12-31 08:00:00');
+drop table t1;
+drop procedure p;
+drop function f;
+
--echo end of the tests
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
index 210b6b50fa8..e9216ed602a 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_until.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -23,6 +23,8 @@
# Test is dependent on binlog positions
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+
# prepare version for substitutions
let $VERSION=`select version()`;
@@ -187,47 +189,6 @@ connection slave;
start slave;
sync_with_master;
- # Bug #47142 "slave start until" stops 1 event too late in 4.1 to 5.0 replication
-#
-# testing fixes that refine the start position of prior-5.0 master's event
-# and by that provide correct execution of
-# START SLAVE UNTIL ... master_log_pos= x;
-# Keep the test at the end of the file because it manipulates with binlog files
-# to substitute the genuine one with a prepared on 4.1 server.
-#
-
---source include/rpl_reset.inc
-
-connection master;
---disable_warnings
-drop table if exists t1; # there is create table t1 in bug47142_master-bin.000001
---enable_warnings
-sync_slave_with_master;
-connection slave;
-stop slave;
-connection master;
-
-flush logs;
-let $MYSQLD_DATADIR= `select @@datadir`;
---remove_file $MYSQLD_DATADIR/master-bin.000001
---copy_file $MYSQL_TEST_DIR/std_data/bug47142_master-bin.000001 $MYSQLD_DATADIR/master-bin.000001
-# this a constant bound to the bug47142_master-bin.000001 binlog file
---let $binlog_before_drop=294;
-
-connection slave;
-stop slave;
-reset slave;
---replace_regex /master_log_pos=[0-9]+/master_log_pos=MASTER_LOG_POS/
-eval start slave until master_log_file='master-bin.000001', master_log_pos=$binlog_before_drop /* to stop right before DROP */;
---source include/wait_for_slave_sql_to_stop.inc
-
-show tables /* t1 must exist */;
-
-# clean-up of Bug #47142 testing
-
-drop table t1; # drop on slave only, master does not have t1.
-stop slave;
-
# End of tests
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_evict_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_evict_basic.result
new file mode 100644
index 00000000000..459ad95bdc6
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_evict_basic.result
@@ -0,0 +1,7 @@
+SELECT @@global.innodb_buffer_pool_evict;
+@@global.innodb_buffer_pool_evict
+
+SET GLOBAL innodb_buffer_pool_evict = 'uncompressed';
+SELECT @@global.innodb_buffer_pool_evict;
+@@global.innodb_buffer_pool_evict
+
diff --git a/mysql-test/suite/sys_vars/r/innodb_use_atomic_writes_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_atomic_writes_basic.result
new file mode 100644
index 00000000000..fa6379fbe1c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_use_atomic_writes_basic.result
@@ -0,0 +1,21 @@
+select @@global.innodb_use_atomic_writes;
+@@global.innodb_use_atomic_writes
+0
+select @@session.innodb_use_atomic_writes;
+ERROR HY000: Variable 'innodb_use_atomic_writes' is a GLOBAL variable
+show global variables like 'innodb_use_atomic_writes';
+Variable_name Value
+innodb_use_atomic_writes OFF
+show session variables like 'innodb_use_atomic_writes';
+Variable_name Value
+innodb_use_atomic_writes OFF
+select * from information_schema.global_variables where variable_name='innodb_use_atomic_writes';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_USE_ATOMIC_WRITES OFF
+select * from information_schema.session_variables where variable_name='innodb_use_atomic_writes';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_USE_ATOMIC_WRITES OFF
+set global innodb_use_atomic_writes=1;
+ERROR HY000: Variable 'innodb_use_atomic_writes' is a read only variable
+set session innodb_use_atomic_writes=1;
+ERROR HY000: Variable 'innodb_use_atomic_writes' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result b/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result
new file mode 100644
index 00000000000..57b4b9eb94c
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/innodb_use_fallocate_basic.result
@@ -0,0 +1,21 @@
+select @@global.innodb_use_fallocate;
+@@global.innodb_use_fallocate
+0
+select @@session.innodb_use_fallocate;
+ERROR HY000: Variable 'innodb_use_fallocate' is a GLOBAL variable
+show global variables like 'innodb_use_fallocate';
+Variable_name Value
+innodb_use_fallocate OFF
+show session variables like 'innodb_use_fallocate';
+Variable_name Value
+innodb_use_fallocate OFF
+select * from information_schema.global_variables where variable_name='innodb_use_fallocate';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_USE_FALLOCATE OFF
+select * from information_schema.session_variables where variable_name='innodb_use_fallocate';
+VARIABLE_NAME VARIABLE_VALUE
+INNODB_USE_FALLOCATE OFF
+set global innodb_use_fallocate=1;
+ERROR HY000: Variable 'innodb_use_fallocate' is a read only variable
+set session innodb_use_fallocate=1;
+ERROR HY000: Variable 'innodb_use_fallocate' is a read only variable
diff --git a/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result
index 9f630e8bb00..bb7492ee7ef 100644
--- a/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic.result
@@ -1,7 +1,7 @@
SET @start_value = @@global.max_binlog_cache_size;
SELECT @start_value;
@start_value
-4294963200
+18446744073709547520
'#--------------------FN_DYNVARS_072_01------------------------#'
SET @@global.max_binlog_cache_size = 5000;
Warnings:
@@ -9,7 +9,7 @@ Warning 1292 Truncated incorrect max_binlog_cache_size value: '5000'
SET @@global.max_binlog_cache_size = DEFAULT;
SELECT @@global.max_binlog_cache_size;
@@global.max_binlog_cache_size
-4294963200
+18446744073709547520
'#---------------------FN_DYNVARS_072_02-------------------------#'
SET @@global.max_binlog_cache_size = @start_value;
SELECT @@global.max_binlog_cache_size = 4294967295;
@@ -149,4 +149,4 @@ ERROR 42S22: Unknown column 'max_binlog_cache_size' in 'field list'
SET @@global.max_binlog_cache_size = @start_value;
SELECT @@global.max_binlog_cache_size;
@@global.max_binlog_cache_size
-4294963200
+18446744073709547520
diff --git a/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result b/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result
index 14407672aa3..0b2db8eef69 100644
--- a/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result
@@ -1,7 +1,7 @@
SET @start_value = @@global.max_binlog_stmt_cache_size;
SELECT @start_value;
@start_value
-4294963200
+18446744073709547520
'#--------------------FN_DYNVARS_072_01------------------------#'
SET @@global.max_binlog_stmt_cache_size = 5000;
Warnings:
@@ -9,7 +9,7 @@ Warning 1292 Truncated incorrect max_binlog_stmt_cache_size value: '5000'
SET @@global.max_binlog_stmt_cache_size = DEFAULT;
SELECT @@global.max_binlog_stmt_cache_size;
@@global.max_binlog_stmt_cache_size
-4294963200
+18446744073709547520
'#---------------------FN_DYNVARS_072_02-------------------------#'
SET @@global.max_binlog_stmt_cache_size = @start_value;
SELECT @@global.max_binlog_stmt_cache_size = 4294967295;
@@ -149,4 +149,4 @@ ERROR 42S22: Unknown column 'max_binlog_stmt_cache_size' in 'field list'
SET @@global.max_binlog_stmt_cache_size = @start_value;
SELECT @@global.max_binlog_stmt_cache_size;
@@global.max_binlog_stmt_cache_size
-4294963200
+18446744073709547520
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
new file mode 100644
index 00000000000..ce42f64395f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_evict_basic.test
@@ -0,0 +1,15 @@
+-- source include/have_innodb.inc
+# This is a debug variable for now
+-- source include/have_debug.inc
+
+if (`select plugin_auth_version <= "5.5.31-MariaDB-30.2" from information_schema.plugins where plugin_name='innodb'`)
+{
+ --skip Not fixed in XtraDB 5.5.31-MariaDB-30.2 or earlier
+}
+
+SELECT @@global.innodb_buffer_pool_evict;
+
+SET GLOBAL innodb_buffer_pool_evict = 'uncompressed';
+
+# Should always be empty.
+SELECT @@global.innodb_buffer_pool_evict;
diff --git a/mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test
new file mode 100644
index 00000000000..e14f618ee6b
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_use_atomic_writes_basic.test
@@ -0,0 +1,22 @@
+--source include/have_innodb.inc
+# bool readonly
+
+#
+# show values;
+#
+select @@global.innodb_use_atomic_writes;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_use_atomic_writes;
+show global variables like 'innodb_use_atomic_writes';
+show session variables like 'innodb_use_atomic_writes';
+select * from information_schema.global_variables where variable_name='innodb_use_atomic_writes';
+select * from information_schema.session_variables where variable_name='innodb_use_atomic_writes';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_use_atomic_writes=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_use_atomic_writes=1;
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test b/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test
new file mode 100644
index 00000000000..655893be98e
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/innodb_use_fallocate_basic.test
@@ -0,0 +1,22 @@
+--source include/have_innodb.inc
+# bool readonly
+
+#
+# show values;
+#
+select @@global.innodb_use_fallocate;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_use_fallocate;
+show global variables like 'innodb_use_fallocate';
+show session variables like 'innodb_use_fallocate';
+select * from information_schema.global_variables where variable_name='innodb_use_fallocate';
+select * from information_schema.session_variables where variable_name='innodb_use_fallocate';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_use_fallocate=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set session innodb_use_fallocate=1;
+
diff --git a/mysql-test/t/cache_temporal_4265.test b/mysql-test/t/cache_temporal_4265.test
new file mode 100644
index 00000000000..6135438f023
--- /dev/null
+++ b/mysql-test/t/cache_temporal_4265.test
@@ -0,0 +1,11 @@
+#
+# MDEV-4265 5.5 is slower than 5.3 because of many str_to_datetime calls
+#
+--source include/have_debug.inc
+
+create table t1 (a date);
+insert t1 values ('2000-01-02'), ('2001-02-03'), ('2002-03-04');
+set debug_dbug='d,str_to_datetime_warn';
+select * from t1 where a > date_add('2000-01-01', interval 5 day);
+drop table t1;
+
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index c39b7267f83..64e8225530b 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -412,6 +412,19 @@ WHERE CAST(a as BINARY)=x'62736D697468'
DROP TABLE t1;
+--echo #
+--echo # Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH
+--echo # LONGTEXT, UNION, USER VARIABLE
+--echo # Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
+--echo #
+
+CREATE TABLE t1 AS SELECT CONCAT(CAST(REPEAT('9', 1000) AS SIGNED)),
+ CONCAT(CAST(REPEAT('9', 1000) AS UNSIGNED));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo # End of test for Bug#13581962, Bug#14096619
+
--echo End of 5.1 tests
select cast("2101-00-01 02:03:04" as datetime);
diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test
index 6140178c0f4..e7b6fe1a014 100644
--- a/mysql-test/t/ctype_cp932_binlog_stm.test
+++ b/mysql-test/t/ctype_cp932_binlog_stm.test
@@ -141,6 +141,23 @@ SELECT HEX(a), HEX(CONVERT(a using cp932)) as b FROM t1 HAVING b<>'3F' ORDER BY
DROP TABLE t1;
+--echo #
+--echo # Bug#MDEV-4489 Replication of big5, cp932, gbk, sjis strings makes wrong values on slave
+--echo #
+let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
+SET NAMES cp932;
+CREATE TABLE t1 (a INT);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (0x31);
+INSERT INTO t1 VALUES (X'31');
+PREPARE stmt FROM 'INSERT INTO t1 (a) VALUES (?)';
+SET @a='1';
+SELECT charset(@a);
+EXECUTE stmt USING @a;
+DROP PREPARE stmt;
+DROP TABLE t1;
+--source include/show_binlog_events.inc
+
--echo #
--echo # End of 5.5 tests
diff --git a/mysql-test/t/ctype_ucs2_query_cache-master.opt b/mysql-test/t/ctype_ucs2_query_cache-master.opt
new file mode 100644
index 00000000000..413ebb9f898
--- /dev/null
+++ b/mysql-test/t/ctype_ucs2_query_cache-master.opt
@@ -0,0 +1 @@
+--collation-server=ucs2_unicode_ci --character-set-server=ucs2,latin1 --query-cache-size=1048576
diff --git a/mysql-test/t/ctype_ucs2_query_cache.test b/mysql-test/t/ctype_ucs2_query_cache.test
new file mode 100644
index 00000000000..bdc1d079d5e
--- /dev/null
+++ b/mysql-test/t/ctype_ucs2_query_cache.test
@@ -0,0 +1,19 @@
+-- source include/have_query_cache.inc
+-- source include/have_ucs2.inc
+
+--echo #
+--echo # Start of 5.5 tests
+--echo #
+
+--echo #
+--echo # Bug#MDEV-4518 Server crashes in is_white_space when it's run
+--echo # with query cache, charset ucs2 and collation ucs2_unicode_ci
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
diff --git a/mysql-test/t/ctype_utf8mb4.test b/mysql-test/t/ctype_utf8mb4.test
index 03696f385b5..fda20ca0ec5 100644
--- a/mysql-test/t/ctype_utf8mb4.test
+++ b/mysql-test/t/ctype_utf8mb4.test
@@ -1812,6 +1812,21 @@ SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
--echo #
+--echo # Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH
+--echo # LONGTEXT, UNION, USER VARIABLE
+--echo # Bug#14096619 UNABLE TO RESTORE DATABASE DUMP
+--echo #
+
+CREATE TABLE t1(f1 LONGTEXT CHARACTER SET utf8mb4);
+INSERT INTO t1 VALUES ('a');
+SELECT @a:= CAST(f1 AS SIGNED) FROM t1
+UNION ALL
+SELECT CAST(f1 AS SIGNED) FROM t1;
+DROP TABLE t1;
+
+--echo # End of test for Bug#13581962,Bug#14096619
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/t/dyncol.test b/mysql-test/t/dyncol.test
index 66e308540f4..ca95dea0779 100644
--- a/mysql-test/t/dyncol.test
+++ b/mysql-test/t/dyncol.test
@@ -550,3 +550,60 @@ select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL(19,0))));
select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal)));
select hex(COLUMN_CREATE(0, 0.0 as decimal));
+
+--echo #
+--echo # MDEV-4292: parse error when selecting on views using dynamic column
+--echo #
+create table t1 (i int, d blob);
+
+create view v1 as select i, column_get(d, 1 as binary) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as int) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as unsigned int) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as date) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as time) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as datetime) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as decimal) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as double) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+create view v1 as select i, column_get(d, 1 as char) as a from t1;
+select * from v1;
+show create view v1;
+drop view v1;
+
+drop table t1;
+
+--echo #
+--echo # end of 5.3 tests
+--echo #
+
diff --git a/mysql-test/t/empty_user_table.test b/mysql-test/t/empty_user_table.test
new file mode 100644
index 00000000000..b54f2109e30
--- /dev/null
+++ b/mysql-test/t/empty_user_table.test
@@ -0,0 +1,20 @@
+#
+# MDEV-4462 mysqld gets SIGFPE when mysql.user table is empty
+#
+
+source include/not_embedded.inc;
+
+create table t1 as select * from mysql.user;
+truncate table mysql.user;
+flush privileges;
+
+# connecting via unix socket gives ER_ACCESS_DENIED_ERROR
+# connecting via tcp/ip gives ER_HOST_NOT_PRIVILEGED
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR,ER_HOST_NOT_PRIVILEGED
+connect (fail,localhost,u1);
+
+insert mysql.user select * from t1;
+drop table t1;
+flush privileges;
+
diff --git a/mysql-test/t/fulltext_derived_4316.test b/mysql-test/t/fulltext_derived_4316.test
new file mode 100644
index 00000000000..ecf4a0e7722
--- /dev/null
+++ b/mysql-test/t/fulltext_derived_4316.test
@@ -0,0 +1,14 @@
+#
+# MATCH on the derived tables
+#
+
+#
+# MDEV-4316 MariaDB server crash with signal 11
+#
+
+create table t1 (ft text) engine=myisam;
+insert into t1 values ('test1'),('test2');
+select distinct match(ft) against("test1" in boolean mode) from
+ (select distinct ft from t1) as t;
+drop table t1;
+
diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test
index fc5a5cb2823..5f27978347c 100644
--- a/mysql-test/t/func_date_add.test
+++ b/mysql-test/t/func_date_add.test
@@ -88,3 +88,15 @@ select b + interval a day from t1;
drop table t1;
--echo End of 5.0 tests
+
+#
+# MDEV-4284 Assertion `cmp_items[(uint)cmp_type]' fails in sql/item_cmpfunc.cc
+#
+
+create table t1 (a varchar(10));
+insert t1 values ('2000-12-03'),('2008-05-03');
+select * from t1 where case a when adddate( '2012-12-12', 7 ) then true end;
+drop table t1;
+
+--echo End of 5.5 tests
+
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 89c6c0fe534..a5c35c0dff2 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1372,7 +1372,39 @@ set @@optimizer_switch=@save_optimizer_switch;
--echo #
DROP TABLE IF EXISTS t1,t2,t3,empty1;
-###
+#
+# MDEV-4286 Server crashes in Protocol_text::store, stack smashing detected
+#
+create table t1 (i int, d date);
+insert into t1 values (1, '2008-10-02'), (2, '2010-12-12');
+select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d order by i;
+drop table t1;
+
+--echo #
+--echo # MDEV-4290: crash in st_select_lex::mark_as_dependent
+--echo #
+create table `t1`(`a` int);
+
+--error ER_INVALID_GROUP_FUNC_USE
+select 1 from t1 v1 right join t1 on count(*);
+--error ER_INVALID_GROUP_FUNC_USE
+select 1 from t1 order by
+(
+ select 1 from
+ (
+ select 1 from t1 v1 right join t1 on count(*)
+ ) v
+);
+insert into t1 values (1),(1),(2),(2);
+select count(*) from t1;
+select z from (select count(*) as z from t1) v;
+--echo # next is how it implemented now (may be changed in case of dependent
+--echo # derived tables)
+select z from (select count(*) as z from t1) v group by 1;
+drop table t1;
+
+--echo # end of 5.3 tests
+
--echo #
--echo # Bug#52123 Assertion failed: aggregator == aggr->Aggrtype(),
--echo # file .\item_sum.cc, line 587
diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test
index 6706792d162..06405808d79 100644
--- a/mysql-test/t/func_group_innodb.test
+++ b/mysql-test/t/func_group_innodb.test
@@ -159,7 +159,20 @@ SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
DROP TABLE t1;
---echo # End of test BUG#12713907
+--echo #
+--echo # MDEV-4269: crash when grouping by values()
+--echo #
+
+SELECT @@storage_engine INTO @old_engine;
+set storage_engine=innodb;
+
+create table y select 1 b;
+select 1 from y group by b;
+select 1 from y group by values(b);
+drop table y;
+SET storage_engine=@old_engine;
+
+### End of 5.1 tests
--echo #
--echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index d8d8f4538e1..1a60b0c222a 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1385,6 +1385,24 @@ LOAD DATA INFILE 'bug58165.txt' INTO TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
+#
+# MDEV-759 lp:998340 - Valgrind complains on simple selects containing expression DAY(FROM_UNIXTIME(-1))
+#
+SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
+SELECT LEFT('1', DAY(FROM_UNIXTIME(-1)));
+SELECT RIGHT('1', DAY(FROM_UNIXTIME(-1)));
+SELECT REPEAT('1', DAY(FROM_UNIXTIME(-1)));
+SELECT RPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
+SELECT LPAD('hi', DAY(FROM_UNIXTIME(-1)),'?');
+
+#
+# MDEV-4289 Assertion `0' fails in make_sortkey with GROUP_CONCAT, MAKE_SET, GROUP BY
+#
+create table t1 (i int);
+insert into t1 values (null),(8);
+select group_concat( i ), make_set( i, 'a', 'b' ) field from t1 group by field;
+drop table t1;
+
--echo End of 5.1 tests
--echo Start of 5.4 tests
@@ -1502,11 +1520,6 @@ round(
--connection default
SET @@global.max_allowed_packet:= @tmp_max;
--disconnect newconn
-
---echo #
---echo # End of 5.5 tests
---echo #
-
#
# Bug#11765562 58545:
# EXPORT_SET() CAN BE USED TO MAKE ENTIRE SERVER COMPLETELY UNRESPONSIVE
@@ -1517,3 +1530,28 @@ SELECT @@global.max_allowed_packet;
SELECT CHAR_LENGTH(EXPORT_SET(1,1,1,REPEAT(1,100000000)));
SET @@global.max_allowed_packet:= @tmp_max;
+--echo #
+--echo # MDEV-4272: DIV operator crashes in Item_func_int_div::val_int
+--echo # (incorrect NULL value handling by convert)
+--echo #
+create table t1(a int) select null;
+select 1 div convert(a using utf8) from t1;
+drop table t1;
+
+#
+# BUG#11757250: REPLACE(...) INSIDE A STORED PROCEDURE.
+#
+create table t1 (a int);
+create table t2 (a int);
+create procedure foo (var char(100))
+ select replace(var, '00000000', table_name)
+ from information_schema.tables where table_schema='test';
+--sorted_result
+call foo('(( 00000000 ++ 00000000 ))');
+drop procedure foo;
+drop table t1,t2;
+
+--echo #
+--echo # End of 5.5 tests
+--echo #
+
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index f60f5e5ced7..109734c3316 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1174,3 +1174,13 @@ select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010')
--error ER_TOO_BIG_PRECISION
select now(258);
+
+#
+# MDEV-4293 Valgrind warnings (Conditional jump or move depends on uninitialised value) in remove_eq_conds on time functions with NULL argument in WHERE
+#
+SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
+SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
+SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12'));
+SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12'));
+SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12'));
+SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12'));
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index 731efe5648e..404f0447f56 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -956,3 +956,23 @@ SELECT a, ASTEXT(b) FROM t1;
DROP TABLE t1;
--echo End of 5.1 tests
+
+#
+# MDEV-4521 MBRContains, MBRWithin no longer work with geometries of different type.
+#
+CREATE TABLE t1 (
+ l LINESTRING NOT NULL,
+ SPATIAL KEY(l)
+) ENGINE = myisam;
+
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(0 0, 1 1)'));
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(1 1, 2 2)'));
+INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
+
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
+SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
+SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
+
+DROP TABLE t1;
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 190445e9c09..cff93fc13ee 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -759,6 +759,87 @@ create spatial index i on t1 (a);
drop table t1;
+#
+# Bug#11767480 - SPATIAL INDEXES ON NON-SPATIAL COLUMNS CAUSE CRASHES.
+#
+CREATE TABLE t0 (a BINARY(32) NOT NULL);
+--error ER_WRONG_ARGUMENTS
+CREATE SPATIAL INDEX i on t0 (a);
+INSERT INTO t0 VALUES (1);
+
+--error ER_WRONG_ARGUMENTS
+CREATE TABLE t1(
+ col0 BINARY NOT NULL,
+ col2 TIMESTAMP,
+ SPATIAL INDEX i1 (col0)
+) ENGINE=MyISAM;
+
+# Test other ways to add indices
+CREATE TABLE t1 (
+ col0 BINARY NOT NULL,
+ col2 TIMESTAMP
+) ENGINE=MyISAM;
+
+--error ER_WRONG_ARGUMENTS
+CREATE SPATIAL INDEX idx0 ON t1(col0);
+
+--error ER_WRONG_ARGUMENTS
+ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
+
+CREATE TABLE t2 (
+ col0 INTEGER NOT NULL,
+ col1 POINT,
+ col2 POINT
+);
+
+--error ER_WRONG_ARGUMENTS
+CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
+
+--error ER_WRONG_ARGUMENTS
+CREATE TABLE t3 (
+ col0 INTEGER NOT NULL,
+ col1 POINT,
+ col2 LINESTRING,
+ SPATIAL INDEX i1 (col1, col2)
+);
+
+# cleanup
+DROP TABLE t0, t1, t2;
+
+
+--echo #
+--echo # BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
+--echo #
+SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
+
+--echo #
+--echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
+--echo # GEOMETRY FUNCTION ARGUMENTS
+--echo #
+--replace_regex /non geometric .* value/non geometric '' value/
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
+
+--echo #
+--echo # MDEV-4252 geometry query crashes server
+--echo #
+select astext(0x0100000000030000000100000000000010);
+select astext(st_centroid(0x0100000000030000000100000000000010));
+select astext(st_exteriorring(0x0100000000030000000100000000000010));
+select envelope(0x0100000000030000000100000000000010);
+select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1);
+select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1);
+
+--echo #
+--echo # MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
+--echo #
+
+SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) )));
+
+--echo #
+--echo # MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
+--echo #
+SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2))));
--echo End of 5.1 tests
#bug 850775 ST_AREA does not work on GEOMETRYCOLLECTIONs in maria-5.3-gis
@@ -1293,6 +1374,7 @@ WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
#WHERE lakes.name = 'Blue Lake';
DROP DATABASE gis_ogs;
+USE test;
--echo #
--echo # BUG #1043845 st_distance() results are incorrect depending on variable order
@@ -1308,25 +1390,18 @@ select st_distance(geomfromtext('point(-95.96269500000000000000 36.1418183333333
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193) ')) ;
-USE test;
-
-
---echo #
---echo # BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
---echo #
-SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
--echo #
---echo # BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
---echo # GEOMETRY FUNCTION ARGUMENTS
+--echo # MDEV-4310 geometry function equals hangs forever.
--echo #
---replace_regex /non geometric .* value/non geometric '' value/
---error ER_ILLEGAL_VALUE_FOR_TYPE
-SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
-
-
---echo End of 5.1 tests
+create table t1(a geometry not null)engine=myisam;
+insert into t1 values(geomfromtext("POINT(0 0)"));
+insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
+insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
+select equals(`a`,convert(`a` using utf8)) from `t1`;
+drop table t1;
+--echo End of 5.3 tests
--echo #
--echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
@@ -1367,11 +1442,4 @@ create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
drop table t1;
---echo #
---echo # TODO-424 geometry query crashes server
---echo #
-select astext(0x0100000000030000000100000000000010);
-select st_area(0x0100000000030000000100000000000010);
-select astext(st_exteriorring(0x0100000000030000000100000000000010));
-select astext(st_centroid(0x0100000000030000000100000000000010));
--echo End of 5.5 tests
diff --git a/mysql-test/t/grant_4332.test b/mysql-test/t/grant_4332.test
new file mode 100644
index 00000000000..f77d3be350f
--- /dev/null
+++ b/mysql-test/t/grant_4332.test
@@ -0,0 +1,108 @@
+#
+# MDEV-4332 Increase username length from 16 characters
+#
+
+# user names here have the pattern
+# <letter><length><more letters>0
+# where '0' at the end is the end-of-name marker
+
+--source include/not_embedded.inc
+
+--enable_metadata
+select user();
+--disable_metadata
+
+--error ER_WRONG_STRING_LENGTH
+create user a17aaaaaaaaaaaaa0@localhost;
+
+alter table mysql.user modify User char(80) binary not null default '';
+alter table mysql.db modify User char(80) binary not null default '';
+alter table mysql.tables_priv modify User char(80) binary not null default '';
+alter table mysql.columns_priv modify User char(80) binary not null default '';
+alter table mysql.procs_priv modify User char(80) binary not null default '';
+alter table mysql.proc modify definer char(141) collate utf8_bin not null default '';
+alter table mysql.event modify definer char(141) collate utf8_bin not null default '';
+
+--source include/restart_mysqld.inc
+
+set global event_scheduler = on;
+
+--enable_metadata
+select user();
+--disable_metadata
+
+create user a17aaaaaaaaaaaaa0@localhost;
+grant usage on *.* to a17aaaaaaaaaaaaa0@localhost;
+grant select on mysql.user to b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost;
+grant select(User) on mysql.tables_priv to c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost;
+
+connect (a17,localhost,a17aaaaaaaaaaaaa0,,);
+connect (b64,localhost,b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0,,);
+connect (c80,localhost,c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0,,);
+
+connection a17;
+select user(), current_user();
+show grants;
+
+connection b64;
+select user(), current_user();
+show grants;
+select user,host from mysql.user where user like '%0';
+--error ER_TABLEACCESS_DENIED_ERROR
+select user,host from mysql.db;
+
+connection c80;
+select user(), current_user();
+show grants;
+select user from mysql.tables_priv;
+--error ER_COLUMNACCESS_DENIED_ERROR
+select user,host from mysql.tables_priv;
+
+create procedure test.p1() select user(), current_user(), user from mysql.tables_priv;
+
+show create procedure test.p1;
+
+create table test.t1 (a text);
+create event e1 on schedule every 1 second
+ do insert test.t1 values (concat(user(), ' ', current_user()));
+
+connection default;
+
+call test.p1();
+
+disconnect a17;
+disconnect b64;
+disconnect c80;
+
+let $wait_timeout= 10;
+let $wait_condition= SELECT 1 from t1;
+--source include/wait_condition.inc
+
+select * from t1 limit 1;
+--error ER_WRONG_STRING_LENGTH
+grant usage on *.* to d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost;
+
+--error ER_WRONG_STRING_LENGTH
+drop user d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost;
+drop user c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost;
+drop user b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost;
+drop user a17aaaaaaaaaaaaa0@localhost;
+
+set global event_scheduler = off;
+drop event e1;
+drop procedure test.p1;
+drop table t1;
+
+alter table mysql.user modify User char(16) binary not null default '';
+alter table mysql.db modify User char(16) binary not null default '';
+alter table mysql.tables_priv modify User char(16) binary not null default '';
+alter table mysql.columns_priv modify User char(16) binary not null default '';
+alter table mysql.procs_priv modify User char(16) binary not null default '';
+alter table mysql.proc modify definer char(77) collate utf8_bin not null default '';
+alter table mysql.event modify definer char(77) collate utf8_bin not null default '';
+flush privileges;
+
+--enable_metadata
+select user();
+--disable_metadata
+
diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test
index 31c6fca2b95..36414105917 100644
--- a/mysql-test/t/innodb_ext_key.test
+++ b/mysql-test/t/innodb_ext_key.test
@@ -539,6 +539,129 @@ select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
drop table t1,t2,t3;
+--echo #
+--echo # Bug mdev-4340: performance regression with extended_keys=on
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+
+CREATE TABLE t1 (
+ page_id int(8) unsigned NOT NULL AUTO_INCREMENT,
+ page_namespace int(11) NOT NULL DEFAULT '0',
+ page_title varbinary(255) NOT NULL DEFAULT '',
+ page_restrictions tinyblob NOT NULL,
+ page_counter bigint(20) unsigned NOT NULL DEFAULT '0',
+ page_is_redirect tinyint(1) unsigned NOT NULL DEFAULT '0',
+ page_is_new tinyint(1) unsigned NOT NULL DEFAULT '0',
+ page_random double unsigned NOT NULL DEFAULT '0',
+ page_touched varbinary(14) NOT NULL DEFAULT '',
+ page_latest int(8) unsigned NOT NULL DEFAULT '0',
+ page_len int(8) unsigned NOT NULL DEFAULT '0',
+ PRIMARY KEY (page_id),
+ UNIQUE KEY name_title (page_namespace,page_title),
+ KEY page_random (page_random),
+ KEY page_len (page_len),
+ KEY page_redirect_namespace_len (page_is_redirect,page_namespace,page_len)
+) ENGINE=InnoDB AUTO_INCREMENT=38929100 DEFAULT CHARSET=binary;
+INSERT INTO t1 VALUES
+(38928077,0,'Sandbox','',0,0,0,0,'',0,0),(38928078,1,'Sandbox','',0,0,0,1,'',0,0),
+(38928079,2,'Sandbox','',0,0,0,2,'',0,0),(38928080,3,'Sandbox','',0,0,0,3,'',0,0),
+(38928081,4,'Sandbox','',0,0,0,4,'',0,0),(38928082,5,'Sandbox','',0,0,0,5,'',0,0);
+
+CREATE TABLE t2 (
+ rev_id int(8) unsigned NOT NULL AUTO_INCREMENT,
+ rev_page int(8) unsigned NOT NULL DEFAULT '0',
+ rev_text_id int(8) unsigned NOT NULL DEFAULT '0',
+ rev_comment varbinary(255) DEFAULT NULL,
+ rev_user int(5) unsigned NOT NULL DEFAULT '0',
+ rev_user_text varbinary(255) NOT NULL DEFAULT '',
+ rev_timestamp varbinary(14) NOT NULL DEFAULT '',
+ rev_minor_edit tinyint(1) unsigned NOT NULL DEFAULT '0',
+ rev_deleted tinyint(1) unsigned NOT NULL DEFAULT '0',
+ rev_len int(8) unsigned DEFAULT NULL,
+ rev_parent_id int(8) unsigned DEFAULT NULL,
+ rev_sha1 varbinary(32) NOT NULL DEFAULT '',
+ PRIMARY KEY (rev_page,rev_id),
+ UNIQUE KEY rev_id (rev_id),
+ KEY rev_timestamp (rev_timestamp),
+ KEY page_timestamp (rev_page,rev_timestamp),
+ KEY user_timestamp (rev_user,rev_timestamp),
+ KEY usertext_timestamp (rev_user_text,rev_timestamp,rev_user,rev_deleted,rev_minor_edit,rev_text_id,rev_comment)
+) ENGINE=InnoDB DEFAULT CHARSET=binary;
+INSERT INTO t2 VALUES
+(547116222,20,0,NULL,3,'','',0,0,NULL,NULL,''),(547117245,20,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118268,20,0,NULL,5,'','',0,0,NULL,NULL,''),(547114177,21,0,NULL,1,'','',0,0,NULL,NULL,''),
+(547115200,21,0,NULL,2,'','',0,0,NULL,NULL,''),(547116223,21,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547117246,21,0,NULL,4,'','',0,0,NULL,NULL,''),(547118269,21,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547114178,22,0,NULL,1,'','',0,0,NULL,NULL,''),(547115201,22,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547116224,22,0,NULL,3,'','',0,0,NULL,NULL,''),(547117247,22,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547116226,24,0,NULL,3,'','',0,0,NULL,NULL,''),(547117249,24,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118272,24,0,NULL,5,'','',0,0,NULL,NULL,''),(547114181,25,0,NULL,1,'','',0,0,NULL,NULL,''),
+(547115204,25,0,NULL,2,'','',0,0,NULL,NULL,''),(547116227,25,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547116157,978,0,NULL,2,'','',0,0,NULL,NULL,''),(547117180,978,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547118203,978,0,NULL,4,'','',0,0,NULL,NULL,''),(547119226,978,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115135,979,0,NULL,1,'','',0,0,NULL,NULL,''),(547116158,979,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547116173,994,0,NULL,2,'','',0,0,NULL,NULL,''),(547117196,994,0,NULL,3,'','',0,0,NULL,NULL,''),
+(547118219,994,0,NULL,4,'','',0,0,NULL,NULL,''),(547119242,994,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115151,995,0,NULL,1,'','',0,0,NULL,NULL,''),(547116174,995,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547117197,995,0,NULL,3,'','',0,0,NULL,NULL,''),(547118220,995,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547118223,998,0,NULL,4,'','',0,0,NULL,NULL,''),(547119246,998,0,NULL,5,'','',0,0,NULL,NULL,''),
+(547115155,999,0,NULL,1,'','',0,0,NULL,NULL,''),(547116178,999,0,NULL,2,'','',0,0,NULL,NULL,''),
+(547117201,999,0,NULL,3,'','',0,0,NULL,NULL,''),(547118224,999,0,NULL,4,'','',0,0,NULL,NULL,''),
+(547119271,38928081,0,NULL,10,'','',0,0,NULL,NULL,''),(547119272,38928081,0,NULL,11,'','',0,0,NULL,NULL,''),
+(547119273,38928081,0,NULL,12,'','',0,0,NULL,NULL,''),(547119274,38928081,0,NULL,13,'','',0,0,NULL,NULL,''),
+(547119275,38928081,0,NULL,14,'','',0,0,NULL,NULL,''),(547119276,38928081,0,NULL,15,'','',0,0,NULL,NULL,''),
+(547119277,38928081,0,NULL,16,'','',0,0,NULL,NULL,''),(547119278,38928081,0,NULL,17,'','',0,0,NULL,NULL,''),
+(547119279,38928081,0,NULL,18,'','',0,0,NULL,NULL,''),(547119280,38928081,0,NULL,19,'','',0,0,NULL,NULL,'');
+
+CREATE TABLE t3 (
+ old_id int(10) unsigned NOT NULL AUTO_INCREMENT,
+ old_text mediumblob NOT NULL,
+ old_flags tinyblob NOT NULL,
+ PRIMARY KEY (old_id)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t3 VALUES
+(1,'text-0',''),(2,'text-1000',''),(3,'text-2000',''),(4,'text-3000',''),
+(5,'text-4000',''),(6,'text-5000',''),(7,'text-6000',''),(8,'text-7000',''),
+(9,'text-8000',''),(10,'text-9000',''),(11,'text-1',''),(12,'text-1001',''),
+(13,'text-2001',''),(14,'text-3001',''),(15,'text-4001',''),(16,'text-5001',''),
+(17,'text-6001',''),(18,'text-7001',''),(19,'text-8001',''),(20,'text-9001',''),
+(21,'text-2',''),(22,'text-1002',''),(23,'text-2002',''),(24,'text-3002',''),
+(25,'text-4002',''),(26,'text-5002',''),(27,'text-6002',''),(28,'text-7002',''),
+(29,'text-8002',''),(30,'text-9002',''),(31,'text-3',''),(32,'text-1003',''),
+(33,'text-2003',''),(34,'text-3003',''),(35,'text-4003',''),(36,'text-5003',''),
+(37,'text-6003',''),(38,'text-7003',''),(39,'text-8003',''),(40,'text-9003',''),
+(41,'text-4',''),(42,'text-1004',''),(43,'text-2004',''),(44,'text-3004',''),
+(45,'text-4004',''),(46,'text-5004',''),(47,'text-6004',''),(48,'text-7004',''),
+(49,'text-8004',''),(50,'text-9004',''),(51,'text-5',''),(52,'text-1005',''),
+(53,'text-2005',''),(54,'text-3005',''),(55,'text-4005',''),(56,'text-5005',''),
+(57,'text-6005',''),(58,'text-7005',''),(59,'text-8005',''),(60,'text-9005',''),
+(61,'text-6',''),(62,'text-1006',''),(63,'text-2006',''),(64,'text-3006',''),
+(65,'text-4006',''),(66,'text-5006',''),(67,'text-6006',''),(68,'text-7006',''),
+(69,'text-8006',''),(70,'text-9006',''),(71,'text-7',''),(72,'text-1007',''),
+(73,'text-2007',''),(74,'text-3007',''),(75,'text-4007',''),(76,'text-5007',''),
+(77,'text-6007',''),(78,'text-7007',''),(79,'text-8007',''),(80,'text-9007',''),
+(81,'text-8',''),(82,'text-1008',''),(83,'text-2008',''),(84,'text-3008',''),
+(85,'text-4008',''),(86,'text-5008',''),(87,'text-6008',''),(88,'text-7008',''),
+(89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''),
+(93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''),
+(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
+
+
+set optimizer_switch='extended_keys=off';
+EXPLAIN
+SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
+ WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
+ORDER BY rev_timestamp ASC LIMIT 10;
+
+set optimizer_switch='extended_keys=on';
+EXPLAIN
+SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
+ WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
+ORDER BY rev_timestamp ASC LIMIT 10;
+
+DROP TABLE t1,t2,t3;
+
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch=@save_ext_key_optimizer_switch;
diff --git a/mysql-test/t/join_nested.test b/mysql-test/t/join_nested.test
index 3168e95f620..7b7d9236835 100644
--- a/mysql-test/t/join_nested.test
+++ b/mysql-test/t/join_nested.test
@@ -1287,3 +1287,27 @@ SET optimizer_switch=@save_optimizer_switch;
--echo End of 5.0 tests
+--echo #
+--echo # MDEV-621: LP:693329 - Assertion `!is_interleave_error' failed on low optimizer_search_depth
+--echo #
+set @tmp_mdev621= @@optimizer_search_depth;
+SET SESSION optimizer_search_depth = 4;
+
+CREATE TABLE t1 (f1 int,f2 int,f3 int,f4 int) ;
+INSERT IGNORE INTO t1 VALUES (0,0,2,0),(NULL,0,2,0);
+CREATE TABLE t2 (f1 int) ;
+CREATE TABLE t3 (f3 int,PRIMARY KEY (f3)) ;
+CREATE TABLE t4 (f5 int) ;
+CREATE TABLE t5 (f2 int) ;
+
+SELECT alias2.f4 FROM t1 AS alias1
+LEFT JOIN t1 AS alias2
+ LEFT JOIN t2 AS alias3
+ LEFT JOIN t3 AS alias4 ON alias3.f1 = alias4.f3
+ ON alias2.f1
+LEFT JOIN t4 AS alias5
+ JOIN t5 ON alias5.f5
+ON alias2.f3 ON alias1.f2;
+DROP TABLE t1,t2,t3,t4,t5;
+set optimizer_search_depth= @tmp_mdev621;
+
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 44f4afd451b..24885c056b8 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -1439,6 +1439,37 @@ GROUP BY t2.f1, t2.f2;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug#13068506 - QUERY WITH GROUP BY ON NON-AGGR COLUMN RETURNS
+--echo # WRONG RESULT
+--echo #
+
+CREATE TABLE t1 (i1 int);
+INSERT INTO t1 VALUES (100), (101);
+
+CREATE TABLE t2 (i2 int, i3 int);
+INSERT INTO t2 VALUES (20,1),(10,2);
+
+CREATE TABLE t3 (i4 int(11));
+INSERT INTO t3 VALUES (1),(2);
+
+let $query= SELECT (
+ SELECT MAX( t2.i2 )
+ FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
+ WHERE t2.i3 <> t1.i1
+) AS field1
+FROM t1;
+
+--echo
+--eval $query;
+--echo
+--eval $query GROUP BY field1;
+
+--echo
+drop table t1,t2,t3;
+
+--echo # End of test for Bug#13068506
+
--echo End of 5.1 tests
--echo #
@@ -1622,4 +1653,21 @@ ORDER BY t1.b;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug mdev-4336: LEFT JOIN with disjunctive
+--echo # <non-nullable datetime field> IS NULL in WHERE
+--echo # causes a hang and eventual crash
+--echo #
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL,
+ modified datetime NOT NULL,
+ PRIMARY KEY (id)
+);
+
+SELECT a.* FROM t1 a LEFT JOIN t1 b ON a.id = b.id
+ WHERE a.modified > b.modified or b.modified IS NULL;
+
+DROP TABLE t1;
+
SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/join_outer_innodb.test b/mysql-test/t/join_outer_innodb.test
index cca1dde481d..539d85a8b11 100644
--- a/mysql-test/t/join_outer_innodb.test
+++ b/mysql-test/t/join_outer_innodb.test
@@ -143,3 +143,233 @@ eval SELECT $rest_of_query;
eval EXPLAIN SELECT $rest_of_query;
drop table t1,t2,t3,t4,t5,t6;
+
+--echo #
+--echo Bug mdev-4318: view over a complex query with outer joins
+--echo #
+
+CREATE TABLE t1 (
+ a1 int NOT NULL, a2 int NOT NULL, a3 int DEFAULT NULL, a4 tinyint NOT NULL,
+ a5 int NOT NULL, a6 tinyint NOT NULL, a7 tinyint(4) DEFAULT NULL,
+ a8 smallint(6) DEFAULT NULL, a9 smallint(6) DEFAULT NULL, a10 tinyint NOT NULL,
+ PRIMARY KEY (a1), KEY a2 (a2), KEY a3 (a3), KEY a4 (a4), KEY a6 (a6),
+ KEY a5 (a5), KEY a7 (a7), KEY a8 (a8), KEY a9 (a9)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+ (3360,5684,2219,1,316832,1,0,NULL,NULL,NULL),
+ (3362,2754,597,2,316844,1,0,NULL,NULL,NULL),
+ (3363,369,NULL,1,317295,1,0,NULL,NULL,NULL);
+
+CREATE TABLE t2 (
+ b1 int NOT NULL, b2 int NOT NULL, PRIMARY KEY (b1,b2), KEY b2 (b2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE t3 (
+ c1 int NOT NULL, PRIMARY KEY (c1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t3 VALUES
+ (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),
+ (1000),(1001),(1002),(1003),(9999);
+
+CREATE TABLE t4 (
+ d1 int NOT NULL, PRIMARY KEY (d1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t4 VALUES (5674),(5676),(5680),(5684),(5685);
+
+CREATE TABLE t5 (
+ e1 int NOT NULL, e2 varchar(64) NOT NULL, PRIMARY KEY (e1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t5 VALUES
+ (5684,'51a5de7a9f56314e082094d78f58be082c3cf0c1'),
+ (5685,'754dc8292cb9f5eb9ade126fe7e961c62412a349'),
+ (5686,'75eeb33f1c819bac21f6d023b4c5b24185eeda5c');
+
+CREATE TABLE t6 (
+ f1 int NOT NULL, PRIMARY KEY (f1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t6 VALUES (5542),(5620),(5686);
+
+CREATE TABLE t7 (
+ g1 tinyint NOT NULL DEFAULT '0', g2 varchar(20) NOT NULL, PRIMARY KEY (g1)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+INSERT INTO t7 VALUES
+ (1,'60feec2b20ed19f55ad0'),(3,'9ddb18bff7fcbd1e3133'),
+ (5,'a05599df9222bb160d11'),(7,'e31bae372f7d01df0589'),
+ (9,'8f8372dd7fc8eb46c8a3'),(11,'f8d0e28529e990a09309');
+
+CREATE TABLE t8 (
+ h1 tinyint NOT NULL, h2 varchar(128) DEFAULT NULL, PRIMARY KEY (h1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t8 VALUES (1,'b'),(2,'c'),(3,'d'),(4,'e');
+
+CREATE TABLE t9 (
+ i1 tinyint NOT NULL, i2 varchar(7) NOT NULL, i3 varchar(128) NOT NULL,
+ PRIMARY KEY (i1,i2), KEY i2 (i2), KEY i3 (i3)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t9 VALUES
+ (2,'a','07630d223c7e5f7b1feb19b3caafb0833fd028eb'),
+ (3,'b','1ca53dcc50b68af86f4b1b4676dbed917b543c30'),
+ (1,'b','2c01ac36c1ce9a7de66be89f85d8aa5f0052e2e8'),
+ (4,'a','496c486b3a9edc439477fef7d34cbefdebba86df'),
+ (3,'a','98bf72d8d467201058a5f69bd7709bfc74a8637e'),
+ (2,'b','9a45425f6160fb59d7f8a02c721498d4ce945302'),
+ (4,'b','9c9a7300f3e708f8e430f9f3376d966f5951f583'),
+ (1,'a','c0af3f076b905f31cbb51af304b9c7ad539e0861');
+
+CREATE TABLE t10 (
+ j1 tinyint NOT NULL, j2 varchar(20) NOT NULL, PRIMARY KEY (j1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t10 VALUES (1,'b'),(2,'c'),(3,'d');
+
+CREATE TABLE t11 (
+ k1 int NOT NULL, k2 datetime DEFAULT NULL, k3 int DEFAULT NULL,
+ k4 int DEFAULT NULL, PRIMARY KEY (k1), KEY k3 (k3), KEY k4 (k4)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t11 VALUES
+ (317422,'2013-03-18 11:43:03',1,NULL),(317423,'2013-03-18 11:43:11',1,NULL),
+ (317424,'2013-03-18 11:52:01',1,1),(317425,'2013-03-18 11:52:01',1,1),
+ (317426,'2013-03-18 11:56:38',1,1),(317427,'2013-03-18 12:18:25',1,NULL),
+ (317428,'2013-03-18 12:46:28',1,NULL),(317429,'2013-03-18 12:46:28',1,NULL),
+ (317430,'2013-03-18 12:46:28',1,NULL),(317431,'2013-03-18 12:46:28',1,NULL),
+ (317432,'2013-03-18 12:46:28',1,NULL),(317433,'2013-03-18 12:46:28',1,NULL),
+ (317434,'2013-03-18 12:46:28',1,NULL),(317435,'2013-03-18 12:46:28',1,NULL),
+ (317436,'2013-03-18 12:46:28',1,NULL),(317437,'2013-03-18 12:46:28',1,NULL),
+ (317438,'2013-03-18 12:46:28',1,NULL),(317439,'2013-03-18 12:46:28',1,NULL),
+ (317440,'2013-03-18 12:55:20',1,NULL),(317441,'2013-03-18 12:58:29',1,NULL),
+ (317442,'2013-03-18 13:06:02',1,NULL),(317443,'2013-03-18 15:23:18',21,NULL);
+
+CREATE TABLE t12 (
+ l1 int NOT NULL, l2 varchar(64) NOT NULL, PRIMARY KEY (l1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t12 VALUES
+ (552,'59a498252ef59f96fbdc13a414abe244d8e8bc30'),
+ (554,'c6025c7cb2d9dfb1be7ce4a61f35b45bb9e61ba3'),
+ (555,'b245bcc672082bb6d10794b2b4ac972dd14b1cf5');
+
+CREATE TABLE t13 (
+ m1 int NOT NULL, m2 int NOT NULL, m3 int NOT NULL,
+ PRIMARY KEY (m1,m2,m3), KEY m3 (m3), KEY m2 (m2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t13 VALUES (3324,43,4),(3332,263,1),(3348,27,3);
+
+CREATE TABLE t14 (
+ n1 smallint NOT NULL, n2 varchar(64) NOT NULL, PRIMARY KEY (n1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t14 VALUES
+ (21,'685bf7ca576af964c7cff564d5e4473b81499b8b'),
+ (23,'b8e42dab1ab952406b3accfb47089c61478138a8'),
+ (25,'3fea441e411db8c70bf039b50c8f18f59515be53'),
+ (27,'998aecc30fd0e0b8a1cac6590e5eccc2d7822223');
+
+CREATE TABLE t15 (
+ o1 smallint NOT NULL, PRIMARY KEY (o1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t15 VALUES (1),(3);
+
+CREATE TABLE t16 (
+ p1 smallint NOT NULL, p2 varchar(7) NOT NULL, p3 varchar(64) NOT NULL,
+ PRIMARY KEY (p1,p2)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+INSERT INTO t16 VALUES
+ (1,'a','66bdbb389456f3ae97206da115a7b397c31400e8'),
+ (1,'b','66bdbb389456f3ae97206da115a7b397c31400e8'),
+ (3,'a','386c10e454278c6e27feb16258089166422f79b4'),
+ (3,'b','386c10e454278c6e27feb16258089166422f79b4');
+
+let $Q=
+select t3.c1,t5.e2,t1.a1,t14.n2,t16.p3,t10.j2,t7.g2,t11.k2,l3.l2,
+ t9.i3,t12.l2 AS l_l2,l2.l2 AS l2_l2,l4.l1 AS l4_l1,t6.f1
+from
+(
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ (
+ t1
+ left join t2 on t1.a1 = t2.b1
+ )
+ left join t3 on t2.b2 = t3.c1
+ )
+ left join t4 on t1.a2 = t4.d1
+ )
+ left join t5 on t4.d1 = t5.e1
+ )
+ left join t6 on t1.a3 = t6.f1
+ )
+ left join t5 e2 on t6.f1 = e2.e1
+ )
+ join t7 on t1.a7 = t7.g1
+ )
+ join t8 on t1.a4 = t8.h1
+ )
+ join t9 on t8.h1 = t9.i1
+ )
+ join t10 on t1.a6 = t10.j1
+ )
+ join t11 on t1.a5 = t11.k1
+ )
+ left join t12 on t11.k3 = t12.l1
+ )
+ left join t12 l2 on t11.k4 = l2.l1
+ )
+ left join t13 on t1.a1 = t13.m1 and t13.m3 = 4
+ )
+ left join t12 l4 on l4.l1 = t13.m2
+ )
+ left join t13 m2 on t1.a1 = m2.m1 and m2.m3 = 3
+ )
+ left join t12 l3 on l3.l1 = m2.m2
+ )
+ left join t14 on t1.a8 = t14.n1
+ )
+ left join t15 on t1.a9 = t15.o1
+)
+left join t16 on t15.o1 = t16.p1
+where t1.a10 = 1;
+
+eval create view v1 as $Q;
+
+eval explain $Q;
+
+explain select * from v1;
+
+drop view v1;
+
+drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16;
+
+
+--echo #
+--echo # MDEV-4270: crash in fix_semijoin_strategies_for_picked_join_order
+--echo #
+drop table if exists t1,t2,t3;
+create table t2(a int,unique key (a)) engine=innodb;
+create table t3(b int) engine=innodb;
+create table t1(a int,b int)engine=innodb;
+
+set @mdev4270_opl= @@optimizer_prune_level;
+set @mdev4270_osd= @@optimizer_search_depth;
+set optimizer_prune_level=0;
+set optimizer_search_depth=2;
+
+select 1 from t1 join t2 a
+natural left join t2 b
+natural right outer join t3;
+
+drop table t1,t2,t3;
+set optimizer_prune_level=@mdev4270_opl;
+set optimizer_search_depth=@mdev4270_osd;
+
diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test
index 08016313ca7..6717cb44fbf 100644
--- a/mysql-test/t/keywords.test
+++ b/mysql-test/t/keywords.test
@@ -162,3 +162,14 @@ call p2();
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP TABLE t1;
+
+#
+# OPTION is not anymore a keyword
+#
+
+create table option (option int not null);
+drop table option;
+--error 1064
+set option=1;
+--error 1193
+set option option=1;
diff --git a/mysql-test/t/log_slow.test b/mysql-test/t/log_slow.test
index af8a948d318..8d5a09d7a94 100644
--- a/mysql-test/t/log_slow.test
+++ b/mysql-test/t/log_slow.test
@@ -6,6 +6,7 @@ select @@log_slow_filter;
select @@log_slow_rate_limit;
select @@log_slow_verbosity;
show variables like "log_slow%";
+set @org_slow_query_log= @@global.slow_query_log;
# Some simple test to set log_slow_filter
set @@log_slow_filter= "filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk,admin";
@@ -42,7 +43,18 @@ show fields from mysql.slow_log;
flush slow logs;
-# Reset used variables
+# MDEV-4206 (empty filter should be no filter)
+set long_query_time=0.1;
+set log_slow_filter='';
+set global slow_query_log=1;
+set global log_output='TABLE';
+select sleep(0.5);
+select count(*) FROM mysql.slow_log;
+truncate mysql.slow_log;
+# Reset used variables
+set @@long_query_time=default;
+set global slow_query_log= @org_slow_query_log;
set @@log_slow_filter=default;
set @@log_slow_verbosity=default;
+set global log_output= default;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index 4066fcb264b..7e198275730 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -226,19 +226,19 @@ drop table t3,t1,t2;
#
# temporary merge tables
#
-CREATE TABLE t1 (c1 INT NOT NULL);
-CREATE TABLE t2 (c1 INT NOT NULL);
-INSERT INTO t1 VALUES (1);
-INSERT INTO t2 VALUES (2);
-CREATE TEMPORARY TABLE t3 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t1,t2);
-SELECT * FROM t3;
-CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL);
-CREATE TEMPORARY TABLE t5 (c1 INT NOT NULL);
-INSERT INTO t4 VALUES (4);
-INSERT INTO t5 VALUES (5);
-CREATE TEMPORARY TABLE t6 (c1 INT NOT NULL) ENGINE=MRG_MYISAM UNION=(t4,t5);
-SELECT * FROM t6;
-DROP TABLE t6, t3, t1, t2, t4, t5;
+create table t1 (a int not null);
+create table t2 (a int not null);
+insert into t1 values (1);
+insert into t2 values (2);
+create temporary table t3 (a int not null) ENGINE=MERGE UNION=(t1,t2);
+select * from t3;
+create temporary table t4 (a int not null);
+create temporary table t5 (a int not null);
+insert into t4 values (1);
+insert into t5 values (2);
+create temporary table t6 (a int not null) ENGINE=MERGE UNION=(t4,t5);
+select * from t6;
+drop table t6, t3, t1, t2, t4, t5;
#
# Bug#19627 - temporary merge table locking
# MERGE table and its children must match in temporary type.
@@ -622,14 +622,6 @@ SHOW CREATE TABLE m1;
DROP TABLE t1, m1;
#
-# BUG#35274 - merge table doesn't need any base tables, gives error 124 when
-# key accessed
-#
-CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
-SELECT MAX(a) FROM t1;
-DROP TABLE t1;
-
-#
# BUG#32047 - 'Spurious' errors while opening MERGE tables
#
CREATE TABLE t1(a INT);
@@ -1306,9 +1298,9 @@ DROP TABLE t1, t2, t3;
# Truncate failed with error message when table was in use by MERGE.
#
# Show that truncate of child table after use of parent table works.
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE t3 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2);
+CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
+CREATE TABLE t2 (c1 INT) ENGINE= MyISAM;
+CREATE TABLE t3 (c1 INT) ENGINE= MRG_MYISAM UNION= (t1, t2);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (2);
SELECT * FROM t3;
@@ -1840,6 +1832,51 @@ DROP TABLE m1, t1;
--echo End of 5.1 tests
+--echo #
+--echo # MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg
+--echo #
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t2 ( i int ) engine=myisam;
+insert into t2 values (1),(2);
+
+create table t3 (a int, b int, filler char(100), key(a), key(b)) engine=myisam;
+create table t4 like t3;
+insert into t3
+ select A.a+10*B.a+100*C.a,
+ A.a+10*B.a+100*C.a,
+ 'filler-data-FILLER-DATA-qqq'
+ from t1 A, t1 B, t1 C where C.a < 5;
+insert into t4
+ select A.a+10*B.a+100*C.a,
+ A.a+10*B.a+100*C.a,
+ 'filler-data-FILLER-DATA-qqq'
+ from t1 A, t1 B, t1 C where C.a >= 5;
+
+create table t5 like t3;
+alter table t5 engine=merge;
+alter table t5 union(t3, t4);
+
+update t5 set b=999, a=999 where b>950;
+
+explain
+select * from t2, t5 where t5.a=999 and t5.b=999;
+select * from t2, t5 where t5.a=999 and t5.b=999;
+
+drop table t5;
+drop table t1,t2,t3,t4;
+
+--echo End of 5.3 tests
+
+#
+# BUG#35274 - merge table doesn't need any base tables, gives error 124 when
+# key accessed
+#
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=merge;
+SELECT MAX(a) FROM t1;
+DROP TABLE t1;
+
--echo #
--echo # An additional test case for Bug#27430 Crash in subquery code
--echo # when in PS and table DDL changed after PREPARE
@@ -2845,3 +2882,4 @@ eval set global storage_engine=$default;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
+
diff --git a/mysql-test/t/myisam-metadata.test b/mysql-test/t/myisam-metadata.test
index c5327aa3a71..2bbcc89a702 100644
--- a/mysql-test/t/myisam-metadata.test
+++ b/mysql-test/t/myisam-metadata.test
@@ -3,6 +3,7 @@
#
--source include/big_test.inc
+--source include/have_debug_sync.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
@@ -29,15 +30,18 @@ while ($1)
--enable_query_log
--connect(con1,localhost,root,,)
---send
+SET debug_sync= 'myisam_after_repair_by_sort SIGNAL waiting WAIT_FOR go';
+send
ALTER TABLE t1 ENABLE KEYS;
--connection default
---let $wait_timeout=10
+--let $wait_timeout=60
--let $show_statement= SHOW PROCESSLIST
--let $field= State
--let $condition= = 'Repair by sorting'
--source include/wait_show_condition.inc
+SET debug_sync= 'now WAIT_FOR waiting';
+SET debug_sync= 'now SIGNAL go';
--replace_column 7 # 8 # 9 # 12 # 13 # 14 #
SHOW TABLE STATUS LIKE 't1';
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index cad5b67c363..9187cf82513 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -231,7 +231,7 @@ drop table t17583;
--exec $MYSQL test -e "connect test invalid_hostname" 2>&1
--echo The commands reported in the bug report
---replace_regex /\([0-9]*\)/(errno)/
+--replace_regex /\([0-9|-]*\)/(errno)/
--error 1
--exec $MYSQL test -e "\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
diff --git a/mysql-test/t/mysql_plugin.test b/mysql-test/t/mysql_plugin.test
index a05b5a624d9..10bc03e0f06 100644
--- a/mysql-test/t/mysql_plugin.test
+++ b/mysql-test/t/mysql_plugin.test
@@ -110,13 +110,8 @@ SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name;
--echo #
--echo # Enable the plugin...
--echo #
-let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
---write_file $expect_file
-wait
-EOF
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -132,9 +127,8 @@ EOF
#
# Restart the server
#
---append_file $expect_file
-restart
-EOF
+
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
@@ -155,12 +149,7 @@ eval INSERT INTO mysql.plugin VALUES ('wonky', '$DAEMONEXAMPLE');
--replace_regex /\.dll/.so/
SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name;
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
---write_file $expect_file
-wait
-EOF
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -177,9 +166,7 @@ EOF
#
# Restart the server
#
---append_file $expect_file
-restart
-EOF
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
@@ -189,12 +176,7 @@ EOF
--replace_regex /\.dll/.so/
SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
---write_file $expect_file
-wait
-EOF
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -211,9 +193,7 @@ let $DAEMON_RELOAD = lib$DAEMONEXAMPLE;
#
# Restart the server
#
---append_file $expect_file
-restart
-EOF
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
@@ -226,12 +206,8 @@ SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
--echo #
--echo # Disable the plugin...
--echo #
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
---write_file $expect_file
-wait
-EOF
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -248,9 +224,7 @@ EOF
#
# Restart the server
#
---append_file $expect_file
-restart
-EOF
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
@@ -262,13 +236,8 @@ SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
#
# Stop the server for error conditions
#
-let $expect_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
---write_file $expect_file
-wait
-EOF
+
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
@@ -382,17 +351,14 @@ replace_result $MYSQL_PLUGIN mysql_plugin;
#
# Restart the server
#
---append_file $expect_file
-restart
-EOF
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
#
# Cleanup
-# MTR will remove this file later, but this might be too late.
---error 0,1
---remove_file $expect_file
+
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Cleanup the share folder in the binary path.
--remove_file $MYSQLD_BASEDIR/share/errmsg.sys
diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test
index 95f3b346ecd..c1bd7a79a71 100644
--- a/mysql-test/t/mysqld--help.test
+++ b/mysql-test/t/mysqld--help.test
@@ -23,8 +23,11 @@ perl;
datadir slave-load-tmpdir tmpdir socket wsrep-node-name/;
# Plugins which may or may not be there:
- @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster feedback debug temp-pool ssl des-key-file
- xtradb thread-concurrency super-large-pages mutex-deadlock-detector null-audit maria aria pbxt oqgraph sphinx thread-handling thread-pool/;
+ @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster
+ feedback debug temp-pool ssl des-key-file
+ xtradb thread-concurrency super-large-pages
+ mutex-deadlock-detector null-audit maria aria pbxt oqgraph
+ sphinx thread-handling thread-pool query-cache-info/;
# And substitute the content some environment variables with their
# names:
diff --git a/mysql-test/t/mysqlshow.test b/mysql-test/t/mysqlshow.test
index cf8661d090c..4602c15e566 100644
--- a/mysql-test/t/mysqlshow.test
+++ b/mysql-test/t/mysqlshow.test
@@ -29,17 +29,14 @@ select "---- -v -v -t ------" as "";
DROP TABLE t1, t2;
-if (`select count(*) from information_schema.plugins where plugin_name='innodb' and plugin_auth_version > "5.5.31"`)
-{
# because of lp:1066512 this test shows xtradb I_S plugins, even when
# xtradb is supposed to be disabled
#
# Bug #19147: mysqlshow INFORMATION_SCHEMA does not work
#
---exec $MYSQL_SHOW information_schema
---exec $MYSQL_SHOW INFORMATION_SCHEMA
---exec $MYSQL_SHOW inf_rmation_schema
-}
+#--exec $MYSQL_SHOW information_schema
+#--exec $MYSQL_SHOW INFORMATION_SCHEMA
+#--exec $MYSQL_SHOW inf_rmation_schema
--echo End of 5.0 tests
diff --git a/mysql-test/t/partition_rename_longfilename.test b/mysql-test/t/partition_rename_longfilename.test
index 5e454f01da7..51d9c583f56 100644
--- a/mysql-test/t/partition_rename_longfilename.test
+++ b/mysql-test/t/partition_rename_longfilename.test
@@ -1,4 +1,5 @@
-- source include/not_windows.inc
+-- source include/support_long_file_names.inc
-- source include/have_partition.inc
-- source include/not_embedded.inc
--disable_warnings
diff --git a/mysql-test/t/quick_select_4161.test b/mysql-test/t/quick_select_4161.test
new file mode 100644
index 00000000000..1e746754b41
--- /dev/null
+++ b/mysql-test/t/quick_select_4161.test
@@ -0,0 +1,53 @@
+#
+# MDEV-4161 Assertion `status_var.memory_used == 0' fails in virtual THD::~THD()
+#
+--source include/have_debug_sync.inc
+
+CREATE TABLE t1 (
+ event_date date DEFAULT '0000-00-00' NOT NULL,
+ type int(11) DEFAULT '0' NOT NULL,
+ event_id int(11) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (event_date,type,event_id)
+);
+
+INSERT INTO t1 VALUES ('1999-07-10',100100,24), ('1999-07-11',100100,25),
+('1999-07-13',100600,0), ('1999-07-13',100600,4), ('1999-07-13',100600,26),
+('1999-07-14',100600,10), ('1999-07-15',100600,16), ('1999-07-15',100800,45),
+('1999-07-15',101000,47), ('1999-07-16',100800,46), ('1999-07-20',100600,5),
+('1999-07-20',100600,27), ('1999-07-21',100600,11), ('1999-07-22',100600,17),
+('1999-07-23',100100,39), ('1999-07-24',100100,39), ('1999-07-24',100500,40),
+('1999-07-25',100100,39), ('1999-07-27',100600,1), ('1999-07-27',100600,6),
+('1999-07-27',100600,28), ('1999-07-28',100600,12), ('1999-07-29',100500,41),
+('1999-07-29',100600,18), ('1999-07-30',100500,41), ('1999-07-31',100500,41),
+('1999-08-01',100700,34), ('1999-08-03',100600,7), ('1999-08-03',100600,29),
+('1999-08-04',100600,13), ('1999-08-05',100500,42), ('1999-08-05',100600,19),
+('1999-08-06',100500,42), ('1999-08-07',100500,42), ('1999-08-08',100500,42),
+('1999-08-10',100600,2), ('1999-08-10',100600,9), ('1999-08-10',100600,30),
+('1999-08-11',100600,14), ('1999-08-12',100600,20), ('1999-08-17',100500,8),
+('1999-08-17',100600,31), ('1999-08-18',100600,15), ('1999-08-19',100600,22),
+('1999-08-24',100600,3), ('1999-08-24',100600,32), ('1999-08-27',100500,43),
+('1999-08-31',100600,33), ('1999-09-17',100100,37), ('1999-09-18',100100,37),
+('1999-09-19',100100,37), ('2000-12-18',100700,38);
+
+connect (killee, localhost, root);
+
+let $id=`select connection_id()`;
+
+set debug_sync='inside_make_join_statistics signal killme wait_for done';
+send select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
+
+connection default;
+set debug_sync='now wait_for killme';
+--replace_result $id %connection%
+eval kill $id;
+set debug_sync='now signal done';
+
+connection killee;
+--error 1053,1927,2006,2013
+reap;
+
+connection default;
+disconnect killee;
+
+drop table t1;
+
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index af507b1f7ef..6a82a2901c5 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -2493,7 +2493,7 @@ DROP TABLE t1,t2;
# Bug #10650
#
-select x'10' + 0, X'10' + 0, b'10' + 0, B'10' + 0;
+select x'3136' + 0, X'3136' + 0, b'10' + 0, B'10' + 0;
#
# Bug #11398 Bug in field_conv() results in wrong result of join with index
@@ -4289,6 +4289,7 @@ SELECT f1 FROM t1 GROUP BY 1;
SELECT f1 FROM t1 GROUP BY '123' = 'abc';
SELECT 1 FROM t1 GROUP BY 1;
drop table t1;
+set sql_buffer_result= 0;
--echo #
@@ -4479,5 +4480,41 @@ WHERE ( NOT (Use_leap_seconds <= Use_leap_seconds AND Time_zone_id != 1)
OR Time_zone_id <> Time_zone_id )
AND Use_leap_seconds <> 'N';
+--echo #
+--echo # Bug mdev-4274: result of simplification of OR badly merged
+--echo # into embedding AND
+--echo #
+
+CREATE TABLE t1 (a int, b int, INDEX idx(b)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (8,8);
+
+CREATE TABLE t2 (c int, INDEX idx(c)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (8), (9);
+
+EXPLAIN EXTENDED
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+ WHERE 1 IS NULL OR b < 33 AND b = c;
+SELECT * FROM t1 INNER JOIN t2 ON ( c = a )
+ WHERE 1 IS NULL OR b < 33 AND b = c;
+
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug mdev-4413: another manifestations of bug mdev-2474
+--echo # (valgrind complains)
+--echo #
+
+CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,1);
+
+CREATE TABLE t2 (c int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0), (8);
+
+SELECT * FROM t1, t2
+ WHERE c = a AND
+ ( 0 OR ( b BETWEEN 45 AND 300 OR a > 45 AND a < 100 ) AND b = c );
+
+DROP TABLE t1, t2;
+
--echo End of 5.3 tests
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 0a368826ee7..3590dc66187 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9209,5 +9209,66 @@ DROP FUNCTION f2;
DROP FUNCTION f3;
DROP FUNCTION f4;
---echo # End of 5.5 test
+--echo
+--echo Stored procedures and a condition handler in a nested procedure call
+--echo doesn't suppress the condition from being passed on to the calling
+--echo procedure
+--echo
+
+--disable_warnings
+drop procedure if exists p1;
+drop procedure if exists p0;
+--enable_warnings
+
+create table t1 (id int);
+delimiter $$;
+create procedure p1 () begin
+declare i int default 0;
+declare continue handler for not found begin
+select "You should see this message and the warning that generated this" as "message";
+show warnings;
+end;
+select id into i from t1;
+end$$
+create procedure p0 () begin
+declare continue handler for not found begin
+select "You should NOT see this message" as "message";
+end;
+call p1();
+end$$
+delimiter ;$$
+call p0();
+drop procedure p1;
+drop procedure p0;
+drop table t1;
+
+--echo
+--echo Test if stored procedures propagates errors
+--echo
+
+create table t1 (id int primary key);
+delimiter $$;
+create procedure p1 () begin
+insert into t1 values(1);
+insert into t1 values(2);
+insert into t1 values(2);
+insert into t1 values(3);
+end$$
+create procedure p2 () begin
+ declare x int;
+ select id into x from t1 where id=5;
+end$$
+delimiter ;$$
+--error ER_DUP_ENTRY
+call p1();
+show warnings;
+select * from t1;
+call p2();
+
+drop procedure p1;
+drop procedure p2;
+
+drop table t1;
+
+--echo # End of 5.5 test
diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test
index 37f660d6682..e427253f65f 100644
--- a/mysql-test/t/subselect4.test
+++ b/mysql-test/t/subselect4.test
@@ -1865,5 +1865,18 @@ ORDER BY alias1.b;
drop table t1, t2, t3;
+--echo #
+--echo # MDEV-4144 simple subquery causes full scan instead of range scan
+--echo #
+
+CREATE TABLE t1 (id int not null auto_increment, x int not null, primary key(id));
+INSERT INTO t1 (x) VALUES (0),(0),(0);
+
+EXPLAIN
+SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
+SELECT x FROM t1 WHERE id > (SELECT MAX(id) - 1000 FROM t1) ORDER BY x LIMIT 1;
+
+drop table t1;
+
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index efbd2b00f24..bfdc6335f1d 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2482,6 +2482,15 @@ deallocate prepare stmt;
drop table t1,t2;
--echo #
+--echo # MDEV-4335: Unexpected results when selecting on information_schema
+--echo #
+CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL);
+INSERT INTO t1 VALUES ('mysql'),('information_schema');
+SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA);
+DROP TABLE t1;
+
+
+--echo #
--echo # MySQL Bug#13340270: assertion table->sort.record_pointers == __null
--echo #
@@ -2531,5 +2540,49 @@ WHERE (field1) IN ($query);
DROP TABLE t1, t2;
+--echo #
+--echo # MDEV-389: Wrong result (missing row) with semijoin, join_cache_level>4, LEFT JOIN...
+--echo # (testcase only)
+--echo #
+
+# Use another connection to get rid of this test's settings
+connect (con1,localhost,root,,);
+connection con1;
+
+SET join_cache_level = 5;
+SET optimizer_switch = 'semijoin=on';
+
+CREATE TABLE t1 (a INT NOT NULL, b CHAR(1), KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (4,'p'),(1,'q'),(8,'e');
+
+CREATE TABLE t2 (c INT, d CHAR(1), KEY(c), KEY(d)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (4,'f'),(2,'i'),(5,'h'),(3,'q'),(1,'g');
+
+SELECT a, COUNT(*) AS cnt
+FROM t1 LEFT JOIN t2 ON (d = b)
+WHERE a IN ( SELECT c FROM t2 WHERE b > 'k' )
+GROUP BY a ORDER BY a, cnt LIMIT 2;
+
+drop table t1, t2;
+connection default;
+disconnect con1;
+
+--echo #
+--echo # MDEV-4071: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with ...
+--echo #
+CREATE TABLE t1 (b INT, c VARCHAR(1)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (7,'v'),(0,'s');
+
+CREATE TABLE t2 (a INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (0),(8);
+
+SELECT c, SUM( DISTINCT b ) AS sm FROM t1
+WHERE ( 5, 108 ) IN ( SELECT MIN(a), MAX(a) FROM t2 )
+GROUP BY b
+HAVING c <> ( SELECT MAX( c ) FROM t1 )
+ORDER BY sm;
+
+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/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test
index 4c40b2b5487..711f2f4f9b6 100644
--- a/mysql-test/t/subselect_sj_mat.test
+++ b/mysql-test/t/subselect_sj_mat.test
@@ -1677,6 +1677,25 @@ SELECT * FROM t1, t2 WHERE b1 IN ( SELECT b2 FROM t2 WHERE b1 > 'o' ) AND ( b1 <
DROP TABLE t1,t2;
+--echo #
+--echo # MDEV-4465: Reproducible crash (mysqld got signal 11) in multi_delete::initialize_tables with semijoin+materialization
+--echo #
+CREATE TABLE t1 (
+ id int(11) NOT NULL
+);
+
+CREATE TABLE t2 (
+ id int(11) NOT NULL,
+ a_id int(11) DEFAULT NULL
+);
+
+insert into t1 values (1), (2), (3);
+insert into t2 values (1, 1), (2, 1), (3, 1), (4, 2), (5, 3), (6, 3), (7, 3);
+
+delete t2 from t2 where a_id in (select * from (select t1.id from t1 limit 2) as x);
+
+drop table t1,t2;
+
--echo # This must be at the end:
set optimizer_switch=@subselect_sj_mat_tmp;
set join_cache_level=@save_join_cache_level;
diff --git a/mysql-test/t/sum_distinct-big.test b/mysql-test/t/sum_distinct-big.test
index d3710056c9a..fee406ee46d 100644
--- a/mysql-test/t/sum_distinct-big.test
+++ b/mysql-test/t/sum_distinct-big.test
@@ -3,15 +3,23 @@
#
--source include/big_test.inc
+--source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
+set @save_tmp_table_size=@@tmp_table_size;
+set @save_max_heap_table_size=@@max_heap_table_size;
+
+set @save_storage_engine=@@storage_engine;
+
#
# Test the case when distinct values doesn't fit in memory and
# filesort is used (see uniques.cc:merge_walk)
#
+set storage_engine=MYISAM;
+
CREATE TABLE t1 (id INTEGER);
CREATE TABLE t2 (id INTEGER);
@@ -82,3 +90,64 @@ SELECT SUM(DISTINCT id) sm FROM t2;
DROP TABLE t1;
DROP TABLE t2;
+
+SET @@tmp_table_size=@save_tmp_table_size;
+SET @@max_heap_table_size=@save_max_heap_table_size;
+
+--echo #
+--echo # Bug mdev-4311: COUNT(DISTINCT...) requiring a file for Unique
+--echo # (bug #68749)
+--echo #
+
+set @save_storage_engine=@@storage_engine;
+set storage_engine=INNODB;
+
+CREATE TABLE t1 (id INTEGER) ENGINE=InnoDB;
+CREATE TABLE t2 (id INTEGER) ENGINE=InnoDB;
+
+INSERT INTO t1 (id) VALUES (1), (1), (1),(1);
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 (id) SELECT id FROM t1;
+INSERT INTO t1 SELECT id+1 FROM t1;
+INSERT INTO t1 SELECT id+2 FROM t1;
+INSERT INTO t1 SELECT id+4 FROM t1;
+INSERT INTO t1 SELECT id+8 FROM t1;
+INSERT INTO t1 SELECT id+16 FROM t1;
+INSERT INTO t1 SELECT id+32 FROM t1;
+INSERT INTO t1 SELECT id+64 FROM t1;
+INSERT INTO t1 SELECT id+128 FROM t1;
+INSERT INTO t1 SELECT id+256 FROM t1;
+INSERT INTO t1 SELECT id+512 FROM t1;
+INSERT INTO t1 SELECT id+1024 FROM t1;
+INSERT INTO t1 SELECT id+2048 FROM t1;
+INSERT INTO t1 SELECT id+4096 FROM t1;
+INSERT INTO t1 SELECT id+8192 FROM t1;
+
+INSERT INTO t2 SELECT id FROM t1 ORDER BY id*rand();
+INSERT INTO t2 VALUE(NULL);
+
+--echo # With default tmp_table_size / max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+
+set @@tmp_table_size=1024*256;
+
+--echo # With reduced tmp_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+
+set @@tmp_table_size=@save_tmp_table_size;
+SET @@max_heap_table_size=1024*256;
+
+--echo # With reduced max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+
+SET @@max_heap_table_size=@save_max_heap_table_size;
+
+--echo # Back to default tmp_table_size / max_heap_table_size
+SELECT SQL_NO_CACHE count(DISTINCT id) sm FROM t2;
+
+DROP TABLE t1,t2;
+
+set storage_engine=@save_storage_engine;
diff --git a/mysql-test/t/temporal_scale_4283.test b/mysql-test/t/temporal_scale_4283.test
new file mode 100644
index 00000000000..d79ca7caa54
--- /dev/null
+++ b/mysql-test/t/temporal_scale_4283.test
@@ -0,0 +1,13 @@
+#
+# MDEV-4283 Assertion `scale <= precision' fails in strings/decimal.c
+#
+create table t1 (a int);
+insert into t1 values (4),(8);
+select distinct 100 mod timestampadd( week, a, '2002-05-20' ) from t1;
+drop table t1;
+
+create table t1 (i int);
+insert into t1 values (2),(4);
+select distinct convert_tz( '2001-03-21', 'utc', 'met' ) mod i from t1;
+drop table t1;
+
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 989e0d29210..05bc72291cd 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -463,6 +463,31 @@ DROP TABLE t1;
--echo End of 5.1 tests
+#
+# MDEV-4281 Assertion `maybe_null && item->null_value' fails in make_sortkey on CASE with different return types, GROUP_CONCAT, GROUP BY
+#
+create table t1 (d date, t time) engine=myisam;
+insert into t1 values ('2000-12-03','22:55:23'),('2008-05-03','10:19:31');
+select case when d = '2012-12-12' then d else t end as cond, group_concat( d ) from t1 group by cond;
+drop table t1;
+
+--echo #
+--echo # Semantics of the condition <non-nullable datetime field> IS NULL
+--echo # when the field belongs to an inner table of an outer join
+--echo #
+
+create table t1 (a int, b date not null);
+insert t1 values (1, 0), (2, '1999-01-02');
+create table t2 (c int);
+insert t2 values (1),(3);
+
+select * from t2 left join t1 on t1.a=t2.c where t1.a is null;
+select * from t2 left join t1 on t1.a=t2.c where t1.b is null;
+
+drop table t1,t2;
+
+--echo End of 5.3 tests
+
--echo #
--echo # Start of 5.5 tests
--echo #
diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test
index 1f9f7b5412d..f03f3fcf703 100644
--- a/mysql-test/t/varbinary.test
+++ b/mysql-test/t/varbinary.test
@@ -13,7 +13,30 @@ drop table if exists t1;
select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ;
select 0x31+1,concat(0x31)+1,-0xf;
-select x'31',X'ffff'+0;
+select x'31',0xffff+0;
+select X'FFFF'+0;
+
+#
+# Hex string vs hex hybrid
+#
+SELECT x'31'+0, 0x31+0;
+SELECT x'31'+0.1e0, 0x31+0.1e0;
+SELECT x'312E39'+0e0, 0x312E39+0e0;
+SELECT CAST(x'31' AS SIGNED), CAST(0x31 AS SIGNED);
+SELECT CAST(x'31' AS DECIMAL(10,1)), CAST(0x31 AS DECIMAL(10,1));
+SELECT CAST(x'312E39' AS SIGNED), CAST(0x312E39 AS SIGNED);
+SELECT CAST(x'312E39' AS DECIMAL(10,1)), CAST(0x312E39 AS DECIMAL(10,1));
+EXPLAIN EXTENDED SELECT X'FFFF', 0xFFFF;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (X'31'),(0x31);
+INSERT INTO t1 VALUES (X'312E39'),(0x312E39);
+SELECT * FROM t1;
+DROP TABLE t1;
+CREATE TABLE t1 (a DECIMAL(10,1));
+INSERT INTO t1 VALUES (X'31'),(0x31);
+INSERT INTO t1 VALUES (X'312E39'),(0x312E39);
+SELECT * FROM t1;
+DROP TABLE t1;
#
# Test of hex constants in WHERE:
@@ -115,7 +138,7 @@ select 0x41;
select b'01000001';
-select x'41', 0+x'41';
+select x'41', 0+x'3635';
select N'abc', length(N'abc');
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 792859386e9..6c4599740e7 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -1538,4 +1538,16 @@ set session collation_connection=2048;
--error ER_UNKNOWN_COLLATION
set session collation_database=2048;
+#
+# Bug #16044655 CRASH: SETTING DEFAULT VALUE FOR SOME VARIABLES
+#
+--error ER_NO_DEFAULT
+set session rand_seed1=DEFAULT;
+
+#
+# Bug #14211565 CRASH WHEN ATTEMPTING TO SET SYSTEM VARIABLE TO RESULT OF VALUES()
+#
+--error ER_BAD_FIELD_ERROR
+set autocommit = values(v);
+
--echo End of 5.5 tests
diff --git a/mysys/default.c b/mysys/default.c
index 0ba7ed494af..fa9576d16f2 100644
--- a/mysys/default.c
+++ b/mysys/default.c
@@ -826,7 +826,7 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
continue;
/* Configuration File Directives */
- if ((*ptr == '!'))
+ if (*ptr == '!')
{
if (recursion_level >= max_recursion_level)
{
diff --git a/mysys/errors.c b/mysys/errors.c
index 1063cae8856..84b406792af 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates
+ Copyright (c) 2000, 2013, 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
diff --git a/mysys/mf_format.c b/mysys/mf_format.c
index 2b2356c08df..d20ce882459 100644
--- a/mysys/mf_format.c
+++ b/mysys/mf_format.c
@@ -46,7 +46,7 @@ char * fn_format(char * to, const char *name, const char *dir,
else if ((flag & MY_RELATIVE_PATH) && !test_if_hard_path(dev))
{
/* Put 'dir' before the given path */
- strmake(buff,dev,sizeof(buff)-1);
+ strmake_buf(buff, dev);
pos=convert_dirname(dev,dir,NullS);
strmake(pos,buff,sizeof(buff)-1- (int) (pos-dev));
}
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 30f269454c2..5b52998f3ca 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -553,7 +553,8 @@ int init_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, uint key_cache_block_si
if (blocks < 8)
{
my_errno= ENOMEM;
- my_error(EE_OUTOFMEMORY, MYF(0), blocks * keycache->key_cache_block_size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_FATALERROR),
+ blocks * keycache->key_cache_block_size);
goto err;
}
blocks= blocks / 4*3;
diff --git a/mysys/my_lockmem.c b/mysys/my_lockmem.c
index 8f06192d9f8..2e036936c70 100644
--- a/mysys/my_lockmem.c
+++ b/mysys/my_lockmem.c
@@ -43,7 +43,7 @@ uchar *my_malloc_lock(uint size,myf MyFlags)
if (!(ptr=memalign(pagesize,size)))
{
if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG+ME_FATALERROR), size);
DBUG_RETURN(0);
}
success = mlock((uchar*) ptr,size);
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index 1a9caf71380..570ab9675ee 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -44,6 +44,11 @@ void *my_malloc(size_t size, myf my_flags)
my_free(point);
point= NULL;
});
+ DBUG_EXECUTE_IF("simulate_persistent_out_of_memory",
+ {
+ free(point);
+ point= NULL;
+ });
if (point == NULL)
{
@@ -51,9 +56,8 @@ void *my_malloc(size_t size, myf my_flags)
if (my_flags & MY_FAE)
error_handler_hook=fatal_error_handler_hook;
if (my_flags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY,
- MYF(ME_BELL | ME_WAITTANG | ME_NOREFRESH | (my_flags & ME_JUST_INFO)),
- size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_WAITTANG +
+ ME_NOREFRESH + ME_FATALERROR),size);
DBUG_EXECUTE_IF("simulate_out_of_memory",
DBUG_SET("-d,simulate_out_of_memory"););
if (my_flags & MY_FAE)
@@ -94,7 +98,7 @@ void *my_realloc(void *oldpoint, size_t size, myf my_flags)
DBUG_RETURN(oldpoint);
my_errno=errno;
if (my_flags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_WAITTANG + ME_FATALERROR), size);
}
DBUG_PRINT("exit",("ptr: %p", point));
DBUG_RETURN(point);
diff --git a/mysys/my_once.c b/mysys/my_once.c
index 7df9b0a1981..b9232db9b2e 100644
--- a/mysys/my_once.c
+++ b/mysys/my_once.c
@@ -59,7 +59,7 @@ void* my_once_alloc(size_t Size, myf MyFlags)
{
my_errno=errno;
if (MyFlags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),get_size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG+ME_FATALERROR), get_size);
return((uchar*) 0);
}
DBUG_PRINT("test",("my_once_malloc %lu byte malloced", (ulong) get_size));
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index ac16189f3a7..b9ad379f4c4 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -446,7 +446,7 @@ const char *my_thread_name(void)
{
my_thread_id id= my_thread_dbug_id();
sprintf(name_buff,"T@%lu", (ulong) id);
- strmake(tmp->name,name_buff,THREAD_NAME_SIZE);
+ strmake_buf(tmp->name, name_buff);
}
return tmp->name;
}
diff --git a/mysys/my_write.c b/mysys/my_write.c
index 4997a4a804a..10a500c3fb3 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c
index 9c21033eca4..7fd87edda6c 100644
--- a/mysys/thr_alarm.c
+++ b/mysys/thr_alarm.c
@@ -66,6 +66,8 @@ static QUEUE alarm_queue;
static uint max_used_alarms=0;
pthread_t alarm_thread;
+#define MY_THR_ALARM_QUEUE_EXTENT 10
+
#ifdef USE_ALARM_THREAD
static void *alarm_handler(void *arg);
#define reschedule_alarms() mysql_cond_signal(&COND_alarm)
@@ -89,7 +91,8 @@ void init_thr_alarm(uint max_alarms)
alarm_aborted=0;
next_alarm_expire_time= ~ (time_t) 0;
init_queue(&alarm_queue, max_alarms+1, offsetof(ALARM,expire_time), 0,
- compare_ulong, NullS, offsetof(ALARM, index_in_queue)+1, 0);
+ compare_ulong, NullS, offsetof(ALARM, index_in_queue)+1,
+ MY_THR_ALARM_QUEUE_EXTENT);
sigfillset(&full_signal_set); /* Neaded to block signals */
mysql_mutex_init(key_LOCK_alarm, &LOCK_alarm, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_alarm, &COND_alarm, NULL);
@@ -140,7 +143,10 @@ void resize_thr_alarm(uint max_alarms)
than max_alarms
*/
if (alarm_queue.elements < max_alarms)
+ {
resize_queue(&alarm_queue,max_alarms+1);
+ max_used_alarms= alarm_queue.elements;
+ }
mysql_mutex_unlock(&LOCK_alarm);
}
@@ -209,16 +215,10 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
mysql_mutex_lock(&LOCK_alarm); /* Lock from threads & alarms */
if (alarm_queue.elements >= max_used_alarms)
{
- if (alarm_queue.elements == alarm_queue.max_elements)
- {
- DBUG_PRINT("info", ("alarm queue full"));
- fprintf(stderr,"Warning: thr_alarm queue is full\n");
- goto abort;
- }
max_used_alarms=alarm_queue.elements+1;
}
reschedule= (ulong) next_alarm_expire_time > (ulong) next;
- queue_insert(&alarm_queue,(uchar*) alarm_data);
+ queue_insert_safe(&alarm_queue, (uchar*) alarm_data);
assert(alarm_data->index_in_queue > 0);
/* Reschedule alarm if the current one has more than sec left */
@@ -238,11 +238,6 @@ my_bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm_data)
(*alrm)= &alarm_data->alarmed;
DBUG_RETURN(0);
-abort:
- if (alarm_data->malloced)
- my_free(alarm_data);
- mysql_mutex_unlock(&LOCK_alarm);
- one_signal_hand_sigmask(SIG_SETMASK,&old_mask,NULL);
abort_no_unlock:
*alrm= 0; /* No alarm */
DBUG_RETURN(1);
diff --git a/packaging/WiX/mysql_server.wxs.in b/packaging/WiX/mysql_server.wxs.in
index 370830d82db..752dc15304e 100644
--- a/packaging/WiX/mysql_server.wxs.in
+++ b/packaging/WiX/mysql_server.wxs.in
@@ -34,8 +34,9 @@
Languages='1033'
Compressed='yes'
SummaryCodepage='1252'
- Platform='@Platform@'/>
-
+ Platform='@Platform@'
+ InstallScope="perMachine"/>
+
<Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
<!-- Upgrade -->
@@ -44,11 +45,13 @@
Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
IncludeMinimum="yes"
Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
+ IncludeMaximum="yes"
Property="OLDERVERSIONBEINGUPGRADED"
MigrateFeatures="yes"
/>
<UpgradeVersion
Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
+ IncludeMinimum="no"
OnlyDetect="yes"
Property="NEWERVERSIONDETECTED" />
</Upgrade>
diff --git a/packaging/rpm-uln/mysql.spec.sh b/packaging/rpm-uln/mysql.spec.sh
index 3e2c5c3f11c..ec195bc9e16 100644
--- a/packaging/rpm-uln/mysql.spec.sh
+++ b/packaging/rpm-uln/mysql.spec.sh
@@ -268,11 +268,12 @@ Requires: bash
Provides: mysql
# MySQL (with caps) is upstream's spelling of their own RPMs for mysql
-Conflicts: MySQL
+Obsoletes: 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
+Obsoletes: mysql < %{version}-%{release}
+Obsoletes: mysql-advanced < %{version}-%{release}
# Working around perl dependency checking bug in rpm FTTB. Remove later.
%global __perl_requires %{SOURCE999}
@@ -295,8 +296,9 @@ further info.
Summary: The shared libraries required for MySQL clients
Group: Applications/Databases
Requires: /sbin/ldconfig
+Obsoletes: mysql-libs < %{version}-%{release}
+Obsoletes: mysql-libs-advanced < %{version}-%{release}
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
@@ -318,9 +320,10 @@ Requires(preun): initscripts
Requires(postun): initscripts
# mysqlhotcopy needs DBI/DBD support
Requires: perl-DBI, perl-DBD-MySQL
+Obsoletes: MySQL-server
+Obsoletes: mysql-server < %{version}-%{release}
+Obsoletes: mysql-server-advanced < %{version}-%{release}
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
@@ -334,9 +337,10 @@ Summary: Files for development of MySQL applications
Group: Applications/Databases
Requires: mysql%{product_suffix} = %{version}-%{release}
Requires: openssl-devel
+Obsoletes: MySQL-devel
+Obsoletes: mysql-devel < %{version}-%{release}
+Obsoletes: mysql-devel-advanced < %{version}-%{release}
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
@@ -347,8 +351,9 @@ developing MySQL client applications.
Summary: MySQL as an embeddable library
Group: Applications/Databases
+Obsoletes: mysql-embedded < %{version}-%{release}
+Obsoletes: mysql-embedded-advanced < %{version}-%{release}
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
@@ -362,8 +367,9 @@ 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}
+Obsoletes: mysql-embedded-devel < %{version}-%{release}
+Obsoletes: mysql-embedded-devel-advanced < %{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
@@ -376,9 +382,10 @@ Summary: The test suite distributed with MySQL
Group: Applications/Databases
Requires: mysql%{product_suffix} = %{version}-%{release}
Requires: mysql-server%{product_suffix} = %{version}-%{release}
+Obsoletes: MySQL-test
+Obsoletes: mysql-test < %{version}-%{release}
+Obsoletes: mysql-test-advanced < %{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
diff --git a/plugin/audit_null/audit_null.c b/plugin/audit_null/audit_null.c
index be0c70fbd35..fd4cd1d1e87 100644
--- a/plugin/audit_null/audit_null.c
+++ b/plugin/audit_null/audit_null.c
@@ -22,11 +22,16 @@
#define __attribute__(A)
#endif
-static volatile int number_of_calls; /* for SHOW STATUS, see below */
-static volatile int number_of_calls_general_log;
-static volatile int number_of_calls_general_error;
-static volatile int number_of_calls_general_result;
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#endif
+
+static volatile int ncalls; /* for SHOW STATUS, see below */
+static volatile int ncalls_general_log;
+static volatile int ncalls_general_error;
+static volatile int ncalls_general_result;
+FILE *f;
/*
Initialize the plugin at server start or plugin installation.
@@ -44,11 +49,16 @@ static volatile int number_of_calls_general_result;
static int audit_null_plugin_init(void *arg __attribute__((unused)))
{
- number_of_calls= 0;
- number_of_calls_general_log= 0;
- number_of_calls_general_error= 0;
- number_of_calls_general_result= 0;
- return(0);
+ ncalls= 0;
+ ncalls_general_log= 0;
+ ncalls_general_error= 0;
+ ncalls_general_result= 0;
+
+ f = fopen("audit_null_tables.log", "w");
+ if (!f)
+ return 1;
+
+ return 0;
}
@@ -67,7 +77,8 @@ static int audit_null_plugin_init(void *arg __attribute__((unused)))
static int audit_null_plugin_deinit(void *arg __attribute__((unused)))
{
- return(0);
+ fclose(f);
+ return 0;
}
@@ -86,7 +97,7 @@ static void audit_null_notify(MYSQL_THD thd __attribute__((unused)),
const void *event)
{
/* prone to races, oh well */
- number_of_calls++;
+ ncalls++;
if (event_class == MYSQL_AUDIT_GENERAL_CLASS)
{
const struct mysql_event_general *event_general=
@@ -94,18 +105,56 @@ static void audit_null_notify(MYSQL_THD thd __attribute__((unused)),
switch (event_general->event_subclass)
{
case MYSQL_AUDIT_GENERAL_LOG:
- number_of_calls_general_log++;
+ ncalls_general_log++;
+ fprintf(f, "%s\t>> %s\n", event_general->general_user,
+ event_general->general_query);
break;
case MYSQL_AUDIT_GENERAL_ERROR:
- number_of_calls_general_error++;
+ ncalls_general_error++;
break;
case MYSQL_AUDIT_GENERAL_RESULT:
- number_of_calls_general_result++;
+ ncalls_general_result++;
break;
default:
break;
}
}
+ else
+ if (event_class == MYSQL_AUDIT_TABLE_CLASS)
+ {
+ const struct mysql_event_table *event_table=
+ (const struct mysql_event_table *) event;
+ const char *ip= event_table->ip ? event_table->ip : "";
+ const char *op= 0;
+ char buf[1024];
+
+ switch (event_table->event_subclass)
+ {
+ case MYSQL_AUDIT_TABLE_LOCK:
+ op= event_table->read_only ? "read" : "write";
+ break;
+ case MYSQL_AUDIT_TABLE_CREATE:
+ op= "create";
+ break;
+ case MYSQL_AUDIT_TABLE_DROP:
+ op= "drop";
+ break;
+ case MYSQL_AUDIT_TABLE_ALTER:
+ op= "alter";
+ break;
+ case MYSQL_AUDIT_TABLE_RENAME:
+ snprintf(buf, sizeof(buf), "rename to %s.%s",
+ event_table->new_database, event_table->new_table);
+ buf[sizeof(buf)-1]= 0;
+ op= buf;
+ break;
+ }
+
+ fprintf(f, "%s[%s] @ %s [%s]\t%s.%s : %s\n",
+ event_table->priv_user, event_table->user,
+ event_table->host, ip,
+ event_table->database, event_table->table, op);
+ }
}
@@ -115,10 +164,8 @@ static void audit_null_notify(MYSQL_THD thd __attribute__((unused)),
static struct st_mysql_audit audit_null_descriptor=
{
- MYSQL_AUDIT_INTERFACE_VERSION, /* interface version */
- NULL, /* release_thd function */
- audit_null_notify, /* notify function */
- { (unsigned long) MYSQL_AUDIT_GENERAL_CLASSMASK } /* class mask */
+ MYSQL_AUDIT_INTERFACE_VERSION, NULL, audit_null_notify,
+ { MYSQL_AUDIT_GENERAL_CLASSMASK | MYSQL_AUDIT_TABLE_CLASSMASK }
};
/*
@@ -127,12 +174,10 @@ static struct st_mysql_audit audit_null_descriptor=
static struct st_mysql_show_var simple_status[]=
{
- { "Audit_null_called", (char *) &number_of_calls, SHOW_INT },
- { "Audit_null_general_log", (char *) &number_of_calls_general_log, SHOW_INT },
- { "Audit_null_general_error", (char *) &number_of_calls_general_error,
- SHOW_INT },
- { "Audit_null_general_result", (char *) &number_of_calls_general_result,
- SHOW_INT },
+ { "Audit_null_called", (char *) &ncalls, SHOW_INT },
+ { "Audit_null_general_log", (char *) &ncalls_general_log, SHOW_INT },
+ { "Audit_null_general_error", (char *) &ncalls_general_error, SHOW_INT },
+ { "Audit_null_general_result", (char *) &ncalls_general_result, SHOW_INT },
{ 0, 0, 0}
};
diff --git a/plugin/auth_examples/CMakeLists.txt b/plugin/auth_examples/CMakeLists.txt
index fb27289770f..f6c2b637067 100644
--- a/plugin/auth_examples/CMakeLists.txt
+++ b/plugin/auth_examples/CMakeLists.txt
@@ -27,5 +27,7 @@ MYSQL_ADD_PLUGIN(qa_auth_server qa_auth_server.c
MYSQL_ADD_PLUGIN(qa_auth_client qa_auth_client.c
MODULE_ONLY COMPONENT Test)
+MYSQL_ADD_PLUGIN(auth_0x0100 auth_0x0100.c MODULE_ONLY COMPONENT Test)
+
MYSQL_ADD_PLUGIN(mysql_clear_password clear_password_client.c
MODULE_ONLY COMPONENT SharedLibraries)
diff --git a/plugin/auth_examples/auth_0x0100.c b/plugin/auth_examples/auth_0x0100.c
new file mode 100644
index 00000000000..d1373b8a0b4
--- /dev/null
+++ b/plugin/auth_examples/auth_0x0100.c
@@ -0,0 +1,91 @@
+/* Copyright (C) 2013 Sergei Golubchik and Monty Program Ab
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; version 2 of the
+ License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+ @file
+
+ auth plugin that uses old structures as of
+ MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100
+
+ To test the old version support.
+ It intentionally uses no constants like CR_OK ok PASSWORD_USED_YES.
+*/
+
+#include <mysql/plugin.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#if 0
+#include <mysql/plugin_auth.h>
+#else
+#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0100
+typedef void MYSQL_PLUGIN_VIO; /* we don't use it here */
+
+typedef struct st_mysql_server_auth_info
+{
+ char *user_name;
+ unsigned int user_name_length;
+ const char *auth_string;
+ unsigned long auth_string_length;
+ char authenticated_as[49];
+ char external_user[512];
+ int password_used;
+ const char *host_or_ip;
+ unsigned int host_or_ip_length;
+} MYSQL_SERVER_AUTH_INFO;
+
+struct st_mysql_auth
+{
+ int interface_version;
+ const char *client_auth_plugin;
+ int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info);
+};
+#endif
+
+static int do_auth_0x0100(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
+{
+ info->password_used= 1;
+ strcpy(info->authenticated_as, "zzzzzzzzzzzzzzzz");
+ memset(info->external_user, 'o', 510);
+ info->external_user[510]='.';
+ info->external_user[511]=0;
+ return vio ? -1 : 0; /* use vio to avoid the 'unused' warning */
+}
+
+static struct st_mysql_auth auth_0x0100_struct=
+{
+ MYSQL_AUTHENTICATION_INTERFACE_VERSION, 0, do_auth_0x0100
+};
+
+maria_declare_plugin(auth_0x0100)
+{
+ MYSQL_AUTHENTICATION_PLUGIN,
+ &auth_0x0100_struct,
+ "auth_0x0100",
+ "Sergei Golubchik",
+ "Test for API 0x0100 support",
+ PLUGIN_LICENSE_GPL,
+ NULL,
+ NULL,
+ 0x0100,
+ NULL,
+ NULL,
+ "1.0",
+ MariaDB_PLUGIN_MATURITY_EXPERIMENTAL,
+}
+maria_declare_plugin_end;
+
diff --git a/plugin/qc_info/CMakeLists.txt b/plugin/qc_info/CMakeLists.txt
new file mode 100644
index 00000000000..f9c58f77466
--- /dev/null
+++ b/plugin/qc_info/CMakeLists.txt
@@ -0,0 +1,4 @@
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/regex
+ ${CMAKE_SOURCE_DIR}/extra/yassl/include)
+
+MYSQL_ADD_PLUGIN(QUERY_CACHE_INFO qc_info.cc)
diff --git a/plugin/qc_info/qc_info.cc b/plugin/qc_info/qc_info.cc
new file mode 100644
index 00000000000..af13b6edf93
--- /dev/null
+++ b/plugin/qc_info/qc_info.cc
@@ -0,0 +1,213 @@
+/*
+ Copyright (c) 2008, Roland Bouman
+ http://rpbouman.blogspot.com/
+ roland.bouman@gmail.com
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the Roland Bouman nor the
+ names of the contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/*
+ * TODO: report query cache flags
+ */
+#ifndef MYSQL_SERVER
+#define MYSQL_SERVER
+#endif
+
+#include <sql_cache.h>
+#include <sql_parse.h> // check_global_access
+#include <sql_acl.h> // PROCESS_ACL
+#include <sql_class.h> // THD
+#include <table.h> // ST_SCHEMA_TABLE
+#include <mysql/plugin.h>
+
+class Accessible_Query_Cache : public Query_cache {
+public:
+ HASH *get_queries()
+ {
+ return &this->queries;
+ }
+} *qc;
+
+bool schema_table_store_record(THD *thd, TABLE *table);
+
+#define MAX_STATEMENT_TEXT_LENGTH 32767
+#define COLUMN_STATEMENT_SCHEMA 0
+#define COLUMN_STATEMENT_TEXT 1
+#define COLUMN_RESULT_BLOCKS_COUNT 2
+#define COLUMN_RESULT_BLOCKS_SIZE 3
+#define COLUMN_RESULT_BLOCKS_SIZE_USED 4
+
+/* ST_FIELD_INFO is defined in table.h */
+static ST_FIELD_INFO qc_info_fields[]=
+{
+ {"STATEMENT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, 0},
+ {"STATEMENT_TEXT", MAX_STATEMENT_TEXT_LENGTH, MYSQL_TYPE_STRING, 0, 0, 0, 0},
+ {"RESULT_BLOCKS_COUNT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, 0, 0},
+ {"RESULT_BLOCKS_SIZE", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
+ {"RESULT_BLOCKS_SIZE_USED", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0, 0, 0, 0},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, 0}
+};
+
+static int qc_info_fill_table(THD *thd, TABLE_LIST *tables,
+ COND *cond)
+{
+ int status= 1;
+ CHARSET_INFO *scs= system_charset_info;
+ TABLE *table= tables->table;
+ HASH *queries = qc->get_queries();
+
+ /* one must have PROCESS privilege to see others' queries */
+ if (check_global_access(thd, PROCESS_ACL, true))
+ return 0;
+
+ if (qc->try_lock(thd))
+ return status;
+
+ /* loop through all queries in the query cache */
+ for (uint i= 0; i < queries->records; i++)
+ {
+ const uchar *query_cache_block_raw;
+ Query_cache_block* query_cache_block;
+ Query_cache_query* query_cache_query;
+ uint result_blocks_count;
+ ulonglong result_blocks_size;
+ ulonglong result_blocks_size_used;
+ Query_cache_block *first_result_block;
+ Query_cache_block *result_block;
+ const char *statement_text;
+ size_t statement_text_length;
+ const char *key, *db;
+ size_t key_length, db_length;
+
+ query_cache_block_raw = my_hash_element(queries, i);
+ query_cache_block = (Query_cache_block*)query_cache_block_raw;
+ if (query_cache_block->type != Query_cache_block::QUERY)
+ continue;
+
+ query_cache_query = query_cache_block->query();
+
+ /* Get the actual SQL statement for this query cache query */
+ statement_text = (const char*)query_cache_query->query();
+ statement_text_length = strlen(statement_text);
+ /* We truncate SQL statements up to MAX_STATEMENT_TEXT_LENGTH in our I_S table */
+ table->field[COLUMN_STATEMENT_TEXT]->store((char*)statement_text,
+ min(statement_text_length, MAX_STATEMENT_TEXT_LENGTH), scs);
+
+ /* get the entire key that identifies this query cache query */
+ key = (const char*)query_cache_query_get_key(query_cache_block_raw,
+ &key_length, 0);
+ /* The database against which the statement is executed is part of the
+ query cache query key
+ */
+ compile_time_assert(QUERY_CACHE_DB_LENGTH_SIZE == 2);
+ db= key + statement_text_length + 1 + QUERY_CACHE_DB_LENGTH_SIZE;
+ db_length= uint2korr(db - QUERY_CACHE_DB_LENGTH_SIZE);
+
+ table->field[COLUMN_STATEMENT_SCHEMA]->store(db, db_length, scs);
+
+ /* If we have result blocks, process them */
+ first_result_block= query_cache_query->result();
+ if(first_result_block)
+ {
+ /* initialize so we can loop over the result blocks*/
+ result_block= first_result_block;
+ result_blocks_count = 1;
+ result_blocks_size = result_block->length;
+ result_blocks_size_used = result_block->used;
+
+ /* loop over the result blocks*/
+ while((result_block= result_block->next)!=first_result_block)
+ {
+ /* calculate total number of result blocks */
+ result_blocks_count++;
+ /* calculate total size of result blocks */
+ result_blocks_size += result_block->length;
+ /* calculate total of used size of result blocks */
+ result_blocks_size_used += result_block->used;
+ }
+ }
+ else
+ {
+ result_blocks_count = 0;
+ result_blocks_size = 0;
+ result_blocks_size_used = 0;
+ }
+ table->field[COLUMN_RESULT_BLOCKS_COUNT]->store(result_blocks_count, 0);
+ table->field[COLUMN_RESULT_BLOCKS_SIZE]->store(result_blocks_size, 0);
+ table->field[COLUMN_RESULT_BLOCKS_SIZE_USED]->store(result_blocks_size_used, 0);
+
+ if (schema_table_store_record(thd, table))
+ goto cleanup;
+ }
+ status = 0;
+
+cleanup:
+ qc->unlock();
+ return status;
+}
+
+static int qc_info_plugin_init(void *p)
+{
+ ST_SCHEMA_TABLE *schema= (ST_SCHEMA_TABLE *)p;
+
+ schema->fields_info= qc_info_fields;
+ schema->fill_table= qc_info_fill_table;
+
+#ifdef _WIN32
+ qc = (Accessible_Query_Cache *)
+ GetProcAddress(GetModuleHandle(NULL), "?query_cache@@3VQuery_cache@@A");
+#else
+ qc = (Accessible_Query_Cache *)&query_cache;
+#endif
+
+ return qc == 0;
+}
+
+
+static struct st_mysql_information_schema qc_info_plugin=
+{ MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION };
+
+/*
+ Plugin library descriptor
+*/
+
+maria_declare_plugin(query_cache_info)
+{
+ MYSQL_INFORMATION_SCHEMA_PLUGIN,
+ &qc_info_plugin,
+ "QUERY_CACHE_INFO",
+ "Roland Bouman",
+ "Lists all queries in the query cache.",
+ PLUGIN_LICENSE_BSD,
+ qc_info_plugin_init, /* Plugin Init */
+ 0, /* Plugin Deinit */
+ 0x0100, /* version, hex */
+ NULL, /* status variables */
+ NULL, /* system variables */
+ "1.0", /* version as a string */
+ MariaDB_PLUGIN_MATURITY_ALPHA
+}
+maria_declare_plugin_end;
+
diff --git a/regex/my_regex.h b/regex/my_regex.h
index 30896e29b91..1f96b8c461e 100644
--- a/regex/my_regex.h
+++ b/regex/my_regex.h
@@ -28,7 +28,7 @@ typedef struct {
/* === regcomp.c === */
-typedef int (*my_regex_stack_check_t)();
+typedef int (*my_regex_stack_check_t)(int);
extern int my_regcomp(my_regex_t *, const char *, int, CHARSET_INFO *charset);
#define REG_BASIC 0000
#define REG_EXTENDED 0001
diff --git a/regex/regcomp.c b/regex/regcomp.c
index 6e2d2511fc1..abc18174f56 100644
--- a/regex/regcomp.c
+++ b/regex/regcomp.c
@@ -227,7 +227,7 @@ int stop; /* character this ERE should end at */
while (MORE() && (c = PEEK()) != '|' && c != stop)
{
if (my_regex_enough_mem_in_stack &&
- my_regex_enough_mem_in_stack())
+ my_regex_enough_mem_in_stack(0))
{
SETERROR(REG_ESPACE);
return;
diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql
index 878555e9458..a222d22b670 100644
--- a/scripts/mysql_system_tables_data.sql
+++ b/scripts/mysql_system_tables_data.sql
@@ -1,5 +1,4 @@
--- Copyright (c) 2007 MySQL AB, 2008 Sun Microsystems, Inc.
--- Use is subject to license terms.
+-- Copyright (c) 2007, 2013, 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
@@ -21,7 +20,12 @@
-- When setting up a "cross bootstrap" database (e.g., creating data on a Unix
-- host which will later be included in a Windows zip file), any lines
-- containing "@current_hostname" are filtered out by mysql_install_db.
-set @current_hostname= @@hostname;
+
+-- Get the hostname, if the hostname has any wildcard character like "_" or "%"
+-- add escape character in front of wildcard character to convert "_" or "%" to
+-- a plain character
+SET @get_hostname= @@hostname;
+SELECT REPLACE((SELECT REPLACE(@get_hostname,'_','\_')),'%','\%') INTO @current_hostname;
-- Fill "db" table with default grants for anyone to
@@ -33,10 +37,9 @@ INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0;
DROP TABLE tmp_db;
--- Fill "users" table with default users allowing root access
--- from local machine if "users" table didn't exist before
+-- Fill "user" table with default users allowing root access
+-- from local machine if "user" table didn't exist before
CREATE TEMPORARY TABLE tmp_user LIKE user;
-set @current_hostname= @@hostname;
INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');
REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','' FROM dual WHERE LOWER( @current_hostname) != 'localhost';
REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','');
diff --git a/sql-common/client.c b/sql-common/client.c
index c8ec031c95c..c81fe6a8a69 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -776,7 +776,7 @@ restart:
len-=2;
if (protocol_41(mysql) && (char) pos[0] == '#')
{
- strmake(net->sqlstate, (char*) pos+1, SQLSTATE_LENGTH);
+ strmake_buf(net->sqlstate, (char*) pos+1);
pos+= SQLSTATE_LENGTH+1;
}
else
@@ -2198,7 +2198,10 @@ mysql_autodetect_character_set(MYSQL *mysql)
#ifdef __WIN__
char cpbuf[64];
{
- my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int) GetConsoleCP());
+ UINT cp= GetConsoleCP();
+ if (cp == 0)
+ cp= GetACP();
+ my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int)cp);
csname= my_os_charset_to_mysql_charset(cpbuf);
}
#elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO)
@@ -2569,8 +2572,6 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
mysql->server_version, mysql->server_capabilities,
mysql->server_status, mysql->client_flag));
- compile_time_assert(MYSQL_USERNAME_LENGTH == USERNAME_LENGTH);
-
/* This needs to be changed as it's not useful with big packets */
if (mysql->user[0])
strmake(end, mysql->user, USERNAME_LENGTH);
@@ -3119,7 +3120,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
bzero((char*) &UNIXaddr, sizeof(UNIXaddr));
UNIXaddr.sun_family= AF_UNIX;
- strmake(UNIXaddr.sun_path, unix_socket, sizeof(UNIXaddr.sun_path)-1);
+ strmake_buf(UNIXaddr.sun_path, unix_socket);
if (connect_sync_or_async(mysql, net, sock,
(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr)))
{
@@ -3413,6 +3414,12 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
strmov(mysql->server_version,(char*) net->read_pos+1);
mysql->port=port;
+ /* remove the rpl hack from the version string, see RPL_VERSION_HACK comment */
+ if (mysql->server_capabilities & CLIENT_PLUGIN_AUTH &&
+ strncmp(mysql->server_version, RPL_VERSION_HACK,
+ sizeof(RPL_VERSION_HACK) - 1) == 0)
+ mysql->server_version+= sizeof(RPL_VERSION_HACK) - 1;
+
if (pkt_end >= end + SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323 + 1)
{
/*
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index 948e0e037df..057976bf9a4 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -204,9 +204,12 @@ INSTALL_DEBUG_TARGET(mysqld
PDB_DESTINATION ${INSTALL_SBINDIR}/debug
RENAME mysqld-debug)
+INCLUDE(${CMAKE_SOURCE_DIR}/cmake/bison.cmake)
+
# Handle out-of-source build from source package with possibly broken
# bison. Copy bison output to from source to build directory, if not already
# there
+IF (NOT BISON_USABLE)
IF (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.cc)
IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc)
@@ -217,8 +220,8 @@ IF (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
ENDIF()
ENDIF()
ENDIF()
+ENDIF()
-INCLUDE(${CMAKE_SOURCE_DIR}/cmake/bison.cmake)
RUN_BISON(
${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
@@ -286,12 +289,9 @@ ADD_CUSTOM_TARGET(distclean
IF(INSTALL_LAYOUT STREQUAL "STANDALONE")
-# We need to create empty directories (data/test) the installation.
-# This does not work with current CPack due to http://www.cmake.org/Bug/view.php?id=8767
-# Avoid completely empty directories and install dummy file instead.
-SET(DUMMY_FILE ${CMAKE_CURRENT_BINARY_DIR}/db.opt )
-FILE(WRITE ${DUMMY_FILE} "")
-INSTALL(FILES ${DUMMY_FILE} DESTINATION data/test COMPONENT DataFiles)
+# Copy db.opt into data/test/
+SET(DBOPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/db.opt )
+INSTALL(FILES ${DBOPT_FILE} DESTINATION data/test COMPONENT DataFiles)
# Install initial database on windows
IF(NOT CMAKE_CROSSCOMPILING)
diff --git a/sql/db.opt b/sql/db.opt
new file mode 100644
index 00000000000..d8429c4e0de
--- /dev/null
+++ b/sql/db.opt
@@ -0,0 +1,2 @@
+default-character-set=latin1
+default-collation=latin1_swedish_ci
diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc
index 14927a66915..37dff0da714 100644
--- a/sql/event_db_repository.cc
+++ b/sql/event_db_repository.cc
@@ -55,7 +55,7 @@ const TABLE_FIELD_TYPE event_table_fields[ET_FIELD_COUNT] =
},
{
{ C_STRING_WITH_LEN("definer") },
- { C_STRING_WITH_LEN("char(77)") },
+ { C_STRING_WITH_LEN("char(") },
{ C_STRING_WITH_LEN("utf8") }
},
{
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 9af57f669e4..ef5ef5357de 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -875,7 +875,10 @@ static void make_sortkey(register SORTPARAM *param,
{
MYSQL_TIME buf;
if (item->get_date_result(&buf, TIME_FUZZY_DATE | TIME_INVALID_DATES))
- DBUG_ASSERT(maybe_null && item->null_value);
+ {
+ DBUG_ASSERT(maybe_null);
+ DBUG_ASSERT(item->null_value);
+ }
else
value= pack_time(&buf);
}
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index b10de0362f2..838c1c374d8 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2005, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2005, 2013, 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
@@ -63,6 +63,8 @@
#include "key.h"
#include "sql_plugin.h"
#include "table.h" /* HA_DATA_PARTITION */
+#include "sql_show.h" // append_identifier
+#include "sql_admin.h" // SQL_ADMIN_MSG_TEXT_SIZE
#include "debug_sync.h"
@@ -275,6 +277,7 @@ void ha_partition::init_handler_variables()
m_rec_length= 0;
m_last_part= 0;
m_rec0= 0;
+ m_err_rec= NULL;
m_curr_key_info[0]= NULL;
m_curr_key_info[1]= NULL;
m_part_func_monotonicity_info= NON_MONOTONIC;
@@ -1042,10 +1045,11 @@ int ha_partition::preload_keys(THD *thd, HA_CHECK_OPT *check_opt)
0 Success
*/
-static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
- handler *file, uint flag)
+int ha_partition::handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
+ uint part_id, uint flag)
{
int error;
+ handler *file= m_file[part_id];
DBUG_ENTER("handle_opt_part");
DBUG_PRINT("enter", ("flag = %u", flag));
@@ -1054,9 +1058,27 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
else if (flag == ANALYZE_PARTS)
error= file->ha_analyze(thd, check_opt);
else if (flag == CHECK_PARTS)
+ {
error= file->ha_check(thd, check_opt);
+ if (!error ||
+ error == HA_ADMIN_ALREADY_DONE ||
+ error == HA_ADMIN_NOT_IMPLEMENTED)
+ {
+ if (check_opt->flags & (T_MEDIUM | T_EXTEND))
+ error= check_misplaced_rows(part_id, false);
+ }
+ }
else if (flag == REPAIR_PARTS)
+ {
error= file->ha_repair(thd, check_opt);
+ if (!error ||
+ error == HA_ADMIN_ALREADY_DONE ||
+ error == HA_ADMIN_NOT_IMPLEMENTED)
+ {
+ if (check_opt->flags & (T_MEDIUM | T_EXTEND))
+ error= check_misplaced_rows(part_id, true);
+ }
+ }
else if (flag == ASSIGN_KEYCACHE_PARTS)
error= file->assign_to_keycache(thd, check_opt);
else if (flag == PRELOAD_KEYS_PARTS)
@@ -1078,11 +1100,11 @@ static int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
TODO: move this into the handler, or rewrite mysql_admin_table.
*/
static bool print_admin_msg(THD* thd, const char* msg_type,
- const char* db_name, const char* table_name,
+ const char* db_name, String &table_name,
const char* op_name, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 6, 7);
static bool print_admin_msg(THD* thd, const char* msg_type,
- const char* db_name, const char* table_name,
+ const char* db_name, String &table_name,
const char* op_name, const char *fmt, ...)
{
va_list args;
@@ -1103,7 +1125,7 @@ static bool print_admin_msg(THD* thd, const char* msg_type,
return TRUE;
}
- length=(uint) (strxmov(name, db_name, ".", table_name,NullS) - name);
+ length=(uint) (strxmov(name, db_name, ".", table_name.c_ptr_safe(), NullS) - name);
/*
TODO: switch from protocol to push_warning here. The main reason we didn't
it yet is parallel repair. Due to following trace:
@@ -1175,15 +1197,14 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
part= i * num_subparts + j;
DBUG_PRINT("info", ("Optimize subpartition %u (%s)",
part, sub_elem->partition_name));
- if ((error= handle_opt_part(thd, check_opt, m_file[part], flag)))
+ if ((error= handle_opt_part(thd, check_opt, part, flag)))
{
/* print a line which partition the error belongs to */
if (error != HA_ADMIN_NOT_IMPLEMENTED &&
error != HA_ADMIN_ALREADY_DONE &&
error != HA_ADMIN_TRY_ALTER)
{
- print_admin_msg(thd, "error", table_share->db.str,
- table->alias.c_ptr(),
+ print_admin_msg(thd, "error", table_share->db.str, table->alias,
opt_op_name[flag],
"Subpartition %s returned error",
sub_elem->partition_name);
@@ -1202,15 +1223,14 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
{
DBUG_PRINT("info", ("Optimize partition %u (%s)", i,
part_elem->partition_name));
- if ((error= handle_opt_part(thd, check_opt, m_file[i], flag)))
+ if ((error= handle_opt_part(thd, check_opt, i, flag)))
{
/* print a line which partition the error belongs to */
if (error != HA_ADMIN_NOT_IMPLEMENTED &&
error != HA_ADMIN_ALREADY_DONE &&
error != HA_ADMIN_TRY_ALTER)
{
- print_admin_msg(thd, "error", table_share->db.str,
- table->alias.c_ptr(),
+ print_admin_msg(thd, "error", table_share->db.str, table->alias,
opt_op_name[flag], "Partition %s returned error",
part_elem->partition_name);
}
@@ -3557,7 +3577,7 @@ exit:
Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc.
new_data is always record[0]
- old_data is normally record[1] but may be anything
+ old_data is always record[1]
*/
int ha_partition::update_row(const uchar *old_data, uchar *new_data)
@@ -3568,6 +3588,7 @@ int ha_partition::update_row(const uchar *old_data, uchar *new_data)
longlong func_value;
timestamp_auto_set_type orig_timestamp_type= table->timestamp_field_type;
DBUG_ENTER("ha_partition::update_row");
+ m_err_rec= NULL;
/*
We need to set timestamp field once before we calculate
@@ -3585,6 +3606,25 @@ int ha_partition::update_row(const uchar *old_data, uchar *new_data)
m_part_info->err_value= func_value;
goto exit;
}
+ /*
+ The protocol for updating a row is:
+ 1) position the handler (cursor) on the row to be updated,
+ either through the last read row (rnd or index) or by rnd_pos.
+ 2) call update_row with both old and new full records as arguments.
+
+ This means that m_last_part should already be set to actual partition
+ where the row was read from. And if that is not the same as the
+ calculated part_id we found a misplaced row, we return an error to
+ notify the user that something is broken in the row distribution
+ between partitions! Since we don't check all rows on read, we return an
+ error instead of correcting m_last_part, to make the user aware of the
+ problem!
+ */
+ if (old_part_id != m_last_part)
+ {
+ m_err_rec= old_data;
+ DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
+ }
m_last_part= new_part_id;
start_part_bulk_insert(thd, new_part_id);
@@ -3690,12 +3730,34 @@ int ha_partition::delete_row(const uchar *buf)
int error;
THD *thd= ha_thd();
DBUG_ENTER("ha_partition::delete_row");
+ m_err_rec= NULL;
if ((error= get_part_for_delete(buf, m_rec0, m_part_info, &part_id)))
{
DBUG_RETURN(error);
}
- m_last_part= part_id;
+ /*
+ The protocol for deleting a row is:
+ 1) position the handler (cursor) on the row to be deleted,
+ either through the last read row (rnd or index) or by rnd_pos.
+ 2) call delete_row with the full record as argument.
+
+ This means that m_last_part should already be set to actual partition
+ where the row was read from. And if that is not the same as the
+ calculated part_id we found a misplaced row, we return an error to
+ notify the user that something is broken in the row distribution
+ between partitions! Since we don't check all rows on read, we return an
+ error instead of forwarding the delete to the correct (m_last_part)
+ partition!
+ TODO: change the assert in InnoDB into an error instead and make this one
+ an assert instead and remove the get_part_for_delete()!
+ */
+ if (part_id != m_last_part)
+ {
+ m_err_rec= buf;
+ DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
+ }
+
tmp_disable_binlog(thd);
error= m_file[part_id]->ha_delete_row(buf);
reenable_binlog(thd);
@@ -4541,7 +4603,6 @@ int ha_partition::index_init(uint inx, bool sorted)
file= m_file;
do
{
- /* TODO RONM: Change to index_init() when code is stable */
if (bitmap_is_set(&(m_part_info->used_partitions), (file - m_file)))
if ((error= (*file)->ha_index_init(inx, sorted)))
{
@@ -6994,6 +7055,57 @@ enum row_type ha_partition::get_row_type() const
}
+void ha_partition::append_row_to_str(String &str)
+{
+ Field **field_ptr;
+ const uchar *rec;
+ bool is_rec0= !m_err_rec || m_err_rec == table->record[0];
+ if (is_rec0)
+ rec= table->record[0];
+ else
+ rec= m_err_rec;
+ // If PK, use full PK instead of full part field array!
+ if (table->s->primary_key != MAX_KEY)
+ {
+ KEY *key= table->key_info + table->s->primary_key;
+ KEY_PART_INFO *key_part= key->key_part;
+ KEY_PART_INFO *key_part_end= key_part + key->key_parts;
+ if (!is_rec0)
+ set_key_field_ptr(key, rec, table->record[0]);
+ for (; key_part != key_part_end; key_part++)
+ {
+ Field *field= key_part->field;
+ str.append(" ");
+ str.append(field->field_name);
+ str.append(":");
+ field_unpack(&str, field, rec, 0, false);
+ }
+ if (!is_rec0)
+ set_key_field_ptr(key, table->record[0], rec);
+ }
+ else
+ {
+ if (!is_rec0)
+ set_field_ptr(m_part_info->full_part_field_array, rec,
+ table->record[0]);
+ /* No primary key, use full partition field array. */
+ for (field_ptr= m_part_info->full_part_field_array;
+ *field_ptr;
+ field_ptr++)
+ {
+ Field *field= *field_ptr;
+ str.append(" ");
+ str.append(field->field_name);
+ str.append(":");
+ field_unpack(&str, field, rec, 0, false);
+ }
+ if (!is_rec0)
+ set_field_ptr(m_part_info->full_part_field_array, table->record[0],
+ rec);
+ }
+}
+
+
void ha_partition::print_error(int error, myf errflag)
{
THD *thd= ha_thd();
@@ -7002,24 +7114,72 @@ void ha_partition::print_error(int error, myf errflag)
/* Should probably look for my own errors first */
DBUG_PRINT("enter", ("error: %d", error));
- if ((error == HA_ERR_NO_PARTITION_FOUND) &&
- ! (thd->lex->alter_info.flags & ALTER_TRUNCATE_PARTITION))
- m_part_info->print_no_partition_found(table);
- else
+ if (error == HA_ERR_NO_PARTITION_FOUND)
{
- /* In case m_file has not been initialized, like in bug#42438 */
- if (m_file)
+ switch(thd_sql_command(thd))
{
- if (m_last_part >= m_tot_parts)
+ case SQLCOM_DELETE:
+ case SQLCOM_DELETE_MULTI:
+ case SQLCOM_UPDATE:
+ case SQLCOM_UPDATE_MULTI:
+ if (m_err_rec)
{
- DBUG_ASSERT(0);
- m_last_part= 0;
+ uint max_length;
+ char buf[MAX_KEY_LENGTH];
+ const char *msg= "Found a row in wrong partition (";
+ String str(buf,sizeof(buf),system_charset_info);
+ uint32 part_id;
+ /* Should only happen on DELETE or UPDATE! */
+ str.length(0);
+ str.append_ulonglong(m_last_part);
+ str.append(" != ");
+ if (!get_part_for_delete(m_err_rec, m_rec0, m_part_info, &part_id))
+ {
+ str.append_ulonglong(part_id);
+ }
+ str.append(")");
+ append_row_to_str(str);
+ /* Log this error, so the DBA can notice it and fix it! */
+ sql_print_error("Table '%-192s' corrupted: %s%s\n"
+ "Please CHECK and REPAIR the table!",
+ table->s->table_name.str, msg, str.c_ptr_safe());
+
+ max_length= (MYSQL_ERRMSG_SIZE-
+ (uint) strlen(msg));
+ if (str.length() >= max_length)
+ {
+ str.length(max_length-4);
+ str.append(STRING_WITH_LEN("..."));
+ }
+ my_printf_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, "%s%s", MYF(0),
+ msg, str.c_ptr_safe());
+ m_err_rec= NULL;
+ DBUG_VOID_RETURN;
+ }
+ default:
+ {
+ if (!(thd->lex->alter_info.flags & ALTER_TRUNCATE_PARTITION))
+ {
+ m_part_info->print_no_partition_found(table);
+ DBUG_VOID_RETURN;
+ }
}
- m_file[m_last_part]->print_error(error, errflag);
+ /* fall through to generic error handling. */
}
- else
- handler::print_error(error, errflag);
}
+
+ /* In case m_file has not been initialized, like in bug#42438 */
+ if (m_file)
+ {
+ if (m_last_part >= m_tot_parts)
+ {
+ DBUG_ASSERT(0);
+ m_last_part= 0;
+ }
+ m_file[m_last_part]->print_error(error, errflag);
+ }
+ else
+ handler::print_error(error, errflag);
DBUG_VOID_RETURN;
}
@@ -7728,6 +7888,288 @@ int ha_partition::indexes_are_disabled(void)
}
+/**
+ Check/fix misplaced rows.
+
+ @param read_part_id Partition to check/fix.
+ @param repair If true, move misplaced rows to correct partition.
+
+ @return Operation status.
+ @retval 0 Success
+ @retval != 0 Error
+*/
+
+int ha_partition::check_misplaced_rows(uint read_part_id, bool repair)
+{
+ int result= 0;
+ uint32 correct_part_id;
+ longlong func_value;
+ longlong num_misplaced_rows= 0;
+
+ DBUG_ENTER("ha_partition::check_misplaced_rows");
+
+ DBUG_ASSERT(m_file);
+
+ if (repair)
+ {
+ /* We must read the full row, if we need to move it! */
+ bitmap_set_all(table->read_set);
+ bitmap_set_all(table->write_set);
+ }
+ else
+ {
+ /* Only need to read the partitioning fields. */
+ bitmap_union(table->read_set, &m_part_info->full_part_field_set);
+ }
+
+ if ((result= m_file[read_part_id]->ha_rnd_init(1)))
+ DBUG_RETURN(result);
+
+ while (true)
+ {
+ if ((result= m_file[read_part_id]->rnd_next(m_rec0)))
+ {
+ if (result == HA_ERR_RECORD_DELETED)
+ continue;
+ if (result != HA_ERR_END_OF_FILE)
+ break;
+
+ if (num_misplaced_rows > 0)
+ {
+ print_admin_msg(ha_thd(), "warning", table_share->db.str, table->alias,
+ opt_op_name[REPAIR_PARTS],
+ "Moved %lld misplaced rows",
+ num_misplaced_rows);
+ }
+ /* End-of-file reached, all rows are now OK, reset result and break. */
+ result= 0;
+ break;
+ }
+
+ result= m_part_info->get_partition_id(m_part_info, &correct_part_id,
+ &func_value);
+ if (result)
+ break;
+
+ if (correct_part_id != read_part_id)
+ {
+ num_misplaced_rows++;
+ if (!repair)
+ {
+ /* Check. */
+ print_admin_msg(ha_thd(), "error", table_share->db.str, table->alias,
+ opt_op_name[CHECK_PARTS],
+ "Found a misplaced row");
+ /* Break on first misplaced row! */
+ result= HA_ADMIN_NEEDS_UPGRADE;
+ break;
+ }
+ else
+ {
+ DBUG_PRINT("info", ("Moving row from partition %d to %d",
+ read_part_id, correct_part_id));
+
+ /*
+ Insert row into correct partition. Notice that there are no commit
+ for every N row, so the repair will be one large transaction!
+ */
+ if ((result= m_file[correct_part_id]->ha_write_row(m_rec0)))
+ {
+ /*
+ We have failed to insert a row, it might have been a duplicate!
+ */
+ char buf[MAX_KEY_LENGTH];
+ String str(buf,sizeof(buf),system_charset_info);
+ str.length(0);
+ if (result == HA_ERR_FOUND_DUPP_KEY)
+ {
+ str.append("Duplicate key found, "
+ "please update or delete the record:\n");
+ result= HA_ADMIN_CORRUPT;
+ }
+ m_err_rec= NULL;
+ append_row_to_str(str);
+
+ /*
+ If the engine supports transactions, the failure will be
+ rollbacked.
+ */
+ if (!m_file[correct_part_id]->has_transactions())
+ {
+ /* Log this error, so the DBA can notice it and fix it! */
+ sql_print_error("Table '%-192s' failed to move/insert a row"
+ " from part %d into part %d:\n%s",
+ table->s->table_name.str,
+ read_part_id,
+ correct_part_id,
+ str.c_ptr_safe());
+ }
+ print_admin_msg(ha_thd(), "error", table_share->db.str, table->alias,
+ opt_op_name[REPAIR_PARTS],
+ "Failed to move/insert a row"
+ " from part %d into part %d:\n%s",
+ read_part_id,
+ correct_part_id,
+ str.c_ptr_safe());
+ break;
+ }
+
+ /* Delete row from wrong partition. */
+ if ((result= m_file[read_part_id]->ha_delete_row(m_rec0)))
+ {
+ if (m_file[correct_part_id]->has_transactions())
+ break;
+ /*
+ We have introduced a duplicate, since we failed to remove it
+ from the wrong partition.
+ */
+ char buf[MAX_KEY_LENGTH];
+ String str(buf,sizeof(buf),system_charset_info);
+ str.length(0);
+ m_err_rec= NULL;
+ append_row_to_str(str);
+
+ /* Log this error, so the DBA can notice it and fix it! */
+ sql_print_error("Table '%-192s': Delete from part %d failed with"
+ " error %d. But it was already inserted into"
+ " part %d, when moving the misplaced row!"
+ "\nPlease manually fix the duplicate row:\n%s",
+ table->s->table_name.str,
+ read_part_id,
+ result,
+ correct_part_id,
+ str.c_ptr_safe());
+ break;
+ }
+ }
+ }
+ }
+
+ int tmp_result= m_file[read_part_id]->ha_rnd_end();
+ DBUG_RETURN(result ? result : tmp_result);
+}
+
+
+#define KEY_PARTITIONING_CHANGED_STR \
+ "KEY () partitioning changed, please run:\nALTER TABLE %s.%s %s"
+
+int ha_partition::check_for_upgrade(HA_CHECK_OPT *check_opt)
+{
+ int error= HA_ADMIN_NEEDS_CHECK;
+ DBUG_ENTER("ha_partition::check_for_upgrade");
+
+ /*
+ This is called even without FOR UPGRADE,
+ if the .frm version is lower than the current version.
+ In that case return that it needs checking!
+ */
+ if (!(check_opt->sql_flags & TT_FOR_UPGRADE))
+ DBUG_RETURN(error);
+
+ /*
+ Partitions will be checked for during their ha_check!
+
+ Check if KEY (sub)partitioning was used and any field's hash calculation
+ differs from 5.1, see bug#14521864.
+ */
+ if (table->s->mysql_version < 50503 && // 5.1 table (<5.5.3)
+ ((m_part_info->part_type == HASH_PARTITION && // KEY partitioned
+ m_part_info->list_of_part_fields) ||
+ (m_is_sub_partitioned && // KEY subpartitioned
+ m_part_info->list_of_subpart_fields)))
+ {
+ Field **field;
+ if (m_is_sub_partitioned)
+ {
+ field= m_part_info->subpart_field_array;
+ }
+ else
+ {
+ field= m_part_info->part_field_array;
+ }
+ for (; *field; field++)
+ {
+ switch ((*field)->real_type()) {
+ case MYSQL_TYPE_TINY:
+ case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_LONG:
+ case MYSQL_TYPE_FLOAT:
+ case MYSQL_TYPE_DOUBLE:
+ case MYSQL_TYPE_NEWDECIMAL:
+ case MYSQL_TYPE_TIMESTAMP:
+ case MYSQL_TYPE_LONGLONG:
+ case MYSQL_TYPE_INT24:
+ case MYSQL_TYPE_TIME:
+ case MYSQL_TYPE_DATETIME:
+ case MYSQL_TYPE_YEAR:
+ case MYSQL_TYPE_NEWDATE:
+ case MYSQL_TYPE_ENUM:
+ case MYSQL_TYPE_SET:
+ {
+ THD *thd= ha_thd();
+ char *part_buf;
+ String db_name, table_name;
+ uint part_buf_len;
+ bool skip_generation= false;
+ partition_info::enum_key_algorithm old_algorithm;
+ old_algorithm= m_part_info->key_algorithm;
+ error= HA_ADMIN_FAILED;
+ append_identifier(ha_thd(), &db_name, table_share->db.str,
+ table_share->db.length);
+ append_identifier(ha_thd(), &table_name, table_share->table_name.str,
+ table_share->table_name.length);
+ if (m_part_info->key_algorithm != partition_info::KEY_ALGORITHM_NONE)
+ {
+ /*
+ Only possible when someone tampered with .frm files,
+ like during tests :)
+ */
+ skip_generation= true;
+ }
+ m_part_info->key_algorithm= partition_info::KEY_ALGORITHM_51;
+ if (skip_generation ||
+ !(part_buf= generate_partition_syntax(m_part_info,
+ &part_buf_len,
+ true,
+ true,
+ NULL,
+ NULL,
+ NULL)) ||
+ /* Also check that the length is smaller than the output field! */
+ (part_buf_len + db_name.length() + table_name.length()) >=
+ (SQL_ADMIN_MSG_TEXT_SIZE -
+ (strlen(KEY_PARTITIONING_CHANGED_STR) - 3)))
+ {
+ print_admin_msg(thd, "error", table_share->db.str, table->alias,
+ opt_op_name[CHECK_PARTS],
+ KEY_PARTITIONING_CHANGED_STR,
+ db_name.c_ptr_safe(), table_name.c_ptr_safe(),
+ "<old partition clause>, but add ALGORITHM = 1"
+ " between 'KEY' and '(' to change the metadata"
+ " without the need of a full table rebuild.");
+ }
+ else
+ {
+ print_admin_msg(thd, "error", table_share->db.str, table->alias,
+ opt_op_name[CHECK_PARTS],
+ KEY_PARTITIONING_CHANGED_STR,
+ db_name.c_ptr_safe(), table_name.c_ptr_safe(),
+ part_buf);
+ }
+ m_part_info->key_algorithm= old_algorithm;
+ DBUG_RETURN(error);
+ }
+ default:
+ /* Not affected! */
+ ;
+ }
+ }
+ }
+
+ DBUG_RETURN(error);
+}
+
+
struct st_mysql_storage_engine partition_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 30262b25bd9..ebf9dcdb842 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -2,7 +2,7 @@
#define HA_PARTITION_INCLUDED
/*
- Copyright (c) 2005, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2005, 2013, 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
@@ -25,13 +25,15 @@
#include "queues.h" /* QUEUE */
enum partition_keywords
-{
+{
PKW_HASH= 0, PKW_RANGE, PKW_LIST, PKW_KEY, PKW_MAXVALUE, PKW_LINEAR,
- PKW_COLUMNS
+ PKW_COLUMNS, PKW_ALGORITHM
};
#define PARTITION_BYTES_IN_POS 2
-#define PARTITION_ENABLED_TABLE_FLAGS (HA_FILE_BASED | HA_REC_NOT_IN_SEQ)
+#define PARTITION_ENABLED_TABLE_FLAGS (HA_FILE_BASED | \
+ HA_REC_NOT_IN_SEQ | \
+ HA_CAN_REPAIR)
#define PARTITION_DISABLED_TABLE_FLAGS (HA_CAN_GEOMETRY | \
HA_CAN_FULLTEXT | \
HA_DUPLICATE_POS | \
@@ -84,6 +86,7 @@ private:
*/
KEY *m_curr_key_info[3]; // Current index
uchar *m_rec0; // table->record[0]
+ const uchar *m_err_rec; // record which gave error
QUEUE m_queue; // Prio queue used by sorted read
/*
Since the partition handler is a handler on top of other handlers, it
@@ -1095,9 +1098,18 @@ public:
virtual bool check_and_repair(THD *thd);
virtual bool auto_repair(int error) const;
virtual bool is_crashed() const;
+ virtual int check_for_upgrade(HA_CHECK_OPT *check_opt);
private:
int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags);
+ int handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt, uint part_id,
+ uint flag);
+ /**
+ Check if the rows are placed in the correct partition. If the given
+ argument is true, then move the rows to the correct partition.
+ */
+ int check_misplaced_rows(uint read_part_id, bool repair);
+ void append_row_to_str(String &str);
public:
/*
-------------------------------------------------------------------------
diff --git a/sql/handler.cc b/sql/handler.cc
index 8f7391511b4..2a6398e9acb 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2009-2011 Monty Program Ab
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -43,6 +43,7 @@
#include "myisam.h"
#include "probes_mysql.h"
#include "debug_sync.h" // DEBUG_SYNC
+#include "sql_audit.h"
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
@@ -285,7 +286,8 @@ handler *get_ha_partition(partition_info *part_info)
}
else
{
- my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(sizeof(ha_partition)));
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR),
+ static_cast<int>(sizeof(ha_partition)));
}
DBUG_RETURN(((handler*) partition));
}
@@ -2158,7 +2160,7 @@ handle_condition(THD *,
{
*cond_hdl= NULL;
/* Grab the error message */
- strmake(buff, msg, sizeof(buff)-1);
+ strmake_buf(buff, msg);
return TRUE;
}
@@ -3503,6 +3505,9 @@ int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt)
}
if ((error= check(thd, check_opt)))
return error;
+ /* Skip updating frm version if not main handler. */
+ if (table->file != this)
+ return error;
return update_frm_version(table);
}
@@ -3755,7 +3760,6 @@ int
handler::ha_delete_table(const char *name)
{
mark_trx_read_write();
-
return delete_table(name);
}
@@ -3788,8 +3792,11 @@ int
handler::ha_create(const char *name, TABLE *form, HA_CREATE_INFO *info)
{
mark_trx_read_write();
-
- return create(name, form, info);
+ int error= create(name, form, info);
+ if (!error &&
+ !(info->options & (HA_LEX_CREATE_TMP_TABLE | HA_CREATE_TMP_ALTER)))
+ mysql_audit_create_table(form);
+ return error;
}
@@ -5169,7 +5176,11 @@ int handler::ha_external_lock(THD *thd, int lock_type)
int error= external_lock(thd, lock_type);
if (error == 0)
+ {
cached_table_flags= table_flags();
+ if (table_share->tmp_table == NO_TMP_TABLE)
+ mysql_audit_external_lock(thd, table_share, lock_type);
+ }
if (MYSQL_HANDLER_RDLOCK_DONE_ENABLED() ||
MYSQL_HANDLER_WRLOCK_DONE_ENABLED() ||
@@ -5224,6 +5235,8 @@ int handler::ha_write_row(uchar *buf)
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");
+ DBUG_EXECUTE_IF("inject_error_ha_write_row",
+ DBUG_RETURN(HA_ERR_INTERNAL_ERROR); );
MYSQL_INSERT_ROW_START(table_share->db.str, table_share->table_name.str);
mark_trx_read_write();
@@ -5252,6 +5265,7 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
(and the old record is in record[1]).
*/
DBUG_ASSERT(new_data == table->record[0]);
+ DBUG_ASSERT(old_data == table->record[1]);
MYSQL_UPDATE_ROW_START(table_share->db.str, table_share->table_name.str);
mark_trx_read_write();
@@ -5271,6 +5285,13 @@ int handler::ha_delete_row(const uchar *buf)
{
int error;
Log_func *log_func= Delete_rows_log_event::binlog_row_logging_function;
+ /*
+ Normally table->record[0] is used, but sometimes table->record[1] is used.
+ */
+ DBUG_ASSERT(buf == table->record[0] ||
+ buf == table->record[1]);
+ DBUG_EXECUTE_IF("inject_error_ha_delete_row",
+ return HA_ERR_INTERNAL_ERROR; );
MYSQL_DELETE_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 7c0c5fac67d..5573f6a5e27 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -285,7 +285,7 @@
(yes, the sum is deliberately inaccurate)
TODO remove the limit, use dynarrays
*/
-#define MAX_HA 15
+#define MAX_HA 64
/*
Use this instead of 0 as the initial value for the slot number of
@@ -318,6 +318,7 @@
#define HA_LEX_CREATE_TMP_TABLE 1
#define HA_LEX_CREATE_IF_NOT_EXISTS 2
#define HA_LEX_CREATE_TABLE_LIKE 4
+#define HA_CREATE_TMP_ALTER 8
#define HA_MAX_REC_LENGTH 65535
/* Table caching type */
diff --git a/sql/innodb_priv.h b/sql/innodb_priv.h
index 5406c292b18..24ee848bed1 100644
--- a/sql/innodb_priv.h
+++ b/sql/innodb_priv.h
@@ -25,7 +25,7 @@ class THD;
int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
bool schema_table_store_record(THD *thd, TABLE *table);
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
-bool check_global_access(THD *thd, ulong want_access);
+bool check_global_access(THD *thd, ulong want_access, bool no_errors=false);
uint strconvert(CHARSET_INFO *from_cs, const char *from,
CHARSET_INFO *to_cs, char *to, uint to_length,
uint *errors);
diff --git a/sql/item.cc b/sql/item.cc
index 2c435eb6a9f..c251e3d6df3 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2010, 2012, Monty Program Ab
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -513,7 +513,7 @@ Item::Item(THD *thd, Item *item):
with_field(item->with_field),
fixed(item->fixed),
is_autogenerated_name(item->is_autogenerated_name),
- with_subselect(item->with_subselect),
+ with_subselect(item->has_subquery()),
collation(item->collation),
cmp_context(item->cmp_context)
{
@@ -1272,11 +1272,15 @@ bool Item::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
DBUG_ASSERT(0);
}
- return 0;
+ return null_value= 0;
err:
+ /*
+ if the item was not null and convertion failed, we return a zero date
+ if allowed, otherwise - null.
+ */
bzero((char*) ltime,sizeof(*ltime));
- return 1;
+ return null_value|= (fuzzydate & (TIME_NO_ZERO_DATE|TIME_NO_ZERO_IN_DATE));
}
bool Item::get_seconds(ulonglong *sec, ulong *sec_part)
@@ -4409,7 +4413,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
if (db_name && lower_case_table_names)
{
/* Convert database to lower case for comparison */
- strmake(name_buff, db_name, sizeof(name_buff)-1);
+ strmake_buf(name_buff, db_name);
my_casedn_str(files_charset_info, name_buff);
db_name= name_buff;
}
@@ -6121,17 +6125,8 @@ inline uint char_val(char X)
X-'a'+10);
}
-Item_hex_string::Item_hex_string()
-{
- hex_string_init("", 0);
-}
-Item_hex_string::Item_hex_string(const char *str, uint str_length)
-{
- hex_string_init(str, str_length);
-}
-
-void Item_hex_string::hex_string_init(const char *str, uint str_length)
+void Item_hex_constant::hex_string_init(const char *str, uint str_length)
{
max_length=(str_length+1)/2;
char *ptr=(char*) sql_alloc(max_length+1);
@@ -6155,7 +6150,7 @@ void Item_hex_string::hex_string_init(const char *str, uint str_length)
unsigned_flag= 1;
}
-longlong Item_hex_string::val_int()
+longlong Item_hex_hybrid::val_int()
{
// following assert is redundant, because fixed=1 assigned in constructor
DBUG_ASSERT(fixed == 1);
@@ -6169,17 +6164,7 @@ longlong Item_hex_string::val_int()
}
-my_decimal *Item_hex_string::val_decimal(my_decimal *decimal_value)
-{
- // following assert is redundant, because fixed=1 assigned in constructor
- DBUG_ASSERT(fixed == 1);
- ulonglong value= (ulonglong)val_int();
- int2my_decimal(E_DEC_FATAL_ERROR, value, TRUE, decimal_value);
- return (decimal_value);
-}
-
-
-int Item_hex_string::save_in_field(Field *field, bool no_conversions)
+int Item_hex_hybrid::save_in_field(Field *field, bool no_conversions)
{
field->set_notnull();
if (field->result_type() == STRING_RESULT)
@@ -6212,22 +6197,27 @@ warn:
}
-void Item_hex_string::print(String *str, enum_query_type query_type)
+void Item_hex_hybrid::print(String *str, enum_query_type query_type)
{
- char *end= (char*) str_value.ptr() + str_value.length(),
- *ptr= end - min(str_value.length(), sizeof(longlong));
+ uint32 len= min(str_value.length(), sizeof(longlong));
+ const char *ptr= str_value.ptr() + str_value.length() - len;
str->append("0x");
- for (; ptr != end ; ptr++)
- {
- str->append(_dig_vec_lower[((uchar) *ptr) >> 4]);
- str->append(_dig_vec_lower[((uchar) *ptr) & 0x0F]);
- }
+ str->append_hex(ptr, len);
}
-bool Item_hex_string::eq(const Item *arg, bool binary_cmp) const
+void Item_hex_string::print(String *str, enum_query_type query_type)
{
- if (arg->basic_const_item() && arg->type() == type())
+ str->append("X'");
+ str->append_hex(str_value.ptr(), str_value.length());
+ str->append("'");
+}
+
+
+bool Item_hex_constant::eq(const Item *arg, bool binary_cmp) const
+{
+ if (arg->basic_const_item() && arg->type() == type() &&
+ arg->cast_to_int_type() == cast_to_int_type())
{
if (binary_cmp)
return !stringcmp(&str_value, &arg->str_value);
@@ -6237,7 +6227,7 @@ bool Item_hex_string::eq(const Item *arg, bool binary_cmp) const
}
-Item *Item_hex_string::safe_charset_converter(CHARSET_INFO *tocs)
+Item *Item_hex_constant::safe_charset_converter(CHARSET_INFO *tocs)
{
Item_string *conv;
String tmp, *str= val_str(&tmp);
@@ -8093,7 +8083,7 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
}
if (!(def_field= (Field*) sql_alloc(field_arg->field->size_of())))
goto error;
- memcpy(def_field, field_arg->field, field_arg->field->size_of());
+ memcpy((void *)def_field, (void *)field_arg->field, field_arg->field->size_of());
def_field->move_field_offset((my_ptrdiff_t)
(def_field->table->s->default_values -
def_field->table->record[0]));
@@ -8229,7 +8219,7 @@ bool Item_insert_value::fix_fields(THD *thd, Item **items)
Field *def_field= (Field*) sql_alloc(field_arg->field->size_of());
if (!def_field)
return TRUE;
- memcpy(def_field, field_arg->field, field_arg->field->size_of());
+ memcpy((void *)def_field, (void *)field_arg->field, field_arg->field->size_of());
def_field->move_field_offset((my_ptrdiff_t)
(def_field->table->insert_values -
def_field->table->record[0]));
@@ -8643,7 +8633,7 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
Item_cache* Item_cache::get_cache(const Item *item)
{
- return get_cache(item, item->result_type());
+ return get_cache(item, item->cmp_type());
}
diff --git a/sql/item.h b/sql/item.h
index bdf6fbe548e..2b0456bd30c 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1,8 +1,8 @@
#ifndef SQL_ITEM_INCLUDED
#define SQL_ITEM_INCLUDED
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009, 2013 Monty Program Ab
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2013 Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -384,6 +384,12 @@ struct Name_resolution_context: Sql_alloc
{
(*error_processor)(thd, error_processor_data);
}
+ st_select_lex *outer_select()
+ {
+ return (outer_context ?
+ outer_context->select_lex :
+ NULL);
+ }
};
@@ -1444,6 +1450,12 @@ public:
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; }
+
+ /**
+ Checks if this item or any of its decendents contains a subquery.
+ */
+ virtual bool has_subquery() const { return with_subselect; }
+
Item* set_expr_cache(THD *thd);
virtual Item_equal *get_item_equal() { return NULL; }
@@ -2724,36 +2736,112 @@ public:
};
-class Item_hex_string: public Item_basic_constant
+/**
+ Item_hex_constant -- a common class for hex literals: X'HHHH' and 0xHHHH
+*/
+class Item_hex_constant: public Item_basic_constant
{
+private:
+ void hex_string_init(const char *str, uint str_length);
public:
- Item_hex_string();
- Item_hex_string(const char *str,uint str_length);
+ Item_hex_constant()
+ {
+ hex_string_init("", 0);
+ }
+ Item_hex_constant(const char *str, uint str_length)
+ {
+ hex_string_init(str, str_length);
+ }
enum Type type() const { return VARBIN_ITEM; }
+ enum Item_result result_type () const { return STRING_RESULT; }
+ enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
+ virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
+ bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
+ bool check_vcol_func_processor(uchar *arg) { return FALSE;}
+ bool basic_const_item() const { return 1; }
+ bool eq(const Item *item, bool binary_cmp) const;
+ String *val_str(String*) { DBUG_ASSERT(fixed == 1); return &str_value; }
+};
+
+
+/**
+ Item_hex_hybrid -- is a class implementing 0xHHHH literals, e.g.:
+ SELECT 0x3132;
+ They can behave as numbers and as strings depending on context.
+*/
+class Item_hex_hybrid: public Item_hex_constant
+{
+public:
+ Item_hex_hybrid(): Item_hex_constant() {}
+ Item_hex_hybrid(const char *str, uint str_length):
+ Item_hex_constant(str, str_length) {}
double val_real()
{
DBUG_ASSERT(fixed == 1);
- return (double) (ulonglong) Item_hex_string::val_int();
+ return (double) (ulonglong) Item_hex_hybrid::val_int();
}
longlong val_int();
- bool basic_const_item() const { return 1; }
- String *val_str(String*) { DBUG_ASSERT(fixed == 1); return &str_value; }
- my_decimal *val_decimal(my_decimal *);
+ my_decimal *val_decimal(my_decimal *decimal_value)
+ {
+ // following assert is redundant, because fixed=1 assigned in constructor
+ DBUG_ASSERT(fixed == 1);
+ ulonglong value= (ulonglong) Item_hex_hybrid::val_int();
+ int2my_decimal(E_DEC_FATAL_ERROR, value, TRUE, decimal_value);
+ return decimal_value;
+ }
int save_in_field(Field *field, bool no_conversions);
- enum Item_result result_type () const { return STRING_RESULT; }
enum Item_result cast_to_int_type() const { return INT_RESULT; }
- enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
- virtual void print(String *str, enum_query_type query_type);
- bool eq(const Item *item, bool binary_cmp) const;
- virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
- bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
- bool check_vcol_func_processor(uchar *arg) { return FALSE;}
-private:
- void hex_string_init(const char *str, uint str_length);
+ void print(String *str, enum_query_type query_type);
+};
+
+
+/**
+ Item_hex_string -- is a class implementing X'HHHH' literals, e.g.:
+ SELECT X'3132';
+ Unlike Item_hex_hybrid, X'HHHH' literals behave as strings in all contexts.
+ X'HHHH' are also used in replication of string constants in case of
+ "dangerous" charsets (sjis, cp932, big5, gbk) who can have backslash (0x5C)
+ as the second byte of a multi-byte character, so using '\' escaping for
+ these charsets is not desirable.
+*/
+class Item_hex_string: public Item_hex_constant
+{
+public:
+ Item_hex_string(): Item_hex_constant() {}
+ Item_hex_string(const char *str, uint str_length):
+ Item_hex_constant(str, str_length) {}
+ longlong val_int()
+ {
+ DBUG_ASSERT(fixed == 1);
+ return longlong_from_string_with_check(str_value.charset(),
+ str_value.ptr(),
+ str_value.ptr()+
+ str_value.length());
+ }
+ double val_real()
+ {
+ DBUG_ASSERT(fixed == 1);
+ return double_from_string_with_check(str_value.charset(),
+ str_value.ptr(),
+ str_value.ptr() +
+ str_value.length());
+ }
+ my_decimal *val_decimal(my_decimal *decimal_value)
+ {
+ return val_decimal_from_string(decimal_value);
+ }
+ int save_in_field(Field *field, bool no_conversions)
+ {
+ field->set_notnull();
+ return field->store(str_value.ptr(), str_value.length(),
+ collation.collation);
+ }
+ enum Item_result cast_to_int_type() const { return STRING_RESULT; }
+ void print(String *str, enum_query_type query_type);
};
-class Item_bin_string: public Item_hex_string
+class Item_bin_string: public Item_hex_hybrid
{
public:
Item_bin_string(const char *str,uint str_length);
@@ -2957,6 +3045,14 @@ public:
DBUG_ASSERT(ref);
return (*ref)->is_outer_field();
}
+
+ /**
+ Checks if the item tree that ref points to contains a subquery.
+ */
+ virtual bool has_subquery() const
+ {
+ return (*ref)->has_subquery();
+ }
};
@@ -4030,6 +4126,7 @@ public:
bool cache_value();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
int save_in_field(Field *field, bool no_conversions);
+ Item_result cmp_type() const { return TIME_RESULT; }
void store_packed(longlong val_arg, Item *example);
/*
Having a clone_item method tells optimizer that this object
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 9a0ed877bf1..dfd60316039 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
@@ -906,7 +906,8 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
}
if ((*is_null= item->null_value))
return ~(ulonglong) 0;
- if (cache_arg && item->const_item() && item->type() != Item::CACHE_ITEM)
+ if (cache_arg && item->const_item() &&
+ !(item->type() == Item::CACHE_ITEM && item->cmp_type() == TIME_RESULT))
{
Query_arena backup;
Query_arena *save_arena= thd->switch_to_arena_for_cached_items(&backup);
@@ -4311,7 +4312,7 @@ Item_cond::fix_fields(THD *thd, Item **ref)
with_sum_func= with_sum_func || item->with_sum_func;
with_field= with_field || item->with_field;
- with_subselect|= item->with_subselect;
+ with_subselect|= item->has_subquery();
if (item->maybe_null)
maybe_null=1;
}
@@ -4978,7 +4979,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref)
return TRUE; /* purecov: inspected */
with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func;
with_field= args[0]->with_field || args[1]->with_field;
- with_subselect|= args[0]->with_subselect | args[1]->with_subselect;
+ with_subselect= args[0]->has_subquery() || args[1]->has_subquery();
max_length= 1;
decimals= 0;
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 96837a8f262..45de3850fcd 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -4373,8 +4373,7 @@ Create_func_make_set::create_native(THD *thd, LEX_STRING name,
return NULL;
}
- Item *param_1= item_list->pop();
- return new (thd->mem_root) Item_func_make_set(param_1, *item_list);
+ return new (thd->mem_root) Item_func_make_set(*item_list);
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index c7c8901af79..14bf71add3d 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
@@ -225,7 +225,7 @@ Item_func::fix_fields(THD *thd, Item **ref)
with_field= with_field || item->with_field;
used_tables_cache|= item->used_tables();
const_item_cache&= item->const_item();
- with_subselect|= item->with_subselect;
+ with_subselect|= item->has_subquery();
}
}
fix_length_and_dec();
@@ -769,13 +769,14 @@ void Item_num_op::find_num_type(void)
{
hybrid_type= DECIMAL_RESULT;
result_precision();
+ fix_decimals();
}
else
{
DBUG_ASSERT(r0 == INT_RESULT && r1 == INT_RESULT);
- decimals= 0;
hybrid_type=INT_RESULT;
result_precision();
+ decimals= 0;
}
DBUG_PRINT("info", ("Type: %s",
(hybrid_type == REAL_RESULT ? "REAL_RESULT" :
@@ -1708,6 +1709,7 @@ void Item_func_div::fix_length_and_dec()
break;
case DECIMAL_RESULT:
result_precision();
+ fix_decimals();
break;
case STRING_RESULT:
case ROW_RESULT:
@@ -1907,6 +1909,16 @@ longlong Item_func_neg::int_op()
if (args[0]->unsigned_flag &&
(ulonglong) value > (ulonglong) LONGLONG_MAX + 1)
return raise_integer_overflow();
+
+ if (value == LONGLONG_MIN)
+ {
+ if (args[0]->unsigned_flag != unsigned_flag)
+ /* negation of LONGLONG_MIN is LONGLONG_MIN. */
+ return LONGLONG_MIN;
+ else
+ return raise_integer_overflow();
+ }
+
return check_integer_overflow(-value, !args[0]->unsigned_flag && value < 0);
}
@@ -5363,7 +5375,7 @@ enum Item_result Item_func_get_user_var::result_type() const
void Item_func_get_user_var::print(String *str, enum_query_type query_type)
{
str->append(STRING_WITH_LEN("(@"));
- str->append(name.str,name.length);
+ append_identifier(current_thd, str, name.str, name.length);
str->append(')');
}
@@ -5990,15 +6002,12 @@ void Item_func_match::init_search(bool no_order)
{
DBUG_ENTER("Item_func_match::init_search");
+ if (!table->file->get_table()) // the handler isn't opened yet
+ DBUG_VOID_RETURN;
+
/* Check if init_search() has been called before */
if (ft_handler)
{
- /*
- We should reset ft_handler as it is cleaned up
- on destruction of FT_SELECT object
- (necessary in case of re-execution of subquery).
- TODO: FT_SELECT should not clean up ft_handler.
- */
if (join_key)
table->file->ft_handler= ft_handler;
DBUG_VOID_RETURN;
@@ -6007,10 +6016,10 @@ void Item_func_match::init_search(bool no_order)
if (key == NO_SUCH_KEY)
{
List<Item> fields;
- fields.push_back(new Item_string(" ",1, cmp_collation.collation));
- for (uint i=1; i < arg_count; i++)
+ fields.push_back(new Item_string(" ", 1, cmp_collation.collation));
+ for (uint i= 1; i < arg_count; i++)
fields.push_back(args[i]);
- concat_ws=new Item_func_concat_ws(fields);
+ concat_ws= new Item_func_concat_ws(fields);
/*
Above function used only to get value and do not need fix_fields for it:
Item_string - basic constant
@@ -6022,10 +6031,10 @@ void Item_func_match::init_search(bool no_order)
if (master)
{
- join_key=master->join_key=join_key|master->join_key;
+ join_key= master->join_key= join_key | master->join_key;
master->init_search(no_order);
- ft_handler=master->ft_handler;
- join_key=master->join_key;
+ ft_handler= master->ft_handler;
+ join_key= master->join_key;
DBUG_VOID_RETURN;
}
@@ -6035,7 +6044,7 @@ void Item_func_match::init_search(bool no_order)
if (!(ft_tmp=key_item()->val_str(&value)))
{
ft_tmp= &value;
- value.set("",0,cmp_collation.collation);
+ value.set("", 0, cmp_collation.collation);
}
if (ft_tmp->charset() != cmp_collation.collation)
@@ -6048,7 +6057,11 @@ void Item_func_match::init_search(bool no_order)
if (join_key && !no_order)
flags|=FT_SORTED;
- ft_handler=table->file->ft_init_ext(flags, key, ft_tmp);
+
+ if (key != NO_SUCH_KEY)
+ thd_proc_info(table->in_use, "FULLTEXT initialization");
+
+ ft_handler= table->file->ft_init_ext(flags, key, ft_tmp);
if (join_key)
table->file->ft_handler=ft_handler;
diff --git a/sql/item_func.h b/sql/item_func.h
index 7b6b60b2914..1fef9938a18 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -431,6 +431,13 @@ public:
void fix_num_length_and_dec();
virtual void find_num_type()= 0; /* To be called from fix_length_and_dec */
+ inline void fix_decimals()
+ {
+ DBUG_ASSERT(result_type() == DECIMAL_RESULT);
+ if (decimals == NOT_FIXED_DEC)
+ set_if_smaller(decimals, max_length - 1);
+ }
+
double val_real();
longlong val_int();
my_decimal *val_decimal(my_decimal *);
@@ -543,12 +550,18 @@ public:
class Item_func_signed :public Item_int_func
{
public:
- Item_func_signed(Item *a) :Item_int_func(a) {}
+ Item_func_signed(Item *a) :Item_int_func(a)
+ {
+ unsigned_flag= 0;
+ }
const char *func_name() const { return "cast_as_signed"; }
longlong val_int();
longlong val_int_from_str(int *error);
void fix_length_and_dec()
- { fix_char_length(args[0]->max_char_length()); unsigned_flag=0; }
+ {
+ fix_char_length(min(args[0]->max_char_length(),
+ MY_INT64_NUM_DECIMAL_DIGITS));
+ }
virtual void print(String *str, enum_query_type query_type);
uint decimal_precision() const { return args[0]->decimal_precision(); }
};
@@ -557,14 +570,11 @@ public:
class Item_func_unsigned :public Item_func_signed
{
public:
- Item_func_unsigned(Item *a) :Item_func_signed(a) {}
- const char *func_name() const { return "cast_as_unsigned"; }
- void fix_length_and_dec()
+ Item_func_unsigned(Item *a) :Item_func_signed(a)
{
- fix_char_length(min(args[0]->max_char_length(),
- DECIMAL_MAX_PRECISION + 2));
- unsigned_flag=1;
+ unsigned_flag= 1;
}
+ const char *func_name() const { return "cast_as_unsigned"; }
longlong val_int();
virtual void print(String *str, enum_query_type query_type);
};
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index e3e80bdf59f..0a7f18e6546 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -561,8 +561,8 @@ longlong Item_func_spatial_mbr_rel::val_int()
args[1]->null_value ||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
!(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
- g1->get_mbr(&mbr1, &dummy) ||
- g2->get_mbr(&mbr2, &dummy))))
+ g1->get_mbr(&mbr1, &dummy) || !mbr1.valid() ||
+ g2->get_mbr(&mbr2, &dummy) || !mbr2.valid())))
return 0;
switch (spatial_rel) {
@@ -687,12 +687,11 @@ longlong Item_func_spatial_rel::val_int()
if ((null_value=
(args[0]->null_value || args[1]->null_value ||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
- !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())))))
+ !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
+ g1->get_mbr(&mbr1, &c_end) || !mbr1.valid() ||
+ g2->get_mbr(&mbr2, &c_end) || !mbr2.valid())))
goto exit;
- g1->get_mbr(&mbr1, &c_end);
- g2->get_mbr(&mbr2, &c_end);
-
umbr= mbr1;
umbr.add_mbr(&mbr2);
collector.set_extent(umbr.xmin, umbr.xmax, umbr.ymin, umbr.ymax);
@@ -826,14 +825,14 @@ String *Item_func_spatial_operation::val_str(String *str_value)
if ((null_value=
(args[0]->null_value || args[1]->null_value ||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
- !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())))))
+ !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
+ g1->get_mbr(&mbr1, &c_end) || !mbr1.valid() ||
+ g2->get_mbr(&mbr2, &c_end) || !mbr2.valid())))
{
str_value= 0;
goto exit;
}
- g1->get_mbr(&mbr1, &c_end);
- g2->get_mbr(&mbr2, &c_end);
mbr1.add_mbr(&mbr2);
collector.set_extent(mbr1.xmin, mbr1.xmax, mbr1.ymin, mbr1.ymax);
@@ -1358,11 +1357,11 @@ longlong Item_func_issimple::val_int()
DBUG_ENTER("Item_func_issimple::val_int");
DBUG_ASSERT(fixed == 1);
- if ((null_value= args[0]->null_value) ||
- !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))
+ if ((null_value= (args[0]->null_value ||
+ !(g= Geometry::construct(&buffer, swkb->ptr(), swkb->length())) ||
+ g->get_mbr(&mbr, &c_end))))
DBUG_RETURN(0);
- g->get_mbr(&mbr, &c_end);
collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax);
if (g->get_class_info()->m_type_id == Geometry::wkb_point)
@@ -1598,11 +1597,11 @@ double Item_func_distance::val_real()
if ((null_value= (args[0]->null_value || args[1]->null_value ||
!(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) ||
- !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())))))
+ !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) ||
+ g1->get_mbr(&mbr1, &c_end) ||
+ g2->get_mbr(&mbr2, &c_end))))
goto mem_error;
- g1->get_mbr(&mbr1, &c_end);
- g2->get_mbr(&mbr2, &c_end);
mbr1.add_mbr(&mbr2);
collector.set_extent(mbr1.xmin, mbr1.xmax, mbr1.ymin, mbr1.ymax);
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index c0a6120b361..a18ded2de80 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -59,6 +59,8 @@ C_MODE_START
#include "../mysys/my_static.h" // For soundex_map
C_MODE_END
+size_t username_char_length= 16;
+
/**
@todo Remove this. It is not safe to use a shared String object.
*/
@@ -2460,38 +2462,16 @@ String *Item_func_elt::val_str(String *str)
}
-void Item_func_make_set::split_sum_func(THD *thd, Item **ref_pointer_array,
- List<Item> &fields)
-{
- item->split_sum_func2(thd, ref_pointer_array, fields, &item, TRUE);
- Item_str_func::split_sum_func(thd, ref_pointer_array, fields);
-}
-
-
void Item_func_make_set::fix_length_and_dec()
{
- uint32 char_length= arg_count - 1; /* Separators */
+ uint32 char_length= arg_count - 2; /* Separators */
- if (agg_arg_charsets_for_string_result(collation, args, arg_count))
+ if (agg_arg_charsets_for_string_result(collation, args + 1, arg_count - 1))
return;
- for (uint i=0 ; i < arg_count ; i++)
+ for (uint i=1 ; i < arg_count ; i++)
char_length+= args[i]->max_char_length();
fix_char_length(char_length);
- used_tables_cache|= item->used_tables();
- not_null_tables_cache&= item->not_null_tables();
- const_item_cache&= item->const_item();
- with_sum_func= with_sum_func || item->with_sum_func;
- with_field= with_field || item->with_field;
-}
-
-
-void Item_func_make_set::update_used_tables()
-{
- Item_func::update_used_tables();
- item->update_used_tables();
- used_tables_cache|=item->used_tables();
- const_item_cache&=item->const_item();
}
@@ -2500,15 +2480,15 @@ String *Item_func_make_set::val_str(String *str)
DBUG_ASSERT(fixed == 1);
ulonglong bits;
bool first_found=0;
- Item **ptr=args;
+ Item **ptr=args+1;
String *result=&my_empty_string;
- bits=item->val_int();
- if ((null_value=item->null_value))
+ bits=args[0]->val_int();
+ if ((null_value=args[0]->null_value))
return NULL;
- if (arg_count < 64)
- bits &= ((ulonglong) 1 << arg_count)-1;
+ if (arg_count < 65)
+ bits &= ((ulonglong) 1 << (arg_count-1))-1;
for (; bits; bits >>= 1, ptr++)
{
@@ -2548,39 +2528,6 @@ String *Item_func_make_set::val_str(String *str)
}
-Item *Item_func_make_set::transform(Item_transformer transformer, uchar *arg)
-{
- DBUG_ASSERT(!current_thd->stmt_arena->is_stmt_prepare());
-
- Item *new_item= item->transform(transformer, arg);
- if (!new_item)
- return 0;
-
- /*
- THD::change_item_tree() should be called only if the tree was
- really transformed, i.e. when a new item has been created.
- Otherwise we'll be allocating a lot of unnecessary memory for
- change records at each execution.
- */
- if (item != new_item)
- current_thd->change_item_tree(&item, new_item);
- return Item_str_func::transform(transformer, arg);
-}
-
-
-void Item_func_make_set::print(String *str, enum_query_type query_type)
-{
- str->append(STRING_WITH_LEN("make_set("));
- item->print(str, query_type);
- if (arg_count)
- {
- str->append(',');
- print_args(str, 0, query_type);
- }
- str->append(')');
-}
-
-
String *Item_func_char::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@@ -2987,7 +2934,7 @@ String *Item_func_conv_charset::val_str(String *str)
return null_value ? 0 : &str_value;
String *arg= args[0]->val_str(str);
uint dummy_errors;
- if (!arg)
+ if (args[0]->null_value)
{
null_value=1;
return 0;
@@ -4497,11 +4444,16 @@ null:
void Item_dyncol_get::print(String *str, enum_query_type query_type)
{
+ /* see create_func_dyncol_get */
+ DBUG_ASSERT(str->length() >= 5);
+ DBUG_ASSERT(strncmp(str->ptr() + str->length() - 5, "cast(", 5) == 0);
+
+ str->length(str->length() - 5); // removing "cast("
str->append(STRING_WITH_LEN("column_get("));
args[0]->print(str, query_type);
str->append(',');
args[1]->print(str, query_type);
- str->append(')');
+ /* let the parent cast item add " as <type>)" */
}
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 786f66e3aab..77179195283 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -25,6 +25,8 @@
#pragma interface /* gcc class implementation */
#endif
+extern size_t username_char_length;
+
class MY_LOCALE;
class Item_str_func :public Item_func
@@ -494,8 +496,8 @@ public:
bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec()
{
- max_length= (USERNAME_LENGTH +
- (HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN);
+ max_length= (username_char_length +
+ HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN;
}
const char *func_name() const { return "user"; }
const char *fully_qualified_func_name() const { return "user()"; }
@@ -544,31 +546,13 @@ public:
class Item_func_make_set :public Item_str_func
{
- Item *item;
String tmp_str;
public:
- Item_func_make_set(Item *a,List<Item> &list) :Item_str_func(list),item(a) {}
+ Item_func_make_set(List<Item> &list) :Item_str_func(list) {}
String *val_str(String *str);
- bool fix_fields(THD *thd, Item **ref)
- {
- DBUG_ASSERT(fixed == 0);
- return ((!item->fixed && item->fix_fields(thd, &item)) ||
- item->check_cols(1) ||
- Item_func::fix_fields(thd, ref));
- }
- void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields);
void fix_length_and_dec();
- void update_used_tables();
const char *func_name() const { return "make_set"; }
-
- bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
- {
- return item->walk(processor, walk_subquery, arg) ||
- Item_str_func::walk(processor, walk_subquery, arg);
- }
- Item *transform(Item_transformer transformer, uchar *arg);
- virtual void print(String *str, enum_query_type query_type);
};
@@ -859,25 +843,37 @@ public:
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::val_int();
- return args[0]->val_int();
+ longlong res= args[0]->val_int();
+ if ((null_value= args[0]->null_value))
+ return 0;
+ return res;
}
double val_real()
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::val_real();
- return args[0]->val_real();
+ double res= args[0]->val_real();
+ if ((null_value= args[0]->null_value))
+ return 0;
+ return res;
}
my_decimal *val_decimal(my_decimal *d)
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::val_decimal(d);
- return args[0]->val_decimal(d);
+ my_decimal *res= args[0]->val_decimal(d);
+ if ((null_value= args[0]->null_value))
+ return NULL;
+ return res;
}
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::get_date(ltime, fuzzydate);
- return args[0]->get_date(ltime, fuzzydate);
+ bool res= args[0]->get_date(ltime, fuzzydate);
+ if ((null_value= args[0]->null_value))
+ return 1;
+ return res;
}
void fix_length_and_dec();
const char *func_name() const { return "convert"; }
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 152b50da616..43855286d4f 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -547,8 +547,19 @@ bool Item_subselect::is_expensive()
if (!cur_join)
continue;
- /* If a subquery is not optimized we cannot estimate its cost. */
- if (!cur_join->join_tab)
+ /*
+ Subqueries whose result is known after optimization are not expensive.
+ Such subqueries have all tables optimized away, thus have no join plan.
+ */
+ if (cur_join->optimized &&
+ (cur_join->zero_result_cause || !cur_join->tables_list))
+ return false;
+
+ /*
+ If a subquery is not optimized we cannot estimate its cost. A subquery is
+ considered optimized if it has a join plan.
+ */
+ if (!(cur_join->optimized && cur_join->join_tab))
return true;
if (sl->first_inner_unit())
@@ -1087,6 +1098,11 @@ enum Item_result Item_singlerow_subselect::result_type() const
return engine->type();
}
+enum Item_result Item_singlerow_subselect::cmp_type() const
+{
+ return engine->cmptype();
+}
+
/*
Don't rely on the result type to calculate field type.
Ask the engine instead.
@@ -3044,12 +3060,13 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row)
{
Item *sel_item;
List_iterator_fast<Item> li(item_list);
- res_type= STRING_RESULT;
+ cmp_type= res_type= STRING_RESULT;
res_field_type= MYSQL_TYPE_VAR_STRING;
for (uint i= 0; (sel_item= li++); i++)
{
item->max_length= sel_item->max_length;
res_type= sel_item->result_type();
+ cmp_type= sel_item->cmp_type();
res_field_type= sel_item->field_type();
item->decimals= sel_item->decimals;
item->unsigned_flag= sel_item->unsigned_flag;
@@ -3060,7 +3077,7 @@ void subselect_engine::set_row(List<Item> &item_list, Item_cache **row)
//psergey-backport-timours: row[i]->store(sel_item);
}
if (item_list.elements > 1)
- res_type= ROW_RESULT;
+ cmp_type= res_type= ROW_RESULT;
}
void subselect_single_select_engine::fix_length_and_dec(Item_cache **row)
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 1da129380e7..25852b55d98 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -286,6 +286,7 @@ public:
bool val_bool();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
enum Item_result result_type() const;
+ enum Item_result cmp_type() const;
enum_field_types field_type() const;
void fix_length_and_dec();
@@ -698,6 +699,7 @@ protected:
THD *thd; /* pointer to current THD */
Item_subselect *item; /* item, that use this engine */
enum Item_result res_type; /* type of results */
+ enum Item_result cmp_type; /* how to compare the results */
enum_field_types res_field_type; /* column type of the results */
bool maybe_null; /* may be null (first item in select) */
public:
@@ -712,7 +714,7 @@ public:
{
result= res;
item= si;
- res_type= STRING_RESULT;
+ cmp_type= res_type= STRING_RESULT;
res_field_type= MYSQL_TYPE_VAR_STRING;
maybe_null= 0;
set_thd(thd_arg);
@@ -752,6 +754,7 @@ public:
virtual uint cols()= 0; /* return number of columns in select */
virtual uint8 uncacheable()= 0; /* query is uncacheable */
enum Item_result type() { return res_type; }
+ enum Item_result cmptype() { return cmp_type; }
enum_field_types field_type() { return res_field_type; }
virtual void exclude()= 0;
virtual bool may_be_null() { return maybe_null; };
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 72e0e637d38..4f4d8588a3a 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -65,7 +65,15 @@ ulonglong Item_sum::ram_limitation(THD *thd)
bool Item_sum::init_sum_func_check(THD *thd)
{
- if (!thd->lex->allow_sum_func)
+ SELECT_LEX *curr_sel= thd->lex->current_select;
+ if (!curr_sel->name_visibility_map)
+ {
+ for (SELECT_LEX *sl= curr_sel; sl; sl= sl->context.outer_select())
+ {
+ curr_sel->name_visibility_map|= (1 << sl-> nest_level);
+ }
+ }
+ if (!(thd->lex->allow_sum_func & curr_sel->name_visibility_map))
{
my_message(ER_INVALID_GROUP_FUNC_USE, ER(ER_INVALID_GROUP_FUNC_USE),
MYF(0));
@@ -136,8 +144,11 @@ bool Item_sum::init_sum_func_check(THD *thd)
bool Item_sum::check_sum_func(THD *thd, Item **ref)
{
+ SELECT_LEX *curr_sel= thd->lex->current_select;
+ nesting_map allow_sum_func= (thd->lex->allow_sum_func &
+ curr_sel->name_visibility_map);
bool invalid= FALSE;
- nesting_map allow_sum_func= thd->lex->allow_sum_func;
+ DBUG_ASSERT(curr_sel->name_visibility_map); // should be set already
/*
The value of max_arg_level is updated if an argument of the set function
contains a column reference resolved against a subquery whose level is
@@ -172,7 +183,7 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
if (!invalid && aggr_level < 0)
{
aggr_level= nest_level;
- aggr_sel= thd->lex->current_select;
+ aggr_sel= curr_sel;
}
/*
By this moment we either found a subquery where the set function is
@@ -309,9 +320,9 @@ bool Item_sum::register_sum_func(THD *thd, Item **ref)
{
SELECT_LEX *sl;
nesting_map allow_sum_func= thd->lex->allow_sum_func;
- for (sl= thd->lex->current_select->master_unit()->outer_select() ;
+ for (sl= thd->lex->current_select->context.outer_select() ;
sl && sl->nest_level > max_arg_level;
- sl= sl->master_unit()->outer_select() )
+ sl= sl->context.outer_select())
{
if (aggr_level < 0 &&
(allow_sum_func & ((nesting_map)1 << sl->nest_level)))
@@ -719,6 +730,14 @@ static int simple_raw_key_cmp(void* arg, const void* key1, const void* key2)
}
+static int item_sum_distinct_walk_for_count(void *element,
+ element_count num_of_dups,
+ void *item)
+{
+ return ((Aggregator_distinct*) (item))->unique_walk_function_for_count(element);
+}
+
+
static int item_sum_distinct_walk(void *element, element_count num_of_dups,
void *item)
{
@@ -1089,7 +1108,12 @@ void Aggregator_distinct::endup()
{
/* go over the tree of distinct keys and calculate the aggregate value */
use_distinct_values= TRUE;
- tree->walk(table, item_sum_distinct_walk, (void*) this);
+ tree_walk_action func;
+ if (item_sum->sum_func() == Item_sum::COUNT_DISTINCT_FUNC)
+ func= item_sum_distinct_walk_for_count;
+ else
+ func= item_sum_distinct_walk;
+ tree->walk(table, func, (void*) this);
use_distinct_values= FALSE;
}
/* prevent consecutive recalculations */
@@ -1466,6 +1490,22 @@ bool Aggregator_distinct::unique_walk_function(void *element)
}
+/*
+ A variant of unique_walk_function() that is to be used with Item_sum_count.
+
+ COUNT is a special aggregate function: it doesn't need the values, it only
+ needs to count them. COUNT needs to know the values are not NULLs, but NULL
+ values are not put into the Unique, so we don't need to check for NULLs here.
+*/
+
+bool Aggregator_distinct::unique_walk_function_for_count(void *element)
+{
+ Item_sum_count *sum= (Item_sum_count *)item_sum;
+ sum->count++;
+ return 0;
+}
+
+
Aggregator_distinct::~Aggregator_distinct()
{
if (tree)
@@ -1581,9 +1621,10 @@ void Item_sum_avg::fix_length_and_dec()
f_scale= args[0]->decimals;
dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale);
}
- else {
+ else
+ {
decimals= min(args[0]->decimals + prec_increment, NOT_FIXED_DEC);
- max_length= args[0]->max_length + prec_increment;
+ max_length= min(args[0]->max_length + prec_increment, float_length(decimals));
}
}
@@ -3287,8 +3328,12 @@ bool Item_func_group_concat::add()
TREE_ELEMENT *el= 0; // Only for safety
if (row_eligible && tree)
{
+ DBUG_EXECUTE_IF("trigger_OOM_in_gconcat_add",
+ DBUG_SET("+d,simulate_persistent_out_of_memory"););
el= tree_insert(tree, table->record[0] + table->s->null_bytes, 0,
tree->custom_arg);
+ DBUG_EXECUTE_IF("trigger_OOM_in_gconcat_add",
+ DBUG_SET("-d,simulate_persistent_out_of_memory"););
/* check if there was enough memory to insert the row */
if (!el)
return 1;
diff --git a/sql/item_sum.h b/sql/item_sum.h
index 40a28d8beae..a954b0f65c1 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -642,6 +642,7 @@ public:
virtual bool arg_is_null();
bool unique_walk_function(void *element);
+ bool unique_walk_function_for_count(void *element);
static int composite_key_cmp(void* arg, uchar* key1, uchar* key2);
};
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 02a7b8511af..69a6dac5381 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -923,16 +923,14 @@ longlong Item_func_dayofmonth::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
- return (longlong) ltime.day;
+ return get_arg0_date(&ltime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.day;
}
longlong Item_func_month::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
- return (longlong) ltime.month;
+ return get_arg0_date(&ltime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.month;
}
@@ -983,16 +981,14 @@ longlong Item_func_hour::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_time(&ltime);
- return ltime.hour;
+ return get_arg0_time(&ltime) ? 0 : ltime.hour;
}
longlong Item_func_minute::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_time(&ltime);
- return ltime.minute;
+ return get_arg0_time(&ltime) ? 0 : ltime.minute;
}
/**
@@ -1002,8 +998,7 @@ longlong Item_func_second::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_time(&ltime);
- return ltime.second;
+ return get_arg0_time(&ltime) ? 0 : ltime.second;
}
@@ -1120,8 +1115,7 @@ longlong Item_func_year::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
- return (longlong) ltime.year;
+ return get_arg0_date(&ltime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.year;
}
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 3e3cd698efc..9b2db9e816e 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -491,6 +491,7 @@ public:
enum Item_result result_type () const { return STRING_RESULT; }
CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; }
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
+ Item_result cmp_type() const { return TIME_RESULT; }
String *val_str(String *str);
longlong val_int();
double val_real();
diff --git a/sql/key.cc b/sql/key.cc
index dd7818119c8..0d3db2d5bf5 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -335,6 +335,70 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
return 0;
}
+
+/**
+ Unpack a field and append it.
+
+ @param[inout] to String to append the field contents to.
+ @param field Field to unpack.
+ @param rec Record which contains the field data.
+ @param max_length Maximum length of field to unpack
+ or 0 for unlimited.
+ @param prefix_key The field is used as a prefix key.
+*/
+
+void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
+ bool prefix_key)
+{
+ String tmp;
+ DBUG_ENTER("field_unpack");
+ if (!max_length)
+ max_length= field->pack_length();
+ if (field)
+ {
+ if (field->is_null())
+ {
+ to->append(STRING_WITH_LEN("NULL"));
+ DBUG_VOID_RETURN;
+ }
+ CHARSET_INFO *cs= field->charset();
+ field->val_str(&tmp);
+ /*
+ For BINARY(N) strip trailing zeroes to make
+ the error message nice-looking
+ */
+ if (field->binary() && field->type() == MYSQL_TYPE_STRING && tmp.length())
+ {
+ const char *tmp_end= tmp.ptr() + tmp.length();
+ while (tmp_end > tmp.ptr() && !*--tmp_end) ;
+ tmp.length(tmp_end - tmp.ptr() + 1);
+ }
+ if (cs->mbmaxlen > 1 && prefix_key)
+ {
+ /*
+ Prefix key, multi-byte charset.
+ For the columns of type CHAR(N), the above val_str()
+ call will return exactly "key_part->length" bytes,
+ which can break a multi-byte characters in the middle.
+ Align, returning not more than "char_length" characters.
+ */
+ uint charpos, char_length= max_length / cs->mbmaxlen;
+ if ((charpos= my_charpos(cs, tmp.ptr(),
+ tmp.ptr() + tmp.length(),
+ char_length)) < tmp.length())
+ tmp.length(charpos);
+ }
+ if (max_length < field->pack_length())
+ tmp.length(min(tmp.length(),max_length));
+ ErrConvString err(&tmp);
+ to->append(err.ptr());
+ }
+ else
+ to->append(STRING_WITH_LEN("???"));
+ DBUG_VOID_RETURN;
+}
+
+
/*
unpack key-fields from record to some buffer.
@@ -352,8 +416,6 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
void key_unpack(String *to,TABLE *table,uint idx)
{
KEY_PART_INFO *key_part,*key_part_end;
- Field *field;
- String tmp;
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
DBUG_ENTER("key_unpack");
@@ -369,47 +431,13 @@ void key_unpack(String *to,TABLE *table,uint idx)
{
if (table->record[0][key_part->null_offset] & key_part->null_bit)
{
- to->append(STRING_WITH_LEN("NULL"));
- continue;
- }
- }
- if ((field=key_part->field))
- {
- CHARSET_INFO *cs= field->charset();
- field->val_str(&tmp);
- /*
- For BINARY(N) strip trailing zeroes to make
- the error message nice-looking
- */
- if (field->binary() && field->type() == MYSQL_TYPE_STRING && tmp.length())
- {
- const char *tmp_end= tmp.ptr() + tmp.length();
- while (tmp_end > tmp.ptr() && !*--tmp_end) ;
- tmp.length(tmp_end - tmp.ptr() + 1);
- }
- if (cs->mbmaxlen > 1 && (key_part->key_part_flag & HA_PART_KEY_SEG))
- {
- /*
- Prefix key, multi-byte charset.
- For the columns of type CHAR(N), the above val_str()
- call will return exactly "key_part->length" bytes,
- which can break a multi-byte characters in the middle.
- Align, returning not more than "char_length" characters.
- */
- uint charpos, char_length= key_part->length / cs->mbmaxlen;
- if ((charpos= my_charpos(cs, tmp.ptr(),
- tmp.ptr() + tmp.length(),
- char_length)) < tmp.length())
- tmp.length(charpos);
+ to->append(STRING_WITH_LEN("NULL"));
+ continue;
}
- if (key_part->length < field->pack_length())
- tmp.length(min(tmp.length(),key_part->length));
- ErrConvString err(&tmp);
- to->append(err.ptr());
}
- else
- to->append(STRING_WITH_LEN("???"));
- }
+ field_unpack(to, key_part->field, table->record[0], key_part->length,
+ test(key_part->key_part_flag & HA_PART_KEY_SEG));
+ }
dbug_tmp_restore_column_map(table->read_set, old_map);
DBUG_VOID_RETURN;
}
diff --git a/sql/key.h b/sql/key.h
index 8bf6f88fa04..0eeda58cd17 100644
--- a/sql/key.h
+++ b/sql/key.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,6 +33,8 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
uint key_length);
bool key_cmp_if_same(TABLE *form,const uchar *key,uint index,uint key_length);
void key_unpack(String *to,TABLE *form,uint index);
+void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
+ bool prefix_key);
bool is_key_used(TABLE *table, uint idx, const MY_BITMAP *fields);
int key_cmp(KEY_PART_INFO *key_part, const uchar *key, uint key_length);
ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key);
diff --git a/sql/log.cc b/sql/log.cc
index c5b69214290..f7d3b62b0d0 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -175,7 +175,7 @@ Silence_log_table_errors::handle_condition(THD *,
MYSQL_ERROR ** cond_hdl)
{
*cond_hdl= NULL;
- strmake(m_message, msg, sizeof(m_message)-1);
+ strmake_buf(m_message, msg);
return TRUE;
}
@@ -2425,7 +2425,7 @@ static int find_uniq_filename(char *name)
my_dirend(dir_info);
/* check if reached the maximum possible extension number */
- if ((max_found == MAX_LOG_UNIQUE_FN_EXT))
+ if (max_found == MAX_LOG_UNIQUE_FN_EXT)
{
sql_print_error("Log filename extension number exhausted: %06lu. \
Please fix this by archiving old logs and \
@@ -3355,8 +3355,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
mysql_file_sync(log_file.file, MYF(MY_WME|MY_SYNC_FILESIZE)))
goto err;
mysql_mutex_lock(&LOCK_commit_ordered);
- strmake(last_commit_pos_file, log_file_name,
- sizeof(last_commit_pos_file)-1);
+ strmake_buf(last_commit_pos_file, log_file_name);
last_commit_pos_offset= my_b_tell(&log_file);
mysql_mutex_unlock(&LOCK_commit_ordered);
@@ -3425,7 +3424,7 @@ int MYSQL_BIN_LOG::get_current_log(LOG_INFO* linfo)
int MYSQL_BIN_LOG::raw_get_current_log(LOG_INFO* linfo)
{
- strmake(linfo->log_file_name, log_file_name, sizeof(linfo->log_file_name)-1);
+ strmake_buf(linfo->log_file_name, log_file_name);
linfo->pos = my_b_tell(&log_file);
return 0;
}
@@ -3863,8 +3862,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
Reset rli's coordinates to the current log.
*/
rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE;
- strmake(rli->event_relay_log_name,rli->linfo.log_file_name,
- sizeof(rli->event_relay_log_name)-1);
+ strmake_buf(rli->event_relay_log_name,rli->linfo.log_file_name);
/*
If we removed the rli->group_relay_log_name file,
@@ -3874,8 +3872,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included)
if (included)
{
rli->group_relay_log_pos = BIN_LOG_HEADER_SIZE;
- strmake(rli->group_relay_log_name,rli->linfo.log_file_name,
- sizeof(rli->group_relay_log_name)-1);
+ strmake_buf(rli->group_relay_log_name,rli->linfo.log_file_name);
rli->notify_group_relay_log_name_update();
}
@@ -4385,9 +4382,7 @@ int MYSQL_BIN_LOG::purge_logs_before_date(time_t purge_time)
else
{
if (stat_area.st_mtime < purge_time)
- strmake(to_log,
- log_info.log_file_name,
- sizeof(log_info.log_file_name) - 1);
+ strmake_buf(to_log, log_info.log_file_name);
else
break;
}
@@ -5003,8 +4998,7 @@ binlog_start_consistent_snapshot(handlerton *hton, THD *thd)
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,
- sizeof(cache_mngr->last_commit_pos_file)-1);
+ strmake_buf(cache_mngr->last_commit_pos_file, mysql_bin_log.last_commit_pos_file);
cache_mngr->last_commit_pos_offset= mysql_bin_log.last_commit_pos_offset;
trans_register_ha(thd, TRUE, hton);
@@ -6249,8 +6243,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
current->error= write_transaction_or_stmt(current);
- strmake(cache_mngr->last_commit_pos_file, log_file_name,
- sizeof(cache_mngr->last_commit_pos_file)-1);
+ strmake_buf(cache_mngr->last_commit_pos_file, log_file_name);
commit_offset= my_b_write_tell(&log_file);
cache_mngr->last_commit_pos_offset= commit_offset;
if (cache_mngr->using_xa && cache_mngr->xa_xid)
@@ -7628,7 +7621,7 @@ int TC_LOG_BINLOG::open(const char *opt_name)
do
{
- strmake(log_name, log_info.log_file_name, sizeof(log_name)-1);
+ strmake_buf(log_name, log_info.log_file_name);
} while (!(error= find_next_log(&log_info, 1)));
if (error != LOG_INFO_EOF)
@@ -7943,7 +7936,7 @@ static void
set_binlog_snapshot_file(const char *src)
{
int dir_len = dirname_length(src);
- strmake(binlog_snapshot_file, src + dir_len, sizeof(binlog_snapshot_file)-1);
+ strmake_buf(binlog_snapshot_file, src + dir_len);
}
/*
diff --git a/sql/log_event.cc b/sql/log_event.cc
index e9f79bc1354..21c6a64df90 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
@@ -625,16 +625,18 @@ static inline int read_str(const char **buf, const char *buf_end,
/**
- Transforms a string into "" or its expression in 0x... form.
+ Transforms a string into "" or its expression in X'HHHH' form.
*/
char *str_to_hex(char *to, const char *from, uint len)
{
if (len)
{
- *to++= '0';
- *to++= 'x';
+ *to++= 'X';
+ *to++= '\'';
to= octet2hex(to, from, len);
+ *to++= '\'';
+ *to= '\0';
}
else
to= strmov(to, "\"\"");
@@ -655,7 +657,7 @@ append_query_string(THD *thd, CHARSET_INFO *csinfo,
{
char *beg, *ptr;
uint32 const orig_len= to->length();
- if (to->reserve(orig_len + from->length()*2+3))
+ if (to->reserve(orig_len + from->length() * 2 + 4))
return 1;
beg= (char*) to->ptr() + to->length();
@@ -1217,7 +1219,9 @@ bool Log_event::write_header(IO_CACHE* file, ulong event_data_length)
int Log_event::read_log_event(IO_CACHE* file, String* packet,
mysql_mutex_t* log_lock,
- uint8 checksum_alg_arg)
+ uint8 checksum_alg_arg,
+ const char *log_file_name_arg,
+ bool* is_binlog_active)
{
ulong data_len;
int result=0;
@@ -1227,6 +1231,10 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
if (log_lock)
mysql_mutex_lock(log_lock);
+
+ if (log_file_name_arg)
+ *is_binlog_active= mysql_bin_log.is_active(log_file_name_arg);
+
if (my_b_read(file, (uchar*) buf, sizeof(buf)))
{
/*
@@ -1372,7 +1380,7 @@ failed my_b_read"));
Log_event *res= 0;
#ifndef max_allowed_packet
THD *thd=current_thd;
- uint max_allowed_packet= thd ? slave_max_allowed_packet:~(ulong)0;
+ uint max_allowed_packet= thd ? slave_max_allowed_packet:~(uint)0;
#endif
if (data_len > max_allowed_packet)
@@ -1807,6 +1815,7 @@ void Log_event::print_header(IO_CACHE* file,
/**
Prints a quoted string to io cache.
Control characters are displayed as hex sequence, e.g. \x00
+ Single-quote and backslash characters are escaped with a \
@param[in] file IO cache
@param[in] prt Pointer to string
@@ -1822,6 +1831,10 @@ my_b_write_quoted(IO_CACHE *file, const uchar *ptr, uint length)
{
if (*s > 0x1F)
my_b_write(file, s, 1);
+ else if (*s == '\'')
+ my_b_write(file, "\\'", 2);
+ else if (*s == '\\')
+ my_b_write(file, "\\\\", 2);
else
{
uchar hex[10];
@@ -6289,7 +6302,7 @@ void User_var_log_event::pack_info(THD *thd, Protocol* protocol)
buf.append(" "))
return;
old_len= buf.length();
- if (buf.reserve(old_len + val_len*2 + 2 + sizeof(" COLLATE ") +
+ if (buf.reserve(old_len + val_len * 2 + 3 + sizeof(" COLLATE ") +
MY_CS_NAME_SIZE))
return;
beg= const_cast<char *>(buf.ptr()) + old_len;
@@ -6332,10 +6345,9 @@ User_var_log_event(const char* buf, uint event_len,
/*
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.
+ payload for val, or even that name_len is 0.
*/
- if (0 == name_len ||
- !valid_buffer_range<uint>(name_len, buf_start, name,
+ if (!valid_buffer_range<uint>(name_len, buf_start, name,
event_len - UV_VAL_IS_NULL))
{
error= true;
@@ -6558,7 +6570,8 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
char *hex_str;
CHARSET_INFO *cs;
- hex_str= (char *)my_malloc(2*val_len+1+2,MYF(MY_WME)); // 2 hex digits / byte
+ // 2 hex digits / byte
+ hex_str= (char *) my_malloc(2 * val_len + 1 + 3, MYF(MY_WME));
if (!hex_str)
return;
str_to_hex(hex_str, val, val_len);
@@ -9516,6 +9529,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli)
table_list->table_id= DBUG_EVALUATE_IF("inject_tblmap_same_id_maps_diff_table", 0, m_table_id);
table_list->updating= 1;
+ table_list->required_type= FRMTYPE_TABLE;
DBUG_PRINT("debug", ("table: %s is mapped to %u", table_list->table_name, table_list->table_id));
enum_tbl_map_status tblmap_status= check_table_map(rli, table_list);
if (tblmap_status == OK_TO_PROCESS)
diff --git a/sql/log_event.h b/sql/log_event.h
index 99c9a0fb1d7..6f5e64eb8f3 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+/* Copyright (c) 2000, 2013, 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
@@ -1056,8 +1056,35 @@ public:
const Format_description_log_event
*description_event,
my_bool crc_check);
+
+ /**
+ Reads an event from a binlog or relay log. Used by the dump thread
+ this method reads the event into a raw buffer without parsing it.
+
+ @Note If mutex is 0, the read will proceed without mutex.
+
+ @Note If a log name is given than the method will check if the
+ given binlog is still active.
+
+ @param[in] file log file to be read
+ @param[out] packet packet to hold the event
+ @param[in] lock the lock to be used upon read
+ @param[in] log_file_name_arg the log's file name
+ @param[out] is_binlog_active is the current log still active
+
+ @retval 0 success
+ @retval LOG_READ_EOF end of file, nothing was read
+ @retval LOG_READ_BOGUS malformed event
+ @retval LOG_READ_IO io error while reading
+ @retval LOG_READ_MEM packet memory allocation failed
+ @retval LOG_READ_TRUNC only a partial event could be read
+ @retval LOG_READ_TOO_LARGE event too large
+ */
static int read_log_event(IO_CACHE* file, String* packet,
- mysql_mutex_t* log_lock, uint8 checksum_alg_arg);
+ mysql_mutex_t* log_lock,
+ uint8 checksum_alg_arg,
+ const char *log_file_name_arg = NULL,
+ bool* is_binlog_active = NULL);
/*
init_show_field_list() prepares the column names and types for the
output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG
diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc
index 800602fe9e1..175405790b5 100644
--- a/sql/multi_range_read.cc
+++ b/sql/multi_range_read.cc
@@ -1648,7 +1648,7 @@ int DsMrr_impl::dsmrr_explain_info(uint mrr_mode, char *str, size_t size)
uint used_str_len= strlen(used_str);
uint copy_len= min(used_str_len, size);
- memcpy(str, used_str, size);
+ memcpy(str, used_str, copy_len);
return copy_len;
}
return 0;
diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc
index 6e2c6ec07f3..9c1a234241f 100644
--- a/sql/mysql_install_db.cc
+++ b/sql/mysql_install_db.cc
@@ -54,6 +54,7 @@ static char *opt_os_password;
static my_bool opt_default_user;
static my_bool opt_allow_remote_root_access;
static my_bool opt_skip_networking;
+static my_bool opt_verbose_bootstrap;
static my_bool verbose_errors;
@@ -83,6 +84,8 @@ static struct my_option my_long_options[]=
0, 0},
{"silent", 's', "Print less information", &opt_silent,
&opt_silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"verbose-bootstrap", 'o', "Include mysqld bootstrap output",&opt_verbose_bootstrap,
+ &opt_verbose_bootstrap, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -244,11 +247,12 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size)
get_basedir(basedir, sizeof(basedir), mysqld_path);
my_snprintf(cmdline, size-1,
- "\"\"%s\" --no-defaults --bootstrap"
- " \"--language=%s\\share\\english\""
+ "\"\"%s\" --no-defaults %s --bootstrap"
+ " \"--lc-messages-dir=%s/share\""
" --basedir=. --datadir=. --default-storage-engine=myisam"
" --max_allowed_packet=9M --loose-skip-innodb"
- " --net-buffer-length=16k\"", mysqld_path, basedir);
+ " --net-buffer-length=16k\"", mysqld_path,
+ opt_verbose_bootstrap?"--console":"", basedir );
return cmdline;
}
@@ -377,7 +381,7 @@ static int register_service()
static void clean_directory(const char *dir)
{
char dir2[MAX_PATH+2];
- *(strmake(dir2, dir, MAX_PATH+1)+1)= 0;
+ *(strmake_buf(dir2, dir)+1)= 0;
SHFILEOPSTRUCT fileop;
fileop.hwnd= NULL; /* no status display */
@@ -552,7 +556,9 @@ static int create_db_instance()
/* Do mysqld --bootstrap. */
init_bootstrap_command_line(cmdline, sizeof(cmdline));
- /* verbose("Executing %s", cmdline); */
+
+ if(opt_verbose_bootstrap)
+ printf("Executing %s\n", cmdline);
in= popen(cmdline, "wt");
if (!in)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index ce8431fbcbd..9276952491d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2288,8 +2288,28 @@ static my_socket activate_tcp_port(uint port)
for (a= ai; a != NULL; a= a->ai_next)
{
ip_sock= socket(a->ai_family, a->ai_socktype, a->ai_protocol);
- if (ip_sock != INVALID_SOCKET)
+
+ char ip_addr[INET6_ADDRSTRLEN];
+
+ if (vio_get_normalized_ip_string(a->ai_addr, a->ai_addrlen,
+ ip_addr, sizeof (ip_addr)))
+ {
+ ip_addr[0]= 0;
+ }
+
+ if (ip_sock == INVALID_SOCKET)
+ {
+ sql_print_error("Failed to create a socket for %s '%s': errno: %d.",
+ (a->ai_family == AF_INET) ? "IPv4" : "IPv6",
+ (const char *) ip_addr,
+ (int) socket_errno);
+ }
+ else
+ {
+ sql_print_information("Server socket created on IP: '%s'.",
+ (const char *) ip_addr);
break;
+ }
}
if (ip_sock == INVALID_SOCKET)
@@ -3346,14 +3366,25 @@ sizeof(load_default_groups)/sizeof(load_default_groups[0]);
#ifndef EMBEDDED_LIBRARY
-static
-int
-check_enough_stack_size()
+/**
+ This function is used to check for stack overrun for pathological
+ cases of regular expressions and 'like' expressions.
+ The call to current_thd is quite expensive, so we try to avoid it
+ for the normal cases.
+ The size of each stack frame for the wildcmp() routines is ~128 bytes,
+ so checking *every* recursive call is not necessary.
+ */
+extern "C" int
+check_enough_stack_size(int recurse_level)
{
uchar stack_top;
+ if (recurse_level % 16 != 0)
+ return 0;
- return check_stack_overrun(current_thd, STACK_MIN_SIZE,
- &stack_top);
+ THD *my_thd= current_thd;
+ if (my_thd != NULL)
+ return check_stack_overrun(my_thd, STACK_MIN_SIZE * 2, &stack_top);
+ return 0;
}
#endif
@@ -3582,7 +3613,7 @@ static int init_common_variables()
WideCharToMultiByte(CP_UTF8,0, wtz_name, -1, system_time_zone,
sizeof(system_time_zone) - 1, NULL, NULL);
#else
- strmake(system_time_zone, tz_name, sizeof(system_time_zone)-1);
+ strmake_buf(system_time_zone, tz_name);
#endif /* _WIN32 */
#endif /* HAVE_TZNAME */
@@ -3857,6 +3888,7 @@ static int init_common_variables()
item_init();
#ifndef EMBEDDED_LIBRARY
my_regex_init(&my_charset_latin1, check_enough_stack_size);
+ my_string_stack_guard= check_enough_stack_size;
#else
my_regex_init(&my_charset_latin1, NULL);
#endif
@@ -4425,11 +4457,13 @@ will be ignored as the --log-bin option is not defined.");
}
}
#endif /* WITH_WSREP */
+ DBUG_ASSERT(!opt_bin_log || opt_bin_logname);
+
if (opt_bin_log)
{
/* Reports an error and aborts, if the --log-bin's path
is a directory.*/
- if (opt_bin_logname &&
+ if (opt_bin_logname[0] &&
opt_bin_logname[strlen(opt_bin_logname) - 1] == FN_LIBCHAR)
{
sql_print_error("Path '%s' is a directory name, please specify \
@@ -4451,7 +4485,7 @@ a file name for --log-bin-index option", opt_binlog_index_name);
char buf[FN_REFLEN];
const char *ln;
ln= mysql_bin_log.generate_name(opt_bin_logname, "-bin", 1, buf);
- if (!opt_bin_logname && !opt_binlog_index_name)
+ if (!opt_bin_logname[0] && !opt_binlog_index_name)
{
/*
User didn't give us info to name the binlog index file.
@@ -8102,8 +8136,8 @@ static int mysql_init_variables(void)
/* Set directory paths */
mysql_real_data_home_len=
- strmake(mysql_real_data_home, get_relative_path(MYSQL_DATADIR),
- sizeof(mysql_real_data_home)-1) - mysql_real_data_home;
+ strmake_buf(mysql_real_data_home,
+ get_relative_path(MYSQL_DATADIR)) - mysql_real_data_home;
/* Replication parameters */
master_info_file= (char*) "master.info",
relay_log_info_file= (char*) "relay-log.info";
@@ -8206,7 +8240,7 @@ static int mysql_init_variables(void)
const char *tmpenv;
if (!(tmpenv = getenv("MY_BASEDIR_VERSION")))
tmpenv = DEFAULT_MYSQL_HOME;
- (void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1);
+ strmake_buf(mysql_home, tmpenv);
#endif
#ifdef WITH_WSREP
if (WSREP_ON && wsrep_init_vars())
@@ -8249,7 +8283,7 @@ mysqld_get_one_option(int optid,
global_system_variables.tx_isolation= ISO_SERIALIZABLE;
break;
case 'b':
- strmake(mysql_home,argument,sizeof(mysql_home)-1);
+ strmake_buf(mysql_home, argument);
break;
case 'C':
if (default_collation_name == compiled_default_collation_name)
@@ -8260,7 +8294,7 @@ mysqld_get_one_option(int optid,
opt_log=1;
break;
case 'h':
- strmake(mysql_real_data_home,argument, sizeof(mysql_real_data_home)-1);
+ strmake_buf(mysql_real_data_home, argument);
/* Correct pointer set by my_getopt (for embedded library) */
mysql_real_data_home_ptr= mysql_real_data_home;
break;
@@ -8271,7 +8305,7 @@ mysqld_get_one_option(int optid,
sql_print_warning("Ignoring user change to '%s' because the user was set to '%s' earlier on the command line\n", argument, mysqld_user);
break;
case 'L':
- strmake(lc_messages_dir, argument, sizeof(lc_messages_dir)-1);
+ strmake_buf(lc_messages_dir, argument);
break;
case OPT_BINLOG_FORMAT:
binlog_format_used= true;
@@ -8451,28 +8485,6 @@ mysqld_get_one_option(int optid,
case (int) OPT_WANT_CORE:
test_flags |= TEST_CORE_ON_SIGNAL;
break;
- case (int) OPT_BIND_ADDRESS:
- {
- struct addrinfo *res_lst, hints;
-
- bzero(&hints, sizeof(struct addrinfo));
- hints.ai_socktype= SOCK_STREAM;
- hints.ai_protocol= IPPROTO_TCP;
-
- if (getaddrinfo(argument, NULL, &hints, &res_lst) != 0)
- {
- sql_print_error("Can't start server: cannot resolve hostname!");
- return 1;
- }
-
- if (res_lst->ai_next)
- {
- sql_print_error("Can't start server: bind-address refers to multiple interfaces!");
- return 1;
- }
- freeaddrinfo(res_lst);
- }
- break;
case OPT_CONSOLE:
if (opt_console)
opt_error_log= 0; // Force logs to stdout
@@ -8986,7 +8998,7 @@ static int fix_paths(void)
char *sharedir=get_relative_path(SHAREDIR);
if (test_if_hard_path(sharedir))
- strmake(buff,sharedir,sizeof(buff)-1); /* purecov: tested */
+ strmake_buf(buff, sharedir); /* purecov: tested */
else
strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NullS);
convert_dirname(buff,buff,NullS);
@@ -8994,7 +9006,7 @@ static int fix_paths(void)
/* If --character-sets-dir isn't given, use shared library dir */
if (charsets_dir)
- strmake(mysql_charsets_dir, charsets_dir, sizeof(mysql_charsets_dir)-1);
+ strmake_buf(mysql_charsets_dir, charsets_dir);
else
strxnmov(mysql_charsets_dir, sizeof(mysql_charsets_dir)-1, buff,
CHARSET_DIR, NullS);
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 36da59fd6ef..5d71ec71903 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -132,7 +132,12 @@
static int sel_cmp(Field *f,uchar *a,uchar *b,uint8 a_flag,uint8 b_flag);
-static uchar is_null_string[2]= {1,0};
+/*
+ this should be long enough so that any memcmp with a string that
+ starts from '\0' won't cross is_null_string boundaries, even
+ if the memcmp is optimized to compare 4- 8- or 16- bytes at once
+*/
+static uchar is_null_string[20]= {1,0};
class RANGE_OPT_PARAM;
/*
@@ -1996,7 +2001,7 @@ int QUICK_ROR_INTERSECT_SELECT::init()
1 error
*/
-int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
+int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc)
{
handler *save_file= file, *org_file;
my_bool org_key_read;
@@ -2024,7 +2029,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
DBUG_RETURN(0);
}
- if (!(file= head->file->clone(head->s->normalized_path.str, thd->mem_root)))
+ if (!(file= head->file->clone(head->s->normalized_path.str, alloc)))
{
/*
Manually set the error flag. Note: there seems to be quite a few
@@ -2125,7 +2130,8 @@ failure:
0 OK
other error code
*/
-int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
+int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler,
+ MEM_ROOT *alloc)
{
List_iterator_fast<QUICK_SELECT_WITH_RECORD> quick_it(quick_selects);
QUICK_SELECT_WITH_RECORD *cur;
@@ -2142,7 +2148,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
There is no use of this->file. Use it for the first of merged range
selects.
*/
- int error= quick->init_ror_merged_scan(TRUE);
+ int error= quick->init_ror_merged_scan(TRUE, alloc);
if (error)
DBUG_RETURN(error);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
@@ -2154,7 +2160,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
const MY_BITMAP * const save_read_set= quick->head->read_set;
const MY_BITMAP * const save_write_set= quick->head->write_set;
#endif
- if (quick->init_ror_merged_scan(FALSE))
+ if (quick->init_ror_merged_scan(FALSE, alloc))
DBUG_RETURN(1);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
@@ -2188,7 +2194,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
int QUICK_ROR_INTERSECT_SELECT::reset()
{
DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::reset");
- if (!scans_inited && init_ror_merged_scan(TRUE))
+ if (!scans_inited && init_ror_merged_scan(TRUE, &alloc))
DBUG_RETURN(1);
scans_inited= TRUE;
List_iterator_fast<QUICK_SELECT_WITH_RECORD> it(quick_selects);
@@ -2324,7 +2330,7 @@ int QUICK_ROR_UNION_SELECT::reset()
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
while ((quick= it++))
{
- if (quick->init_ror_merged_scan(FALSE))
+ if (quick->init_ror_merged_scan(FALSE, &alloc))
DBUG_RETURN(1);
}
scans_inited= TRUE;
@@ -7288,6 +7294,14 @@ static SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param,
param->current_table);
DBUG_ENTER("get_full_func_mm_tree");
+#ifdef HAVE_SPATIAL
+ if (field_item->field->type() == MYSQL_TYPE_GEOMETRY)
+ {
+ /* We have to be able to store all sorts of spatial features here */
+ ((Field_geom*) field_item->field)->geom_type= Field::GEOM_GEOMETRY;
+ }
+#endif /*HAVE_SPATIAL*/
+
for (uint i= 0; i < cond_func->arg_count; i++)
{
Item *arg= cond_func->arguments()[i]->real_item();
@@ -7367,8 +7381,10 @@ static SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param,COND *cond)
DBUG_RETURN(tree);
}
/* Here when simple cond */
- if (cond->const_item() && !cond->is_expensive())
+ if (cond->const_item())
{
+ if (cond->is_expensive())
+ DBUG_RETURN(0);
/*
During the cond->val_int() evaluation we can come across a subselect
item which may allocate memory on the thd->mem_root and assumes
@@ -10845,9 +10861,13 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
do
{
+ DBUG_EXECUTE_IF("innodb_quick_report_deadlock",
+ DBUG_SET("+d,innodb_report_deadlock"););
if ((error= quick->get_next()))
{
- quick_with_last_rowid->file->unlock_row();
+ /* On certain errors like deadlock, trx might be rolled back.*/
+ if (!current_thd->transaction_rollback_request)
+ quick_with_last_rowid->file->unlock_row();
DBUG_RETURN(error);
}
quick->file->position(quick->record);
@@ -10873,7 +10893,9 @@ int QUICK_ROR_INTERSECT_SELECT::get_next()
quick->file->unlock_row(); /* row not in range; unlock */
if ((error= quick->get_next()))
{
- quick_with_last_rowid->file->unlock_row();
+ /* On certain errors like deadlock, trx might be rolled back.*/
+ if (!current_thd->transaction_rollback_request)
+ quick_with_last_rowid->file->unlock_row();
DBUG_RETURN(error);
}
}
@@ -11758,13 +11780,15 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
NGA1.If in the index I there is a gap between the last GROUP attribute G_k,
and the MIN/MAX attribute C, then NGA must consist of exactly the
index attributes that constitute the gap. As a result there is a
- permutation of NGA that coincides with the gap in the index
- <B_1, ..., B_m>.
+ permutation of NGA, BA=<B_1,...,B_m>, that coincides with the gap
+ in the index.
NGA2.If BA <> {}, then the WHERE clause must contain a conjunction EQ of
equality conditions for all NG_i of the form (NG_i = const) or
(const = NG_i), such that each NG_i is referenced in exactly one
conjunct. Informally, the predicates provide constants to fill the
gap in the index.
+ NGA3.If BA <> {}, there can only be one range. TODO: This is a code
+ limitation and is not strictly needed. See BUG#15947433
WA1. There are no other attributes in the WHERE clause except the ones
referenced in predicates RNG, PA, PC, EQ defined above. Therefore
WA is subset of (GA union NGA union C) for GA,NGA,C that pass the
@@ -12507,6 +12531,74 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
/*
+ Get SEL_ARG tree, if any, for the keypart covering non grouping
+ attribute (NGA) field 'nga_field'.
+
+ This function enforces the NGA3 test: If 'keypart_tree' contains a
+ condition for 'nga_field', there can only be one range. In the
+ opposite case, this function returns with error and 'cur_range'
+ should not be used.
+
+ Note that the NGA1 and NGA2 requirements, like whether or not the
+ range predicate for 'nga_field' is equality, is not tested by this
+ function.
+
+ @param[in] nga_field The NGA field we want the SEL_ARG tree for
+ @param[in] keypart_tree Root node of the SEL_ARG* tree for the index
+ @param[out] cur_range The SEL_ARG tree, if any, for the keypart
+ covering field 'keypart_field'
+ @retval true 'keypart_tree' contained a predicate for 'nga_field' but
+ multiple ranges exists. 'cur_range' should not be used.
+ @retval false otherwise
+*/
+
+static bool
+get_sel_arg_for_keypart(Field *nga_field,
+ SEL_ARG *keypart_tree,
+ SEL_ARG **cur_range)
+{
+ if(keypart_tree == NULL)
+ return false;
+ if(keypart_tree->field->eq(nga_field))
+ {
+ /*
+ Enforce NGA3: If a condition for nga_field has been found, only
+ a single range is allowed.
+ */
+ if (keypart_tree->prev || keypart_tree->next)
+ return true; // There are multiple ranges
+
+ *cur_range= keypart_tree;
+ return false;
+ }
+
+ SEL_ARG *found_tree= NULL;
+ SEL_ARG *first_kp= keypart_tree->first();
+
+ for (SEL_ARG *cur_kp= first_kp; cur_kp && !found_tree;
+ cur_kp= cur_kp->next)
+ {
+ if (cur_kp->next_key_part)
+ {
+ if (get_sel_arg_for_keypart(nga_field,
+ cur_kp->next_key_part,
+ &found_tree))
+ return true;
+
+ }
+ /*
+ Enforce NGA3: If a condition for nga_field has been found,only
+ a single range is allowed.
+ */
+ if (found_tree && first_kp->next)
+ return true; // There are multiple ranges
+ }
+ *cur_range= found_tree;
+ return false;
+}
+
+
+/*
Extract a sequence of constants from a conjunction of equality predicates.
SYNOPSIS
@@ -12520,12 +12612,13 @@ check_group_min_max_predicates(Item *cond, Item_field *min_max_arg_item,
key_infix [out] Infix of constants to be used for index lookup
key_infix_len [out] Lenghth of the infix
first_non_infix_part [out] The first keypart after the infix (if any)
-
+
DESCRIPTION
- Test conditions (NGA1, NGA2) from get_best_group_min_max(). Namely,
- for each keypart field NGF_i not in GROUP-BY, check that there is a
- constant equality predicate among conds with the form (NGF_i = const_ci) or
- (const_ci = NGF_i).
+ Test conditions (NGA1, NGA2, NGA3) from get_best_group_min_max(). Namely,
+ for each keypart field NG_i not in GROUP-BY, check that there is exactly one
+ constant equality predicate among conds with the form (NG_i = const_ci) or
+ (const_ci = NG_i).. In addition, there can only be one range when there is
+ such a gap.
Thus all the NGF_i attributes must fill the 'gap' between the last group-by
attribute and the MIN/MAX attribute in the index (if present). If these
conditions hold, copy each constant from its corresponding predicate into
@@ -12554,17 +12647,14 @@ get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree,
uchar *key_ptr= key_infix;
for (cur_part= first_non_group_part; cur_part != end_part; cur_part++)
{
+ cur_range= NULL;
/*
Find the range tree for the current keypart. We assume that
- index_range_tree points to the leftmost keypart in the index.
+ index_range_tree points to the first keypart in the index.
*/
- for (cur_range= index_range_tree;
- cur_range && cur_range->type == SEL_ARG::KEY_RANGE;
- cur_range= cur_range->next_key_part)
- {
- if (cur_range->field->eq(cur_part->field))
- break;
- }
+ if(get_sel_arg_for_keypart(cur_part->field, index_range_tree, &cur_range))
+ return false;
+
if (!cur_range || cur_range->type != SEL_ARG::KEY_RANGE)
{
if (min_max_arg_part)
@@ -12576,9 +12666,6 @@ get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree,
}
}
- /* Check that the current range tree is a single point interval. */
- if (cur_range->prev || cur_range->next)
- return FALSE; /* This is not the only range predicate for the field. */
if ((cur_range->min_flag & NO_MIN_RANGE) ||
(cur_range->max_flag & NO_MAX_RANGE) ||
(cur_range->min_flag & NEAR_MIN) || (cur_range->max_flag & NEAR_MAX))
diff --git a/sql/opt_range.h b/sql/opt_range.h
index c59b2a7eb02..fff6e414ad9 100644
--- a/sql/opt_range.h
+++ b/sql/opt_range.h
@@ -323,7 +323,7 @@ public:
0 Ok
other Error
*/
- virtual int init_ror_merged_scan(bool reuse_handler)
+ virtual int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc)
{ DBUG_ASSERT(0); return 1; }
/*
@@ -473,7 +473,7 @@ public:
uchar *cur_prefix);
bool reverse_sorted() { return 0; }
bool unique_key_range();
- int init_ror_merged_scan(bool reuse_handler);
+ int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc);
void save_last_pos()
{ file->position(record); }
int get_type() { return QS_TYPE_RANGE; }
@@ -722,7 +722,7 @@ public:
#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
- int init_ror_merged_scan(bool reuse_handler);
+ int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc);
bool push_quick_back(MEM_ROOT *alloc, QUICK_RANGE_SELECT *quick_sel_range);
class QUICK_SELECT_WITH_RECORD : public Sql_alloc
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index dfe2ece76d9..c0a01dded35 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -1509,6 +1509,9 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
*/
parent_lex->leaf_tables.concat(&subq_lex->leaf_tables);
+ if (subq_lex->options & OPTION_SCHEMA_TABLE)
+ parent_lex->options |= OPTION_SCHEMA_TABLE;
+
/*
Same as above for next_local chain
(a theory: a next_local chain always starts with ::leaf_tables
@@ -1725,6 +1728,9 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
*/
parent_lex->leaf_tables.push_back(jtbm);
+ if (subq_pred->unit->first_select()->options & OPTION_SCHEMA_TABLE)
+ parent_lex->options |= OPTION_SCHEMA_TABLE;
+
/*
Same as above for TABLE_LIST::next_local chain
(a theory: a next_local chain always starts with ::leaf_tables
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index fa3a07b72c5..069fe6452e8 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -84,7 +84,7 @@ static ulonglong get_exact_record_count(List<TABLE_LIST> &tables)
while ((tl= ti++))
{
ha_rows tmp= tl->table->file->records();
- if ((tmp == HA_POS_ERROR))
+ if (tmp == HA_POS_ERROR)
return ULONGLONG_MAX;
count*= tmp;
}
diff --git a/sql/partition_element.h b/sql/partition_element.h
index 87f3d00e68c..4f03d91035a 100644
--- a/sql/partition_element.h
+++ b/sql/partition_element.h
@@ -1,7 +1,7 @@
#ifndef PARTITION_ELEMENT_INCLUDED
#define PARTITION_ELEMENT_INCLUDED
-/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -107,9 +107,8 @@ public:
enum partition_state part_state;
uint16 nodegroup_id;
bool has_null_value;
- /* signed_flag and max_value only relevant for subpartitions */
- bool signed_flag;
- bool max_value;
+ bool signed_flag; // Range value signed
+ bool max_value; // MAXVALUE range
partition_element()
: part_max_rows(0), part_min_rows(0), range_value(0),
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 028afd7899e..d877491e770 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -1,5 +1,4 @@
-/*
- Copyright (c) 2006, 2010, Oracle and/or its affiliates.
+/* Copyright (c) 2006, 2013, 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
@@ -2181,9 +2180,36 @@ int partition_info::fix_parser_data(THD *thd)
if (!(part_type == RANGE_PARTITION ||
part_type == LIST_PARTITION))
{
- /* Nothing to do for HASH/KEY partitioning */
+ if (part_type == HASH_PARTITION && list_of_part_fields)
+ {
+ /* KEY partitioning, check ALGORITHM = N. Should not pass the parser! */
+ if (key_algorithm > KEY_ALGORITHM_55)
+ {
+ my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
+ DBUG_RETURN(true);
+ }
+ /* If not set, use DEFAULT = 2 for CREATE and ALTER! */
+ if ((thd_sql_command(thd) == SQLCOM_CREATE_TABLE ||
+ thd_sql_command(thd) == SQLCOM_ALTER_TABLE) &&
+ key_algorithm == KEY_ALGORITHM_NONE)
+ key_algorithm= KEY_ALGORITHM_55;
+ }
DBUG_RETURN(FALSE);
}
+ if (is_sub_partitioned() && list_of_subpart_fields)
+ {
+ /* KEY subpartitioning, check ALGORITHM = N. Should not pass the parser! */
+ if (key_algorithm > KEY_ALGORITHM_55)
+ {
+ my_error(ER_PARTITION_FUNCTION_IS_NOT_ALLOWED, MYF(0));
+ DBUG_RETURN(true);
+ }
+ /* If not set, use DEFAULT = 2 for CREATE and ALTER! */
+ if ((thd_sql_command(thd) == SQLCOM_CREATE_TABLE ||
+ thd_sql_command(thd) == SQLCOM_ALTER_TABLE) &&
+ key_algorithm == KEY_ALGORITHM_NONE)
+ key_algorithm= KEY_ALGORITHM_55;
+ }
do
{
part_elem= it++;
@@ -2232,6 +2258,263 @@ int partition_info::fix_parser_data(THD *thd)
DBUG_RETURN(FALSE);
}
+
+/**
+ helper function to compare strings that can also be
+ a NULL pointer.
+
+ @param a char pointer (can be NULL).
+ @param b char pointer (can be NULL).
+
+ @return false if equal
+ @retval true strings differs
+ @retval false strings is equal
+*/
+
+static bool strcmp_null(const char *a, const char *b)
+{
+ if (!a && !b)
+ return false;
+ if (a && b && !strcmp(a, b))
+ return false;
+ return true;
+}
+
+
+/**
+ Check if the new part_info has the same partitioning.
+
+ @param new_part_info New partition definition to compare with.
+
+ @return True if not considered to have changed the partitioning.
+ @retval true Allowed change (only .frm change, compatible distribution).
+ @retval false Different partitioning, will need redistribution of rows.
+
+ @note Currently only used to allow changing from non-set key_algorithm
+ to a specified key_algorithm, to avoid rebuild when upgrading from 5.1 of
+ such partitioned tables using numeric colums in the partitioning expression.
+ For more info see bug#14521864.
+ Does not check if columns etc has changed, i.e. only for
+ alter_info->flags == ALTER_PARTITION.
+*/
+
+bool partition_info::has_same_partitioning(partition_info *new_part_info)
+{
+ DBUG_ENTER("partition_info::has_same_partitioning");
+
+ DBUG_ASSERT(part_field_array && part_field_array[0]);
+
+ /*
+ Only consider pre 5.5.3 .frm's to have same partitioning as
+ a new one with KEY ALGORITHM = 1 ().
+ */
+
+ if (part_field_array[0]->table->s->mysql_version >= 50503)
+ DBUG_RETURN(false);
+
+ if (!new_part_info ||
+ part_type != new_part_info->part_type ||
+ num_parts != new_part_info->num_parts ||
+ use_default_partitions != new_part_info->use_default_partitions ||
+ new_part_info->is_sub_partitioned() != is_sub_partitioned())
+ DBUG_RETURN(false);
+
+ if (part_type != HASH_PARTITION)
+ {
+ /*
+ RANGE or LIST partitioning, check if KEY subpartitioned.
+ Also COLUMNS partitioning was added in 5.5, so treat that as different.
+ */
+ if (!is_sub_partitioned() ||
+ !new_part_info->is_sub_partitioned() ||
+ column_list ||
+ new_part_info->column_list ||
+ !list_of_subpart_fields ||
+ !new_part_info->list_of_subpart_fields ||
+ new_part_info->num_subparts != num_subparts ||
+ new_part_info->subpart_field_list.elements !=
+ subpart_field_list.elements ||
+ new_part_info->use_default_subpartitions !=
+ use_default_subpartitions)
+ DBUG_RETURN(false);
+ }
+ else
+ {
+ /* Check if KEY partitioned. */
+ if (!new_part_info->list_of_part_fields ||
+ !list_of_part_fields ||
+ new_part_info->part_field_list.elements != part_field_list.elements)
+ DBUG_RETURN(false);
+ }
+
+ /* Check that it will use the same fields in KEY (fields) list. */
+ List_iterator<char> old_field_name_it(part_field_list);
+ List_iterator<char> new_field_name_it(new_part_info->part_field_list);
+ char *old_name, *new_name;
+ while ((old_name= old_field_name_it++))
+ {
+ new_name= new_field_name_it++;
+ if (!new_name || my_strcasecmp(system_charset_info,
+ new_name,
+ old_name))
+ DBUG_RETURN(false);
+ }
+
+ if (is_sub_partitioned())
+ {
+ /* Check that it will use the same fields in KEY subpart fields list. */
+ List_iterator<char> old_field_name_it(subpart_field_list);
+ List_iterator<char> new_field_name_it(new_part_info->subpart_field_list);
+ char *old_name, *new_name;
+ while ((old_name= old_field_name_it++))
+ {
+ new_name= new_field_name_it++;
+ if (!new_name || my_strcasecmp(system_charset_info,
+ new_name,
+ old_name))
+ DBUG_RETURN(false);
+ }
+ }
+
+ if (!use_default_partitions)
+ {
+ /*
+ Loop over partitions/subpartition to verify that they are
+ the same, including state and name.
+ */
+ List_iterator<partition_element> part_it(partitions);
+ List_iterator<partition_element> new_part_it(new_part_info->partitions);
+ uint i= 0;
+ do
+ {
+ partition_element *part_elem= part_it++;
+ partition_element *new_part_elem= new_part_it++;
+ /*
+ The following must match:
+ partition_name, tablespace_name, data_file_name, index_file_name,
+ engine_type, part_max_rows, part_min_rows, nodegroup_id.
+ (max_value, signed_flag, has_null_value only on partition level,
+ RANGE/LIST)
+ The following can differ:
+ - part_comment
+ part_state must be PART_NORMAL!
+ */
+ if (!part_elem || !new_part_elem ||
+ strcmp(part_elem->partition_name,
+ new_part_elem->partition_name) ||
+ part_elem->part_state != PART_NORMAL ||
+ new_part_elem->part_state != PART_NORMAL ||
+ part_elem->max_value != new_part_elem->max_value ||
+ part_elem->signed_flag != new_part_elem->signed_flag ||
+ part_elem->has_null_value != new_part_elem->has_null_value)
+ DBUG_RETURN(false);
+
+ /* new_part_elem may not have engine_type set! */
+ if (new_part_elem->engine_type &&
+ part_elem->engine_type != new_part_elem->engine_type)
+ DBUG_RETURN(false);
+
+ if (is_sub_partitioned())
+ {
+ /*
+ Check that both old and new partition has the same definition
+ (VALUES IN/VALUES LESS THAN) (No COLUMNS partitioning, see above)
+ */
+ if (part_type == LIST_PARTITION)
+ {
+ List_iterator<part_elem_value> list_vals(part_elem->list_val_list);
+ List_iterator<part_elem_value>
+ new_list_vals(new_part_elem->list_val_list);
+ part_elem_value *val;
+ part_elem_value *new_val;
+ while ((val= list_vals++))
+ {
+ new_val= new_list_vals++;
+ if (!new_val)
+ DBUG_RETURN(false);
+ if ((!val->null_value && !new_val->null_value) &&
+ val->value != new_val->value)
+ DBUG_RETURN(false);
+ }
+ if (new_list_vals++)
+ DBUG_RETURN(false);
+ }
+ else
+ {
+ DBUG_ASSERT(part_type == RANGE_PARTITION);
+ if (new_part_elem->range_value != part_elem->range_value)
+ DBUG_RETURN(false);
+ }
+
+ if (!use_default_subpartitions)
+ {
+ List_iterator<partition_element>
+ sub_part_it(part_elem->subpartitions);
+ List_iterator<partition_element>
+ new_sub_part_it(new_part_elem->subpartitions);
+ uint j= 0;
+ do
+ {
+ partition_element *sub_part_elem= sub_part_it++;
+ partition_element *new_sub_part_elem= new_sub_part_it++;
+ /* new_part_elem may not have engine_type set! */
+ if (new_sub_part_elem->engine_type &&
+ sub_part_elem->engine_type != new_part_elem->engine_type)
+ DBUG_RETURN(false);
+
+ if (strcmp(sub_part_elem->partition_name,
+ new_sub_part_elem->partition_name) ||
+ sub_part_elem->part_state != PART_NORMAL ||
+ new_sub_part_elem->part_state != PART_NORMAL ||
+ sub_part_elem->part_min_rows !=
+ new_sub_part_elem->part_min_rows ||
+ sub_part_elem->part_max_rows !=
+ new_sub_part_elem->part_max_rows ||
+ sub_part_elem->nodegroup_id !=
+ new_sub_part_elem->nodegroup_id)
+ DBUG_RETURN(false);
+
+ if (strcmp_null(sub_part_elem->data_file_name,
+ new_sub_part_elem->data_file_name) ||
+ strcmp_null(sub_part_elem->index_file_name,
+ new_sub_part_elem->index_file_name) ||
+ strcmp_null(sub_part_elem->tablespace_name,
+ new_sub_part_elem->tablespace_name))
+ DBUG_RETURN(false);
+
+ } while (++j < num_subparts);
+ }
+ }
+ else
+ {
+ if (part_elem->part_min_rows != new_part_elem->part_min_rows ||
+ part_elem->part_max_rows != new_part_elem->part_max_rows ||
+ part_elem->nodegroup_id != new_part_elem->nodegroup_id)
+ DBUG_RETURN(false);
+
+ if (strcmp_null(part_elem->data_file_name,
+ new_part_elem->data_file_name) ||
+ strcmp_null(part_elem->index_file_name,
+ new_part_elem->index_file_name) ||
+ strcmp_null(part_elem->tablespace_name,
+ new_part_elem->tablespace_name))
+ DBUG_RETURN(false);
+ }
+ } while (++i < num_parts);
+ }
+
+ /*
+ Only if key_algorithm was not specified before and it is now set,
+ consider this as nothing was changed, and allow change without rebuild!
+ */
+ if (key_algorithm != partition_info::KEY_ALGORITHM_NONE ||
+ new_part_info->key_algorithm == partition_info::KEY_ALGORITHM_NONE)
+ DBUG_RETURN(false);
+
+ DBUG_RETURN(true);
+}
+
+
void partition_info::print_debug(const char *str, uint *value)
{
DBUG_ENTER("print_debug");
diff --git a/sql/partition_info.h b/sql/partition_info.h
index e59d4ec8ba4..d3706c8abf4 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -1,7 +1,7 @@
#ifndef PARTITION_INFO_INCLUDED
#define PARTITION_INFO_INCLUDED
-/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -192,6 +192,19 @@ public:
but mainly of use to handlers supporting partitioning.
*/
uint16 linear_hash_mask;
+ /*
+ PARTITION BY KEY ALGORITHM=N
+ Which algorithm to use for hashing the fields.
+ N = 1 - Use 5.1 hashing (numeric fields are hashed as binary)
+ N = 2 - Use 5.5 hashing (numeric fields are hashed like latin1 bytes)
+ */
+ enum enum_key_algorithm
+ {
+ KEY_ALGORITHM_NONE= 0,
+ KEY_ALGORITHM_51= 1,
+ KEY_ALGORITHM_55= 2
+ };
+ enum_key_algorithm key_algorithm;
bool use_default_partitions;
bool use_default_num_partitions;
@@ -232,6 +245,7 @@ public:
count_curr_subparts(0), part_error_code(0),
num_list_values(0), num_part_fields(0), num_subpart_fields(0),
num_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0),
+ key_algorithm(KEY_ALGORITHM_NONE),
use_default_partitions(TRUE), use_default_num_partitions(TRUE),
use_default_subpartitions(TRUE), use_default_num_subpartitions(TRUE),
default_partitions_setup(FALSE), defined_max_value(FALSE),
@@ -298,6 +312,7 @@ public:
bool add_column_list_value(THD *thd, Item *item);
void set_show_version_string(String *packet);
void report_part_expr_error(bool use_subpart_expr);
+ bool has_same_partitioning(partition_info *new_part_info);
private:
static int list_part_cmp(const void* a, const void* b);
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index 64525f81603..f9c8c8ea5b2 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -67,7 +67,7 @@ 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];
char host[HOSTNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1];
- char user[USERNAME_LENGTH*+1];
+ char user[USERNAME_LENGTH+1];
char password[MAX_PASSWORD_LENGTH*SYSTEM_CHARSET_MBMAXLEN+1];
bool ssl; // enables use of SSL connection if true
char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN];
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index cbd7ac8f5ef..e03d46606d5 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -309,8 +309,7 @@ Failed to open the existing relay log info file '%s' (errno %d)",
msg="Error reading slave log configuration";
goto err;
}
- strmake(rli->event_relay_log_name,rli->group_relay_log_name,
- sizeof(rli->event_relay_log_name)-1);
+ strmake_buf(rli->event_relay_log_name,rli->group_relay_log_name);
rli->group_relay_log_pos= rli->event_relay_log_pos= relay_log_pos;
rli->group_master_log_pos= master_log_pos;
@@ -528,10 +527,8 @@ int init_relay_log_pos(Relay_log_info* rli,const char* log,
*errmsg="Could not find target log during relay log initialization";
goto err;
}
- strmake(rli->group_relay_log_name,rli->linfo.log_file_name,
- sizeof(rli->group_relay_log_name)-1);
- strmake(rli->event_relay_log_name,rli->linfo.log_file_name,
- sizeof(rli->event_relay_log_name)-1);
+ strmake_buf(rli->group_relay_log_name,rli->linfo.log_file_name);
+ strmake_buf(rli->event_relay_log_name,rli->linfo.log_file_name);
if (rli->relay_log.is_active(rli->linfo.log_file_name))
{
/*
@@ -871,8 +868,7 @@ void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
mysql_mutex_lock(&data_lock);
inc_event_relay_log_pos();
group_relay_log_pos= event_relay_log_pos;
- strmake(group_relay_log_name,event_relay_log_name,
- sizeof(group_relay_log_name)-1);
+ strmake_buf(group_relay_log_name,event_relay_log_name);
notify_group_relay_log_name_update();
@@ -1005,10 +1001,8 @@ int purge_relay_logs(Relay_log_info* rli, THD *thd, bool just_reset,
goto err;
}
/* Save name of used relay log file */
- strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(),
- sizeof(rli->group_relay_log_name)-1);
- strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(),
- sizeof(rli->event_relay_log_name)-1);
+ strmake_buf(rli->group_relay_log_name, rli->relay_log.get_log_fname());
+ strmake_buf(rli->event_relay_log_name, rli->relay_log.get_log_fname());
rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE;
if (count_relay_log_space(rli))
{
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index c83e52fe26b..ed6b9d13584 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -1172,6 +1172,7 @@ void Deferred_log_events::rewind()
Log_event *ev= *(Log_event **) dynamic_array_ptr(&array, i);
delete ev;
}
+ last_added= NULL;
if (array.elements > array.max_element)
freeze_size(&array);
reset_dynamic(&array);
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 4e6354d9af4..7c3cec38601 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2002, 2011, Oracle and/or its affiliates.
- Copyright (c) 2008-2011 Monty Program Ab
+/* Copyright (c) 2002, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2011, 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
@@ -255,17 +255,14 @@ uchar *sys_var::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
return session_value_ptr(thd, base);
}
-bool sys_var::set_default(THD *thd, enum_var_type type)
+bool sys_var::set_default(THD *thd, set_var* var)
{
- LEX_STRING empty={0,0};
- set_var var(type, 0, &empty, 0);
-
- if (type == OPT_GLOBAL || scope() == GLOBAL)
- global_save_default(thd, &var);
+ if (var->type == OPT_GLOBAL || scope() == GLOBAL)
+ global_save_default(thd, var);
else
- session_save_default(thd, &var);
+ session_save_default(thd, var);
- return check(thd, &var) || update(thd, &var);
+ return check(thd, var) || update(thd, var);
}
void sys_var::do_deprecated_warning(THD *thd)
@@ -667,7 +664,7 @@ int set_var::light_check(THD *thd)
*/
int set_var::update(THD *thd)
{
- return value ? var->update(thd, this) : var->set_default(thd, type);
+ return value ? var->update(thd, this) : var->set_default(thd, this);
}
diff --git a/sql/set_var.h b/sql/set_var.h
index ec6d2c28e6a..15707512663 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -1,6 +1,6 @@
#ifndef SET_VAR_INCLUDED
#define SET_VAR_INCLUDED
-/* Copyright (c) 2002, 2011, Oracle and/or its affiliates.
+/* Copyright (c) 2002, 2013, 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
@@ -104,7 +104,13 @@ public:
bool check(THD *thd, set_var *var);
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
- bool set_default(THD *thd, enum_var_type type);
+
+ /**
+ Update the system variable with the default value from either
+ session or global scope. The default value is stored in the
+ 'var' argument. Return false when successful.
+ */
+ bool set_default(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
SHOW_TYPE show_type() { return show_val_type; }
diff --git a/sql/slave.cc b/sql/slave.cc
index 89a325efb53..caef5acd5f1 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -362,16 +362,13 @@ int init_recovery(Master_info* mi, const char** errmsg)
{
mi->master_log_pos= max(BIN_LOG_HEADER_SIZE,
rli->group_master_log_pos);
- strmake(mi->master_log_name, rli->group_master_log_name,
- sizeof(mi->master_log_name)-1);
+ strmake_buf(mi->master_log_name, rli->group_master_log_name);
sql_print_warning("Recovery from master pos %ld and file %s.",
(ulong) mi->master_log_pos, mi->master_log_name);
- strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(),
- sizeof(rli->group_relay_log_name)-1);
- strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(),
- sizeof(mi->rli.event_relay_log_name)-1);
+ strmake_buf(rli->group_relay_log_name, rli->relay_log.get_log_fname());
+ strmake_buf(rli->event_relay_log_name, rli->relay_log.get_log_fname());
rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE;
}
@@ -1219,6 +1216,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
int err_code= 0;
MYSQL_RES *master_res= 0;
MYSQL_ROW master_row;
+ uint version= mysql_get_server_version(mysql) / 10000;
DBUG_ENTER("get_master_version_and_clock");
/*
@@ -1239,20 +1237,20 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
/*
Note the following switch will bug when we have MySQL branch 30 ;)
*/
- switch (*mysql->server_version)
+ switch (version)
{
- case '0':
- case '1':
- case '2':
+ case 0:
+ case 1:
+ case 2:
errmsg = "Master reported unrecognized MySQL version";
err_code= ER_SLAVE_FATAL_ERROR;
sprintf(err_buff, ER(err_code), errmsg);
break;
- case '3':
+ case 3:
mi->rli.relay_log.description_event_for_queue= new
Format_description_log_event(1, mysql->server_version);
break;
- case '4':
+ case 4:
mi->rli.relay_log.description_event_for_queue= new
Format_description_log_event(3, mysql->server_version);
break;
@@ -1473,10 +1471,10 @@ maybe it is a *VERY OLD MASTER*.");
*/
/* redundant with rest of code but safer against later additions */
- if (*mysql->server_version == '3')
+ if (version == 3)
goto err;
- if (*mysql->server_version == '4')
+ if (version == 4)
{
master_res= NULL;
if (!mysql_real_query(mysql,
@@ -1539,7 +1537,7 @@ inconsistency if replicated data deals with collation.");
This check is only necessary for 4.x masters (and < 5.0.4 masters but
those were alpha).
*/
- if (*mysql->server_version == '4')
+ if (version == 4)
{
master_res= NULL;
if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT @@GLOBAL.TIME_ZONE")) &&
@@ -3612,8 +3610,8 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
mysql_mutex_lock(&rli->data_lock);
if (rli->slave_skip_counter)
{
- strmake(saved_log_name, rli->group_relay_log_name, FN_REFLEN - 1);
- strmake(saved_master_log_name, rli->group_master_log_name, FN_REFLEN - 1);
+ strmake_buf(saved_log_name, rli->group_relay_log_name);
+ strmake_buf(saved_master_log_name, rli->group_master_log_name);
saved_log_pos= rli->group_relay_log_pos;
saved_master_log_pos= rli->group_master_log_pos;
saved_skip= rli->slave_skip_counter;
@@ -5247,8 +5245,7 @@ static Log_event* next_event(Relay_log_info* rli)
goto err;
}
rli->event_relay_log_pos = BIN_LOG_HEADER_SIZE;
- strmake(rli->event_relay_log_name,rli->linfo.log_file_name,
- sizeof(rli->event_relay_log_name)-1);
+ strmake_buf(rli->event_relay_log_name,rli->linfo.log_file_name);
flush_relay_log_info(rli);
}
diff --git a/sql/sp.cc b/sql/sp.cc
index acd10bc45a4..269917d6863 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -114,7 +114,7 @@ TABLE_FIELD_TYPE proc_table_fields[MYSQL_PROC_FIELD_COUNT] =
},
{
{ C_STRING_WITH_LEN("definer") },
- { C_STRING_WITH_LEN("char(77)") },
+ { C_STRING_WITH_LEN("char(") },
{ C_STRING_WITH_LEN("utf8") }
},
{
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index be6dc935dcc..244fba2819c 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1160,8 +1160,9 @@ find_handler_after_execution(THD *thd, sp_rcontext *ctx)
MYSQL_ERROR *err;
while ((err= it++))
{
- if (err->get_level() != MYSQL_ERROR::WARN_LEVEL_WARN &&
- err->get_level() != MYSQL_ERROR::WARN_LEVEL_NOTE)
+ if ((err->get_level() != MYSQL_ERROR::WARN_LEVEL_WARN &&
+ err->get_level() != MYSQL_ERROR::WARN_LEVEL_NOTE) ||
+ err->handled())
continue;
if (ctx->find_handler(thd,
@@ -1170,6 +1171,7 @@ find_handler_after_execution(THD *thd, sp_rcontext *ctx)
err->get_level(),
err->get_message_text()))
{
+ err->mark_handled();
break;
}
}
@@ -1419,6 +1421,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
Will write this SP statement into binlog separately.
TODO: consider changing the condition to "not inside event union".
*/
+ MEM_ROOT *user_var_events_alloc_saved= thd->user_var_events_alloc;
if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
thd->user_var_events_alloc= thd->mem_root;
@@ -1434,7 +1437,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
if (thd->locked_tables_mode <= LTM_LOCK_TABLES)
{
reset_dynamic(&thd->user_var_events);
- thd->user_var_events_alloc= NULL;//DEBUG
+ thd->user_var_events_alloc= user_var_events_alloc_saved;
}
/* we should cleanup free_list and memroot, used by instruction */
diff --git a/sql/spatial.cc b/sql/spatial.cc
index 267e038c5b8..2359f4fa271 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -312,6 +312,9 @@ bool Geometry::envelope(String *result) const
const char *end;
if (get_mbr(&mbr, &end))
+ return 1;
+
+ if (!mbr.valid())
{
/* Empty geometry */
if (result->reserve(1 + 4*2))
@@ -444,18 +447,19 @@ const char *Geometry::append_points(String *txt, uint32 n_points,
const char *Geometry::get_mbr_for_points(MBR *mbr, const char *data,
uint offset) const
{
- uint32 points;
+ uint32 n_points;
/* read number of points */
if (no_data(data, 4))
return 0;
- points= uint4korr(data);
+ n_points= uint4korr(data);
data+= 4;
- if (no_data(data, (POINT_DATA_SIZE + offset) * points))
+ if (n_points > max_n_points ||
+ no_data(data, (POINT_DATA_SIZE + offset) * n_points))
return 0;
/* Calculate MBR for points */
- while (points--)
+ while (n_points--)
{
data+= offset;
mbr->add_xy(data, data + SIZEOF_STORED_DOUBLE);
@@ -559,9 +563,12 @@ const Geometry::Class_info *Gis_point::get_class_info() const
uint32 Gis_line_string::get_data_size() const
{
- if (no_data(m_data, 4))
+ uint32 n_points, size;
+ if (no_data(m_data, 4) ||
+ (n_points= uint4korr(m_data)) > max_n_points ||
+ no_data(m_data, (size= 4 + n_points * POINT_DATA_SIZE)))
return GET_SIZE_ERROR;
- return 4 + uint4korr(m_data) * POINT_DATA_SIZE;
+ return size;
}
@@ -754,6 +761,9 @@ int Gis_line_string::end_point(String *result) const
if (no_data(m_data, 4))
return 1;
n_points= uint4korr(m_data);
+ if (n_points == 0 || n_points > max_n_points ||
+ no_data(m_data, POINT_DATA_SIZE * n_points))
+ return 1;
return create_point(result, m_data + 4 + (n_points - 1) * POINT_DATA_SIZE);
}
@@ -763,11 +773,14 @@ int Gis_line_string::point_n(uint32 num, String *result) const
uint32 n_points;
if (no_data(m_data, 4))
return 1;
+ num--;
n_points= uint4korr(m_data);
- if ((uint32) (num - 1) >= n_points) // means (num > n_points || num < 1)
+ if (num >= n_points ||
+ num > max_n_points || // means (num > n_points || num < 1)
+ no_data(m_data, num * POINT_DATA_SIZE))
return 1;
- return create_point(result, m_data + 4 + (num - 1) * POINT_DATA_SIZE);
+ return create_point(result, m_data + 4 + num*POINT_DATA_SIZE);
}
@@ -817,6 +830,7 @@ const Geometry::Class_info *Gis_line_string::get_class_info() const
uint32 Gis_polygon::get_data_size() const
{
uint32 n_linear_rings;
+ uint32 n_points;
const char *data= m_data;
if (no_data(data, 4))
@@ -826,10 +840,13 @@ uint32 Gis_polygon::get_data_size() const
while (n_linear_rings--)
{
- if (no_data(data, 4))
+ if (no_data(data, 4) ||
+ (n_points= uint4korr(data)) > max_n_points)
return GET_SIZE_ERROR;
- data+= 4 + uint4korr(data)*POINT_DATA_SIZE;
+ data+= 4 + n_points*POINT_DATA_SIZE;
}
+ if (no_data(data, 0))
+ return GET_SIZE_ERROR;
return (uint32) (data - m_data);
}
@@ -1022,7 +1039,8 @@ int Gis_polygon::area(double *ar, const char **end_of_data) const
if (no_data(data, 4))
return 1;
n_points= uint4korr(data);
- if (n_points > max_n_points || no_data(data, POINT_DATA_SIZE * n_points))
+ if (n_points == 0 || n_points > max_n_points ||
+ no_data(data, POINT_DATA_SIZE * n_points))
return 1;
get_point(&prev_x, &prev_y, data+4);
data+= (4+POINT_DATA_SIZE);
@@ -1126,13 +1144,11 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
const char *data= m_data;
bool first_loop= 1;
- if (no_data(data, 4))
+ if (no_data(data, 4) ||
+ (n_linear_rings= uint4korr(data)) == 0)
return 1;
- n_linear_rings= uint4korr(data);
data+= 4;
- DBUG_ASSERT(n_linear_rings > 0);
-
while (n_linear_rings--)
{
uint32 n_points, org_n_points;
@@ -1145,7 +1161,8 @@ int Gis_polygon::centroid_xy(double *x, double *y) const
return 1;
org_n_points= n_points= uint4korr(data);
data+= 4;
- if (n_points > max_n_points || no_data(data, POINT_DATA_SIZE * n_points))
+ if (n_points == 0 || n_points > max_n_points ||
+ no_data(data, POINT_DATA_SIZE * n_points))
return 1;
get_point(&prev_x, &prev_y, data);
data+= POINT_DATA_SIZE;
@@ -1273,9 +1290,14 @@ const Geometry::Class_info *Gis_polygon::get_class_info() const
uint32 Gis_multi_point::get_data_size() const
{
- if (no_data(m_data, 4))
- return GET_SIZE_ERROR;
- return 4 + uint4korr(m_data)*(POINT_DATA_SIZE + WKB_HEADER_SIZE);
+ uint32 n_points;
+ uint32 size;
+
+ if (no_data(m_data, 4) ||
+ (n_points= uint4korr(m_data)) > max_n_points ||
+ no_data(m_data, (size= 4 + n_points*(POINT_DATA_SIZE + WKB_HEADER_SIZE))))
+ return GET_SIZE_ERROR;
+ return size;
}
@@ -1369,8 +1391,8 @@ bool Gis_multi_point::get_data_as_wkt(String *txt, const char **end) const
return 1;
n_points= uint4korr(m_data);
- if (no_data(m_data+4,
- n_points * (POINT_DATA_SIZE + WKB_HEADER_SIZE)) ||
+ if (n_points > max_n_points ||
+ no_data(m_data+4, n_points * (POINT_DATA_SIZE + WKB_HEADER_SIZE)) ||
txt->reserve(((MAX_DIGITS_IN_DOUBLE + 1) * 2 + 1) * n_points))
return 1;
*end= append_points(txt, n_points, m_data+4, WKB_HEADER_SIZE);
@@ -1451,6 +1473,7 @@ const Geometry::Class_info *Gis_multi_point::get_class_info() const
uint32 Gis_multi_line_string::get_data_size() const
{
uint32 n_line_strings;
+ uint32 n_points;
const char *data= m_data;
if (no_data(data, 4))
@@ -1460,11 +1483,13 @@ uint32 Gis_multi_line_string::get_data_size() const
while (n_line_strings--)
{
- if (no_data(data, WKB_HEADER_SIZE + 4))
+ if (no_data(data, WKB_HEADER_SIZE + 4) ||
+ (n_points= uint4korr(data + WKB_HEADER_SIZE)) > max_n_points)
return GET_SIZE_ERROR;
- data+= (WKB_HEADER_SIZE + 4 + uint4korr(data + WKB_HEADER_SIZE) *
- POINT_DATA_SIZE);
+ data+= (WKB_HEADER_SIZE + 4 + n_points*POINT_DATA_SIZE);
}
+ if (no_data(data, 0))
+ return GET_SIZE_ERROR;
return (uint32) (data - m_data);
}
@@ -1649,7 +1674,7 @@ int Gis_multi_line_string::geometry_n(uint32 num, String *result) const
return 1;
n_points= uint4korr(data + WKB_HEADER_SIZE);
length= WKB_HEADER_SIZE + 4+ POINT_DATA_SIZE * n_points;
- if (no_data(data, length))
+ if (n_points > max_n_points || no_data(data, length))
return 1;
if (!--num)
break;
@@ -1760,6 +1785,7 @@ const Geometry::Class_info *Gis_multi_line_string::get_class_info() const
uint32 Gis_multi_polygon::get_data_size() const
{
uint32 n_polygons;
+ uint32 n_points;
const char *data= m_data;
if (no_data(data, 4))
@@ -1778,11 +1804,14 @@ uint32 Gis_multi_polygon::get_data_size() const
while (n_linear_rings--)
{
- if (no_data(data, 4))
+ if (no_data(data, 4) ||
+ (n_points= uint4korr(data)) > max_n_points)
return GET_SIZE_ERROR;
- data+= 4 + uint4korr(data) * POINT_DATA_SIZE;
+ data+= 4 + n_points * POINT_DATA_SIZE;
}
}
+ if (no_data(data, 0))
+ return GET_SIZE_ERROR;
return (uint32) (data - m_data);
}
@@ -2325,7 +2354,7 @@ bool Gis_geometry_collection::get_mbr(MBR *mbr, const char **end) const
n_objects= uint4korr(data);
data+= 4;
if (n_objects == 0)
- return 1;
+ goto exit;
while (n_objects--)
{
@@ -2342,6 +2371,7 @@ bool Gis_geometry_collection::get_mbr(MBR *mbr, const char **end) const
if (geom->get_mbr(mbr, &data))
return 1;
}
+exit:
*end= data;
return 0;
}
@@ -2359,10 +2389,11 @@ int Gis_geometry_collection::area(double *ar, const char **end) const
return 1;
n_objects= uint4korr(data);
data+= 4;
- if (n_objects == 0)
- return 1;
result= 0.0;
+ if (n_objects == 0)
+ goto exit;
+
while (n_objects--)
{
uint32 wkb_type;
@@ -2379,6 +2410,7 @@ int Gis_geometry_collection::area(double *ar, const char **end) const
return 1;
result+= *ar;
}
+exit:
*end= data;
*ar= result;
return 0;
@@ -2397,10 +2429,11 @@ int Gis_geometry_collection::geom_length(double *len, const char **end) const
return 1;
n_objects= uint4korr(data);
data+= 4;
+ result= 0.0;
+
if (n_objects == 0)
- return 1;
+ goto exit;
- result= 0.0;
while (n_objects--)
{
uint32 wkb_type;
@@ -2417,6 +2450,8 @@ int Gis_geometry_collection::geom_length(double *len, const char **end) const
return 1;
result+= *len;
}
+
+exit:
*end= data;
*len= result;
return 0;
diff --git a/sql/spatial.h b/sql/spatial.h
index f55d1ccba8e..9aaedfe8a20 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -200,6 +200,9 @@ struct MBR
return (d == intersection.dimension());
}
+
+ int valid() const
+ { return xmin <= xmax && ymin <= ymax; }
};
@@ -212,7 +215,7 @@ class Geometry
public:
// Maximum number of points in feature that can fit into String
static const uint32 max_n_points=
- (uint32) (UINT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) /
+ (uint32) (INT_MAX32 - WKB_HEADER_SIZE - 4 /* n_points */) /
POINT_DATA_SIZE;
Geometry() {} /* Remove gcc warning */
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index b843a86068d..8f77d2758dd 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -52,6 +52,8 @@
#include "sql_db.h"
#include "sql_array.h"
+#include "sql_plugin_compat.h"
+
bool mysql_user_table_is_in_short_password_format= false;
static const
@@ -68,7 +70,7 @@ TABLE_FIELD_TYPE mysql_db_table_fields[MYSQL_DB_FIELD_COUNT] = {
},
{
{ C_STRING_WITH_LEN("User") },
- { C_STRING_WITH_LEN("char(16)") },
+ { C_STRING_WITH_LEN("char(") },
{NULL, 0}
},
{
@@ -826,6 +828,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
table->use_all_columns();
(void) my_init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100);
+ username_char_length= min(table->field[1]->char_length(), USERNAME_CHAR_LENGTH);
password_length= table->field[2]->field_length /
table->field[2]->charset()->mbmaxlen;
if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
@@ -1433,12 +1436,12 @@ bool acl_getroot(Security_context *sctx, char *user, char *host,
sctx->master_access= acl_user->access;
if (acl_user->user)
- strmake(sctx->priv_user, user, USERNAME_LENGTH);
+ strmake_buf(sctx->priv_user, user);
else
*sctx->priv_user= 0;
if (acl_user->host.hostname)
- strmake(sctx->priv_host, acl_user->host.hostname, MAX_HOSTNAME - 1);
+ strmake_buf(sctx->priv_host, acl_user->host.hostname);
else
*sctx->priv_host= 0;
}
@@ -8334,6 +8337,12 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
cs->coll->hash_sort(cs, (uchar*) sctx->user, strlen(sctx->user), &nr1, &nr2);
mysql_mutex_lock(&acl_cache->lock);
+ if (!acl_users.elements)
+ {
+ mysql_mutex_unlock(&acl_cache->lock);
+ login_failed_error(mpvio->thd);
+ DBUG_RETURN(1);
+ }
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);
@@ -8359,10 +8368,9 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
mpvio->auth_info.user_name= sctx->user;
mpvio->auth_info.user_name_length= strlen(sctx->user);
mpvio->auth_info.auth_string= mpvio->acl_user->auth_string.str;
- mpvio->auth_info.auth_string_length=
- (unsigned long) mpvio->acl_user->auth_string.length;
- strmake(mpvio->auth_info.authenticated_as, mpvio->acl_user->user ?
- mpvio->acl_user->user : "", USERNAME_LENGTH);
+ mpvio->auth_info.auth_string_length= (unsigned long) mpvio->acl_user->auth_string.length;
+ strmake_buf(mpvio->auth_info.authenticated_as, mpvio->acl_user->user ?
+ mpvio->acl_user->user : "");
DBUG_PRINT("info", ("exit: user=%s, auth_string=%s, authenticated as=%s"
"plugin=%s",
@@ -8446,7 +8454,7 @@ static bool parse_com_change_user_packet(MPVIO_EXT *mpvio, uint packet_length)
/* Clear variables that are allocated */
thd->user_connect= 0;
- strmake(sctx->priv_user, sctx->user, USERNAME_LENGTH);
+ strmake_buf(sctx->priv_user, sctx->user);
if (thd->make_lex_string(&mpvio->db, db_buff, db_len, 0) == 0)
DBUG_RETURN(1); /* The error is set by make_lex_string(). */
@@ -8661,14 +8669,15 @@ static ulong parse_client_handshake_packet(MPVIO_EXT *mpvio,
/*
Clip username to allowed length in characters (not bytes). This is
- mostly for backward compatibility.
+ mostly for backward compatibility (to truncate long usernames, as
+ old 5.1 did)
*/
{
CHARSET_INFO *cs= system_charset_info;
int err;
user_len= (uint) cs->cset->well_formed_len(cs, user, user + user_len,
- USERNAME_CHAR_LENGTH, &err);
+ username_char_length, &err);
user[user_len]= '\0';
}
@@ -9063,7 +9072,20 @@ static int do_auth_once(THD *thd, const LEX_STRING *auth_plugin_name,
if (plugin)
{
st_mysql_auth *auth= (st_mysql_auth *) plugin_decl(plugin)->info;
- res= auth->authenticate_user(mpvio, &mpvio->auth_info);
+ switch (auth->interface_version) {
+ case 0x0200:
+ res= auth->authenticate_user(mpvio, &mpvio->auth_info);
+ break;
+ case 0x0100:
+ {
+ MYSQL_SERVER_AUTH_INFO_0x0100 compat;
+ compat.downgrade(&mpvio->auth_info);
+ res= auth->authenticate_user(mpvio, (MYSQL_SERVER_AUTH_INFO *)&compat);
+ compat.upgrade(&mpvio->auth_info);
+ }
+ break;
+ default: DBUG_ASSERT(0);
+ }
if (unlock_plugin)
plugin_unlock(thd, plugin);
@@ -9114,8 +9136,6 @@ bool acl_authenticate(THD *thd, uint connect_errors,
: COM_CONNECT;
DBUG_ENTER("acl_authenticate");
- compile_time_assert(MYSQL_USERNAME_LENGTH == USERNAME_LENGTH);
-
bzero(&mpvio, sizeof(mpvio));
mpvio.read_packet= server_mpvio_read_packet;
mpvio.write_packet= server_mpvio_write_packet;
@@ -9252,12 +9272,12 @@ bool acl_authenticate(THD *thd, uint connect_errors,
sctx->master_access= acl_user->access;
if (acl_user->user)
- strmake(sctx->priv_user, acl_user->user, USERNAME_LENGTH - 1);
+ strmake_buf(sctx->priv_user, acl_user->user);
else
*sctx->priv_user= 0;
if (acl_user->host.hostname)
- strmake(sctx->priv_host, acl_user->host.hostname, MAX_HOSTNAME - 1);
+ strmake_buf(sctx->priv_host, acl_user->host.hostname);
else
*sctx->priv_host= 0;
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index c68d4dc16a4..ae5b21fc959 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -332,7 +332,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
item->maybe_null = 1;
field_list.push_back(item = new Item_empty_string("Msg_type", 10));
item->maybe_null = 1;
- field_list.push_back(item = new Item_empty_string("Msg_text", 255));
+ field_list.push_back(item = new Item_empty_string("Msg_text",
+ SQL_ADMIN_MSG_TEXT_SIZE));
item->maybe_null = 1;
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
diff --git a/sql/sql_admin.h b/sql/sql_admin.h
index f7ec76efd5e..5398e3019f1 100644
--- a/sql/sql_admin.h
+++ b/sql/sql_admin.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -16,6 +16,8 @@
#ifndef SQL_TABLE_MAINTENANCE_H
#define SQL_TABLE_MAINTENANCE_H
+/* Must be able to hold ALTER TABLE t PARTITION BY ... KEY ALGORITHM = 1 ... */
+#define SQL_ADMIN_MSG_TEXT_SIZE 128 * 1024
bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
LEX_STRING *key_cache_name);
diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc
index 523f07592bc..8e17f49df28 100644
--- a/sql/sql_audit.cc
+++ b/sql/sql_audit.cc
@@ -31,8 +31,7 @@ unsigned long mysql_global_audit_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
static mysql_mutex_t LOCK_audit_mask;
-static void event_class_dispatch(THD *thd, unsigned int event_class,
- const void *event);
+static void event_class_dispatch(THD *, unsigned int, const void *);
static inline
@@ -111,9 +110,36 @@ static void connection_class_handler(THD *thd, uint event_subclass, va_list ap)
}
+static void table_class_handler(THD *thd, uint event_subclass, va_list ap)
+{
+ mysql_event_table event;
+ event.event_subclass= event_subclass;
+ event.read_only= va_arg(ap, int);
+ event.thread_id= va_arg(ap, unsigned long);
+ event.user= va_arg(ap, const char *);
+ event.priv_user= va_arg(ap, const char *);
+ event.priv_host= va_arg(ap, const char *);
+ event.external_user= va_arg(ap, const char *);
+ event.proxy_user= va_arg(ap, const char *);
+ event.host= va_arg(ap, const char *);
+ event.ip= va_arg(ap, const char *);
+ event.database= va_arg(ap, const char *);
+ event.database_length= va_arg(ap, unsigned int);
+ event.table= va_arg(ap, const char *);
+ event.table_length= va_arg(ap, unsigned int);
+ event.new_database= va_arg(ap, const char *);
+ event.new_database_length= va_arg(ap, unsigned int);
+ event.new_table= va_arg(ap, const char *);
+ event.new_table_length= va_arg(ap, unsigned int);
+ event_class_dispatch(thd, MYSQL_AUDIT_TABLE_CLASS, &event);
+}
+
+
static audit_handler_t audit_handlers[] =
{
- general_class_handler, connection_class_handler
+ general_class_handler, connection_class_handler,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0, /* placeholders */
+ table_class_handler
};
static const uint audit_handlers_count=
diff --git a/sql/sql_audit.h b/sql/sql_audit.h
index 46afe4b7596..75b338a16c8 100644
--- a/sql/sql_audit.h
+++ b/sql/sql_audit.h
@@ -43,17 +43,23 @@ static inline bool mysql_audit_general_enabled()
return mysql_global_audit_mask[0] & MYSQL_AUDIT_GENERAL_CLASSMASK;
}
+static inline bool mysql_audit_table_enabled()
+{
+ return mysql_global_audit_mask[0] & MYSQL_AUDIT_TABLE_CLASSMASK;
+}
+
#else
static inline void mysql_audit_notify(THD *thd, uint event_class,
uint event_subtype, ...) { }
#define mysql_audit_general_enabled() 0
+#define mysql_audit_table_enabled() 0
#endif
extern void mysql_audit_release(THD *thd);
#define MAX_USER_HOST_SIZE 512
static inline uint make_user_name(THD *thd, char *buf)
{
- Security_context *sctx= thd->security_ctx;
+ const Security_context *sctx= thd->security_ctx;
return strxnmov(buf, MAX_USER_HOST_SIZE,
sctx->priv_user[0] ? sctx->priv_user : "", "[",
sctx->user ? sctx->user : "", "] @ ",
@@ -174,4 +180,87 @@ void mysql_audit_general(THD *thd, uint event_subtype,
(thd)->security_ctx->ip ? strlen((thd)->security_ctx->ip) : 0,\
(thd)->db, (thd)->db ? strlen((thd)->db) : 0)
+static inline
+void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock)
+{
+ if (lock != F_UNLCK && mysql_audit_table_enabled())
+ {
+ const Security_context *sctx= thd->security_ctx;
+ mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, MYSQL_AUDIT_TABLE_LOCK,
+ (int)(lock == F_RDLCK), (ulong)thd->thread_id,
+ sctx->user, sctx->priv_user, sctx->priv_host,
+ sctx->external_user, sctx->proxy_user, sctx->host,
+ sctx->ip, share->db.str, (uint)share->db.length,
+ share->table_name.str, (uint)share->table_name.length,
+ 0,0,0,0);
+ }
+}
+
+static inline
+void mysql_audit_create_table(TABLE *table)
+{
+ if (mysql_audit_table_enabled())
+ {
+ THD *thd= table->in_use;
+ const TABLE_SHARE *share= table->s;
+ const Security_context *sctx= thd->security_ctx;
+ mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, MYSQL_AUDIT_TABLE_CREATE,
+ 0, (ulong)thd->thread_id,
+ sctx->user, sctx->priv_user, sctx->priv_host,
+ sctx->external_user, sctx->proxy_user, sctx->host,
+ sctx->ip, share->db.str, (uint)share->db.length,
+ share->table_name.str, (uint)share->table_name.length,
+ 0,0,0,0);
+ }
+}
+
+static inline
+void mysql_audit_drop_table(THD *thd, TABLE_LIST *table)
+{
+ if (mysql_audit_table_enabled())
+ {
+ const Security_context *sctx= thd->security_ctx;
+ mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, MYSQL_AUDIT_TABLE_DROP,
+ 0, (ulong)thd->thread_id,
+ sctx->user, sctx->priv_user, sctx->priv_host,
+ sctx->external_user, sctx->proxy_user, sctx->host,
+ sctx->ip, table->db, (uint)table->db_length,
+ table->table_name, (uint)table->table_name_length,
+ 0,0,0,0);
+ }
+}
+
+static inline
+void mysql_audit_rename_table(THD *thd, const char *old_db, const char *old_tb,
+ const char *new_db, const char *new_tb)
+{
+ if (mysql_audit_table_enabled())
+ {
+ const Security_context *sctx= thd->security_ctx;
+ mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, MYSQL_AUDIT_TABLE_RENAME,
+ 0, (ulong)thd->thread_id,
+ sctx->user, sctx->priv_user, sctx->priv_host,
+ sctx->external_user, sctx->proxy_user, sctx->host,
+ sctx->ip,
+ old_db, (uint)strlen(old_db), old_tb, (uint)strlen(old_tb),
+ new_db, (uint)strlen(new_db), new_tb, (uint)strlen(new_tb));
+ }
+}
+
+static inline
+void mysql_audit_alter_table(THD *thd, TABLE_LIST *table)
+{
+ if (mysql_audit_table_enabled())
+ {
+ const Security_context *sctx= thd->security_ctx;
+ mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, MYSQL_AUDIT_TABLE_ALTER,
+ 0, (ulong)thd->thread_id,
+ sctx->user, sctx->priv_user, sctx->priv_host,
+ sctx->external_user, sctx->proxy_user, sctx->host,
+ sctx->ip, table->db, (uint)table->db_length,
+ table->table_name, (uint)table->table_name_length,
+ 0,0,0,0);
+ }
+}
+
#endif /* SQL_AUDIT_INCLUDED */
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 6483ab283ea..9d2120439f1 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -6948,7 +6948,7 @@ find_field_in_tables(THD *thd, Item_ident *item,
We can't do this in Item_field as this would change the
'name' of the item which may be used in the select list
*/
- strmake(name_buff, db, sizeof(name_buff)-1);
+ strmake_buf(name_buff, db);
my_casedn_str(files_charset_info, name_buff);
db= name_buff;
}
@@ -8521,7 +8521,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
We can't do this in Item_field as this would change the
'name' of the item which may be used in the select list
*/
- strmake(name_buff, db_name, sizeof(name_buff)-1);
+ strmake_buf(name_buff, db_name);
my_casedn_str(files_charset_info, name_buff);
db_name= name_buff;
}
@@ -9523,7 +9523,6 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order)
List_iterator<Item_func_match> li(*(select_lex->ftfunc_list));
Item_func_match *ifm;
DBUG_PRINT("info",("Performing FULLTEXT search"));
- thd_proc_info(thd, "FULLTEXT initialization");
while ((ifm=li++))
ifm->init_search(no_order);
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index a4664da2bf6..3bb5deab406 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -107,7 +107,7 @@ void mysql_client_binlog_statement(THD* thd)
rli->relay_log.description_event_for_exec &&
buf))
{
- my_error(ER_OUTOFMEMORY, MYF(0), 1); /* needed 1 bytes */
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1); /* needed 1 bytes */
goto end;
}
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 016973ab51a..1e5c99822ff 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -466,6 +466,8 @@ static void make_base_query(String *new_query,
/* The following is guaranteed by the query_cache interface */
DBUG_ASSERT(query[query_length] == 0);
DBUG_ASSERT(!is_white_space(query[0]));
+ /* We do not support UCS2, UTF16, UTF32 as a client character set */
+ DBUG_ASSERT(current_thd->variables.character_set_client->mbminlen == 1);
new_query->length(0); // Don't copy anything from old buffer
if (new_query->realloc(query_length + additional_length))
@@ -828,18 +830,18 @@ void Query_cache_block::destroy()
DBUG_VOID_RETURN;
}
-inline uint Query_cache_block::headers_len()
+uint Query_cache_block::headers_len()
{
return (ALIGN_SIZE(sizeof(Query_cache_block_table)*n_tables) +
ALIGN_SIZE(sizeof(Query_cache_block)));
}
-inline uchar* Query_cache_block::data(void)
+uchar* Query_cache_block::data(void)
{
return (uchar*)( ((uchar*)this) + headers_len() );
}
-inline Query_cache_query * Query_cache_block::query()
+Query_cache_query * Query_cache_block::query()
{
#ifndef DBUG_OFF
if (type != QUERY)
@@ -848,7 +850,7 @@ inline Query_cache_query * Query_cache_block::query()
return (Query_cache_query *) data();
}
-inline Query_cache_table * Query_cache_block::table()
+Query_cache_table * Query_cache_block::table()
{
#ifndef DBUG_OFF
if (type != TABLE)
@@ -857,7 +859,7 @@ inline Query_cache_table * Query_cache_block::table()
return (Query_cache_table *) data();
}
-inline Query_cache_result * Query_cache_block::result()
+Query_cache_result * Query_cache_block::result()
{
#ifndef DBUG_OFF
if (type != RESULT && type != RES_CONT && type != RES_BEG &&
@@ -867,7 +869,7 @@ inline Query_cache_result * Query_cache_block::result()
return (Query_cache_result *) data();
}
-inline Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n)
+Query_cache_block_table * Query_cache_block::table(TABLE_COUNTER_TYPE n)
{
return ((Query_cache_block_table *)
(((uchar*)this)+ALIGN_SIZE(sizeof(Query_cache_block)) +
@@ -2430,7 +2432,28 @@ void Query_cache::init()
m_cache_status= Query_cache::OK;
m_requests_in_progress= 0;
initialized = 1;
- query_state_map= default_charset_info->state_map;
+ /*
+ Using state_map from latin1 should be fine in all cases:
+ 1. We do not support UCS2, UTF16, UTF32 as a client character set.
+ 2. The other character sets are compatible on the lower ASCII-range
+ 0x00-0x20, and have the following characters marked as spaces:
+
+ 0x09 TAB
+ 0x0A LINE FEED
+ 0x0B VERTICAL TAB
+ 0x0C FORM FEED
+ 0x0D CARRIAGE RETUR
+ 0x20 SPACE
+
+ Additionally, only some of the ASCII-compatible character sets
+ (including latin1) can have 0xA0 mapped to "NON-BREAK SPACE"
+ and thus marked as space.
+ That should not be a problem for those charsets that map 0xA0
+ to something else: the parser will just return syntax error
+ if this character appears straight in the query
+ (i.e. not inside a string literal or comment).
+ */
+ query_state_map= my_charset_latin1.state_map;
/*
If we explicitly turn off query cache from the command line query
cache will be disabled for the reminder of the server life
diff --git a/sql/sql_cache.h b/sql/sql_cache.h
index 7444d444cf9..f35ac889b23 100644
--- a/sql/sql_cache.h
+++ b/sql/sql_cache.h
@@ -141,12 +141,12 @@ struct Query_cache_block
inline bool is_free(void) { return type == FREE; }
void init(ulong length);
void destroy();
- inline uint headers_len();
- inline uchar* data(void);
- inline Query_cache_query *query();
- inline Query_cache_table *table();
- inline Query_cache_result *result();
- inline Query_cache_block_table *table(TABLE_COUNTER_TYPE n);
+ uint headers_len();
+ uchar* data(void);
+ Query_cache_query *query();
+ Query_cache_table *table();
+ Query_cache_result *result();
+ Query_cache_block_table *table(TABLE_COUNTER_TYPE n);
};
struct Query_cache_query
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 898787fa953..65b8b77bae8 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1369,10 +1369,16 @@ MYSQL_ERROR* THD::raise_condition(uint sql_errno,
query_cache_abort(&query_cache_tls);
- /* When simulating OOM, skip writing to error log to avoid mtr errors */
- DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_RETURN(NULL););
-
- cond= warning_info->push_warning(this, sql_errno, sqlstate, level, msg);
+ /*
+ Avoid pushing a condition for fatal out of memory errors as this will
+ require memory allocation and therefore might fail. Non fatal out of
+ memory errors can occur if raised by SIGNAL/RESIGNAL statement.
+ */
+ if (!(is_fatal_error && (sql_errno == EE_OUTOFMEMORY ||
+ sql_errno == ER_OUTOFMEMORY)))
+ {
+ cond= warning_info->push_warning(this, sql_errno, sqlstate, level, msg);
+ }
DBUG_RETURN(cond);
}
@@ -2318,7 +2324,7 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
key_length + 1);
if (!new_table)
{
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL),
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_FATALERROR),
ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1);
killed= KILL_CONNECTION;
return 0;
@@ -2777,7 +2783,7 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
bool string_results= FALSE, non_string_results= FALSE;
unit= u;
if ((uint) strlen(exchange->file_name) + NAME_LEN >= FN_REFLEN)
- strmake(path,exchange->file_name,FN_REFLEN-1);
+ strmake_buf(path,exchange->file_name);
write_cs= exchange->cs ? exchange->cs : &my_charset_bin;
@@ -2915,7 +2921,7 @@ int select_export::send_data(List<Item> &items)
set_if_smaller(estimated_bytes, UINT_MAX32);
if (cvt_str.realloc((uint32) estimated_bytes))
{
- my_error(ER_OUTOFMEMORY, MYF(0), (uint32) estimated_bytes);
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), (uint32) estimated_bytes);
goto err;
}
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index ddac46eb943..c350334b46c 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -438,7 +438,7 @@ void init_user_stats(USER_STATS *user_stats,
memcpy(user_stats->user, user, user_length);
user_stats->user[user_length]= 0;
user_stats->user_name_length= user_length;
- strmake(user_stats->priv_user, priv_user, sizeof(user_stats->priv_user)-1);
+ strmake_buf(user_stats->priv_user, priv_user);
user_stats->total_connections= total_connections;
user_stats->concurrent_connections= concurrent_connections;
diff --git a/sql/sql_const.h b/sql/sql_const.h
index de2704a8553..9d227601a20 100644
--- a/sql/sql_const.h
+++ b/sql/sql_const.h
@@ -92,7 +92,7 @@
#define FIELD_NR_MASK 16383 /* To get fieldnumber */
#define FERR -1 /* Error from my_functions */
#define CREATE_MODE 0 /* Default mode on new files */
-#define NAMES_SEP_CHAR '\377' /* Char to sep. names */
+#define NAMES_SEP_CHAR 255 /* Char to sep. names */
#define READ_RECORD_BUFFER (uint) (IO_SIZE*8) /* Pointer_buffer_size */
#define DISK_BUFFER_SIZE (uint) (IO_SIZE*16) /* Size of diskbuffer */
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index a3d68f54c9c..48bae0af29a 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -681,7 +681,7 @@ multi_delete::initialize_tables(JOIN *join)
tab;
tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS))
{
- if (tab->table->map & tables_to_delete_from)
+ if (!tab->bush_children && tab->table->map & tables_to_delete_from)
{
/* We are going to delete from this table */
TABLE *tbl=walk->table=tab->table;
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 06da6250e71..a4f5b210285 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -185,6 +185,7 @@ MYSQL_ERROR::MYSQL_ERROR()
m_cursor_name((const char*) NULL, 0, & my_charset_utf8_bin),
m_message_text(),
m_sql_errno(0),
+ m_handled(0),
m_level(MYSQL_ERROR::WARN_LEVEL_ERROR),
m_mem_root(NULL)
{
@@ -212,6 +213,7 @@ void MYSQL_ERROR::clear()
m_cursor_name.length(0);
m_message_text.length(0);
m_sql_errno= 0;
+ m_handled= 0;
m_level= MYSQL_ERROR::WARN_LEVEL_ERROR;
}
@@ -229,6 +231,7 @@ MYSQL_ERROR::MYSQL_ERROR(MEM_ROOT *mem_root)
m_cursor_name((const char*) NULL, 0, & my_charset_utf8_bin),
m_message_text(),
m_sql_errno(0),
+ m_handled(0),
m_level(MYSQL_ERROR::WARN_LEVEL_ERROR),
m_mem_root(mem_root)
{
@@ -267,6 +270,7 @@ MYSQL_ERROR::copy_opt_attributes(const MYSQL_ERROR *cond)
copy_string(m_mem_root, & m_table_name, & cond->m_table_name);
copy_string(m_mem_root, & m_column_name, & cond->m_column_name);
copy_string(m_mem_root, & m_cursor_name, & cond->m_cursor_name);
+ m_handled= cond->m_handled;
}
void
@@ -367,7 +371,7 @@ Diagnostics_area::set_ok_status(THD *thd, ulonglong affected_rows_arg,
m_affected_rows= affected_rows_arg;
m_last_insert_id= last_insert_id_arg;
if (message_arg)
- strmake(m_message, message_arg, sizeof(m_message) - 1);
+ strmake_buf(m_message, message_arg);
else
m_message[0]= '\0';
m_status= DA_OK;
@@ -435,7 +439,7 @@ Diagnostics_area::set_error_status(THD *thd, uint sql_errno_arg,
m_sql_errno= sql_errno_arg;
memcpy(m_sqlstate, sqlstate, SQLSTATE_LENGTH);
m_sqlstate[SQLSTATE_LENGTH]= '\0';
- strmake(m_message, message_arg, sizeof(m_message)-1);
+ strmake_buf(m_message, message_arg);
m_status= DA_ERROR;
DBUG_VOID_RETURN;
diff --git a/sql/sql_error.h b/sql/sql_error.h
index 00ade934226..0483e7c65d1 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -191,6 +191,17 @@ public:
MYSQL_ERROR::enum_warning_level get_level() const
{ return m_level; }
+ /** check if condition was handled by a condition handler */
+ bool handled() const
+ {
+ return m_handled;
+ }
+ /** mark that condition was handled */
+ void mark_handled()
+ {
+ m_handled= 1;
+ }
+
private:
/*
The interface of MYSQL_ERROR is mostly private, by design,
@@ -306,6 +317,9 @@ private:
/** MySQL extension, MYSQL_ERRNO condition item. */
uint m_sql_errno;
+ /** Marker if error/warning was handled by a continue handler */
+ bool m_handled;
+
/**
SQL RETURNED_SQLSTATE condition item.
This member is always NUL terminated.
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index d779f679021..df979c62541 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2001, 2011, Oracle and/or its affiliates.
- Copyright (c) 2011 Monty Program Ab
+/* Copyright (c) 2001, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2011, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1008,11 +1008,13 @@ static SQL_HANDLER *mysql_ha_find_match(THD *thd, TABLE_LIST *tables)
for (tables= first; tables; tables= tables->next_local)
{
+ if (tables->is_anonymous_derived_table())
+ continue;
if ((! *tables->db ||
! my_strcasecmp(&my_charset_latin1, hash_tables->db.str,
- tables->db)) &&
+ tables->get_db_name())) &&
! my_strcasecmp(&my_charset_latin1, hash_tables->table_name.str,
- tables->table_name))
+ tables->get_table_name()))
{
/* Link into hash_tables list */
hash_tables->next= head;
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 4f080235069..8f08c129519 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -2015,8 +2015,7 @@ public:
DBUG_ENTER("Delayed_insert constructor");
thd.security_ctx->user=(char*) delayed_user;
thd.security_ctx->host=(char*) my_localhost;
- strmake(thd.security_ctx->priv_user, thd.security_ctx->user,
- USERNAME_LENGTH);
+ strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user);
thd.current_tablenr=0;
thd.command=COM_DELAYED_INSERT;
thd.lex->current_select= 0; // for my_message_sql
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 659cf36ff43..6a1ab788e20 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1411,7 +1411,7 @@ int lex_one_token(void *arg, void *yythd)
yylval->lex_str=get_token(lip,
2, // skip x'
length-3); // don't count x' and last '
- return (HEX_NUM);
+ return HEX_STRING;
case MY_LEX_BIN_NUMBER: // Found b'bin-string'
lip->yySkip(); // Accept opening '
@@ -1928,6 +1928,7 @@ void st_select_lex::init_select()
merged_into= 0;
m_non_agg_field_used= false;
m_agg_func_used= false;
+ name_visibility_map= 0;
}
/*
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 2f3214646de..2af1ddbf39c 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -887,6 +887,9 @@ public:
*/
List<String> *prev_join_using;
+ /* namp of nesting SELECT visibility (for aggregate functions check) */
+ nesting_map name_visibility_map;
+
void init_query();
void init_select();
st_select_lex_unit* master_unit();
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 52ca997bef5..0765138c1c9 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1715,7 +1715,8 @@ void log_slow_statement(THD *thd)
/* Follow the slow log filter configuration. */
if (!thd->enable_slow_log ||
- !(thd->variables.log_slow_filter & thd->query_plan_flags))
+ (thd->variables.log_slow_filter
+ && !(thd->variables.log_slow_filter & thd->query_plan_flags)))
DBUG_VOID_RETURN;
if (((thd->server_status & SERVER_QUERY_WAS_SLOW) ||
@@ -1848,7 +1849,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
break;
case SCH_USER_STATS:
case SCH_CLIENT_STATS:
- if (check_global_access(thd, SUPER_ACL | PROCESS_ACL))
+ if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true))
DBUG_RETURN(1);
case SCH_TABLE_STATS:
case SCH_INDEX_STATS:
@@ -2023,7 +2024,7 @@ bool sp_process_definer(THD *thd)
if ((strcmp(lex->definer->user.str, thd->security_ctx->priv_user) ||
my_strcasecmp(system_charset_info, lex->definer->host.str,
thd->security_ctx->priv_host)) &&
- check_global_access(thd, SUPER_ACL))
+ check_global_access(thd, SUPER_ACL, true))
{
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
DBUG_RETURN(TRUE);
@@ -5692,14 +5693,17 @@ bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table)
1 Access denied. In this case an error is sent to the client
*/
-bool check_global_access(THD *thd, ulong want_access)
+bool check_global_access(THD *thd, ulong want_access, bool no_errors)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
char command[128];
if ((thd->security_ctx->master_access & want_access))
return 0;
- get_privilege_desc(command, sizeof(command), want_access);
- my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
+ if (!no_errors)
+ {
+ get_privilege_desc(command, sizeof(command), want_access);
+ my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
+ }
status_var_increment(thd->status_var.access_denied_errors);
return 1;
#else
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 1303eba84b7..6f7869ed5e4 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -196,7 +196,7 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
/* These were under the INNODB_COMPATIBILITY_HOOKS */
-bool check_global_access(THD *thd, ulong want_access);
+bool check_global_access(THD *thd, ulong want_access, bool no_errors= false);
inline bool is_supported_parser_charset(CHARSET_INFO *cs)
{
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 2bec12e4f66..72061f90e67 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2005, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009-2011, Monty Program Ab
+/* Copyright (c) 2005, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2011, 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
@@ -87,7 +87,9 @@ const LEX_STRING partition_keywords[]=
{ C_STRING_WITH_LEN("KEY") },
{ C_STRING_WITH_LEN("MAXVALUE") },
{ C_STRING_WITH_LEN("LINEAR ") },
- { C_STRING_WITH_LEN(" COLUMNS") }
+ { C_STRING_WITH_LEN(" COLUMNS") },
+ { C_STRING_WITH_LEN("ALGORITHM") }
+
};
static const char *part_str= "PARTITION";
static const char *sub_str= "SUB";
@@ -368,7 +370,7 @@ int get_parts_for_update(const uchar *old_data, uchar *new_data,
longlong old_func_value;
DBUG_ENTER("get_parts_for_update");
- DBUG_ASSERT(new_data == rec0);
+ DBUG_ASSERT(new_data == rec0); // table->record[0]
set_field_ptr(part_field_array, old_data, rec0);
error= part_info->get_partition_id(part_info, old_part_id,
&old_func_value);
@@ -526,12 +528,12 @@ static bool set_up_field_array(TABLE *table,
}
if (num_fields > MAX_REF_PARTS)
{
- char *ptr;
+ char *err_str;
if (is_sub_part)
- ptr= (char*)"subpartition function";
+ err_str= (char*)"subpartition function";
else
- ptr= (char*)"partition function";
- my_error(ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0), ptr);
+ err_str= (char*)"partition function";
+ my_error(ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0), err_str);
DBUG_RETURN(TRUE);
}
if (num_fields == 0)
@@ -2339,6 +2341,58 @@ end:
return err;
}
+
+/**
+ Add 'KEY' word, with optional 'ALGORTIHM = N'.
+
+ @param fptr File to write to.
+ @param part_info partition_info holding the used key_algorithm
+ @param current_comment_start NULL, or comment string encapsulating the
+ PARTITION BY clause.
+
+ @return Operation status.
+ @retval 0 Success
+ @retval != 0 Failure
+*/
+
+static int add_key_with_algorithm(File fptr, partition_info *part_info,
+ const char *current_comment_start)
+{
+ int err= 0;
+ err+= add_part_key_word(fptr, partition_keywords[PKW_KEY].str);
+
+ /*
+ current_comment_start is given when called from SHOW CREATE TABLE,
+ Then only add ALGORITHM = 1, not the default 2 or non-set 0!
+ For .frm current_comment_start is NULL, then add ALGORITHM if != 0.
+ */
+ if (part_info->key_algorithm == partition_info::KEY_ALGORITHM_51 || // SHOW
+ (!current_comment_start && // .frm
+ (part_info->key_algorithm != partition_info::KEY_ALGORITHM_NONE)))
+ {
+ /* If we already are within a comment, end that comment first. */
+ if (current_comment_start)
+ err+= add_string(fptr, "*/ ");
+ err+= add_string(fptr, "/*!50531 ");
+ err+= add_part_key_word(fptr, partition_keywords[PKW_ALGORITHM].str);
+ err+= add_equal(fptr);
+ err+= add_space(fptr);
+ err+= add_int(fptr, part_info->key_algorithm);
+ err+= add_space(fptr);
+ err+= add_string(fptr, "*/ ");
+ if (current_comment_start)
+ {
+ /* Skip new line. */
+ if (current_comment_start[0] == '\n')
+ current_comment_start++;
+ err+= add_string(fptr, current_comment_start);
+ err+= add_space(fptr);
+ }
+ }
+ return err;
+}
+
+
/*
Generate the partition syntax from the partition data structure.
Useful for support of generating defaults, SHOW CREATE TABLES
@@ -2383,7 +2437,8 @@ char *generate_partition_syntax(partition_info *part_info,
bool use_sql_alloc,
bool show_partition_options,
HA_CREATE_INFO *create_info,
- Alter_info *alter_info)
+ Alter_info *alter_info,
+ const char *current_comment_start)
{
uint i,j, tot_num_parts, num_subparts;
partition_element *part_elem;
@@ -2417,7 +2472,8 @@ char *generate_partition_syntax(partition_info *part_info,
err+= add_string(fptr, partition_keywords[PKW_LINEAR].str);
if (part_info->list_of_part_fields)
{
- err+= add_part_key_word(fptr, partition_keywords[PKW_KEY].str);
+ err+= add_key_with_algorithm(fptr, part_info,
+ current_comment_start);
err+= add_part_field_list(fptr, part_info->part_field_list);
}
else
@@ -2457,8 +2513,9 @@ char *generate_partition_syntax(partition_info *part_info,
err+= add_string(fptr, partition_keywords[PKW_LINEAR].str);
if (part_info->list_of_subpart_fields)
{
- add_part_key_word(fptr, partition_keywords[PKW_KEY].str);
- add_part_field_list(fptr, part_info->subpart_field_list);
+ err+= add_key_with_algorithm(fptr, part_info,
+ current_comment_start);
+ err+= add_part_field_list(fptr, part_info->subpart_field_list);
}
else
err+= add_part_key_word(fptr, partition_keywords[PKW_HASH].str);
@@ -2667,10 +2724,82 @@ static uint32 calculate_key_value(Field **field_array)
{
ulong nr1= 1;
ulong nr2= 4;
+ bool use_51_hash;
+ use_51_hash= test((*field_array)->table->part_info->key_algorithm ==
+ partition_info::KEY_ALGORITHM_51);
do
{
Field *field= *field_array;
+ if (use_51_hash)
+ {
+ switch (field->real_type()) {
+ case MYSQL_TYPE_TINY:
+ case MYSQL_TYPE_SHORT:
+ case MYSQL_TYPE_LONG:
+ case MYSQL_TYPE_FLOAT:
+ case MYSQL_TYPE_DOUBLE:
+ case MYSQL_TYPE_NEWDECIMAL:
+ case MYSQL_TYPE_TIMESTAMP:
+ case MYSQL_TYPE_LONGLONG:
+ case MYSQL_TYPE_INT24:
+ case MYSQL_TYPE_TIME:
+ case MYSQL_TYPE_DATETIME:
+ case MYSQL_TYPE_YEAR:
+ case MYSQL_TYPE_NEWDATE:
+ {
+ if (field->is_null())
+ {
+ nr1^= (nr1 << 1) | 1;
+ continue;
+ }
+ /* Force this to my_hash_sort_bin, which was used in 5.1! */
+ uint len= field->pack_length();
+ my_charset_bin.coll->hash_sort(&my_charset_bin, field->ptr, len,
+ &nr1, &nr2);
+ /* Done with this field, continue with next one. */
+ continue;
+ }
+ case MYSQL_TYPE_STRING:
+ case MYSQL_TYPE_VARCHAR:
+ case MYSQL_TYPE_BIT:
+ /* Not affected, same in 5.1 and 5.5 */
+ break;
+ /*
+ ENUM/SET uses my_hash_sort_simple in 5.1 (i.e. my_charset_latin1)
+ and my_hash_sort_bin in 5.5!
+ */
+ case MYSQL_TYPE_ENUM:
+ case MYSQL_TYPE_SET:
+ {
+ if (field->is_null())
+ {
+ nr1^= (nr1 << 1) | 1;
+ continue;
+ }
+ /* Force this to my_hash_sort_bin, which was used in 5.1! */
+ uint len= field->pack_length();
+ my_charset_latin1.coll->hash_sort(&my_charset_latin1, field->ptr,
+ len, &nr1, &nr2);
+ continue;
+ }
+ /* These types should not be allowed for partitioning! */
+ case MYSQL_TYPE_NULL:
+ case MYSQL_TYPE_DECIMAL:
+ case MYSQL_TYPE_DATE:
+ case MYSQL_TYPE_TINY_BLOB:
+ case MYSQL_TYPE_MEDIUM_BLOB:
+ case MYSQL_TYPE_LONG_BLOB:
+ case MYSQL_TYPE_BLOB:
+ case MYSQL_TYPE_VAR_STRING:
+ case MYSQL_TYPE_GEOMETRY:
+ /* fall through. */
+ default:
+ DBUG_ASSERT(0); // New type?
+ /* Fall through for default hashing (5.5). */
+ }
+ /* fall through, use collation based hashing. */
+ }
field->hash(&nr1, &nr2);
} while (*(++field_array));
return (uint32) nr1;
@@ -5413,14 +5542,25 @@ the generated partition syntax in a correct manner.
Need to cater for engine types that can handle partition without
using the partition handler.
*/
- if (thd->work_part_info != table->part_info)
+ if (part_info != table->part_info)
{
- DBUG_PRINT("info", ("partition changed"));
- *partition_changed= TRUE;
- if (thd->work_part_info->fix_parser_data(thd))
+ if (part_info->fix_parser_data(thd))
{
goto err;
}
+ /*
+ Compare the old and new part_info. If only key_algorithm
+ change is done, don't consider it as changed partitioning (to avoid
+ rebuild). This is to handle KEY (numeric_cols) partitioned tables
+ created in 5.1. For more info, see bug#14521864.
+ */
+ if (alter_info->flags != ALTER_PARTITION ||
+ !table->part_info ||
+ !table->part_info->has_same_partitioning(part_info))
+ {
+ DBUG_PRINT("info", ("partition changed"));
+ *partition_changed= true;
+ }
}
/*
Set up partition default_engine_type either from the create_info
@@ -6975,7 +7115,8 @@ void set_key_field_ptr(KEY *key_info, const uchar *new_buf,
void mem_alloc_error(size_t size)
{
- my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(size));
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR),
+ static_cast<int>(size));
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -7062,12 +7203,12 @@ void make_used_partitions_str(partition_info *part_info, String *parts_str)
definition)
IMPLEMENTATION
- There are two available interval analyzer functions:
- (1) get_part_iter_for_interval_via_mapping
+ There are three available interval analyzer functions:
+ (1) get_part_iter_for_interval_via_mapping
(2) get_part_iter_for_interval_cols_via_map
(3) get_part_iter_for_interval_via_walking
- They both have limited applicability:
+ They all have limited applicability:
(1) is applicable for "PARTITION BY <RANGE|LIST>(func(t.field))", where
func is a monotonic function.
@@ -7440,6 +7581,9 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
get_endpoint_func UNINIT_VAR(get_endpoint);
bool can_match_multiple_values; /* is not '=' */
uint field_len= field->pack_length_in_rec();
+ MYSQL_TIME start_date;
+ bool check_zero_dates= false;
+ bool zero_in_start_date= true;
DBUG_ENTER("get_part_iter_for_interval_via_mapping");
DBUG_ASSERT(!is_subpart);
(void) store_length_array;
@@ -7496,6 +7640,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
{
/* col is NOT NULL, but F(col) can return NULL, add NULL partition */
part_iter->ret_null_part= part_iter->ret_null_part_orig= TRUE;
+ check_zero_dates= true;
}
}
@@ -7539,6 +7684,19 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
DBUG_RETURN(1);
}
part_iter->part_nums.cur= part_iter->part_nums.start;
+ if (check_zero_dates && !part_info->part_expr->null_value)
+ {
+ if (!(flags & NO_MAX_RANGE) &&
+ (field->type() == MYSQL_TYPE_DATE ||
+ field->type() == MYSQL_TYPE_DATETIME))
+ {
+ /* Monotonic, but return NULL for dates with zeros in month/day. */
+ zero_in_start_date= field->get_date(&start_date, 0);
+ DBUG_PRINT("info", ("zero start %u %04d-%02d-%02d",
+ zero_in_start_date, start_date.year,
+ start_date.month, start_date.day));
+ }
+ }
if (part_iter->part_nums.start == max_endpoint_val)
DBUG_RETURN(0); /* No partitions */
}
@@ -7552,6 +7710,29 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
store_key_image_to_rec(field, max_value, field_len);
bool include_endp= !test(flags & NEAR_MAX);
part_iter->part_nums.end= get_endpoint(part_info, 0, include_endp);
+ if (check_zero_dates &&
+ !zero_in_start_date &&
+ !part_info->part_expr->null_value)
+ {
+ MYSQL_TIME end_date;
+ bool zero_in_end_date= field->get_date(&end_date, 0);
+ /*
+ This is an optimization for TO_DAYS()/TO_SECONDS() to avoid scanning
+ the NULL partition for ranges that cannot include a date with 0 as
+ month/day.
+ */
+ DBUG_PRINT("info", ("zero end %u %04d-%02d-%02d",
+ zero_in_end_date,
+ end_date.year, end_date.month, end_date.day));
+ DBUG_ASSERT(!memcmp(((Item_func*) part_info->part_expr)->func_name(),
+ "to_days", 7) ||
+ !memcmp(((Item_func*) part_info->part_expr)->func_name(),
+ "to_seconds", 10));
+ if (!zero_in_end_date &&
+ start_date.month == end_date.month &&
+ start_date.year == end_date.year)
+ part_iter->ret_null_part= part_iter->ret_null_part_orig= false;
+ }
if (part_iter->part_nums.start >= part_iter->part_nums.end &&
!part_iter->ret_null_part)
DBUG_RETURN(0); /* No partitions */
diff --git a/sql/sql_partition.h b/sql/sql_partition.h
index 2fd9b4c3d75..951d58a655b 100644
--- a/sql/sql_partition.h
+++ b/sql/sql_partition.h
@@ -1,8 +1,7 @@
#ifndef SQL_PARTITION_INCLUDED
#define SQL_PARTITION_INCLUDED
-/*
- Copyright (c) 2006, 2010, Oracle and/or its affiliates.
+/* Copyright (c) 2006, 2013, 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
@@ -268,7 +267,8 @@ char *generate_partition_syntax(partition_info *part_info,
uint *buf_length, bool use_sql_alloc,
bool show_partition_options,
HA_CREATE_INFO *create_info,
- Alter_info *alter_info);
+ Alter_info *alter_info,
+ const char *current_comment_start);
bool partition_key_modified(TABLE *table, const MY_BITMAP *fields);
#else
#define partition_key_modified(X,Y) 0
diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc
index 4edd47de855..b9bf3dbc217 100644
--- a/sql/sql_partition_admin.cc
+++ b/sql/sql_partition_admin.cc
@@ -141,7 +141,9 @@ bool Alter_table_truncate_partition_statement::execute(THD *thd)
TODO: Add support for TRUNCATE PARTITION for NDB and other
engines supporting native partitioning.
*/
- if (first_table->table->s->db_type() != partition_hton)
+
+ if (!first_table->table || first_table->view ||
+ first_table->table->s->db_type() != partition_hton)
{
my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
DBUG_RETURN(TRUE);
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index a66b3b633d2..e635fdd5dbe 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -35,6 +35,8 @@
#include <mysql/plugin_auth.h>
#include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT
#include <mysql/plugin_auth.h>
+#include "sql_plugin_compat.h"
+
#define REPORT_TO_LOG 1
#define REPORT_TO_USER 2
@@ -135,7 +137,7 @@ static int min_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION,
MYSQL_AUDIT_INTERFACE_VERSION,
MYSQL_REPLICATION_INTERFACE_VERSION,
- MYSQL_AUTHENTICATION_INTERFACE_VERSION
+ MIN_AUTHENTICATION_INTERFACE_VERSION
};
static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
diff --git a/sql/sql_plugin_compat.h b/sql/sql_plugin_compat.h
new file mode 100644
index 00000000000..5c7bb620575
--- /dev/null
+++ b/sql/sql_plugin_compat.h
@@ -0,0 +1,65 @@
+/* Copyright (C) 2013 Sergei Golubchik and Monty Program Ab
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/* old plugin api structures, used for backward compatibility */
+
+#define upgrade_var(X) latest->X= X
+#define upgrade_str(X) strmake_buf(latest->X, X)
+#define downgrade_var(X) X= latest->X
+#define downgrade_str(X) strmake_buf(X, latest->X)
+
+/**************************************************************/
+/* Authentication API, version 0x0100 *************************/
+#define MIN_AUTHENTICATION_INTERFACE_VERSION 0x0100
+
+struct MYSQL_SERVER_AUTH_INFO_0x0100 {
+ char *user_name;
+ unsigned int user_name_length;
+ const char *auth_string;
+ unsigned long auth_string_length;
+ char authenticated_as[49];
+ char external_user[512];
+ int password_used;
+ const char *host_or_ip;
+ unsigned int host_or_ip_length;
+
+ void upgrade(MYSQL_SERVER_AUTH_INFO *latest)
+ {
+ upgrade_var(user_name);
+ upgrade_var(user_name_length);
+ upgrade_var(auth_string);
+ upgrade_var(auth_string_length);
+ upgrade_str(authenticated_as);
+ upgrade_str(external_user);
+ upgrade_var(password_used);
+ upgrade_var(host_or_ip);
+ upgrade_var(host_or_ip_length);
+ }
+ void downgrade(MYSQL_SERVER_AUTH_INFO *latest)
+ {
+ downgrade_var(user_name);
+ downgrade_var(user_name_length);
+ downgrade_var(auth_string);
+ downgrade_var(auth_string_length);
+ downgrade_str(authenticated_as);
+ downgrade_str(external_user);
+ downgrade_var(password_used);
+ downgrade_var(host_or_ip);
+ downgrade_var(host_or_ip_length);
+ }
+};
+
+/**************************************************************/
+
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 10aa1ccec26..d278ccb870e 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -879,7 +879,7 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
if (param->state == Item_param::NO_VALUE)
DBUG_RETURN(1);
- if (param->limit_clause_param && param->item_type != Item::INT_ITEM)
+ if (param->limit_clause_param)
{
param->set_int(param->val_int(), MY_INT64_NUM_DECIMAL_DIGITS);
param->item_type= Item::INT_ITEM;
@@ -1503,7 +1503,8 @@ static int mysql_test_select(Prepared_statement *stmt,
if (!lex->result && !(lex->result= new (stmt->mem_root) select_send))
{
- my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(sizeof(select_send)));
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR),
+ static_cast<int>(sizeof(select_send)));
goto error;
}
@@ -1877,7 +1878,7 @@ static bool mysql_test_multidelete(Prepared_statement *stmt,
stmt->thd->lex->current_select= &stmt->thd->lex->select_lex;
if (add_item_to_list(stmt->thd, new Item_null()))
{
- my_error(ER_OUTOFMEMORY, MYF(0), 0);
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 0);
goto error;
}
@@ -3878,7 +3879,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
alloc_query(thd, (char*) expanded_query->ptr(),
expanded_query->length()))
{
- my_error(ER_OUTOFMEMORY, 0, expanded_query->length());
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), expanded_query->length());
goto error;
}
/*
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 1f5f63c87b5..abb78f6f1d3 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2008, 2012, Monty Program Ab
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2012, 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
@@ -631,6 +631,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
uint8 current_checksum_alg= BINLOG_CHECKSUM_ALG_UNDEF;
int old_max_allowed_packet= thd->variables.max_allowed_packet;
+
#ifndef DBUG_OFF
int left_events = max_binlog_dump_events;
#endif
@@ -878,8 +879,11 @@ impossible position";
if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg))
goto err;
- while (!(error = Log_event::read_log_event(&log, packet, log_lock,
- current_checksum_alg)))
+ bool is_active_binlog= false;
+ while (!(error= Log_event::read_log_event(&log, packet, log_lock,
+ current_checksum_alg,
+ log_file_name,
+ &is_active_binlog)))
{
#ifndef DBUG_OFF
if (max_binlog_dump_events && !left_events--)
@@ -961,6 +965,13 @@ impossible position";
goto err;
}
+ DBUG_EXECUTE_IF("wait_after_binlog_EOF",
+ {
+ const char act[]= "now wait_for signal.rotate_finished";
+ DBUG_ASSERT(!debug_sync_set_action(current_thd,
+ STRING_WITH_LEN(act)));
+ };);
+
/*
TODO: now that we are logging the offset, check to make sure
the recorded offset and the actual match.
@@ -971,8 +982,11 @@ impossible position";
if (test_for_non_eof_log_read_errors(error, &errmsg))
goto err;
- if (!(flags & BINLOG_DUMP_NON_BLOCK) &&
- mysql_bin_log.is_active(log_file_name))
+ /*
+ We should only move to the next binlog when the last read event
+ came from a already deactivated binlog.
+ */
+ if (!(flags & BINLOG_DUMP_NON_BLOCK) && is_active_binlog)
{
/*
Block until there is more data in the log
@@ -1026,7 +1040,8 @@ impossible position";
mysql_mutex_unlock(log_lock);
read_packet = 1;
p_coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
- event_type= (Log_event_type)((*packet)[LOG_EVENT_OFFSET+ev_offset]);
+ event_type=
+ (Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]);
break;
case LOG_READ_EOF:
@@ -1272,8 +1287,7 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
We don't check thd->lex->mi.log_file_name for NULL here
since it is checked in sql_yacc.yy
*/
- strmake(mi->rli.until_log_name, thd->lex->mi.log_file_name,
- sizeof(mi->rli.until_log_name)-1);
+ strmake_buf(mi->rli.until_log_name, thd->lex->mi.log_file_name);
}
else if (thd->lex->mi.relay_log_pos)
{
@@ -1281,8 +1295,7 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
slave_errno=ER_BAD_SLAVE_UNTIL_COND;
mi->rli.until_condition= Relay_log_info::UNTIL_RELAY_POS;
mi->rli.until_log_pos= thd->lex->mi.relay_log_pos;
- strmake(mi->rli.until_log_name, thd->lex->mi.relay_log_name,
- sizeof(mi->rli.until_log_name)-1);
+ strmake_buf(mi->rli.until_log_name, thd->lex->mi.relay_log_name);
}
else
mi->rli.clear_until_condition();
@@ -1564,14 +1577,15 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
*/
static bool get_string_parameter(char *to, const char *from, size_t length,
- const char *name)
+ const char *name, CHARSET_INFO *cs)
{
if (from) // Empty paramaters allowed
{
- size_t from_length;
- if ((from_length= strlen(from)) > length)
+ size_t from_length= strlen(from);
+ uint from_numchars= cs->cset->numchars(cs, from, from + from_length);
+ if (from_numchars > length / cs->mbmaxlen)
{
- my_error(ER_WRONG_STRING_LENGTH, MYF(0), from, name, (int) length);
+ my_error(ER_WRONG_STRING_LENGTH, MYF(0), from, name, length / cs->mbmaxlen);
return 1;
}
memcpy(to, from, from_length+1);
@@ -1646,9 +1660,9 @@ bool change_master(THD* thd, Master_info* mi)
/*
Before processing the command, save the previous state.
*/
- strmake(saved_host, mi->host, HOSTNAME_LENGTH);
+ strmake_buf(saved_host, mi->host);
saved_port= mi->port;
- strmake(saved_log_name, mi->master_log_name, FN_REFLEN - 1);
+ strmake_buf(saved_log_name, mi->master_log_name);
saved_log_pos= mi->master_log_pos;
/*
@@ -1663,8 +1677,7 @@ bool change_master(THD* thd, Master_info* mi)
}
if (lex_mi->log_file_name)
- strmake(mi->master_log_name, lex_mi->log_file_name,
- sizeof(mi->master_log_name)-1);
+ strmake_buf(mi->master_log_name, lex_mi->log_file_name);
if (lex_mi->pos)
{
mi->master_log_pos= lex_mi->pos;
@@ -1672,11 +1685,12 @@ bool change_master(THD* thd, Master_info* mi)
DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos));
if (get_string_parameter(mi->host, lex_mi->host, sizeof(mi->host)-1,
- "MASTER_HOST") ||
+ "MASTER_HOST", system_charset_info) ||
get_string_parameter(mi->user, lex_mi->user, sizeof(mi->user)-1,
- "MASTER_USER") ||
+ "MASTER_USER", system_charset_info) ||
get_string_parameter(mi->password, lex_mi->password,
- sizeof(mi->password)-1, "MASTER_PASSWORD"))
+ sizeof(mi->password)-1, "MASTER_PASSWORD",
+ &my_charset_bin))
{
ret= TRUE;
goto err;
@@ -1728,15 +1742,15 @@ bool change_master(THD* thd, Master_info* mi)
(lex_mi->ssl_verify_server_cert == LEX_MASTER_INFO::LEX_MI_ENABLE);
if (lex_mi->ssl_ca)
- strmake(mi->ssl_ca, lex_mi->ssl_ca, sizeof(mi->ssl_ca)-1);
+ strmake_buf(mi->ssl_ca, lex_mi->ssl_ca);
if (lex_mi->ssl_capath)
- strmake(mi->ssl_capath, lex_mi->ssl_capath, sizeof(mi->ssl_capath)-1);
+ strmake_buf(mi->ssl_capath, lex_mi->ssl_capath);
if (lex_mi->ssl_cert)
- strmake(mi->ssl_cert, lex_mi->ssl_cert, sizeof(mi->ssl_cert)-1);
+ strmake_buf(mi->ssl_cert, lex_mi->ssl_cert);
if (lex_mi->ssl_cipher)
- strmake(mi->ssl_cipher, lex_mi->ssl_cipher, sizeof(mi->ssl_cipher)-1);
+ strmake_buf(mi->ssl_cipher, lex_mi->ssl_cipher);
if (lex_mi->ssl_key)
- strmake(mi->ssl_key, lex_mi->ssl_key, sizeof(mi->ssl_key)-1);
+ strmake_buf(mi->ssl_key, lex_mi->ssl_key);
#ifndef HAVE_OPENSSL
if (lex_mi->ssl || lex_mi->ssl_ca || lex_mi->ssl_capath ||
lex_mi->ssl_cert || lex_mi->ssl_cipher || lex_mi->ssl_key ||
@@ -1750,10 +1764,8 @@ bool change_master(THD* thd, Master_info* mi)
need_relay_log_purge= 0;
char relay_log_name[FN_REFLEN];
mi->rli.relay_log.make_log_name(relay_log_name, lex_mi->relay_log_name);
- strmake(mi->rli.group_relay_log_name, relay_log_name,
- sizeof(mi->rli.group_relay_log_name)-1);
- strmake(mi->rli.event_relay_log_name, relay_log_name,
- sizeof(mi->rli.event_relay_log_name)-1);
+ strmake_buf(mi->rli.group_relay_log_name, relay_log_name);
+ strmake_buf(mi->rli.event_relay_log_name, relay_log_name);
}
if (lex_mi->relay_log_pos)
@@ -1789,8 +1801,7 @@ bool change_master(THD* thd, Master_info* mi)
*/
mi->master_log_pos = max(BIN_LOG_HEADER_SIZE,
mi->rli.group_master_log_pos);
- strmake(mi->master_log_name, mi->rli.group_master_log_name,
- sizeof(mi->master_log_name)-1);
+ strmake_buf(mi->master_log_name, mi->rli.group_master_log_name);
}
/*
Relay log's IO_CACHE may not be inited, if rli->inited==0 (server was never
@@ -1843,8 +1854,7 @@ bool change_master(THD* thd, Master_info* mi)
*/
mi->rli.group_master_log_pos= mi->master_log_pos;
DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos));
- strmake(mi->rli.group_master_log_name,mi->master_log_name,
- sizeof(mi->rli.group_master_log_name)-1);
+ strmake_buf(mi->rli.group_master_log_name,mi->master_log_name);
if (!mi->rli.group_master_log_name[0]) // uninitialized case
mi->rli.group_master_log_pos=0;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index e1397b05bff..39512034cba 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2367,7 +2367,12 @@ JOIN::exec()
List<Item> *curr_all_fields= &all_fields;
List<Item> *curr_fields_list= &fields_list;
TABLE *curr_tmp_table= 0;
- bool tmp_having_used_tables_updated= FALSE;
+ /*
+ curr_join->join_free() will call JOIN::cleanup(full=TRUE). It will not
+ be safe to call update_used_tables() after that.
+ */
+ if (curr_join->tmp_having)
+ curr_join->tmp_having->update_used_tables();
/*
Initialize examined rows here because the values from all join parts
@@ -2618,16 +2623,6 @@ JOIN::exec()
curr_join->select_distinct=0; /* Each row is unique */
- /*
- curr_join->join_free() will call JOIN::cleanup(full=TRUE). It will not
- be safe to call update_used_tables() after that.
- */
- if (curr_join->tmp_having)
- {
- curr_join->tmp_having->update_used_tables();
- tmp_having_used_tables_updated= TRUE;
- }
-
curr_join->join_free(); /* Free quick selects */
if (curr_join->select_distinct && ! curr_join->group_list)
@@ -2708,9 +2703,6 @@ JOIN::exec()
if (curr_join->tmp_having && ! curr_join->group_list &&
! curr_join->sort_and_group)
{
- // Some tables may have been const
- if (!tmp_having_used_tables_updated)
- curr_join->tmp_having->update_used_tables();
JOIN_TAB *curr_table= &curr_join->join_tab[curr_join->const_tables];
table_map used_tables= (curr_join->const_table_map |
curr_table->table->map);
@@ -3523,9 +3515,16 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
!table->fulltext_searched &&
(!embedding || (embedding->sj_on_expr && !embedding->embedding)))
{
+ key_map base_part, base_const_ref, base_eq_part;
+ base_part.set_prefix(keyinfo->key_parts);
+ base_const_ref= const_ref;
+ base_const_ref.intersect(base_part);
+ base_eq_part= eq_part;
+ base_eq_part.intersect(base_part);
if (table->actual_key_flags(keyinfo) & HA_NOSAME)
{
- if (const_ref == eq_part &&
+
+ if (base_const_ref == base_eq_part &&
!has_expensive_keyparts &&
!((outer_join & table->map) &&
(*s->on_expr_ref)->is_expensive()))
@@ -3551,7 +3550,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
else
found_ref|= refs; // Table is const if all refs are const
}
- else if (const_ref == eq_part)
+ else if (base_const_ref == base_eq_part)
s->const_keys.set_bit(key);
}
}
@@ -3682,6 +3681,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
DBUG_RETURN(TRUE);
join->join_tab=stat;
+ join->top_join_tab_count= table_count;
join->map2table=stat_ref;
join->table= table_vector;
join->const_tables=const_count;
@@ -3729,6 +3729,8 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (join->choose_subquery_plan(all_table_map & ~join->const_table_map))
goto error;
+ DEBUG_SYNC(join->thd, "inside_make_join_statistics");
+
/* Generate an execution plan from the found optimal join order. */
DBUG_RETURN(join->thd->killed || get_best_combination(join));
@@ -10398,6 +10400,11 @@ bool JOIN_TAB::preread_init()
preread_init_done= TRUE;
if (select && select->quick)
select->quick->replace_handler(table->file);
+
+ /* init ftfuns for just initialized derived table */
+ if (table->fulltext_searched)
+ init_ftfuncs(join->thd, join->select_lex, test(join->order));
+
return FALSE;
}
@@ -10925,7 +10932,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
*simple_order=0; // Must do a temp table to sort
else if (!(order_tables & not_const_tables))
{
- if (order->item[0]->with_subselect)
+ if (order->item[0]->has_subquery())
{
/*
Delay the evaluation of constant ORDER and/or GROUP expressions that
@@ -12853,9 +12860,6 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top,
table->prep_on_expr= table->on_expr= 0;
}
}
-
- if (!top)
- continue;
/*
Only inner tables of non-convertible outer joins
@@ -13250,13 +13254,13 @@ static void restore_prev_nj_state(JOIN_TAB *last)
bool was_fully_covered= nest->is_fully_covered();
+ join->cur_embedding_map|= nest->nj_map;
+
if (--nest->counter == 0)
join->cur_embedding_map&= ~nest->nj_map;
if (!was_fully_covered)
break;
-
- join->cur_embedding_map|= nest->nj_map;
}
}
}
@@ -13474,7 +13478,27 @@ internal_remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
if (new_item_and_list->is_empty())
li.remove();
else
+ {
+ Item *list_item;
+ Item *new_list_item;
+ uint cnt= new_item_and_list->elements;
+ List_iterator<Item> it(*new_item_and_list);
+ while ((list_item= it++))
+ {
+ uchar* is_subst_valid= (uchar *) Item::ANY_SUBST;
+ new_list_item=
+ list_item->compile(&Item::subst_argument_checker,
+ &is_subst_valid,
+ &Item::equal_fields_propagator,
+ (uchar *) &cond_and->cond_equal);
+ if (new_list_item != list_item)
+ it.replace(new_list_item);
+ new_list_item->update_used_tables();
+ }
li.replace(*new_item_and_list);
+ for (cnt--; cnt; cnt--)
+ item= li++;
+ }
cond_and_list->concat((List<Item>*) cond_equal_items);
}
else if (new_item->type() == Item::FUNC_ITEM &&
@@ -13494,7 +13518,13 @@ internal_remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
if (new_item->type() == Item::COND_ITEM &&
((Item_cond*) new_item)->functype() ==
((Item_cond*) cond)->functype())
- li.replace(*((Item_cond*) new_item)->argument_list());
+ {
+ List<Item> *arg_list= ((Item_cond*) new_item)->argument_list();
+ uint cnt= arg_list->elements;
+ li.replace(*arg_list);
+ for ( cnt--; cnt; cnt--)
+ item= li++;
+ }
else
li.replace(new_item);
}
@@ -14076,6 +14106,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
}
case Item::FIELD_ITEM:
case Item::DEFAULT_VALUE_ITEM:
+ case Item::INSERT_VALUE_ITEM:
{
Item_field *field= (Item_field*) item;
bool orig_modify= modify_item;
@@ -18823,7 +18854,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
!(table->file->index_flags(best_key, 0, 1) & HA_CLUSTERED_INDEX)))
goto use_filesort;
- if (table->quick_keys.is_set(best_key) && best_key != ref_key)
+ if (select &&
+ table->quick_keys.is_set(best_key) && best_key != ref_key)
{
key_map map;
map.clear_all(); // Force the creation of quick select
@@ -19476,7 +19508,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
}
if (copy_blobs(first_field))
{
- my_message(ER_OUTOFMEMORY, ER(ER_OUTOFMEMORY), MYF(0));
+ my_message(ER_OUTOFMEMORY, ER(ER_OUTOFMEMORY), MYF(ME_FATALERROR));
error=0;
goto err;
}
@@ -19509,7 +19541,8 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
if (!found)
break; // End of file
/* Restart search on saved row */
- error=file->restart_rnd_next(record);
+ if ((error= file->restart_rnd_next(record)))
+ goto err;
}
file->extra(HA_EXTRA_NO_CACHE);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 18241c4f80f..ec4633dadf9 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2009, 2012, Monty Program Ab
+/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2012, 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
@@ -1532,6 +1532,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
MODE_MYSQL323 |
MODE_MYSQL40)) != 0;
my_bitmap_map *old_map;
+ int error= 0;
DBUG_ENTER("store_create_info");
DBUG_PRINT("enter",("table: %s", table->s->table_name.str));
@@ -1893,28 +1894,35 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
{
- /*
- Partition syntax for CREATE TABLE is at the end of the syntax.
- */
- uint part_syntax_len;
- char *part_syntax;
if (table->part_info &&
- (!table->part_info->is_auto_partitioned) &&
- ((part_syntax= generate_partition_syntax(table->part_info,
+ !((table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION) &&
+ table->part_info->is_auto_partitioned))
+ {
+ /*
+ Partition syntax for CREATE TABLE is at the end of the syntax.
+ */
+ uint part_syntax_len;
+ char *part_syntax;
+ String comment_start;
+ table->part_info->set_show_version_string(&comment_start);
+ if ((part_syntax= generate_partition_syntax(table->part_info,
&part_syntax_len,
FALSE,
show_table_options,
- NULL, NULL))))
- {
- table->part_info->set_show_version_string(packet);
- packet->append(part_syntax, part_syntax_len);
- packet->append(STRING_WITH_LEN(" */"));
- my_free(part_syntax);
+ NULL, NULL,
+ comment_start.c_ptr())))
+ {
+ packet->append(comment_start);
+ if (packet->append(part_syntax, part_syntax_len) ||
+ packet->append(STRING_WITH_LEN(" */")))
+ error= 1;
+ my_free(part_syntax);
+ }
}
}
#endif
tmp_restore_column_map(table->read_set, old_map);
- DBUG_RETURN(0);
+ DBUG_RETURN(error);
}
@@ -2158,7 +2166,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
DBUG_ENTER("mysqld_list_processes");
field_list.push_back(new Item_int("Id", 0, MY_INT32_NUM_DECIMAL_DIGITS));
- field_list.push_back(new Item_empty_string("User",16));
+ field_list.push_back(new Item_empty_string("User", USERNAME_CHAR_LENGTH));
field_list.push_back(new Item_empty_string("Host",LIST_PROCESS_HOST_LEN));
field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN));
field->maybe_null=1;
@@ -2923,8 +2931,8 @@ int fill_schema_user_stats(THD* thd, TABLE_LIST* tables, COND* cond)
int result;
DBUG_ENTER("fill_schema_user_stats");
- if (check_global_access(thd, SUPER_ACL | PROCESS_ACL))
- DBUG_RETURN(1);
+ if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true))
+ DBUG_RETURN(0);
/*
Iterates through all the global stats and sends them to the client.
@@ -2958,8 +2966,8 @@ int fill_schema_client_stats(THD* thd, TABLE_LIST* tables, COND* cond)
int result;
DBUG_ENTER("fill_schema_client_stats");
- if (check_global_access(thd, SUPER_ACL | PROCESS_ACL))
- DBUG_RETURN(1);
+ if (check_global_access(thd, SUPER_ACL | PROCESS_ACL, true))
+ DBUG_RETURN(0);
/*
Iterates through all the global stats and sends them to the client.
@@ -7044,7 +7052,7 @@ struct schema_table_ref
ST_FIELD_INFO user_stats_fields_info[]=
{
- {"USER", USERNAME_LENGTH, MYSQL_TYPE_STRING, 0, 0, "User", SKIP_OPEN_TABLE},
+ {"USER", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "User", SKIP_OPEN_TABLE},
{"TOTAL_CONNECTIONS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Total_connections",SKIP_OPEN_TABLE},
{"CONCURRENT_CONNECTIONS", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Concurrent_connections",SKIP_OPEN_TABLE},
{"CONNECTED_TIME", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Connected_time",SKIP_OPEN_TABLE},
@@ -7244,20 +7252,20 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
break;
case MYSQL_TYPE_DATE:
if (!(item=new Item_return_date_time(fields_info->field_name,
- MAX_DATE_WIDTH,
+ strlen(fields_info->field_name),
fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_TIME:
if (!(item=new Item_return_date_time(fields_info->field_name,
- MAX_TIME_FULL_WIDTH,
+ strlen(fields_info->field_name),
fields_info->field_type)))
DBUG_RETURN(0);
break;
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATETIME:
if (!(item=new Item_return_date_time(fields_info->field_name,
- MAX_DATETIME_WIDTH,
+ strlen(fields_info->field_name),
fields_info->field_type)))
DBUG_RETURN(0);
break;
@@ -8410,7 +8418,8 @@ ST_FIELD_INFO variables_fields_info[]=
ST_FIELD_INFO processlist_fields_info[]=
{
{"ID", 4, MYSQL_TYPE_LONGLONG, 0, 0, "Id", SKIP_OPEN_TABLE},
- {"USER", 16, MYSQL_TYPE_STRING, 0, 0, "User", SKIP_OPEN_TABLE},
+ {"USER", USERNAME_CHAR_LENGTH, MYSQL_TYPE_STRING, 0, 0, "User",
+ SKIP_OPEN_TABLE},
{"HOST", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Host",
SKIP_OPEN_TABLE},
{"DB", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Db", SKIP_OPEN_TABLE},
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 4aba2ee51c5..4f3ec940cef 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -732,7 +732,7 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length)
{
if (from->Alloced_length >= from_length)
return from;
- if (from->alloced || !to || from == to)
+ if ((from->alloced && (from->Alloced_length != 0)) || !to || from == to)
{
(void) from->realloc(from_length);
return from;
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 8b09d449c2b..7a2f27da998 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -364,6 +364,16 @@ public:
}
return 0;
}
+ bool append_hex(const char *src, uint32 srclen)
+ {
+ for (const char *end= src + srclen ; src != end ; src++)
+ {
+ if (append(_dig_vec_lower[((uchar) *src) >> 4]) ||
+ append(_dig_vec_lower[((uchar) *src) & 0x0F]))
+ return true;
+ }
+ return false;
+ }
bool fill(uint32 max_length,char fill);
void strip_sp();
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 8aac364265d..616e60a6199 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2010, 2013, Monty Program Ab
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2013, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -54,6 +54,7 @@
#include "sql_show.h"
#include "transaction.h"
#include "datadict.h" // dd_frm_type()
+#include "sql_audit.h"
#ifdef __WIN__
#include <io.h>
@@ -1692,7 +1693,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
&syntax_len,
TRUE, TRUE,
lpt->create_info,
- lpt->alter_info)))
+ lpt->alter_info,
+ NULL)))
{
DBUG_RETURN(TRUE);
}
@@ -1785,7 +1787,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
&syntax_len,
TRUE, TRUE,
lpt->create_info,
- lpt->alter_info)))
+ lpt->alter_info,
+ NULL)))
{
error= 1;
goto err;
@@ -2344,6 +2347,10 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
wrong_tables.append(',');
wrong_tables.append(String(table->table_name,system_charset_info));
}
+ else
+ {
+ mysql_audit_drop_table(thd, table);
+ }
DBUG_PRINT("table", ("table: 0x%lx s: 0x%lx", (long) table->table,
table->table ? (long) table->table->s : (long) -1));
@@ -4252,7 +4259,8 @@ bool mysql_create_table_no_lock(THD *thd,
&syntax_len,
TRUE, TRUE,
create_info,
- alter_info)))
+ alter_info,
+ NULL)))
goto err;
part_info->part_info_string= part_syntax_buf;
part_info->part_info_len= syntax_len;
@@ -4728,6 +4736,8 @@ mysql_rename_table(handlerton *base, const char *old_db,
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "ALTER TABLE");
else if (error)
my_error(ER_ERROR_ON_RENAME, MYF(0), from, to, error);
+ else if (!(flags & FN_IS_TMP))
+ mysql_audit_rename_table(thd, old_db, old_name, new_db, new_name);
DBUG_RETURN(error != 0);
}
@@ -6054,6 +6064,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
mysql_ha_rm_tables(thd, table_list);
+ mysql_audit_alter_table(thd, table_list);
+
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
if (alter_info->tablespace_op != NO_TABLESPACE_OP)
/* Conditionally writes to binlog. */
@@ -6725,6 +6737,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
HA_OPTION_PACK_RECORD));
}
tmp_disable_binlog(thd);
+ create_info->options|=HA_CREATE_TMP_ALTER;
error= mysql_create_table_no_lock(thd, new_db, tmp_name,
create_info,
alter_info,
diff --git a/sql/sql_time.cc b/sql/sql_time.cc
index 57dbd979933..dadf579b2e7 100644
--- a/sql/sql_time.cc
+++ b/sql/sql_time.cc
@@ -302,6 +302,9 @@ str_to_datetime_with_warn(CHARSET_INFO *cs,
make_truncated_value_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
str, length, flags & TIME_TIME_ONLY ?
MYSQL_TIMESTAMP_TIME : ts_type, NullS);
+ DBUG_EXECUTE_IF("str_to_datetime_warn",
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_YES, str););
return ts_type;
}
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index b0dd2183b62..65282de71cc 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -701,10 +701,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
thd->security_ctx->priv_host)))
{
if (check_global_access(thd, SUPER_ACL))
- {
- my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
return TRUE;
- }
}
/*
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index bbc5c324573..0e22db11eb8 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1156,9 +1156,10 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
TODO: when VIEWs will be stored in cache, table mem_root should
be used here
*/
- if (parser->parse((uchar*)table, thd->mem_root, view_parameters,
- required_view_parameters, &file_parser_dummy_hook))
- goto err;
+ if ((result= parser->parse((uchar*)table, thd->mem_root,
+ view_parameters, required_view_parameters,
+ &file_parser_dummy_hook)))
+ goto end;
/*
check old format view .frm
@@ -1221,6 +1222,11 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
now Lex placed in statement memory
*/
table->view= lex= thd->lex= (LEX*) new(thd->mem_root) st_lex_local;
+ if (!table->view)
+ {
+ result= true;
+ goto end;
+ }
{
char old_db_buf[SAFE_NAME_LEN+1];
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 253ec61460e..c621c61aff3 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2010, 2011 Monty Program Ab
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2011, 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
@@ -788,10 +788,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%pure_parser /* We have threads */
/*
- Currently there are 174 shift/reduce conflicts.
+ Currently there are 175 shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
-%expect 174
+%expect 175
/*
Comments for TOKENS.
@@ -1021,6 +1021,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token HAVING /* SQL-2003-R */
%token HELP_SYM
%token HEX_NUM
+%token HEX_STRING
%token HIGH_PRIORITY
%token HOST_SYM
%token HOSTS_SYM
@@ -1448,7 +1449,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%left INTERVAL_SYM
%type <lex_str>
- IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM
+ IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM
+ HEX_NUM HEX_STRING hex_num_or_string
LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text
IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
NCHAR_STRING opt_component key_cache_name
@@ -4418,7 +4420,7 @@ partition:
;
part_type_def:
- opt_linear KEY_SYM '(' part_field_list ')'
+ opt_linear KEY_SYM opt_key_algo '(' part_field_list ')'
{
partition_info *part_info= Lex->part_info;
part_info->list_of_part_fields= TRUE;
@@ -4444,6 +4446,25 @@ opt_linear:
{ Lex->part_info->linear_hash_ind= TRUE;}
;
+opt_key_algo:
+ /* empty */
+ { Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_NONE;}
+ | ALGORITHM_SYM EQ real_ulong_num
+ {
+ switch ($3) {
+ case 1:
+ Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_51;
+ break;
+ case 2:
+ Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_55;
+ break;
+ default:
+ my_parse_error(ER(ER_SYNTAX_ERROR));
+ MYSQL_YYABORT;
+ }
+ }
+ ;
+
part_field_list:
/* empty */ {}
| part_field_item_list {}
@@ -4525,7 +4546,7 @@ opt_sub_part:
| SUBPARTITION_SYM BY opt_linear HASH_SYM sub_part_func
{ Lex->part_info->subpart_type= HASH_PARTITION; }
opt_num_subparts {}
- | SUBPARTITION_SYM BY opt_linear KEY_SYM
+ | SUBPARTITION_SYM BY opt_linear KEY_SYM opt_key_algo
'(' sub_part_field_list ')'
{
partition_info *part_info= Lex->part_info;
@@ -5977,6 +5998,11 @@ now_or_signed_literal:
{ $$=$1; }
;
+hex_num_or_string:
+ HEX_NUM {}
+ | HEX_STRING {}
+ ;
+
charset:
CHAR_SYM SET {}
| CHARSET {}
@@ -12242,7 +12268,7 @@ text_string:
}
| HEX_NUM
{
- Item *tmp= new (YYTHD->mem_root) Item_hex_string($1.str, $1.length);
+ Item *tmp= new (YYTHD->mem_root) Item_hex_hybrid($1.str, $1.length);
if (tmp == NULL)
MYSQL_YYABORT;
/*
@@ -12252,6 +12278,14 @@ text_string:
tmp->quick_fix_field();
$$= tmp->val_str((String*) 0);
}
+ | HEX_STRING
+ {
+ Item *tmp= new (YYTHD->mem_root) Item_hex_string($1.str, $1.length);
+ if (tmp == NULL)
+ MYSQL_YYABORT;
+ tmp->quick_fix_field();
+ $$= tmp->val_str((String*) 0);
+ }
| BIN_NUM
{
Item *tmp= new (YYTHD->mem_root) Item_bin_string($1.str, $1.length);
@@ -12321,6 +12355,12 @@ literal:
}
| HEX_NUM
{
+ $$ = new (YYTHD->mem_root) Item_hex_hybrid($1.str, $1.length);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | HEX_STRING
+ {
$$ = new (YYTHD->mem_root) Item_hex_string($1.str, $1.length);
if ($$ == NULL)
MYSQL_YYABORT;
@@ -12331,7 +12371,7 @@ literal:
if ($$ == NULL)
MYSQL_YYABORT;
}
- | UNDERSCORE_CHARSET HEX_NUM
+ | UNDERSCORE_CHARSET hex_num_or_string
{
Item *tmp= new (YYTHD->mem_root) Item_hex_string($2.str, $2.length);
if (tmp == NULL)
@@ -12887,7 +12927,7 @@ user:
$$->auth= empty_lex_str;
if (check_string_char_length(&$$->user, ER(ER_USERNAME),
- USERNAME_CHAR_LENGTH,
+ username_char_length,
system_charset_info, 0))
MYSQL_YYABORT;
}
@@ -12902,7 +12942,7 @@ user:
$$->auth= empty_lex_str;
if (check_string_char_length(&$$->user, ER(ER_USERNAME),
- USERNAME_CHAR_LENGTH,
+ username_char_length,
system_charset_info, 0) ||
check_host_name(&$$->host))
MYSQL_YYABORT;
@@ -12960,6 +13000,7 @@ keyword:
| LANGUAGE_SYM {}
| NO_SYM {}
| OPEN_SYM {}
+ | OPTION {}
| OPTIONS_SYM {}
| OWNER_SYM {}
| PARSER_SYM {}
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index da971516141..bc54c9a5db7 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1068,7 +1068,7 @@ static Sys_var_ulonglong Sys_max_binlog_cache_size(
"Sets the total size of the transactional cache",
GLOBAL_VAR(max_binlog_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, ULONGLONG_MAX),
- DEFAULT((UINT_MAX/IO_SIZE)*IO_SIZE),
+ DEFAULT((ULONGLONG_MAX/IO_SIZE)*IO_SIZE),
BLOCK_SIZE(IO_SIZE));
static Sys_var_ulonglong Sys_max_binlog_stmt_cache_size(
@@ -1076,7 +1076,7 @@ static Sys_var_ulonglong Sys_max_binlog_stmt_cache_size(
"Sets the total size of the statement cache",
GLOBAL_VAR(max_binlog_stmt_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, ULONGLONG_MAX),
- DEFAULT((UINT_MAX/IO_SIZE)*IO_SIZE),
+ DEFAULT((ULONGLONG_MAX/IO_SIZE)*IO_SIZE),
BLOCK_SIZE(IO_SIZE));
static bool fix_max_binlog_size(sys_var *self, THD *thd, enum_var_type type)
diff --git a/sql/sys_vars.h b/sql/sys_vars.h
index 95a8e45f7c3..8345a2836dd 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.h
@@ -547,8 +547,7 @@ public:
protected:
virtual uchar *session_value_ptr(THD *thd, LEX_STRING *base)
{
- return thd->security_ctx->proxy_user[0] ?
- (uchar *) &(thd->security_ctx->proxy_user[0]) : NULL;
+ return (uchar*)thd->security_ctx->external_user;
}
};
diff --git a/sql/table.cc b/sql/table.cc
index c92a096be90..77e251729c7 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -3537,9 +3537,9 @@ bool check_column_name(const char *name)
}
#else
last_char_is_space= *name==' ';
-#endif
- if (*name == NAMES_SEP_CHAR)
+ if (*name == '\377')
return 1;
+#endif
name++;
name_length++;
}
diff --git a/sql/tztime.cc b/sql/tztime.cc
index 0e793290bba..95a1001485b 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2559,7 +2559,7 @@ main(int argc, char **argv)
if (argc == 2)
{
- root_name_end= strmake(fullname, argv[1], FN_REFLEN);
+ root_name_end= strmake_buf(fullname, argv[1]);
printf("TRUNCATE TABLE time_zone;\n");
printf("TRUNCATE TABLE time_zone_name;\n");
@@ -2713,7 +2713,7 @@ main(int argc, char **argv)
(int)t, (int)t1);
/* Let us load time zone description */
- str_end= strmake(fullname, TZDIR, FN_REFLEN);
+ str_end= strmake_buf(fullname, TZDIR);
strmake(str_end, "/MET", FN_REFLEN - (str_end - fullname));
if (tz_load(fullname, &tz_info, &tz_storage))
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index d31e5ee8d89..54a85ec3a44 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -1436,9 +1436,9 @@ int ha_tina::rnd_end()
DBUG_RETURN(-1);
/* Open the file again */
- if (((data_file= mysql_file_open(csv_key_file_data,
- share->data_file_name,
- O_RDONLY, MYF(MY_WME))) == -1))
+ if ((data_file= mysql_file_open(csv_key_file_data,
+ share->data_file_name,
+ O_RDONLY, MYF(MY_WME))) == -1)
DBUG_RETURN(my_errno ? my_errno : -1);
/*
As we reopened the data file, increase share->data_file_version
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index c0bf0acb523..40b8d3d24d9 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -587,7 +587,7 @@ static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num)
buf_len= min(table->s->connect_string.length,
FEDERATED_QUERY_BUFFER_SIZE-1);
strmake(buf, table->s->connect_string.str, buf_len);
- my_error(error_num, MYF(0), buf);
+ my_error(error_num, MYF(0), buf, 14);
DBUG_RETURN(error_num);
}
@@ -3243,7 +3243,7 @@ int ha_federated::stash_remote_error()
if (!mysql)
DBUG_RETURN(remote_error_number);
remote_error_number= mysql_errno(mysql);
- strmake(remote_error_buf, mysql_error(mysql), sizeof(remote_error_buf)-1);
+ strmake_buf(remote_error_buf, mysql_error(mysql));
if (remote_error_number == ER_DUP_ENTRY ||
remote_error_number == ER_DUP_KEY)
DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY);
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index a10285a81aa..aac2414bca1 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -525,7 +525,7 @@ static int parse_url_error(FEDERATEDX_SHARE *share, TABLE *table, int error_num)
buf_len= min(table->s->connect_string.length,
FEDERATEDX_QUERY_BUFFER_SIZE-1);
strmake(buf, table->s->connect_string.str, buf_len);
- my_error(error_num, MYF(0), buf);
+ my_error(error_num, MYF(0), buf, 14);
DBUG_RETURN(error_num);
}
@@ -585,9 +585,8 @@ int get_connection(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share)
DBUG_RETURN(0);
error:
- sprintf(error_buffer, "server name: '%s' doesn't exist!",
- share->connection_string);
- my_error(error_num, MYF(0), error_buffer);
+ my_printf_error(error_num, "server name: '%s' doesn't exist!",
+ MYF(0), share->connection_string);
DBUG_RETURN(error_num);
}
@@ -764,7 +763,7 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATEDX_SHARE *share, TABLE *table,
user:@hostname:port/db/table
Then password is a null string, so set to NULL
*/
- if ((share->password[0] == '\0'))
+ if (share->password[0] == '\0')
share->password= NULL;
}
@@ -3439,7 +3438,7 @@ int ha_federatedx::stash_remote_error()
if (!io)
DBUG_RETURN(remote_error_number);
remote_error_number= io->error_code();
- strmake(remote_error_buf, io->error_str(), sizeof(remote_error_buf)-1);
+ strmake_buf(remote_error_buf, io->error_str());
if (remote_error_number == ER_DUP_ENTRY ||
remote_error_number == ER_DUP_KEY)
DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY);
diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
index 955be01f032..b48fb705cd8 100644
--- a/storage/innobase/btr/btr0cur.c
+++ b/storage/innobase/btr/btr0cur.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -1248,27 +1248,13 @@ btr_cur_optimistic_insert(
Subtract one byte for the encoded heap_no in the
modification log. */
ulint free_space_zip = page_zip_empty_size(
- cursor->index->n_fields, zip_size) - 1;
+ cursor->index->n_fields, zip_size);
ulint n_uniq = dict_index_get_n_unique_in_tree(index);
ut_ad(dict_table_is_comp(index->table));
- /* There should be enough room for two node pointer
- records on an empty non-leaf page. This prevents
- infinite page splits. */
-
- if (UNIV_LIKELY(entry->n_fields >= n_uniq)
- && UNIV_UNLIKELY(REC_NODE_PTR_SIZE
- + rec_get_converted_size_comp_prefix(
- index, entry->fields, n_uniq,
- NULL)
- /* On a compressed page, there is
- a two-byte entry in the dense
- page directory for every record.
- But there is no record header. */
- - (REC_N_NEW_EXTRA_BYTES - 2)
- > free_space_zip / 2)) {
-
+ if (free_space_zip == 0) {
+too_big:
if (big_rec_vec) {
dtuple_convert_back_big_rec(
index, entry, big_rec_vec);
@@ -1276,6 +1262,27 @@ btr_cur_optimistic_insert(
return(DB_TOO_BIG_RECORD);
}
+
+ /* Subtract one byte for the encoded heap_no in the
+ modification log. */
+ free_space_zip--;
+
+ /* There should be enough room for two node pointer
+ records on an empty non-leaf page. This prevents
+ infinite page splits. */
+
+ if (entry->n_fields >= n_uniq
+ && (REC_NODE_PTR_SIZE
+ + rec_get_converted_size_comp_prefix(
+ index, entry->fields, n_uniq, NULL)
+ /* On a compressed page, there is
+ a two-byte entry in the dense
+ page directory for every record.
+ But there is no record header. */
+ - (REC_N_NEW_EXTRA_BYTES - 2)
+ > free_space_zip / 2)) {
+ goto too_big;
+ }
}
LIMIT_OPTIMISTIC_INSERT_DEBUG(page_get_n_recs(page),
diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
index 2406980196e..31be914afa0 100644
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -2322,6 +2322,10 @@ loop2:
retries = 0;
} else if (retries < BUF_PAGE_READ_MAX_RETRIES) {
++retries;
+ DBUG_EXECUTE_IF(
+ "innodb_page_corruption_retries",
+ retries = BUF_PAGE_READ_MAX_RETRIES;
+ );
} else {
fprintf(stderr, "InnoDB: Error: Unable"
" to read tablespace %lu page no"
@@ -2359,6 +2363,7 @@ got_block:
/* The page is being read to buffer pool,
but we cannot wait around for the read to
complete. */
+null_exit:
buf_pool_mutex_exit(buf_pool);
return(NULL);
@@ -2373,6 +2378,14 @@ got_block:
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
+ if (mode == BUF_PEEK_IF_IN_POOL) {
+ /* This mode is only used for dropping an
+ adaptive hash index. There cannot be an
+ adaptive hash index for a compressed-only
+ page, so do not bother decompressing the page. */
+ goto null_exit;
+ }
+
bpage = &block->page;
/* Protect bpage->buf_fix_count. */
mutex_enter(&buf_pool->zip_mutex);
diff --git a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
index 40550186191..d12fd3fce31 100644
--- a/storage/innobase/buf/buf0rea.c
+++ b/storage/innobase/buf/buf0rea.c
@@ -177,7 +177,10 @@ buf_read_page_low(
ut_ad(buf_page_in_file(bpage));
- thd_wait_begin(NULL, THD_WAIT_DISKIO);
+ if (sync) {
+ thd_wait_begin(NULL, THD_WAIT_DISKIO);
+ }
+
if (zip_size) {
*err = fil_io(OS_FILE_READ | wake_later,
sync, space, zip_size, offset, 0, zip_size,
@@ -189,7 +192,10 @@ buf_read_page_low(
sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
((buf_block_t*) bpage)->frame, bpage);
}
- thd_wait_end(NULL);
+
+ if (sync) {
+ thd_wait_end(NULL);
+ }
if (*err == DB_TABLESPACE_DELETED) {
buf_read_page_handle_error(bpage);
diff --git a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.c
index d7373a4b8ef..cb3dbcbe4ac 100644
--- a/storage/innobase/dict/dict0crea.c
+++ b/storage/innobase/dict/dict0crea.c
@@ -42,6 +42,7 @@ Created 1/8/1996 Heikki Tuuri
#include "trx0roll.h"
#include "usr0sess.h"
#include "ut0vec.h"
+#include "ha_prototypes.h"
/*****************************************************************//**
Based on a table object, this function builds the entry to be inserted
@@ -1427,12 +1428,20 @@ dict_create_add_foreign_to_dictionary(
pars_info_t* info = pars_info_create();
if (foreign->id == NULL) {
+ char* stripped_name;
/* Generate a new constraint id */
ulint namelen = strlen(table->name);
char* id = mem_heap_alloc(foreign->heap, namelen + 20);
/* no overflow if number < 1e13 */
sprintf(id, "%s_ibfk_%lu", table->name, (ulong) (*id_nr)++);
foreign->id = id;
+
+ stripped_name = strchr(foreign->id, '/') + 1;
+ if (innobase_check_identifier_length(stripped_name)) {
+ fprintf(stderr, "InnoDB: Generated foreign key "
+ "name (%s) is too long\n", foreign->id);
+ return(DB_IDENTIFIER_TOO_LONG);
+ }
}
pars_info_add_str_literal(info, "id", foreign->id);
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index 18e70cee58f..f8b5854c20e 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1466,6 +1466,10 @@ dict_index_too_big_for_tree(
/* maximum allowed size of a node pointer record */
ulint page_ptr_max;
+ DBUG_EXECUTE_IF(
+ "ib_force_create_table",
+ return(FALSE););
+
comp = dict_table_is_comp(table);
zip_size = dict_table_zip_size(table);
@@ -1480,7 +1484,10 @@ dict_index_too_big_for_tree(
number in the page modification log. The maximum
allowed node pointer size is half that. */
page_rec_max = page_zip_empty_size(new_index->n_fields,
- zip_size) - 1;
+ zip_size);
+ if (page_rec_max) {
+ page_rec_max--;
+ }
page_ptr_max = page_rec_max / 2;
/* On a compressed page, there is a two-byte entry in
the dense page directory for every record. But there
@@ -4691,6 +4698,7 @@ dict_print_info_on_foreign_key_in_create_format(
dict_foreign_t* foreign, /*!< in: foreign key constraint */
ibool add_newline) /*!< in: whether to add a newline */
{
+ char constraint_name[MAX_TABLE_NAME_LEN];
const char* stripped_id;
ulint i;
@@ -4712,7 +4720,9 @@ dict_print_info_on_foreign_key_in_create_format(
}
fputs(" CONSTRAINT ", file);
- ut_print_name(file, trx, FALSE, stripped_id);
+ innobase_convert_from_id(&my_charset_filename, constraint_name,
+ stripped_id, MAX_TABLE_NAME_LEN);
+ ut_print_name(file, trx, FALSE, constraint_name);
fputs(" FOREIGN KEY (", file);
for (i = 0;;) {
diff --git a/storage/innobase/dyn/dyn0dyn.c b/storage/innobase/dyn/dyn0dyn.c
index e1275f040f3..d0f50ad0c32 100644
--- a/storage/innobase/dyn/dyn0dyn.c
+++ b/storage/innobase/dyn/dyn0dyn.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -11,8 +11,8 @@ 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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -35,7 +35,7 @@ UNIV_INTERN
dyn_block_t*
dyn_array_add_block(
/*================*/
- dyn_array_t* arr) /*!< in: dyn array */
+ dyn_array_t* arr) /*!< in/out: dyn array */
{
mem_heap_t* heap;
dyn_block_t* block;
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index 2f875663039..c3a206fb009 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -4023,6 +4023,24 @@ fil_extend_space_to_desired_size(
start_page_no = space->size;
file_start_page_no = space->size - node->size;
+#ifdef HAVE_POSIX_FALLOCATE
+ if (srv_use_posix_fallocate) {
+ offset_high = size_after_extend * page_size / (4ULL*1024*1024*1024);
+ offset_low = size_after_extend * page_size % (4ULL*1024*1024*1024);
+
+ mutex_exit(&fil_system->mutex);
+ success = os_file_set_size(node->name, node->handle,
+ offset_low, offset_high);
+ mutex_enter(&fil_system->mutex);
+ if (success) {
+ node->size += (size_after_extend - start_page_no);
+ space->size += (size_after_extend - start_page_no);
+ os_has_said_disk_full = FALSE;
+ }
+ goto complete_io;
+ }
+#endif
+
/* Extend at most 64 pages at a time */
buf_size = ut_min(64, size_after_extend - start_page_no) * page_size;
buf2 = mem_alloc(buf_size + page_size);
@@ -4075,6 +4093,10 @@ fil_extend_space_to_desired_size(
mem_free(buf2);
+#ifdef HAVE_POSIX_FALLOCATE
+complete_io:
+#endif
+
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
*actual_size = space->size;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index f0ae2ff9f86..89682a714a6 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
@@ -195,6 +195,8 @@ static my_bool innobase_file_format_check = TRUE;
static my_bool innobase_log_archive = FALSE;
static char* innobase_log_arch_dir = NULL;
#endif /* UNIV_LOG_ARCHIVE */
+static my_bool innobase_use_atomic_writes = FALSE;
+static my_bool innobase_use_fallocate = TRUE;
static my_bool innobase_use_doublewrite = TRUE;
static my_bool innobase_use_checksums = TRUE;
static my_bool innobase_locks_unsafe_for_binlog = FALSE;
@@ -1126,6 +1128,8 @@ convert_error_code_to_mysql(
return(HA_ERR_UNDO_REC_TOO_BIG);
case DB_OUT_OF_MEMORY:
return(HA_ERR_OUT_OF_MEM);
+ case DB_IDENTIFIER_TOO_LONG:
+ return(HA_ERR_INTERNAL_ERROR);
}
}
@@ -1206,6 +1210,37 @@ innobase_convert_from_table_id(
strconvert(cs, from, &my_charset_filename, to, (uint) len, &errors);
}
+/**********************************************************************
+Check if the length of the identifier exceeds the maximum allowed.
+The input to this function is an identifier in charset my_charset_filename.
+return true when length of identifier is too long. */
+extern "C" UNIV_INTERN
+my_bool
+innobase_check_identifier_length(
+/*=============================*/
+ const char* id) /* in: identifier to check. it must belong
+ to charset my_charset_filename */
+{
+ char tmp[MAX_TABLE_NAME_LEN + 10];
+ uint errors;
+ uint len;
+ int well_formed_error = 0;
+ CHARSET_INFO* cs1 = &my_charset_filename;
+ CHARSET_INFO* cs2 = thd_charset(current_thd);
+
+ len = strconvert(cs1, id, cs2, tmp, MAX_TABLE_NAME_LEN + 10, &errors);
+
+ uint res = cs2->cset->well_formed_len(cs2, tmp, tmp + len,
+ NAME_CHAR_LEN,
+ &well_formed_error);
+
+ if (well_formed_error || res != len) {
+ my_error(ER_TOO_LONG_IDENT, MYF(0), tmp);
+ return(true);
+ }
+ return(false);
+}
+
/******************************************************************//**
Converts an identifier to UTF-8. */
extern "C" UNIV_INTERN
@@ -2533,6 +2568,38 @@ innobase_change_buffering_inited_ok:
innobase_commit_concurrency_init_default();
+#ifdef HAVE_POSIX_FALLOCATE
+ srv_use_posix_fallocate = (ibool) innobase_use_fallocate;
+#endif
+ srv_use_atomic_writes = (ibool) innobase_use_atomic_writes;
+ if (innobase_use_atomic_writes) {
+ fprintf(stderr, "InnoDB: using atomic writes.\n");
+
+ /* Force doublewrite buffer off, atomic writes replace it. */
+ if (srv_use_doublewrite_buf) {
+ fprintf(stderr, "InnoDB: Switching off doublewrite buffer "
+ "because of atomic writes.\n");
+ innobase_use_doublewrite = srv_use_doublewrite_buf = FALSE;
+ }
+
+ /* Force O_DIRECT on Unixes (on Windows writes are always unbuffered)*/
+#ifndef _WIN32
+ if(!innobase_file_flush_method ||
+ !strstr(innobase_file_flush_method, "O_DIRECT")) {
+ innobase_file_flush_method =
+ srv_file_flush_method_str = (char*)"O_DIRECT";
+ fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n");
+ }
+#endif
+#ifdef HAVE_POSIX_FALLOCATE
+ /* Due to a bug in directFS, using atomics needs
+ * posix_fallocate to extend the file
+ * pwrite() past end of the file won't work
+ */
+ srv_use_posix_fallocate = TRUE;
+#endif
+ }
+
#ifdef HAVE_PSI_INTERFACE
/* Register keys with MySQL performance schema */
if (PSI_server) {
@@ -6251,6 +6318,8 @@ ha_innobase::unlock_row(void)
{
DBUG_ENTER("ha_innobase::unlock_row");
+ ut_ad(prebuilt->trx->conc_state == TRX_ACTIVE);
+
/* Consistent read does not take any locks, thus there is
nothing to unlock. */
@@ -8590,12 +8659,18 @@ innobase_rename_table(
DEBUG_SYNC_C("innodb_rename_table_ready");
/* Serialize data dictionary operations with dictionary mutex:
- no deadlocks can occur then in these operations */
+ no deadlocks can occur then in these operations. Start the
+ transaction first to avoid a possible deadlock in the server. */
+ trx_start_if_not_started(trx);
if (lock_and_commit) {
row_mysql_lock_data_dictionary(trx);
}
+ /* Flag this transaction as a dictionary operation, so that
+ the data dictionary will be locked in crash recovery. */
+ trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
+
error = row_rename_table_for_mysql(
norm_from, norm_to, trx, lock_and_commit);
@@ -12263,6 +12338,61 @@ innodb_change_buffering_update(
*static_cast<const char*const*>(save);
}
+#ifndef DBUG_OFF
+static char* srv_buffer_pool_evict;
+
+/****************************************************************//**
+Called on SET GLOBAL innodb_buffer_pool_evict=...
+Handles some values specially, to evict pages from the buffer pool.
+SET GLOBAL innodb_buffer_pool_evict='uncompressed'
+evicts all uncompressed page frames of compressed tablespaces. */
+static
+void
+innodb_buffer_pool_evict_update(
+/*============================*/
+ THD* thd, /*!< in: thread handle */
+ struct st_mysql_sys_var*var, /*!< in: pointer to system variable */
+ void* var_ptr,/*!< out: ignored */
+ const void* save) /*!< in: immediate result
+ from check function */
+{
+ if (const char* op = *static_cast<const char*const*>(save)) {
+ if (!strcmp(op, "uncompressed")) {
+ /* Evict all uncompressed pages of compressed
+ tables from the buffer pool. Keep the compressed
+ pages in the buffer pool. */
+
+ for (ulint i = 0; i < srv_buf_pool_instances; i++) {
+ buf_pool_t* buf_pool = &buf_pool_ptr[i];
+
+ buf_pool_mutex_enter(buf_pool);
+
+ for (buf_block_t* block = UT_LIST_GET_LAST(
+ buf_pool->unzip_LRU);
+ block != NULL; ) {
+
+ buf_block_t* prev_block
+ = UT_LIST_GET_PREV(unzip_LRU,
+ block);
+ ut_ad(buf_block_get_state(block)
+ == BUF_BLOCK_FILE_PAGE);
+ ut_ad(block->in_unzip_LRU_list);
+ ut_ad(block->page.in_LRU_list);
+
+ mutex_enter(&block->mutex);
+ buf_LRU_free_block(&block->page,
+ FALSE);
+ mutex_exit(&block->mutex);
+ block = prev_block;
+ }
+
+ buf_pool_mutex_exit(buf_pool);
+ }
+ }
+ }
+}
+#endif /* !DBUG_OFF */
+
static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff)
{
innodb_export_status();
@@ -12616,6 +12746,20 @@ static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
"Disable with --skip-innodb-doublewrite.",
NULL, NULL, TRUE);
+static MYSQL_SYSVAR_BOOL(use_atomic_writes, innobase_use_atomic_writes,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Prevent partial page writes, via atomic writes."
+ "The option is used to prevent partial writes in case of a crash/poweroff, "
+ "as faster alternative to doublewrite buffer."
+ "Currently this option works only "
+ "on Linux only with FusionIO device, and directFS filesystem.",
+ NULL, NULL, FALSE);
+
+static MYSQL_SYSVAR_BOOL(use_fallocate, innobase_use_fallocate,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Preallocate files fast, using operating system functionality. On POSIX systems, posix_fallocate system call is used.",
+ NULL, NULL, FALSE);
+
static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
PLUGIN_VAR_RQCMDARG,
"Number of IOPs the server can do. Tunes the background IO rate",
@@ -12780,6 +12924,13 @@ static MYSQL_SYSVAR_ULONG(autoextend_increment, srv_auto_extend_increment,
"Data file autoextend increment in megabytes",
NULL, NULL, 8L, 1L, 1000L, 0);
+#ifndef DBUG_OFF
+static MYSQL_SYSVAR_STR(buffer_pool_evict, srv_buffer_pool_evict,
+ PLUGIN_VAR_RQCMDARG,
+ "Evict pages from the InnoDB buffer pool.",
+ NULL, innodb_buffer_pool_evict_update, "");
+#endif /* !DBUG_OFF */
+
static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
@@ -13001,6 +13152,9 @@ static MYSQL_SYSVAR_BOOL(print_all_deadlocks, srv_print_all_deadlocks,
static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(additional_mem_pool_size),
MYSQL_SYSVAR(autoextend_increment),
+#ifndef DBUG_OFF
+ MYSQL_SYSVAR(buffer_pool_evict),
+#endif /* !DBUG_OFF */
MYSQL_SYSVAR(buffer_pool_size),
MYSQL_SYSVAR(buffer_pool_instances),
MYSQL_SYSVAR(checksums),
@@ -13009,6 +13163,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(data_file_path),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
+ MYSQL_SYSVAR(use_atomic_writes),
+ MYSQL_SYSVAR(use_fallocate),
MYSQL_SYSVAR(fast_shutdown),
MYSQL_SYSVAR(file_io_threads),
MYSQL_SYSVAR(read_io_threads),
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 59ea065c5c7..38596bc69b5 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -2295,6 +2295,7 @@ i_s_innodb_buffer_stats_fill_table(
buf_pool_info_t* pool_info;
DBUG_ENTER("i_s_innodb_buffer_fill_general");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* Only allow the PROCESS privilege holder to access the stats */
if (check_global_access(thd, PROCESS_ACL)) {
@@ -2911,6 +2912,7 @@ i_s_innodb_fill_buffer_pool(
mem_heap_t* heap;
DBUG_ENTER("i_s_innodb_fill_buffer_pool");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
heap = mem_heap_create(10000);
@@ -3480,6 +3482,7 @@ i_s_innodb_fill_buffer_lru(
ulint lru_len;
DBUG_ENTER("i_s_innodb_fill_buffer_lru");
+ RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* Obtain buf_pool mutex before allocate info_buffer, since
UT_LIST_GET_LEN(buf_pool->LRU) could change */
diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
index 70af56b99f2..11505121fa2 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.c
+++ b/storage/innobase/ibuf/ibuf0ibuf.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -4685,6 +4685,16 @@ loop:
== page_no);
ut_ad(ibuf_rec_get_space(&mtr, rec) == space);
+ /* Mark the change buffer record processed,
+ so that it will not be merged again in case
+ the server crashes between the following
+ mtr_commit() and the subsequent mtr_commit()
+ of deleting the change buffer record. */
+
+ 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);
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h
index 95ccef16be0..b27bc954940 100644
--- a/storage/innobase/include/db0err.h
+++ b/storage/innobase/include/db0err.h
@@ -114,6 +114,7 @@ enum db_err {
DB_UNDO_RECORD_TOO_BIG, /* the undo log record is too big */
DB_TABLE_IN_FK_CHECK, /* table is being used in foreign
key check */
+ DB_IDENTIFIER_TOO_LONG, /* Identifier name too long */
/* The following are partial failure codes */
DB_FAIL = 1000,
diff --git a/storage/innobase/include/dyn0dyn.h b/storage/innobase/include/dyn0dyn.h
index 121a5946ac7..62ed862e82c 100644
--- a/storage/innobase/include/dyn0dyn.h
+++ b/storage/innobase/include/dyn0dyn.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -11,8 +11,8 @@ 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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -47,15 +47,17 @@ UNIV_INLINE
dyn_array_t*
dyn_array_create(
/*=============*/
- dyn_array_t* arr); /*!< in: pointer to a memory buffer of
+ dyn_array_t* arr) /*!< in/out memory buffer of
size sizeof(dyn_array_t) */
+ __attribute__((nonnull));
/************************************************************//**
Frees a dynamic array. */
UNIV_INLINE
void
dyn_array_free(
/*===========*/
- dyn_array_t* arr); /*!< in: dyn array */
+ dyn_array_t* arr) /*!< in,own: dyn array */
+ __attribute__((nonnull));
/*********************************************************************//**
Makes room on top of a dyn array and returns a pointer to a buffer in it.
After copying the elements, the caller must close the buffer using
@@ -66,8 +68,9 @@ byte*
dyn_array_open(
/*===========*/
dyn_array_t* arr, /*!< in: dynamic array */
- ulint size); /*!< in: size in bytes of the buffer; MUST be
+ ulint size) /*!< in: size in bytes of the buffer; MUST be
smaller than DYN_ARRAY_DATA_SIZE! */
+ __attribute__((nonnull, warn_unused_result));
/*********************************************************************//**
Closes the buffer returned by dyn_array_open. */
UNIV_INLINE
@@ -75,7 +78,8 @@ void
dyn_array_close(
/*============*/
dyn_array_t* arr, /*!< in: dynamic array */
- byte* ptr); /*!< in: buffer space from ptr up was not used */
+ const byte* ptr) /*!< in: end of used space */
+ __attribute__((nonnull));
/*********************************************************************//**
Makes room on top of a dyn array and returns a pointer to
the added element. The caller must copy the element to
@@ -85,8 +89,9 @@ UNIV_INLINE
void*
dyn_array_push(
/*===========*/
- dyn_array_t* arr, /*!< in: dynamic array */
- ulint size); /*!< in: size in bytes of the element */
+ dyn_array_t* arr, /*!< in/out: dynamic array */
+ ulint size) /*!< in: size in bytes of the element */
+ __attribute__((nonnull, warn_unused_result));
/************************************************************//**
Returns pointer to an element in dyn array.
@return pointer to element */
@@ -94,9 +99,10 @@ UNIV_INLINE
void*
dyn_array_get_element(
/*==================*/
- dyn_array_t* arr, /*!< in: dyn array */
- ulint pos); /*!< in: position of element as bytes
- from array start */
+ const dyn_array_t* arr, /*!< in: dyn array */
+ ulint pos) /*!< in: position of element
+ in bytes from array start */
+ __attribute__((nonnull, warn_unused_result));
/************************************************************//**
Returns the size of stored data in a dyn array.
@return data size in bytes */
@@ -104,30 +110,33 @@ UNIV_INLINE
ulint
dyn_array_get_data_size(
/*====================*/
- dyn_array_t* arr); /*!< in: dyn array */
+ const dyn_array_t* arr) /*!< in: dyn array */
+ __attribute__((nonnull, warn_unused_result, pure));
/************************************************************//**
-Gets the first block in a dyn array. */
-UNIV_INLINE
-dyn_block_t*
-dyn_array_get_first_block(
-/*======================*/
- dyn_array_t* arr); /*!< in: dyn array */
+Gets the first block in a dyn array.
+@param arr dyn array
+@return first block */
+#define dyn_array_get_first_block(arr) (arr)
/************************************************************//**
-Gets the last block in a dyn array. */
-UNIV_INLINE
-dyn_block_t*
-dyn_array_get_last_block(
-/*=====================*/
- dyn_array_t* arr); /*!< in: dyn array */
+Gets the last block in a dyn array.
+@param arr dyn array
+@return last block */
+#define dyn_array_get_last_block(arr) \
+ ((arr)->heap ? UT_LIST_GET_LAST((arr)->base) : (arr))
/********************************************************************//**
Gets the next block in a dyn array.
-@return pointer to next, NULL if end of list */
-UNIV_INLINE
-dyn_block_t*
-dyn_array_get_next_block(
-/*=====================*/
- dyn_array_t* arr, /*!< in: dyn array */
- dyn_block_t* block); /*!< in: dyn array block */
+@param arr dyn array
+@param block dyn array block
+@return pointer to next, NULL if end of list */
+#define dyn_array_get_next_block(arr, block) \
+ ((arr)->heap ? UT_LIST_GET_NEXT(list, block) : NULL)
+/********************************************************************//**
+Gets the previous block in a dyn array.
+@param arr dyn array
+@param block dyn array block
+@return pointer to previous, NULL if end of list */
+#define dyn_array_get_prev_block(arr, block) \
+ ((arr)->heap ? UT_LIST_GET_PREV(list, block) : NULL)
/********************************************************************//**
Gets the number of used bytes in a dyn array block.
@return number of bytes used */
@@ -135,7 +144,8 @@ UNIV_INLINE
ulint
dyn_block_get_used(
/*===============*/
- dyn_block_t* block); /*!< in: dyn array block */
+ const dyn_block_t* block) /*!< in: dyn array block */
+ __attribute__((nonnull, warn_unused_result, pure));
/********************************************************************//**
Gets pointer to the start of data in a dyn array block.
@return pointer to data */
@@ -143,16 +153,18 @@ UNIV_INLINE
byte*
dyn_block_get_data(
/*===============*/
- dyn_block_t* block); /*!< in: dyn array block */
+ const dyn_block_t* block) /*!< in: dyn array block */
+ __attribute__((nonnull, warn_unused_result, pure));
/********************************************************//**
Pushes n bytes to a dyn array. */
UNIV_INLINE
void
dyn_push_string(
/*============*/
- dyn_array_t* arr, /*!< in: dyn array */
+ dyn_array_t* arr, /*!< in/out: dyn array */
const byte* str, /*!< in: string to write */
- ulint len); /*!< in: string length */
+ ulint len) /*!< in: string length */
+ __attribute__((nonnull));
/*#################################################################*/
diff --git a/storage/innobase/include/dyn0dyn.ic b/storage/innobase/include/dyn0dyn.ic
index 110e674abff..177877ed1fd 100644
--- a/storage/innobase/include/dyn0dyn.ic
+++ b/storage/innobase/include/dyn0dyn.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -11,8 +11,8 @@ 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., 59 Temple
-Place, Suite 330, Boston, MA 02111-1307 USA
+this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
@@ -35,56 +35,8 @@ UNIV_INTERN
dyn_block_t*
dyn_array_add_block(
/*================*/
- dyn_array_t* arr); /*!< in: dyn array */
-
-
-/************************************************************//**
-Gets the first block in a dyn array. */
-UNIV_INLINE
-dyn_block_t*
-dyn_array_get_first_block(
-/*======================*/
- dyn_array_t* arr) /*!< in: dyn array */
-{
- return(arr);
-}
-
-/************************************************************//**
-Gets the last block in a dyn array. */
-UNIV_INLINE
-dyn_block_t*
-dyn_array_get_last_block(
-/*=====================*/
- dyn_array_t* arr) /*!< in: dyn array */
-{
- if (arr->heap == NULL) {
-
- return(arr);
- }
-
- return(UT_LIST_GET_LAST(arr->base));
-}
-
-/********************************************************************//**
-Gets the next block in a dyn array.
-@return pointer to next, NULL if end of list */
-UNIV_INLINE
-dyn_block_t*
-dyn_array_get_next_block(
-/*=====================*/
- dyn_array_t* arr, /*!< in: dyn array */
- dyn_block_t* block) /*!< in: dyn array block */
-{
- ut_ad(arr && block);
-
- if (arr->heap == NULL) {
- ut_ad(arr == block);
-
- return(NULL);
- }
-
- return(UT_LIST_GET_NEXT(list, block));
-}
+ dyn_array_t* arr) /*!< in/out: dyn array */
+ __attribute__((nonnull, warn_unused_result));
/********************************************************************//**
Gets the number of used bytes in a dyn array block.
@@ -93,7 +45,7 @@ UNIV_INLINE
ulint
dyn_block_get_used(
/*===============*/
- dyn_block_t* block) /*!< in: dyn array block */
+ const dyn_block_t* block) /*!< in: dyn array block */
{
ut_ad(block);
@@ -107,11 +59,11 @@ UNIV_INLINE
byte*
dyn_block_get_data(
/*===============*/
- dyn_block_t* block) /*!< in: dyn array block */
+ const dyn_block_t* block) /*!< in: dyn array block */
{
ut_ad(block);
- return(block->data);
+ return((byte*) block->data);
}
/*********************************************************************//**
@@ -121,7 +73,7 @@ UNIV_INLINE
dyn_array_t*
dyn_array_create(
/*=============*/
- dyn_array_t* arr) /*!< in: pointer to a memory buffer of
+ dyn_array_t* arr) /*!< in/out: memory buffer of
size sizeof(dyn_array_t) */
{
ut_ad(arr);
@@ -132,10 +84,9 @@ dyn_array_create(
arr->heap = NULL;
arr->used = 0;
-#ifdef UNIV_DEBUG
- arr->buf_end = 0;
- arr->magic_n = DYN_BLOCK_MAGIC_N;
-#endif
+ ut_d(arr->buf_end = 0);
+ ut_d(arr->magic_n = DYN_BLOCK_MAGIC_N);
+
return(arr);
}
@@ -151,9 +102,7 @@ dyn_array_free(
mem_heap_free(arr->heap);
}
-#ifdef UNIV_DEBUG
- arr->magic_n = 0;
-#endif
+ ut_d(arr->magic_n = 0);
}
/*********************************************************************//**
@@ -164,7 +113,7 @@ UNIV_INLINE
void*
dyn_array_push(
/*===========*/
- dyn_array_t* arr, /*!< in: dynamic array */
+ dyn_array_t* arr, /*!< in/out: dynamic array */
ulint size) /*!< in: size in bytes of the element */
{
dyn_block_t* block;
@@ -176,24 +125,23 @@ dyn_array_push(
ut_ad(size);
block = arr;
- used = block->used;
- if (used + size > DYN_ARRAY_DATA_SIZE) {
+ if (block->used + size > DYN_ARRAY_DATA_SIZE) {
/* Get the last array block */
block = dyn_array_get_last_block(arr);
- used = block->used;
- if (used + size > DYN_ARRAY_DATA_SIZE) {
+ if (block->used + size > DYN_ARRAY_DATA_SIZE) {
block = dyn_array_add_block(arr);
- used = block->used;
}
}
+ used = block->used;
+
block->used = used + size;
ut_ad(block->used <= DYN_ARRAY_DATA_SIZE);
- return((block->data) + used);
+ return(block->data + used);
}
/*********************************************************************//**
@@ -210,7 +158,6 @@ dyn_array_open(
smaller than DYN_ARRAY_DATA_SIZE! */
{
dyn_block_t* block;
- ulint used;
ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
@@ -218,28 +165,23 @@ dyn_array_open(
ut_ad(size);
block = arr;
- used = block->used;
- if (used + size > DYN_ARRAY_DATA_SIZE) {
+ if (block->used + size > DYN_ARRAY_DATA_SIZE) {
/* Get the last array block */
block = dyn_array_get_last_block(arr);
- used = block->used;
- if (used + size > DYN_ARRAY_DATA_SIZE) {
+ if (block->used + size > DYN_ARRAY_DATA_SIZE) {
block = dyn_array_add_block(arr);
- used = block->used;
ut_a(size <= DYN_ARRAY_DATA_SIZE);
}
}
ut_ad(block->used <= DYN_ARRAY_DATA_SIZE);
-#ifdef UNIV_DEBUG
ut_ad(arr->buf_end == 0);
+ ut_d(arr->buf_end = block->used + size);
- arr->buf_end = used + size;
-#endif
- return((block->data) + used);
+ return(block->data + block->used);
}
/*********************************************************************//**
@@ -248,8 +190,8 @@ UNIV_INLINE
void
dyn_array_close(
/*============*/
- dyn_array_t* arr, /*!< in: dynamic array */
- byte* ptr) /*!< in: buffer space from ptr up was not used */
+ dyn_array_t* arr, /*!< in/out: dynamic array */
+ const byte* ptr) /*!< in: end of used space */
{
dyn_block_t* block;
@@ -264,9 +206,7 @@ dyn_array_close(
ut_ad(block->used <= DYN_ARRAY_DATA_SIZE);
-#ifdef UNIV_DEBUG
- arr->buf_end = 0;
-#endif
+ ut_d(arr->buf_end = 0);
}
/************************************************************//**
@@ -276,12 +216,11 @@ UNIV_INLINE
void*
dyn_array_get_element(
/*==================*/
- dyn_array_t* arr, /*!< in: dyn array */
- ulint pos) /*!< in: position of element as bytes
- from array start */
+ const dyn_array_t* arr, /*!< in: dyn array */
+ ulint pos) /*!< in: position of element
+ in bytes from array start */
{
- dyn_block_t* block;
- ulint used;
+ const dyn_block_t* block;
ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
@@ -290,21 +229,23 @@ dyn_array_get_element(
block = dyn_array_get_first_block(arr);
if (arr->heap != NULL) {
- used = dyn_block_get_used(block);
+ for (;;) {
+ ulint used = dyn_block_get_used(block);
+
+ if (pos < used) {
+ break;
+ }
- while (pos >= used) {
pos -= used;
block = UT_LIST_GET_NEXT(list, block);
ut_ad(block);
-
- used = dyn_block_get_used(block);
}
}
ut_ad(block);
ut_ad(dyn_block_get_used(block) >= pos);
- return(block->data + pos);
+ return((byte*) block->data + pos);
}
/************************************************************//**
@@ -314,10 +255,10 @@ UNIV_INLINE
ulint
dyn_array_get_data_size(
/*====================*/
- dyn_array_t* arr) /*!< in: dyn array */
+ const dyn_array_t* arr) /*!< in: dyn array */
{
- dyn_block_t* block;
- ulint sum = 0;
+ const dyn_block_t* block;
+ ulint sum = 0;
ut_ad(arr);
ut_ad(arr->magic_n == DYN_BLOCK_MAGIC_N);
@@ -344,7 +285,7 @@ UNIV_INLINE
void
dyn_push_string(
/*============*/
- dyn_array_t* arr, /*!< in: dyn array */
+ dyn_array_t* arr, /*!< in/out: dyn array */
const byte* str, /*!< in: string to write */
ulint len) /*!< in: string length */
{
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index 664e18c52a8..2b34cb0ff2f 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -308,4 +308,15 @@ ulint
innobase_get_lower_case_table_names(void);
/*=====================================*/
+/**********************************************************************
+Check if the length of the identifier exceeds the maximum allowed.
+The input to this function is an identifier in charset my_charset_filename.
+return true when length of identifier is too long. */
+UNIV_INTERN
+my_bool
+innobase_check_identifier_length(
+/*=============================*/
+ const char* id); /* in: identifier to check. it must belong
+ to charset my_charset_filename */
+
#endif
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index 46f1ff9310c..88ac3c138de 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -295,9 +295,10 @@ UNIV_INTERN
void
mtr_memo_release(
/*=============*/
- mtr_t* mtr, /*!< in: mtr */
+ mtr_t* mtr, /*!< in/out: mini-transaction */
void* object, /*!< in: object */
- ulint type); /*!< in: object type: MTR_MEMO_S_LOCK, ... */
+ ulint type) /*!< in: object type: MTR_MEMO_S_LOCK, ... */
+ __attribute__((nonnull));
#ifdef UNIV_DEBUG
# ifndef UNIV_HOTBACKUP
/**********************************************************//**
@@ -309,7 +310,8 @@ mtr_memo_contains(
/*==============*/
mtr_t* mtr, /*!< in: mtr */
const void* object, /*!< in: object to search */
- ulint type); /*!< in: type of object */
+ ulint type) /*!< in: type of object */
+ __attribute__((warn_unused_result, nonnull));
/**********************************************************//**
Checks if memo contains the given page.
diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic
index 75cc7a9fcc4..b5480604bdf 100644
--- a/storage/innobase/include/page0zip.ic
+++ b/storage/innobase/include/page0zip.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2009, Innobase Oy. All Rights Reserved.
+Copyright (c) 2005, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -188,8 +188,8 @@ page_zip_rec_needs_ext(
one record on an empty leaf page. Subtract 1 byte for
the encoded heap number. Check also the available space
on the uncompressed page. */
- return(rec_size - (REC_N_NEW_EXTRA_BYTES - 2)
- >= (page_zip_empty_size(n_fields, zip_size) - 1)
+ return(rec_size - (REC_N_NEW_EXTRA_BYTES - 2 - 1)
+ >= page_zip_empty_size(n_fields, zip_size)
|| rec_size >= page_get_free_space_of_empty(TRUE) / 2);
}
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index acd120d4d33..5877768c3b6 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -216,6 +216,11 @@ extern ibool srv_innodb_status;
extern unsigned long long srv_stats_sample_pages;
extern ibool srv_use_doublewrite_buf;
+extern ibool srv_use_atomic_writes;
+#ifdef HAVE_POSIX_FALLOCATE
+extern ibool srv_use_posix_fallocate;
+#endif
+
extern ibool srv_use_checksums;
extern ulong srv_max_buf_pool_modified_pct;
diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h
index ce6dcb63049..4913b357768 100644
--- a/storage/innobase/include/ut0dbg.h
+++ b/storage/innobase/include/ut0dbg.h
@@ -55,49 +55,8 @@ ut_dbg_assertion_failed(
ulint line) /*!< in: line number of the assertion */
UNIV_COLD __attribute__((nonnull(2)));
-
-#define UT_DBG_USE_ABORT
-
-
-#ifndef UT_DBG_USE_ABORT
-/** A null pointer that will be dereferenced to trigger a memory trap */
-extern ulint* ut_dbg_null_ptr;
-#endif
-
-#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
-/** If this is set to TRUE by ut_dbg_assertion_failed(), all threads
-will stop at the next ut_a() or ut_ad(). */
-extern ibool ut_dbg_stop_threads;
-
-/*************************************************************//**
-Stop a thread after assertion failure. */
-UNIV_INTERN
-void
-ut_dbg_stop_thread(
-/*===============*/
- const char* file,
- ulint line);
-#endif
-
-#ifdef UT_DBG_USE_ABORT
/** Abort the execution. */
-#ifdef _WIN32
-# define UT_DBG_PANIC __debugbreak()
-#else
# define UT_DBG_PANIC abort()
-#endif
-/** Stop threads (null operation) */
-# define UT_DBG_STOP do {} while (0)
-#else /* UT_DBG_USE_ABORT */
-/** Abort the execution. */
-# define UT_DBG_PANIC \
- if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL
-/** Stop threads in ut_a(). */
-# define UT_DBG_STOP do \
- if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \
- ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \
- } while (0)
-#endif /* UT_DBG_USE_ABORT */
/** Abort execution if EXPR does not evaluate to nonzero.
@param EXPR assertion expression that should hold */
@@ -107,7 +66,6 @@ ut_dbg_stop_thread(
__FILE__, (ulint) __LINE__); \
UT_DBG_PANIC; \
} \
- UT_DBG_STOP; \
} while (0)
/** Abort execution. */
diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
index 853e65c8573..b36a9aed7cd 100644
--- a/storage/innobase/lock/lock0lock.c
+++ b/storage/innobase/lock/lock0lock.c
@@ -2162,6 +2162,8 @@ lock_rec_lock_fast(
#endif /* WITH_WSREP */
|| mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP);
+ DBUG_EXECUTE_IF("innodb_report_deadlock", return(LOCK_REC_FAIL););
+
lock = lock_rec_get_first_on_page(block);
trx = thr_get_trx(thr);
@@ -2251,6 +2253,8 @@ lock_rec_lock_slow(
trx = thr_get_trx(thr);
+ DBUG_EXECUTE_IF("innodb_report_deadlock", return(DB_DEADLOCK););
+
lock = lock_rec_has_expl(mode, block, heap_no, trx);
if (lock) {
if (lock->type_mode & LOCK_CONV_BY_OTHER) {
@@ -4404,6 +4408,7 @@ lock_rec_unlock(
ut_ad(trx && rec);
ut_ad(block->frame == page_align(rec));
+ ut_ad(trx->conc_state == TRX_ACTIVE);
heap_no = page_rec_get_heap_no(rec);
diff --git a/storage/innobase/mtr/mtr0mtr.c b/storage/innobase/mtr/mtr0mtr.c
index d852ed6f496..a5c98761523 100644
--- a/storage/innobase/mtr/mtr0mtr.c
+++ b/storage/innobase/mtr/mtr0mtr.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -39,72 +39,81 @@ Created 11/26/1995 Heikki Tuuri
# include "log0recv.h"
/*****************************************************************//**
Releases the item in the slot given. */
-static
+static __attribute__((nonnull))
void
-mtr_memo_slot_release(
-/*==================*/
- mtr_t* mtr, /*!< in: mtr */
+mtr_memo_slot_release_func(
+/*=======================*/
+#ifdef UNIV_DEBUG
+ mtr_t* mtr, /*!< in/out: mini-transaction */
+#endif /* UNIV_DEBUG */
mtr_memo_slot_t* slot) /*!< in: memo slot */
{
- void* object;
- ulint type;
-
- ut_ad(mtr);
- ut_ad(slot);
-
-#ifndef UNIV_DEBUG
- UT_NOT_USED(mtr);
-#endif /* UNIV_DEBUG */
-
- object = slot->object;
- type = slot->type;
+ void* object = slot->object;
+ slot->object = NULL;
- if (UNIV_LIKELY(object != NULL)) {
- if (type <= MTR_MEMO_BUF_FIX) {
- buf_page_release((buf_block_t*)object, type);
- } else if (type == MTR_MEMO_S_LOCK) {
- rw_lock_s_unlock((rw_lock_t*)object);
+ /* slot release is a local operation for the current mtr.
+ We must not be holding the flush_order mutex while
+ doing this. */
+ ut_ad(!log_flush_order_mutex_own());
+
+ switch (slot->type) {
+ case MTR_MEMO_PAGE_S_FIX:
+ case MTR_MEMO_PAGE_X_FIX:
+ case MTR_MEMO_BUF_FIX:
+ buf_page_release((buf_block_t*) object, slot->type);
+ break;
+ case MTR_MEMO_S_LOCK:
+ rw_lock_s_unlock((rw_lock_t*) object);
+ break;
+ case MTR_MEMO_X_LOCK:
+ rw_lock_x_unlock((rw_lock_t*) object);
+ break;
#ifdef UNIV_DEBUG
- } else if (type != MTR_MEMO_X_LOCK) {
- ut_ad(type == MTR_MEMO_MODIFY);
- ut_ad(mtr_memo_contains(mtr, object,
- MTR_MEMO_PAGE_X_FIX));
+ default:
+ ut_ad(slot->type == MTR_MEMO_MODIFY);
+ ut_ad(mtr_memo_contains(mtr, object, MTR_MEMO_PAGE_X_FIX));
#endif /* UNIV_DEBUG */
- } else {
- rw_lock_x_unlock((rw_lock_t*)object);
- }
}
-
- slot->object = NULL;
}
+#ifdef UNIV_DEBUG
+# define mtr_memo_slot_release(mtr, slot) mtr_memo_slot_release_func(mtr, slot)
+#else /* UNIV_DEBUG */
+# define mtr_memo_slot_release(mtr, slot) mtr_memo_slot_release_func(slot)
+#endif /* UNIV_DEBUG */
+
/**********************************************************//**
Releases the mlocks and other objects stored in an mtr memo.
They are released in the order opposite to which they were pushed
to the memo. */
-static
+static __attribute__((nonnull))
void
mtr_memo_pop_all(
/*=============*/
- mtr_t* mtr) /*!< in: mtr */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
{
- mtr_memo_slot_t* slot;
- dyn_array_t* memo;
- ulint offset;
+ const dyn_block_t* block;
- ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_COMMITTING); /* Currently only used in
commit */
- memo = &(mtr->memo);
-
- offset = dyn_array_get_data_size(memo);
- while (offset > 0) {
- offset -= sizeof(mtr_memo_slot_t);
- slot = dyn_array_get_element(memo, offset);
-
- mtr_memo_slot_release(mtr, slot);
+ for (block = dyn_array_get_last_block(&mtr->memo);
+ block;
+ block = dyn_array_get_prev_block(&mtr->memo, block)) {
+ const mtr_memo_slot_t* start
+ = (mtr_memo_slot_t*) dyn_block_get_data(block);
+ mtr_memo_slot_t* slot
+ = (mtr_memo_slot_t*) (dyn_block_get_data(block)
+ + dyn_block_get_used(block));
+
+ ut_ad(!(dyn_block_get_used(block) % sizeof(mtr_memo_slot_t)));
+
+ while (slot-- != start) {
+ if (slot->object != NULL) {
+ mtr_memo_slot_release(mtr, slot);
+ }
+ }
}
}
@@ -288,42 +297,36 @@ UNIV_INTERN
void
mtr_memo_release(
/*=============*/
- mtr_t* mtr, /*!< in: mtr */
+ mtr_t* mtr, /*!< in/out: mini-transaction */
void* object, /*!< in: object */
ulint type) /*!< in: object type: MTR_MEMO_S_LOCK, ... */
{
- mtr_memo_slot_t* slot;
- dyn_array_t* memo;
- ulint offset;
+ const dyn_block_t* block;
- ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE);
-
- memo = &(mtr->memo);
-
- offset = dyn_array_get_data_size(memo);
-
- log_flush_order_mutex_enter();
- while (offset > 0) {
- offset -= sizeof(mtr_memo_slot_t);
-
- slot = dyn_array_get_element(memo, offset);
-
- if (object == slot->object && type == slot->type) {
-
- /* We cannot release a page that has been written
- to in the middle of a mini-transaction. */
-
- ut_ad(!(mtr->modifications
- && slot->type == MTR_MEMO_PAGE_X_FIX));
-
- mtr_memo_slot_release(mtr, slot);
-
- break;
+ /* We cannot release a page that has been written to in the
+ middle of a mini-transaction. */
+ ut_ad(!mtr->modifications || type != MTR_MEMO_PAGE_X_FIX);
+
+ for (block = dyn_array_get_last_block(&mtr->memo);
+ block;
+ block = dyn_array_get_prev_block(&mtr->memo, block)) {
+ const mtr_memo_slot_t* start
+ = (mtr_memo_slot_t*) dyn_block_get_data(block);
+ mtr_memo_slot_t* slot
+ = (mtr_memo_slot_t*) (dyn_block_get_data(block)
+ + dyn_block_get_used(block));
+
+ ut_ad(!(dyn_block_get_used(block) % sizeof(mtr_memo_slot_t)));
+
+ while (slot-- != start) {
+ if (object == slot->object && type == slot->type) {
+ mtr_memo_slot_release(mtr, slot);
+ return;
+ }
}
}
- log_flush_order_mutex_exit();
}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
index 983465881b2..447277a9492 100644
--- a/storage/innobase/os/os0file.c
+++ b/storage/innobase/os/os0file.c
@@ -1374,6 +1374,42 @@ os_file_set_nocache(
#endif
}
+
+#ifdef __linux__
+#include <sys/ioctl.h>
+#ifndef DFS_IOCTL_ATOMIC_WRITE_SET
+#define DFS_IOCTL_ATOMIC_WRITE_SET _IOW(0x95, 2, uint)
+#endif
+static int os_file_set_atomic_writes(os_file_t file, const char *name)
+{
+ int atomic_option = 1;
+
+ int ret = ioctl (file, DFS_IOCTL_ATOMIC_WRITE_SET, &atomic_option);
+
+ if (ret) {
+ fprintf(stderr,
+ "InnoDB : can't use atomic write on %s, errno %d\n",
+ name, errno);
+ return ret;
+ }
+ return ret;
+}
+#else
+static int os_file_set_atomic_writes(os_file_t file, const char *name)
+{
+ fprintf(stderr,
+ "InnoDB : can't use atomic writes on %s - not implemented on this platform."
+ "innodb_use_atomic_writes needs to be 0.\n",
+ name);
+#ifdef _WIN32
+ SetLastError(ERROR_INVALID_FUNCTION);
+#else
+ errno = EINVAL;
+#endif
+ return -1;
+}
+#endif
+
/****************************************************************//**
NOTE! Use the corresponding macro os_file_create(), not directly
this function!
@@ -1525,6 +1561,13 @@ try_again:
*success = TRUE;
}
+ if (srv_use_atomic_writes && type == OS_DATA_FILE &&
+ os_file_set_atomic_writes(file, name)) {
+ CloseHandle(file);
+ *success = FALSE;
+ file = INVALID_HANDLE_VALUE;
+ }
+
return(file);
#else /* __WIN__ */
os_file_t file;
@@ -1641,6 +1684,12 @@ try_again:
file = -1;
}
#endif /* USE_FILE_LOCK */
+ if (srv_use_atomic_writes && type == OS_DATA_FILE
+ && os_file_set_atomic_writes(file, name)) {
+ close(file);
+ *success = FALSE;
+ file = -1;
+ }
return(file);
#endif /* __WIN__ */
@@ -1988,6 +2037,28 @@ os_file_set_size(
current_size = 0;
desired_size = (ib_int64_t)size + (((ib_int64_t)size_high) << 32);
+#ifdef HAVE_POSIX_FALLOCATE
+ if (srv_use_posix_fallocate) {
+ if (posix_fallocate(file, current_size, desired_size) == -1) {
+ fprintf(stderr,
+ "InnoDB: Error: preallocating data for"
+ " file %s failed at\n"
+ "InnoDB: offset 0 size %lld %lld. Operating system"
+ " error number %d.\n"
+ "InnoDB: Check that the disk is not full"
+ " or a disk quota exceeded.\n"
+ "InnoDB: Some operating system error numbers"
+ " are described at\n"
+ "InnoDB: "
+ REFMAN "operating-system-error-codes.html\n",
+ name, (long long)size_high, (long long)size, errno);
+
+ return (FALSE);
+ }
+ return (TRUE);
+ }
+#endif
+
/* Write up to 1 megabyte at a time. */
buf_size = ut_min(64, (ulint) (desired_size / UNIV_PAGE_SIZE))
* UNIV_PAGE_SIZE;
diff --git a/storage/innobase/page/page0zip.c b/storage/innobase/page/page0zip.c
index 9f895e60803..f9338da079e 100644
--- a/storage/innobase/page/page0zip.c
+++ b/storage/innobase/page/page0zip.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2005, 2013, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -837,11 +837,12 @@ page_zip_compress_node_ptrs(
c_stream->next_in = (byte*) rec;
c_stream->avail_in = rec_offs_data_size(offsets)
- REC_NODE_PTR_SIZE;
- ut_ad(c_stream->avail_in);
- err = deflate(c_stream, Z_NO_FLUSH);
- if (UNIV_UNLIKELY(err != Z_OK)) {
- break;
+ if (c_stream->avail_in) {
+ err = deflate(c_stream, Z_NO_FLUSH);
+ if (UNIV_UNLIKELY(err != Z_OK)) {
+ break;
+ }
}
ut_ad(!c_stream->avail_in);
diff --git a/storage/innobase/plugin_exports b/storage/innobase/plugin_exports
index 03b8cf8c217..e059601c96e 100644
--- a/storage/innobase/plugin_exports
+++ b/storage/innobase/plugin_exports
@@ -6,6 +6,8 @@
thd_wait_service;
my_snprintf_service;
thd_alloc_service;
+ thd_kill_statement_service;
+ debug_sync_service;
local:
*;
};
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
index 73da6215f0d..77fa6518b35 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -3840,6 +3840,7 @@ row_rename_table_for_mysql(
ut_a(old_name != NULL);
ut_a(new_name != NULL);
+ ut_ad(trx->conc_state == TRX_ACTIVE);
if (srv_created_new_raw || srv_force_recovery) {
fputs("InnoDB: A new raw disk partition was initialized or\n"
@@ -3864,7 +3865,6 @@ row_rename_table_for_mysql(
}
trx->op_info = "renaming table";
- trx_start_if_not_started(trx);
old_is_tmp = row_is_mysql_tmp_table_name(old_name);
new_is_tmp = row_is_mysql_tmp_table_name(new_name);
diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
index b46b2eacd9d..76c1f01d63a 100644
--- a/storage/innobase/row/row0sel.c
+++ b/storage/innobase/row/row0sel.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -57,6 +57,8 @@ Created 12/19/1997 Heikki Tuuri
#include "read0read.h"
#include "buf0lru.h"
#include "ha_prototypes.h"
+#include "m_string.h" /* for my_sys.h */
+#include "my_sys.h" /* DEBUG_SYNC_C */
/* Maximum number of rows to prefetch; MySQL interface has another parameter */
#define SEL_MAX_N_PREFETCH 16
@@ -3918,7 +3920,9 @@ wait_table_again:
}
rec_loop:
+ DEBUG_SYNC_C("row_search_rec_loop");
if (trx_is_interrupted(trx)) {
+ btr_pcur_store_position(pcur, &mtr);
err = DB_INTERRUPTED;
goto normal_return;
}
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index f872955f955..1b83a919748 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
@@ -287,7 +287,7 @@ UNIV_INTERN ulint srv_data_read = 0;
/* Internal setting for "innodb_stats_method". Decides how InnoDB treats
NULL value when collecting statistics. By default, it is set to
SRV_STATS_NULLS_EQUAL(0), ie. all NULL value are treated equal */
-ulong srv_innodb_stats_method = SRV_STATS_NULLS_EQUAL;
+UNIV_INTERN ulong srv_innodb_stats_method = SRV_STATS_NULLS_EQUAL;
/* here we count the amount of data written in total (in bytes) */
UNIV_INTERN ulint srv_data_written = 0;
@@ -412,6 +412,10 @@ this many index pages */
UNIV_INTERN unsigned long long srv_stats_sample_pages = 8;
UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
+UNIV_INTERN ibool srv_use_atomic_writes = FALSE;
+#ifdef HAVE_POSIX_FALLOCATE
+UNIV_INTERN ibool srv_use_posix_fallocate = TRUE;
+#endif
UNIV_INTERN ibool srv_use_checksums = TRUE;
UNIV_INTERN ulong srv_replication_delay = 0;
@@ -2208,19 +2212,31 @@ srv_export_innodb_status(void)
export_vars.innodb_truncated_status_writes = srv_truncated_status_writes;
#ifdef UNIV_DEBUG
- if (trx_sys->max_trx_id < purge_sys->done_trx_no) {
- export_vars.innodb_purge_trx_id_age = 0;
- } else {
- export_vars.innodb_purge_trx_id_age =
- trx_sys->max_trx_id - purge_sys->done_trx_no;
- }
+ {
+ trx_id_t done_trx_no;
+ trx_id_t up_limit_id;
+
+ rw_lock_s_lock(&purge_sys->latch);
+ done_trx_no = purge_sys->done_trx_no;
+ up_limit_id = purge_sys->view
+ ? purge_sys->view->up_limit_id
+ : 0;
+ rw_lock_s_unlock(&purge_sys->latch);
+
+ if (trx_sys->max_trx_id < done_trx_no) {
+ export_vars.innodb_purge_trx_id_age = 0;
+ } else {
+ export_vars.innodb_purge_trx_id_age =
+ trx_sys->max_trx_id - done_trx_no;
+ }
- if (!purge_sys->view
- || trx_sys->max_trx_id < purge_sys->view->up_limit_id) {
- export_vars.innodb_purge_view_trx_id_age = 0;
- } else {
- export_vars.innodb_purge_view_trx_id_age =
- trx_sys->max_trx_id - purge_sys->view->up_limit_id;
+ if (!up_limit_id
+ || trx_sys->max_trx_id < up_limit_id) {
+ export_vars.innodb_purge_view_trx_id_age = 0;
+ } else {
+ export_vars.innodb_purge_view_trx_id_age =
+ trx_sys->max_trx_id - up_limit_id;
+ }
}
#endif /* UNIV_DEBUG */
diff --git a/storage/innobase/sync/sync0arr.c b/storage/innobase/sync/sync0arr.c
index c6cbfc94dca..b2778184335 100644
--- a/storage/innobase/sync/sync0arr.c
+++ b/storage/innobase/sync/sync0arr.c
@@ -604,10 +604,6 @@ sync_array_deadlock_step(
new = sync_array_find_thread(arr, thread);
if (UNIV_UNLIKELY(new == start)) {
- /* Stop running of other threads */
-
- ut_dbg_stop_threads = TRUE;
-
/* Deadlock */
fputs("########################################\n"
"DEADLOCK of threads detected!\n", stderr);
@@ -945,6 +941,8 @@ sync_array_print_long_waits(
# define SYNC_ARRAY_TIMEOUT 240
#endif
+ sync_array_enter(sync_primary_wait_array);
+
for (i = 0; i < sync_primary_wait_array->n_cells; i++) {
double diff;
@@ -979,6 +977,8 @@ sync_array_print_long_waits(
}
}
+ sync_array_exit(sync_primary_wait_array);
+
if (noticed) {
fprintf(stderr,
"InnoDB: ###### Starts InnoDB Monitor"
diff --git a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
index fb7101fdb8d..fba43ad859c 100644
--- a/storage/innobase/sync/sync0sync.c
+++ b/storage/innobase/sync/sync0sync.c
@@ -316,9 +316,9 @@ mutex_create_func(
/* NOTE! The very first mutexes are not put to the mutex list */
- if ((mutex == &mutex_list_mutex)
+ if (mutex == &mutex_list_mutex
#ifdef UNIV_SYNC_DEBUG
- || (mutex == &sync_thread_mutex)
+ || mutex == &sync_thread_mutex
#endif /* UNIV_SYNC_DEBUG */
) {
diff --git a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
index d62b95adc2b..ad28931e100 100644
--- a/storage/innobase/trx/trx0sys.c
+++ b/storage/innobase/trx/trx0sys.c
@@ -141,7 +141,7 @@ UNIV_INTERN mysql_pfs_key_t file_format_max_mutex_key;
#ifndef UNIV_HOTBACKUP
#ifdef UNIV_DEBUG
/* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */
-uint trx_rseg_n_slots_debug = 0;
+UNIV_INTERN uint trx_rseg_n_slots_debug = 0;
#endif
/** This is used to track the maximum file format id known to InnoDB. It's
diff --git a/storage/innobase/ut/ut0dbg.c b/storage/innobase/ut/ut0dbg.c
index 53ed4a53044..a440b72d32a 100644
--- a/storage/innobase/ut/ut0dbg.c
+++ b/storage/innobase/ut/ut0dbg.c
@@ -35,16 +35,6 @@ Created 1/30/1994 Heikki Tuuri
UNIV_INTERN ulint ut_dbg_zero = 0;
#endif
-#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
-/** If this is set to TRUE by ut_dbg_assertion_failed(), all threads
-will stop at the next ut_a() or ut_ad(). */
-UNIV_INTERN ibool ut_dbg_stop_threads = FALSE;
-#endif
-#ifndef UT_DBG_USE_ABORT
-/** A null pointer that will be dereferenced to trigger a memory trap */
-UNIV_INTERN ulint* ut_dbg_null_ptr = NULL;
-#endif
-
/*************************************************************//**
Report a failed assertion. */
UNIV_INTERN
@@ -80,30 +70,8 @@ ut_dbg_assertion_failed(
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
"InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
-#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
- ut_dbg_stop_threads = TRUE;
-#endif
}
-#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
-/*************************************************************//**
-Stop a thread after assertion failure. */
-UNIV_INTERN
-void
-ut_dbg_stop_thread(
-/*===============*/
- const char* file,
- ulint line)
-{
-#ifndef UNIV_HOTBACKUP
- fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
- os_thread_pf(os_thread_get_curr_id()),
- innobase_basename(file), line);
- os_thread_sleep(1000000000);
-#endif /* !UNIV_HOTBACKUP */
-}
-#endif
-
#ifdef UNIV_COMPILE_TEST_FUNCS
#include <sys/types.h>
diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c
index 2fe45aad2a7..699af1fcaa1 100644
--- a/storage/innobase/ut/ut0ut.c
+++ b/storage/innobase/ut/ut0ut.c
@@ -728,6 +728,8 @@ ut_strerr(
return("End of index");
case DB_TABLE_IN_FK_CHECK:
return("Table is being used in foreign key check");
+ case DB_IDENTIFIER_TOO_LONG:
+ return("Identifier name is too long");
/* do not add default: in order to produce a warning if new code
is added to the enum but not added here */
}
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 31b903871ce..7958868689b 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -1309,8 +1309,9 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt)
old_proc_info= thd_proc_info(thd, "Checking status");
thd_progress_init(thd, 3);
- (void) maria_chk_status(&param, file); // Not fatal
- error= maria_chk_size(&param, file);
+ error= maria_chk_status(&param, file); // Not fatal
+ if (maria_chk_size(&param, file))
+ error= 1;
if (!error)
error|= maria_chk_del(&param, file, param.testflag);
thd_proc_info(thd, "Checking keys");
@@ -1667,6 +1668,11 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
}
}
thd_proc_info(thd, "Saving state");
+ if (optimize_done && !error && !(param->testflag & T_NO_CREATE_RENAME_LSN))
+ {
+ /* Set trid (needed if the table was moved from another system) */
+ share->state.create_trid= trnman_get_min_safe_trid();
+ }
mysql_mutex_lock(&share->intern_lock);
if (!error)
{
@@ -1682,6 +1688,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
*/
if (file->state != &share->state.state)
*file->state= share->state.state;
+
if (share->base.auto_key)
_ma_update_auto_increment_key(param, file, 1);
if (optimize_done)
@@ -1689,6 +1696,9 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize)
UPDATE_TIME | UPDATE_OPEN_COUNT |
(local_testflag &
T_STATISTICS ? UPDATE_STAT : 0));
+ /* File is repaired; Mark the file as moved to this system */
+ (void) _ma_set_uuid(share, 0);
+
info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE |
HA_STATUS_CONST);
if (rows != file->state->records && !(param->testflag & T_VERY_SILENT))
@@ -2405,7 +2415,9 @@ int ha_maria::remember_rnd_pos()
int ha_maria::restart_rnd_next(uchar *buf)
{
- (*file->s->scan_restore_pos)(file, remember_pos);
+ int error;
+ if ((error= (*file->s->scan_restore_pos)(file, remember_pos)))
+ return error;
return rnd_next(buf);
}
@@ -2638,23 +2650,6 @@ int ha_maria::external_lock(THD *thd, int lock_type)
/* Transactional table */
if (lock_type != F_UNLCK)
{
- if (!file->s->lock_key_trees) // If we don't use versioning
- {
- /*
- We come here in the following cases:
- - The table is a temporary table
- - It's a table which is crash safe but not yet versioned, for
- example a table with fulltext or rtree keys
-
- Set the current state to point to save_state so that the
- block_format code don't count the same record twice.
- Copy also the current state. This may have been wrong if the
- same file was used several times in the last statement
- */
- file->state= file->state_start;
- *file->state= file->s->state.state;
- }
-
if (file->trn)
{
/* This can only happen with tables created with clone() */
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index f5d32d6a191..407b4ed2b92 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -135,8 +135,7 @@ const char *bits_to_txt[]=
"tail 00-40 % full", "tail 40-80 % full", "tail/blob full"
};
-/*#define WRONG_BITMAP_FLUSH 1*/ /*define only for provoking bugs*/
-#undef WRONG_BITMAP_FLUSH
+#define WRONG_BITMAP_FLUSH 0 /*define to 1 only for provoking bugs*/
static my_bool _ma_read_bitmap_page(MARIA_HA *info,
MARIA_FILE_BITMAP *bitmap,
@@ -164,11 +163,7 @@ static inline my_bool write_changed_bitmap(MARIA_SHARE *share,
*/
bitmap->changed_not_flushed= 1;
- if ((bitmap->non_flushable == 0)
-#ifdef WRONG_BITMAP_FLUSH
- || 1
-#endif
- )
+ if ((bitmap->non_flushable == 0) || WRONG_BITMAP_FLUSH)
{
res= pagecache_write(share->pagecache,
&bitmap->file, bitmap->page, 0,
@@ -495,7 +490,7 @@ my_bool _ma_bitmap_flush_all(MARIA_SHARE *share)
{
bitmap->flush_all_requested++;
bitmap->waiting_for_non_flushable++;
-#ifndef WRONG_BITMAP_FLUSH
+#if !WRONG_BITMAP_FLUSH
while (bitmap->non_flushable > 0)
{
DBUG_PRINT("info", ("waiting for bitmap to be flushable"));
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 71faa11fd2b..dcfabe7b3a2 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -4007,6 +4007,8 @@ static int delete_dir_entry(uchar *buff, uint block_size, uint record_number,
uint length, empty_space;
uchar *dir;
DBUG_ENTER("delete_dir_entry");
+ DBUG_PRINT("enter", ("record_number: %u number_of_records: %u",
+ record_number, number_of_records));
#ifdef SANITY_CHECKS
if (record_number >= number_of_records ||
@@ -4023,7 +4025,8 @@ static int delete_dir_entry(uchar *buff, uint block_size, uint record_number,
check_directory(buff, block_size, 0, (uint) -1);
empty_space= uint2korr(buff + EMPTY_SPACE_OFFSET);
dir= dir_entry_pos(buff, block_size, record_number);
- length= uint2korr(dir + 2);
+ length= uint2korr(dir + 2); /* Length of entry we just deleted */
+ DBUG_ASSERT(uint2korr(dir) != 0 && length < block_size);
if (record_number == number_of_records - 1)
{
@@ -5240,11 +5243,6 @@ void _ma_scan_end_block_record(MARIA_HA *info)
For the moment we can only remember one position, but this is
good enough for MySQL usage
- @Warning
- When this function is called, we assume that the thread is not deleting
- or updating the current row before ma_scan_restore_block_record()
- is called!
-
@return
@retval 0 ok
@retval HA_ERR_WRONG_IN_RECORD Could not allocate memory to hold position
@@ -5264,15 +5262,18 @@ int _ma_scan_remember_block_record(MARIA_HA *info,
info->scan_save->bitmap_buff= ((uchar*) info->scan_save +
ALIGN_SIZE(sizeof(*info->scan_save)));
}
- /* Point to the last read row */
- *lastpos= info->cur_row.nextpos - 1;
- info->scan.dir+= DIR_ENTRY_SIZE;
+ /* For checking if pages have changed since we last read it */
+ info->scan.row_changes= info->row_changes;
/* Remember used bitmap and used head page */
bitmap_buff= info->scan_save->bitmap_buff;
memcpy(info->scan_save, &info->scan, sizeof(*info->scan_save));
info->scan_save->bitmap_buff= bitmap_buff;
memcpy(bitmap_buff, info->scan.bitmap_buff, info->s->block_size * 2);
+
+ /* Point to the last read row */
+ *lastpos= info->cur_row.nextpos - 1;
+ info->scan_save->dir+= DIR_ENTRY_SIZE;
DBUG_RETURN(0);
}
@@ -5280,15 +5281,22 @@ int _ma_scan_remember_block_record(MARIA_HA *info,
/**
@brief restore scan block it's original values
+ @return
+ 0 ok
+ # error
+
@note
In theory we could swap bitmap buffers instead of copy them.
For the moment we don't do that because there are variables pointing
inside the buffers and it's a bit of hassle to either make them relative
or repoint them.
+
+ If the data file has changed, we will re-read the new block record
+ to ensure that when we continue scanning we can ignore any deleted rows.
*/
-void _ma_scan_restore_block_record(MARIA_HA *info,
- MARIA_RECORD_POS lastpos)
+int _ma_scan_restore_block_record(MARIA_HA *info,
+ MARIA_RECORD_POS lastpos)
{
uchar *bitmap_buff;
DBUG_ENTER("_ma_scan_restore_block_record");
@@ -5299,7 +5307,26 @@ void _ma_scan_restore_block_record(MARIA_HA *info,
info->scan.bitmap_buff= bitmap_buff;
memcpy(bitmap_buff, info->scan_save->bitmap_buff, info->s->block_size * 2);
- DBUG_VOID_RETURN;
+ if (info->scan.row_changes != info->row_changes)
+ {
+ /*
+ Table has been changed. We have to re-read the current page block as
+ data may have changed on it that we have to see.
+ */
+ if (!(pagecache_read(info->s->pagecache,
+ &info->dfile,
+ ma_recordpos_to_page(info->scan.row_base_page),
+ 0, info->scan.page_buff,
+ info->s->page_type,
+ PAGECACHE_LOCK_LEFT_UNLOCKED, 0)))
+ DBUG_RETURN(my_errno);
+ info->scan.number_of_rows=
+ (uint) (uchar) info->scan.page_buff[DIR_COUNT_OFFSET];
+ info->scan.dir_end= (info->scan.page_buff + info->s->block_size -
+ PAGE_SUFFIX_SIZE -
+ info->scan.number_of_rows * DIR_ENTRY_SIZE);
+ }
+ DBUG_RETURN(0);
}
@@ -5326,7 +5353,7 @@ void _ma_scan_restore_block_record(MARIA_HA *info,
RETURN
0 ok
- # Error code
+ # Error code (Normally HA_ERR_END_OF_FILE)
*/
int _ma_scan_block_record(MARIA_HA *info, uchar *record,
@@ -5345,6 +5372,12 @@ restart_record_read:
uchar *data, *end_of_data;
int error;
+ /* Ensure that scan.dir and record_pos are in sync */
+ DBUG_ASSERT(info->scan.dir == dir_entry_pos(info->scan.page_buff,
+ share->block_size,
+ record_pos));
+
+ /* Search for a valid directory entry (not 0) */
while (!(offset= uint2korr(info->scan.dir)))
{
info->scan.dir-= DIR_ENTRY_SIZE;
@@ -5357,13 +5390,19 @@ restart_record_read:
}
#endif
}
+ /*
+ This should always be true as the directory should always start with
+ a valid entry.
+ */
+ DBUG_ASSERT(info->scan.dir >= info->scan.dir_end);
+
/* found row */
info->cur_row.lastpos= info->scan.row_base_page + record_pos;
info->cur_row.nextpos= record_pos + 1;
data= info->scan.page_buff + offset;
length= uint2korr(info->scan.dir + 2);
end_of_data= data + length;
- info->scan.dir-= DIR_ENTRY_SIZE; /* Point to previous row */
+ info->scan.dir-= DIR_ENTRY_SIZE; /* Point to next row to process */
#ifdef SANITY_CHECKS
if (end_of_data > info->scan.dir_end ||
offset < PAGE_HEADER_SIZE || length < share->base.min_block_length)
@@ -6937,6 +6976,7 @@ my_bool _ma_apply_undo_row_insert(MARIA_HA *info, LSN undo_lsn,
res= 0;
end:
+ /* The following is true only if _ma_bitmap_flushable() was called earlier */
if (info->non_flushable_state)
_ma_bitmap_flushable(info, -1);
_ma_unpin_all_pages_and_finalize_row(info, lsn);
@@ -6946,6 +6986,11 @@ err:
DBUG_ASSERT(!maria_assert_if_crashed_table);
res= 1;
_ma_mark_file_crashed(share);
+ /*
+ Don't write a new LSN on the used pages. Not important as the file is
+ marked as crashed and need to be repaired before it can be used.
+ */
+ lsn= LSN_IMPOSSIBLE;
goto end;
}
@@ -7123,7 +7168,7 @@ my_bool _ma_apply_undo_row_delete(MARIA_HA *info, LSN undo_lsn,
memcpy(field_pos, field_length_data, size_length);
field_length_data+= size_length;
- memcpy(field_pos + size_length, &header, sizeof(&header));
+ memcpy(field_pos + size_length, &header, sizeof(header));
header+= blob_length;
*blob_lengths++= blob_length;
break;
diff --git a/storage/maria/ma_blockrec.h b/storage/maria/ma_blockrec.h
index 45f5613bb60..40ca2591236 100644
--- a/storage/maria/ma_blockrec.h
+++ b/storage/maria/ma_blockrec.h
@@ -167,8 +167,8 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info);
void _ma_scan_end_block_record(MARIA_HA *info);
int _ma_scan_remember_block_record(MARIA_HA *info,
MARIA_RECORD_POS *lastpos);
-void _ma_scan_restore_block_record(MARIA_HA *info,
- MARIA_RECORD_POS lastpos);
+int _ma_scan_restore_block_record(MARIA_HA *info,
+ MARIA_RECORD_POS lastpos);
MARIA_RECORD_POS _ma_write_init_block_record(MARIA_HA *info,
const uchar *record);
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index 1feb2ae5df2..d63ac8be3cb 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -140,13 +140,22 @@ void maria_chk_init_for_check(HA_CHECK *param, MARIA_HA *info)
Set up transaction handler so that we can see all rows. When rows is read
we will check the found id against param->max_tried
*/
- if (param->max_trid == 0)
+ if (!info->s->base.born_transactional)
+ {
+ /*
+ There are no trids. Howver we want to set max_trid to make test of
+ create_trid simpler.
+ */
+ param->max_trid= ~(TrID) 0;
+ }
+ else if (param->max_trid == 0)
{
if (!ma_control_file_inited())
param->max_trid= 0; /* Give warning for first trid found */
else
param->max_trid= max_trid_in_system();
}
+
maria_ignore_trids(info);
}
@@ -179,6 +188,13 @@ int maria_chk_status(HA_CHECK *param, MARIA_HA *info)
if (param->testflag & T_UPDATE_STATE)
param->warning_printed=save;
}
+ if (share->state.create_trid > param->max_trid)
+ {
+ _ma_check_print_warning(param,
+ "Table create_trd (%llu) > current max_transaction id (%llu). Table needs to be repaired or zerofilled to be usable",
+ share->state.create_trid, param->max_trid);
+ return 1;
+ }
return 0;
}
@@ -1246,17 +1262,13 @@ static int check_dynamic_record(HA_CHECK *param, MARIA_HA *info, int extend,
{
MARIA_BLOCK_INFO block_info;
MARIA_SHARE *share= info->s;
- my_off_t start_recpos, start_block, pos;
- uchar *to;
- ulong left_length;
+ my_off_t UNINIT_VAR(start_recpos), start_block, pos;
+ uchar *UNINIT_VAR(to);
+ ulong UNINIT_VAR(left_length);
uint b_type;
char llbuff[22],llbuff2[22],llbuff3[22];
DBUG_ENTER("check_dynamic_record");
- LINT_INIT(left_length);
- LINT_INIT(start_recpos);
- LINT_INIT(to);
-
pos= 0;
while (pos < share->state.state.data_file_length)
{
@@ -1847,10 +1859,8 @@ static int check_block_record(HA_CHECK *param, MARIA_HA *info, int extend,
pos < share->state.state.data_file_length;
pos+= block_size, page++)
{
- uint row_count, real_row_count, empty_space, page_type, bitmap_pattern;
+ uint UNINIT_VAR(row_count), real_row_count, empty_space, page_type, bitmap_pattern;
uint bitmap_for_page;
- LINT_INIT(row_count);
- LINT_INIT(empty_space);
if (_ma_killed_ptr(param))
{
@@ -2430,11 +2440,10 @@ static void restore_table_state_after_repair(MARIA_HA *info,
{
maria_versioning(info, info->s->have_versioning);
info->s->lock_key_trees= org_share->lock_key_trees;
+ DBUG_ASSERT(!info->s->have_versioning || info->s->lock_key_trees);
}
-
-
/**
@brief Drop all indexes
@@ -3559,7 +3568,10 @@ int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name)
/* Ensure state is later flushed to disk, if within maria_chk */
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
- /* Reset create_trid to make file comparable */
+ /*
+ Reset create_trid to make file comparable and to ensure that new
+ trid's in the file starts from 0.
+ */
share->state.create_trid= 0;
}
if (reenable_logging)
diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c
index 30124b2205d..1e8adb64981 100644
--- a/storage/maria/ma_checkpoint.c
+++ b/storage/maria/ma_checkpoint.c
@@ -758,13 +758,11 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon)
struct st_state_copy *state_copies= NULL, /**< fixed-size cache of states */
*state_copies_end, /**< cache ends here */
*state_copy; /**< iterator in cache */
- TRANSLOG_ADDRESS state_copies_horizon; /**< horizon of states' _copies_ */
+ TRANSLOG_ADDRESS UNINIT_VAR(state_copies_horizon); /**< horizon of states' _copies_ */
struct st_filter_param filter_param;
PAGECACHE_FLUSH_FILTER filter;
DBUG_ENTER("collect_tables");
- LINT_INIT(state_copies_horizon);
-
/* let's make a list of distinct shares */
mysql_mutex_lock(&THR_LOCK_maria);
for (nb= 0, pos= maria_open_list; pos; pos= pos->next)
diff --git a/storage/maria/ma_delete.c b/storage/maria/ma_delete.c
index 5b8d0e01677..22f7341098d 100644
--- a/storage/maria/ma_delete.c
+++ b/storage/maria/ma_delete.c
@@ -112,6 +112,7 @@ int maria_delete(MARIA_HA *info,const uchar *record)
info->state->checksum-= info->cur_row.checksum;
info->state->records--;
info->update= HA_STATE_CHANGED+HA_STATE_DELETED+HA_STATE_ROW_CHANGED;
+ info->row_changes++;
share->state.changed|= (STATE_NOT_OPTIMIZED_ROWS | STATE_NOT_MOVABLE |
STATE_NOT_ZEROFILLED);
info->state->changed=1;
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 341bbc6088f..54f67eb1ab3 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -7472,9 +7472,8 @@ static void translog_force_current_buffer_to_finish()
struct st_translog_buffer *old_buffer= log_descriptor.bc.buffer;
uchar *data= log_descriptor.bc.ptr - log_descriptor.bc.current_page_fill;
uint16 left= TRANSLOG_PAGE_SIZE - log_descriptor.bc.current_page_fill;
- uint16 current_page_fill, write_counter, previous_offset;
+ uint16 UNINIT_VAR(current_page_fill), write_counter, previous_offset;
DBUG_ENTER("translog_force_current_buffer_to_finish");
- LINT_INIT(current_page_fill);
DBUG_PRINT("enter", ("Buffer #%u 0x%lx "
"Buffer addr: (%lu,0x%lx) "
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index 5f90f61c786..7cefb12faae 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -437,15 +437,23 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
share->open_count_not_zero_on_open= 1;
/*
+ A transactional table is not usable on this system if:
+ - share->state.create_trid > trnman_get_max_trid()
+ - Critical as trid as stored releativel to create_trid.
+ - uuid is different
+
+ STATE_NOT_MOVABLE is reset when a table is zerofilled
+ (has no LSN's and no trids)
+
We can ignore testing uuid if STATE_NOT_MOVABLE is set, as in this
- case the uuid will be set in _ma_mark_file_changed()
+ case the uuid will be set in _ma_mark_file_changed().
*/
- if ((share->state.changed & STATE_NOT_MOVABLE) &&
- share->base.born_transactional &&
- ((!(open_flags & HA_OPEN_IGNORE_MOVED_STATE) &&
- memcmp(share->base.uuid, maria_uuid, MY_UUID_SIZE)) ||
- (share->state.create_trid > trnman_get_max_trid() &&
- !maria_in_recovery)))
+ if (share->base.born_transactional &&
+ ((share->state.create_trid > trnman_get_max_trid() &&
+ !maria_in_recovery) ||
+ ((share->state.changed & STATE_NOT_MOVABLE) &&
+ ((!(open_flags & HA_OPEN_IGNORE_MOVED_STATE) &&
+ memcmp(share->base.uuid, maria_uuid, MY_UUID_SIZE))))))
{
DBUG_PRINT("warning", ("table is moved from another system. uuid_diff: %d create_trid: %lu max_trid: %lu",
memcmp(share->base.uuid, maria_uuid,
@@ -756,7 +764,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
HA_ERR_CRASHED_ON_REPAIR : HA_ERR_CRASHED_ON_USAGE);
goto err;
}
- else
+ else if (!(open_flags & HA_OPEN_FOR_REPAIR))
{
/* create_rename_lsn != LSN_NEEDS_NEW_STATE_LSNS */
share->state.changed|= STATE_NOT_MOVABLE;
@@ -894,8 +902,10 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
&share->keyinfo[i].root_lock);
mysql_rwlock_init(key_SHARE_mmap_lock, &share->mmap_lock);
- share->row_is_visible= _ma_row_visible_always;
- share->lock.get_status= _ma_reset_update_flag;
+ share->row_is_visible= _ma_row_visible_always;
+ share->lock.get_status= _ma_reset_update_flag;
+ share->lock.start_trans= _ma_start_trans;
+
if (!thr_lock_inited)
{
/* Probably a single threaded program; Don't use concurrent inserts */
diff --git a/storage/maria/ma_pagecrc.c b/storage/maria/ma_pagecrc.c
index 58e3b4b203d..a79f34016c1 100644
--- a/storage/maria/ma_pagecrc.c
+++ b/storage/maria/ma_pagecrc.c
@@ -358,8 +358,7 @@ my_bool maria_flush_log_for_page(uchar *page,
MARIA_SHARE *share= (MARIA_SHARE*) data_ptr;
DBUG_ENTER("maria_flush_log_for_page");
/* share is 0 here only in unittest */
- DBUG_ASSERT(!share || (share->page_type == PAGECACHE_LSN_PAGE &&
- share->now_transactional));
+ DBUG_ASSERT(!share || share->page_type == PAGECACHE_LSN_PAGE);
lsn= lsn_korr(page);
if (translog_flush(lsn))
DBUG_RETURN(1);
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 9ac42f885b5..0f3fb0f8a1e 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -3304,7 +3304,7 @@ static LSN parse_checkpoint_record(LSN lsn)
first_log_write_lsn= lsn_korr(ptr);
ptr+= LSN_STORE_SIZE;
name_len= strlen((char *)ptr) + 1;
- strmake(name, (char *)ptr, sizeof(name)-1);
+ strmake_buf(name, (char *)ptr);
ptr+= name_len;
if (new_table(sid, name, first_log_write_lsn))
return LSN_ERROR;
diff --git a/storage/maria/ma_rt_split.c b/storage/maria/ma_rt_split.c
index ea90b60ce12..d14422a21d2 100644
--- a/storage/maria/ma_rt_split.c
+++ b/storage/maria/ma_rt_split.c
@@ -185,18 +185,14 @@ static int split_maria_rtree_node(SplitStruct *node, int n_entries,
double **d_buffer, int n_dim)
{
SplitStruct *cur;
- SplitStruct *a;
- SplitStruct *b;
+ SplitStruct *UNINIT_VAR(a);
+ SplitStruct *UNINIT_VAR(b);
double *g1= reserve_coords(d_buffer, n_dim);
double *g2= reserve_coords(d_buffer, n_dim);
- SplitStruct *next;
- int next_node;
+ SplitStruct *UNINIT_VAR(next);
+ int UNINIT_VAR(next_node);
int i;
SplitStruct *end= node + n_entries;
- LINT_INIT(a);
- LINT_INIT(b);
- LINT_INIT(next);
- LINT_INIT(next_node);
if (all_size < min_size * 2)
{
diff --git a/storage/maria/ma_scan.c b/storage/maria/ma_scan.c
index cbac463a2c8..ad526211615 100644
--- a/storage/maria/ma_scan.c
+++ b/storage/maria/ma_scan.c
@@ -68,7 +68,8 @@ int _ma_def_scan_remember_pos(MARIA_HA *info, MARIA_RECORD_POS *lastpos)
}
-void _ma_def_scan_restore_pos(MARIA_HA *info, MARIA_RECORD_POS lastpos)
+int _ma_def_scan_restore_pos(MARIA_HA *info, MARIA_RECORD_POS lastpos)
{
info->cur_row.nextpos= lastpos;
+ return 0;
}
diff --git a/storage/maria/ma_search.c b/storage/maria/ma_search.c
index ccb4bf77717..d38bc7af26c 100644
--- a/storage/maria/ma_search.c
+++ b/storage/maria/ma_search.c
@@ -424,9 +424,9 @@ int _ma_prefix_search(const MARIA_KEY *key, const MARIA_PAGE *ma_page,
flag is the value returned by ha_key_cmp and as treated as final
*/
int flag=0, my_flag=-1;
- uint nod_flag, length, len, matched, cmplen, kseg_len;
- uint page_flag, prefix_len,suffix_len;
- int key_len_skip, seg_len_pack, key_len_left;
+ uint nod_flag, UNINIT_VAR(length), len, matched, cmplen, kseg_len;
+ uint page_flag, UNINIT_VAR(prefix_len),suffix_len;
+ int key_len_skip, UNINIT_VAR(seg_len_pack), key_len_left;
uchar *end, *vseg, *UNINIT_VAR(saved_vseg), *UNINIT_VAR(saved_from);
uchar *page;
uchar tt_buff[MARIA_MAX_KEY_BUFF+2], *t_buff=tt_buff+2;
@@ -439,10 +439,6 @@ int _ma_prefix_search(const MARIA_KEY *key, const MARIA_PAGE *ma_page,
const uchar *sort_order= keyinfo->seg->charset->sort_order;
DBUG_ENTER("_ma_prefix_search");
- LINT_INIT(seg_len_pack);
- LINT_INIT(prefix_len);
- LINT_INIT(length);
-
t_buff[0]=0; /* Avoid bugs */
page_flag= ma_page->flag;
nod_flag= ma_page->node;
diff --git a/storage/maria/ma_state.c b/storage/maria/ma_state.c
index 1f4a7504c56..f130da21d07 100644
--- a/storage/maria/ma_state.c
+++ b/storage/maria/ma_state.c
@@ -59,6 +59,8 @@ my_bool _ma_setup_live_state(MARIA_HA *info)
MARIA_STATE_HISTORY *history;
DBUG_ENTER("_ma_setup_live_state");
+ DBUG_ASSERT(share->lock_key_trees);
+
if (maria_create_trn_hook(info))
DBUG_RETURN(1);
@@ -377,6 +379,17 @@ void _ma_reset_update_flag(void *param,
info->state->changed= 0;
}
+my_bool _ma_start_trans(void* param)
+{
+ MARIA_HA *info=(MARIA_HA*) param;
+ if (!info->s->lock_key_trees)
+ {
+ info->state= info->state_start;
+ *info->state= info->s->state.state;
+ }
+ return 0;
+}
+
/**
@brief Check if should allow concurrent inserts
@@ -622,6 +635,22 @@ my_bool _ma_block_start_trans(void* param)
*/
return _ma_setup_live_state(info);
}
+ else
+ {
+ /*
+ We come here in the following cases:
+ - The table is a temporary table
+ - It's a table which is crash safe but not yet versioned, for
+ example a table with fulltext or rtree keys
+
+ Set the current state to point to save_state so that the
+ block_format code don't count the same record twice.
+ Copy also the current state. This may have been wrong if the
+ same file was used several times in the last statement
+ */
+ info->state= info->state_start;
+ *info->state= info->s->state.state;
+ }
/*
Info->trn is set if this table is already handled and we are
@@ -668,9 +697,11 @@ my_bool _ma_block_start_trans_no_versioning(void* param)
{
MARIA_HA *info=(MARIA_HA*) param;
DBUG_ENTER("_ma_block_get_status_no_version");
- DBUG_ASSERT(info->s->base.born_transactional);
+ DBUG_ASSERT(info->s->base.born_transactional && !info->s->lock_key_trees);
info->state->changed= 0; /* from _ma_reset_update_flag() */
+ info->state= info->state_start;
+ *info->state= info->s->state.state;
if (!info->trn)
{
/*
@@ -689,18 +720,22 @@ my_bool _ma_block_start_trans_no_versioning(void* param)
void maria_versioning(MARIA_HA *info, my_bool versioning)
{
+ MARIA_SHARE *share= info->s;
/* For now, this is a hack */
- if (info->s->have_versioning)
+ if (share->have_versioning)
{
enum thr_lock_type save_lock_type;
- /* Assume is a non threaded application (for now) */
- info->s->lock_key_trees= 0;
+ share->lock_key_trees= versioning;
/* Set up info->lock.type temporary for _ma_block_get_status() */
save_lock_type= info->lock.type;
info->lock.type= versioning ? TL_WRITE_CONCURRENT_INSERT : TL_WRITE;
_ma_block_get_status((void*) info, versioning);
info->lock.type= save_lock_type;
- info->state= info->state_start= &info->s->state.common;
+ if (versioning)
+ info->state= &share->state.common;
+ else
+ info->state= &share->state.state; /* Change global values by default */
+ info->state_start= info->state; /* Initial values */
}
}
diff --git a/storage/maria/ma_state.h b/storage/maria/ma_state.h
index 03ce5c2ea8c..2903986e32a 100644
--- a/storage/maria/ma_state.h
+++ b/storage/maria/ma_state.h
@@ -66,6 +66,7 @@ void _ma_update_status_with_lock(MARIA_HA *info);
void _ma_restore_status(void *param);
void _ma_copy_status(void* to, void *from);
void _ma_reset_update_flag(void *param, my_bool concurrent_insert);
+my_bool _ma_start_trans(void* param);
my_bool _ma_check_status(void *param);
void _ma_block_get_status(void* param, my_bool concurrent_insert);
void _ma_block_update_status(void *param);
diff --git a/storage/maria/ma_test1.c b/storage/maria/ma_test1.c
index 945654a0bbe..5a655d4412a 100644
--- a/storage/maria/ma_test1.c
+++ b/storage/maria/ma_test1.c
@@ -55,7 +55,6 @@ static void create_key(uchar *key,uint rownr);
static void create_record(uchar *record,uint rownr);
static void update_record(uchar *record);
-
/*
These are here only for testing of recovery with undo. We are not
including maria_def.h here as this test is also to be an example of
@@ -506,6 +505,7 @@ end:
break;
}
printf("Dying on request without maria_commit()/maria_close()\n");
+ sf_leaking_memory= 1;
exit(0);
}
@@ -514,6 +514,7 @@ end:
if (maria_close(file))
goto err;
maria_end();
+ my_uuid_end();
my_end(MY_CHECK_ERROR);
return (0);
diff --git a/storage/maria/ma_test2.c b/storage/maria/ma_test2.c
index ea1978b4ee5..a3b7a2a9e98 100644
--- a/storage/maria/ma_test2.c
+++ b/storage/maria/ma_test2.c
@@ -971,6 +971,7 @@ end:
break;
}
printf("Dying on request without maria_commit()/maria_close()\n");
+ sf_leaking_memory= 1; /* no memory leak reports here */
exit(0);
}
if (maria_commit(file))
@@ -1017,6 +1018,7 @@ reads: %10lu\n",
}
maria_end();
my_free(blob_buffer);
+ my_uuid_end();
my_end(silent ? MY_CHECK_ERROR : MY_CHECK_ERROR | MY_GIVE_INFO);
return(0);
err:
@@ -1029,6 +1031,8 @@ err2:
maria_close(file);
}
maria_end();
+ my_uuid_end();
+ my_end(0);
return(1);
} /* main */
diff --git a/storage/maria/ma_test3.c b/storage/maria/ma_test3.c
index c11de6f8242..64b22e45c1b 100644
--- a/storage/maria/ma_test3.c
+++ b/storage/maria/ma_test3.c
@@ -114,7 +114,7 @@ int main(int argc,char **argv)
sleep(1);
return 0;
}
- rnd(1);
+ (void)rnd(1);
}
for (i=0 ; i < forks ; i++)
diff --git a/storage/maria/ma_update.c b/storage/maria/ma_update.c
index 0a726c1b7f9..e0e804ca655 100644
--- a/storage/maria/ma_update.c
+++ b/storage/maria/ma_update.c
@@ -173,6 +173,7 @@ int maria_update(register MARIA_HA *info, const uchar *oldrec, uchar *newrec)
We can't yet have HA_STATE_AKTIV here, as block_record dosn't support it
*/
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | key_changed);
+ info->row_changes++;
share->state.changed|= STATE_NOT_MOVABLE | STATE_NOT_ZEROFILLED;
info->state->changed= 1;
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index f1649083105..944ae93b17f 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -298,6 +298,7 @@ int maria_write(MARIA_HA *info, uchar *record)
info->state->records++;
info->update= (HA_STATE_CHANGED | HA_STATE_AKTIV | HA_STATE_WRITTEN |
HA_STATE_ROW_CHANGED);
+ info->row_changes++;
share->state.changed|= STATE_NOT_MOVABLE | STATE_NOT_ZEROFILLED;
info->state->changed= 1;
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 62225a7a4b0..05a5aefb4f4 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -88,9 +88,22 @@ static int sort_record_index(MARIA_SORT_PARAM *sort_param, MARIA_PAGE *page,
uint sortkey, File new_file,
my_bool update_index);
static my_bool write_log_record(HA_CHECK *param);
+static void my_exit(int exit_code) __attribute__ ((noreturn));
HA_CHECK check_param;
+/* Free memory and exit */
+
+static void my_exit(int exit_code)
+{
+ free_tmpdir(&maria_chk_tmpdir);
+ free_defaults(default_argv);
+ my_end(check_param.testflag & T_INFO ?
+ MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
+ exit(exit_code);
+}
+
+
/* Main program */
int main(int argc, char **argv)
@@ -178,12 +191,8 @@ end:
printf("\nTotal of all %d Aria-files:\nData records: %9s Deleted blocks: %9s\n",check_param.total_files,llstr(check_param.total_records,buff),
llstr(check_param.total_deleted,buff2));
}
- free_defaults(default_argv);
- free_tmpdir(&maria_chk_tmpdir);
maria_end();
- my_end(check_param.testflag & T_INFO ?
- MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
- exit(error);
+ my_exit(error);
#ifndef _lint
return 0; /* No compiler warning */
#endif
@@ -252,10 +261,10 @@ static struct my_option my_long_options[] =
"Restart with -r if there are any errors in the table. States will be updated as with --update-state.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"HELP", 'H',
- "Display this help and exit.",
+ "Print all argument options sorted alphabetically and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?',
- "Display this help and exit.",
+ "Print all options by groups and exit. See also --HELP",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"information", 'i',
"Print statistics information about table that is checked.",
@@ -406,7 +415,7 @@ static struct my_option my_long_options[] =
(char**) &maria_stats_method_str, (char**) &maria_stats_method_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "zerofill", 'z',
- "Fill empty space in data and index files with zeroes,",
+ "Fill empty space in data and index files with zeroes. This makes the data file movable between different servers.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "zerofill-keep-lsn", OPT_ZEROFILL_KEEP_LSN,
"Like --zerofill but does not zero out LSN of data/index pages;"
@@ -418,7 +427,7 @@ static struct my_option my_long_options[] =
static void print_version(void)
{
- printf("%s Ver 1.1 for %s at %s\n", my_progname, SYSTEM_TYPE,
+ printf("%s Ver 1.2 for %s at %s\n", my_progname, SYSTEM_TYPE,
MACHINE_TYPE);
}
@@ -437,8 +446,8 @@ static void usage(void)
-#, --debug=... Output debug log. Often this is 'd:t:o,filename'.\n");
#endif
printf("\
- -H, --HELP Display this help and exit.\n\
- -?, --help Display this help and exit.\n\
+ -H, --HELP Print all argument options sorted alphabetically.\n\
+ -?, --help Print all options by groups\n\
--datadir=path Path for control file (and logs if --logdir not used)\n\
--logdir=path Path for log files\n\
--ignore-control-file Don't open the control file. Only use this if you\n\
@@ -554,7 +563,9 @@ Recover (repair)/ options (When using '--recover' or '--safe-recover'):\n\
(It may be VERY slow to do a sort the first time!).\n\
-b, --block-search=#\n\
Find a record, a block at given offset belongs to.\n\
- -z, --zerofill Fill empty space in data and index files with zeroes\n\
+ -z, --zerofill Fill empty space in data and index files with zeroes.\n\
+ This makes the data file movable between different \n\
+ servers.\n\
--zerofill-keep-lsn Like --zerofill but does not zero out LSN of\n\
data/index pages.");
@@ -757,7 +768,7 @@ get_one_option(int optid,
fprintf(stderr,
"The value of the sort key is bigger than max key: %d.\n",
MARIA_MAX_KEY);
- exit(1);
+ my_exit(1);
}
}
break;
@@ -785,7 +796,7 @@ get_one_option(int optid,
break;
case 'V':
print_version();
- exit(0);
+ my_exit(0);
case OPT_CORRECT_CHECKSUM:
if (argument == disabled_my_option)
check_param.testflag&= ~T_CALC_CHECKSUM;
@@ -800,7 +811,7 @@ get_one_option(int optid,
if ((method=find_type(argument, &maria_stats_method_typelib, 2)) <= 0)
{
fprintf(stderr, "Invalid value of stats_method: %s.\n", argument);
- exit(1);
+ my_exit(1);
}
switch (method-1) {
case 0:
@@ -836,10 +847,11 @@ get_one_option(int optid,
break;
case 'H':
my_print_help(my_long_options);
- exit(0);
+ my_print_variables(my_long_options);
+ my_exit(0);
case '?':
usage();
- exit(0);
+ my_exit(0);
}
return 0;
}
@@ -856,7 +868,7 @@ static void get_options(register int *argc,register char ***argv)
check_param.testflag|=T_WRITE_LOOP;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
- exit(ho_error);
+ my_exit(ho_error);
/* If using repair, then update checksum if one uses --update-state */
if ((check_param.testflag & T_UPDATE_STATE) &&
@@ -866,7 +878,7 @@ static void get_options(register int *argc,register char ***argv)
if (*argc == 0)
{
usage();
- exit(-1);
+ my_exit(-1);
}
if ((check_param.testflag & T_UNPACK) &&
@@ -874,7 +886,7 @@ static void get_options(register int *argc,register char ***argv)
{
fprintf(stderr, "%s: --unpack can't be used with --quick or --sort-records\n",
my_progname_short);
- exit(1);
+ my_exit(1);
}
if ((check_param.testflag & T_READONLY) &&
(check_param.testflag &
@@ -883,7 +895,7 @@ static void get_options(register int *argc,register char ***argv)
{
fprintf(stderr, "%s: Can't use --readonly when repairing or sorting\n",
my_progname_short);
- exit(1);
+ my_exit(1);
}
if (!opt_debug)
@@ -891,20 +903,26 @@ static void get_options(register int *argc,register char ***argv)
DEBUGGER_OFF; /* Speed up things a bit */
}
if (init_tmpdir(&maria_chk_tmpdir, opt_tmpdir))
- exit(1);
+ my_exit(1);
check_param.tmpdir=&maria_chk_tmpdir;
if (set_collation_name)
if (!(set_collation= get_charset_by_name(set_collation_name,
MYF(MY_WME))))
- exit(1);
+ my_exit(1);
if (maria_data_root != default_log_dir && opt_log_dir == default_log_dir)
{
/* --datadir was used and --log-dir was not. Set log-dir to datadir */
opt_log_dir= maria_data_root;
}
+
+ /* If we are using zerofill, then we don't need to read the control file */
+ if ((check_param.testflag & (T_ZEROFILL_KEEP_LSN | T_ZEROFILL)) &&
+ !(check_param.testflag & ~(T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX | T_STATISTICS | T_CHECK | T_FAST | T_CHECK_ONLY_CHANGED)))
+ opt_ignore_control_file= 1;
+
return;
} /* get options */
@@ -1187,8 +1205,11 @@ static int maria_chk(HA_CHECK *param, char *filename)
((param->testflag & (T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX |
T_ZEROFILL | T_ZEROFILL_KEEP_LSN)) !=
(T_ZEROFILL | T_ZEROFILL_KEEP_LSN)))
+ {
share->state.create_rename_lsn= share->state.is_of_horizon=
share->state.skip_redo_lsn= LSN_NEEDS_NEW_STATE_LSNS;
+ share->state.create_trid= 0;
+ }
}
if (!error && (param->testflag & T_REP_ANY))
{
@@ -1475,6 +1496,8 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
LSN_IN_PARTS(share->state.create_rename_lsn),
LSN_IN_PARTS(share->state.is_of_horizon),
LSN_IN_PARTS(share->state.skip_redo_lsn));
+ printf("create_trid: %s\n",
+ llstr(share->state.create_trid, llbuff));
}
compile_time_assert((MY_UUID_STRING_LENGTH + 1) <= sizeof(buff));
buff[MY_UUID_STRING_LENGTH]= 0;
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index 1eb720c9607..a588986e4f0 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -385,7 +385,7 @@ typedef struct st_maria_share
/* End scan */
void (*scan_end)(MARIA_HA *);
int (*scan_remember_pos)(MARIA_HA *, MARIA_RECORD_POS*);
- void (*scan_restore_pos)(MARIA_HA *, MARIA_RECORD_POS);
+ int (*scan_restore_pos)(MARIA_HA *, MARIA_RECORD_POS);
/* Pre-write of row (some handlers may do the actual write here) */
MARIA_RECORD_POS (*write_record_init)(MARIA_HA *, const uchar *);
/* Write record (or accept write_record_init) */
@@ -560,6 +560,7 @@ typedef struct st_maria_block_scan
ulonglong bits;
uint number_of_rows, bit_pos;
MARIA_RECORD_POS row_base_page;
+ ulonglong row_changes;
} MARIA_BLOCK_SCAN;
//typedef ICP_RESULT (*index_cond_func_t)(void *param);
@@ -602,6 +603,7 @@ struct st_maria_handler
int (*read_record)(MARIA_HA *, uchar*, MARIA_RECORD_POS);
invalidator_by_filename invalidator; /* query cache invalidator */
ulonglong last_auto_increment; /* auto value at start of statement */
+ ulonglong row_changes; /* Incremented for each change */
ulong this_unique; /* uniq filenumber or thread */
ulong last_unique; /* last unique number */
ulong this_loop; /* counter for this open */
@@ -1291,7 +1293,7 @@ my_bool _ma_check_status(void *param);
void _ma_restore_status(void *param);
void _ma_reset_status(MARIA_HA *maria);
int _ma_def_scan_remember_pos(MARIA_HA *info, MARIA_RECORD_POS *lastpos);
-void _ma_def_scan_restore_pos(MARIA_HA *info, MARIA_RECORD_POS lastpos);
+int _ma_def_scan_restore_pos(MARIA_HA *info, MARIA_RECORD_POS lastpos);
#include "ma_commit.h"
diff --git a/storage/maria/unittest/ma_test_recovery.expected b/storage/maria/unittest/ma_test_recovery.expected
index 6a6051735c5..6aaff86e6cf 100644
--- a/storage/maria/unittest/ma_test_recovery.expected
+++ b/storage/maria/unittest/ma_test_recovery.expected
@@ -69,8 +69,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -78,8 +78,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -87,8 +87,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -98,8 +98,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -107,8 +107,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -116,8 +116,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -166,8 +166,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -175,8 +175,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -184,8 +184,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -195,8 +195,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -204,8 +204,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -213,8 +213,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -263,8 +263,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -272,8 +272,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -281,8 +281,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -292,8 +292,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -301,8 +301,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -310,8 +310,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -360,8 +360,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -369,8 +369,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -378,8 +378,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -389,8 +389,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -398,8 +398,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -407,8 +407,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -457,8 +457,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -466,8 +466,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -475,8 +475,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -486,8 +486,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -495,8 +495,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -504,8 +504,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -554,8 +554,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -563,8 +563,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -572,8 +572,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -583,8 +583,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -592,8 +592,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -601,8 +601,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -651,8 +651,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -660,8 +660,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -669,8 +669,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -680,8 +680,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -689,8 +689,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -698,8 +698,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -748,8 +748,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -757,8 +757,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -766,8 +766,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -777,8 +777,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -786,8 +786,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -795,8 +795,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -845,8 +845,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -854,8 +854,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -863,8 +863,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -874,8 +874,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -883,8 +883,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -892,8 +892,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -942,8 +942,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -951,8 +951,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -960,8 +960,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -971,8 +971,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -980,8 +980,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -989,8 +989,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1039,8 +1039,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1048,8 +1048,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1057,8 +1057,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1068,8 +1068,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1077,8 +1077,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1086,8 +1086,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1136,8 +1136,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1145,8 +1145,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1154,8 +1154,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1165,8 +1165,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1174,8 +1174,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1183,8 +1183,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1233,8 +1233,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1242,8 +1242,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1251,8 +1251,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1262,8 +1262,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1271,8 +1271,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1280,8 +1280,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1330,8 +1330,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1339,8 +1339,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1348,8 +1348,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1359,8 +1359,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1368,8 +1368,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1377,8 +1377,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1427,8 +1427,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1436,8 +1436,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1445,8 +1445,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1456,8 +1456,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1465,8 +1465,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1474,8 +1474,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1524,8 +1524,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1533,8 +1533,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1542,8 +1542,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1553,8 +1553,8 @@ Dying on request without maria_commit()/maria_close()
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1562,8 +1562,8 @@ testing idempotency
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
@@ -1571,8 +1571,8 @@ testing applying of CLRs to recreate table
applying log
Differences in aria_chk -dvv, recovery not yet perfect !
========DIFF START=======
-6c6
-< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled
+7c7
+< Status: checked,analyzed,optimized keys,sorted index pages,zerofilled,movable
---
> Status: changed
========DIFF END=======
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 770c7d660b2..e455b00418c 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -30,6 +30,7 @@
#include "rt_index.h"
#include "sql_table.h" // tablename_to_filename
#include "sql_class.h" // THD
+#include "debug_sync.h"
ulonglong myisam_recover_options;
static ulong opt_myisam_block_size;
@@ -1131,6 +1132,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK &param, bool do_optimize)
thd_proc_info(thd, "Repair by sorting");
error = mi_repair_by_sort(&param, file, fixed_name,
test(param.testflag & T_QUICK));
+ DEBUG_SYNC(thd, "myisam_after_repair_by_sort");
}
}
else
diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c
index 70cc96d0cba..7bb063f2c10 100644
--- a/storage/myisam/mi_write.c
+++ b/storage/myisam/mi_write.c
@@ -85,9 +85,10 @@ int mi_write(MI_INFO *info, uchar *record)
/* Calculate and check all unique constraints */
for (i=0 ; i < share->state.header.uniques ; i++)
{
- if (mi_check_unique(info,share->uniqueinfo+i,record,
- mi_unique_hash(share->uniqueinfo+i,record),
- HA_OFFSET_ERROR))
+ MI_UNIQUEDEF *def= share->uniqueinfo + i;
+ if (mi_is_key_active(share->state.key_map, def->key) &&
+ mi_check_unique(info, def, record, mi_unique_hash(def, record),
+ HA_OFFSET_ERROR))
goto err2;
}
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index 5d6b03ff4b8..3b115bcba09 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -2143,7 +2143,8 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
*/
if (!(packed_tree=(uint*) my_alloca(sizeof(uint)*length*2)))
{
- my_error(EE_OUTOFMEMORY,MYF(ME_BELL),sizeof(uint)*length*2);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_FATALERROR),
+ sizeof(uint)*length*2);
return 0;
}
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 47a3abb78d2..2b571675aef 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -331,6 +331,19 @@ extern "C" int myisammrg_parent_open_callback(void *callback_param,
CPP_UNNAMED_NS_END
+/*
+ Set external_ref for the child MyISAM tables. They need this to be set in
+ order to check for killed status.
+*/
+static void myrg_set_external_ref(MYRG_INFO *m_info, void *ext_ref_arg)
+{
+ int i;
+ for (i= 0; i < (int)m_info->tables; i++)
+ {
+ m_info->open_tables[i].table->external_ref= ext_ref_arg;
+ }
+}
+
/**
Open a MERGE parent table, but not its children.
@@ -394,6 +407,7 @@ int ha_myisammrg::open(const char *name, int mode __attribute__((unused)),
}
file->children_attached= TRUE;
+ myrg_set_external_ref(file, (void*)table);
info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
}
@@ -1456,7 +1470,7 @@ static void split_file_name(const char *file_name,
char buff[FN_REFLEN];
db->length= 0;
- strmake(buff, file_name, sizeof(buff)-1);
+ strmake_buf(buff, file_name);
dir_length= dirname_length(buff);
if (dir_length > 1)
{
diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc
index 38f6df3003d..2c9951e3f46 100644
--- a/storage/perfschema/pfs_engine_table.cc
+++ b/storage/perfschema/pfs_engine_table.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -512,7 +512,7 @@ bool pfs_show_status(handlerton *hton, THD *thd,
uint buflen;
const char *name;
int i;
- uint size;
+ size_t size;
DBUG_ENTER("pfs_show_status");
@@ -526,7 +526,7 @@ bool pfs_show_status(handlerton *hton, THD *thd,
if (stat != HA_ENGINE_STATUS)
DBUG_RETURN(false);
- uint total_memory= 0;
+ size_t total_memory= 0;
for (i=0; /* empty */; i++)
{
@@ -763,7 +763,7 @@ bool pfs_show_status(handlerton *hton, THD *thd,
break;
}
- buflen= int10_to_str(size, buf, 10) - buf;
+ buflen= longlong10_to_str(size, buf, 10) - buf;
if (print(thd,
PERFORMANCE_SCHEMA_str.str, PERFORMANCE_SCHEMA_str.length,
name, strlen(name),
diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc
index fa57f335325..335f57c69c6 100644
--- a/storage/perfschema/pfs_global.cc
+++ b/storage/perfschema/pfs_global.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
#include <string.h>
bool pfs_initialized= false;
-ulonglong pfs_allocated_memory= 0;
+size_t pfs_allocated_memory= 0;
/**
Memory allocation for the performance schema.
diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h
index c0c0490a380..5a3cc342b7d 100644
--- a/storage/perfschema/pfs_global.h
+++ b/storage/perfschema/pfs_global.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
*/
extern bool pfs_initialized;
-extern ulonglong pfs_allocated_memory;
+extern size_t pfs_allocated_memory;
void *pfs_malloc(size_t size, myf flags);
#define PFS_MALLOC_ARRAY(n, T, f) \
diff --git a/storage/xtradb/btr/btr0btr.c b/storage/xtradb/btr/btr0btr.c
index a3e57d632a0..79a8eb9dcc6 100644
--- a/storage/xtradb/btr/btr0btr.c
+++ b/storage/xtradb/btr/btr0btr.c
@@ -688,7 +688,7 @@ btr_root_fseg_validate(
{
ulint offset = mach_read_from_2(seg_header + FSEG_HDR_OFFSET);
- if (UNIV_UNLIKELY(srv_pass_corrupt_table)) {
+ if (UNIV_UNLIKELY(srv_pass_corrupt_table != 0)) {
return (mach_read_from_4(seg_header + FSEG_HDR_SPACE) == space)
&& (offset >= FIL_PAGE_DATA)
&& (offset <= UNIV_PAGE_SIZE - FIL_PAGE_DATA_END);
@@ -723,17 +723,14 @@ btr_root_block_get(
block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH,
index, mtr);
- if (srv_pass_corrupt_table && !block) {
- return(0);
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return(0););
btr_assert_not_corrupted(block, index);
#ifdef UNIV_BTR_DEBUG
if (!dict_index_is_ibuf(index)) {
const page_t* root = buf_block_get_frame(block);
- if (UNIV_UNLIKELY(srv_pass_corrupt_table)) {
+ if (UNIV_UNLIKELY(srv_pass_corrupt_table != 0)) {
if (!btr_root_fseg_validate(FIL_PAGE_DATA
+ PAGE_BTR_SEG_LEAF
+ root, space))
@@ -1063,11 +1060,11 @@ btr_get_size(
root = btr_root_get(index, mtr);
- if (srv_pass_corrupt_table && !root) {
+ SRV_CORRUPT_TABLE_CHECK(root,
+ {
mtr_commit(mtr);
return(0);
- }
- ut_a(root);
+ });
if (flag == BTR_N_LEAF_PAGES) {
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
@@ -1525,11 +1522,11 @@ leaf_loop:
root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH,
NULL, &mtr);
- if (srv_pass_corrupt_table && !root) {
+ SRV_CORRUPT_TABLE_CHECK(root,
+ {
mtr_commit(&mtr);
return;
- }
- ut_a(root);
+ });
#ifdef UNIV_BTR_DEBUG
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
@@ -1555,11 +1552,12 @@ top_loop:
root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH,
NULL, &mtr);
- if (srv_pass_corrupt_table && !root) {
+ SRV_CORRUPT_TABLE_CHECK(root,
+ {
mtr_commit(&mtr);
return;
- }
- ut_a(root);
+ });
+
#ifdef UNIV_BTR_DEBUG
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
+ root, space));
@@ -1593,10 +1591,7 @@ btr_free_root(
block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH,
NULL, mtr);
- if (srv_pass_corrupt_table && !block) {
- return;
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return;);
btr_search_drop_page_hash_index(block);
@@ -4565,10 +4560,11 @@ btr_validate_index(
root = btr_root_get(index, &mtr);
- if (UNIV_UNLIKELY(srv_pass_corrupt_table && !root)) {
+ SRV_CORRUPT_TABLE_CHECK(root,
+ {
mtr_commit(&mtr);
return(FALSE);
- }
+ });
n = btr_page_get_level(root, &mtr);
diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c
index d089fb5ad22..488212f087c 100644
--- a/storage/xtradb/btr/btr0cur.c
+++ b/storage/xtradb/btr/btr0cur.c
@@ -258,10 +258,8 @@ btr_cur_latch_leaves(
get_block = btr_block_get(
space, zip_size, page_no, mode, cursor->index, mtr);
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
@@ -283,10 +281,8 @@ btr_cur_latch_leaves(
space, zip_size, left_page_no,
sibling_mode, cursor->index, mtr);
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
@@ -309,10 +305,8 @@ btr_cur_latch_leaves(
space, zip_size, page_no,
mode, cursor->index, mtr);
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
@@ -325,10 +319,8 @@ btr_cur_latch_leaves(
space, zip_size, right_page_no,
sibling_mode, cursor->index, mtr);
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
@@ -357,10 +349,8 @@ btr_cur_latch_leaves(
left_page_no, mode, cursor->index, mtr);
cursor->left_block = get_block;
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
@@ -373,10 +363,8 @@ btr_cur_latch_leaves(
get_block = btr_block_get(
space, zip_size, page_no, mode, cursor->index, mtr);
- if (srv_pass_corrupt_table && !get_block) {
- return;
- }
- ut_a(get_block);
+ SRV_CORRUPT_TABLE_CHECK(get_block, return;);
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
#endif /* UNIV_BTR_DEBUG */
@@ -652,18 +640,19 @@ retry_page_get:
file, line, mtr);
if (block == NULL) {
- if (srv_pass_corrupt_table
- && buf_mode != BUF_GET_IF_IN_POOL
- && buf_mode != BUF_GET_IF_IN_POOL_OR_WATCH) {
- page_cursor->block = 0;
- page_cursor->rec = 0;
- if (estimate) {
- cursor->path_arr->nth_rec = ULINT_UNDEFINED;
- }
- goto func_exit;
- }
- ut_a(buf_mode == BUF_GET_IF_IN_POOL
- || buf_mode == BUF_GET_IF_IN_POOL_OR_WATCH);
+ SRV_CORRUPT_TABLE_CHECK(buf_mode == BUF_GET_IF_IN_POOL ||
+ buf_mode == BUF_GET_IF_IN_POOL_OR_WATCH,
+ {
+ page_cursor->block = 0;
+ page_cursor->rec = 0;
+ if (estimate) {
+
+ cursor->path_arr->nth_rec =
+ ULINT_UNDEFINED;
+ }
+
+ goto func_exit;
+ });
/* This must be a search to perform an insert/delete
mark/ delete; try using the insert/delete buffer */
@@ -739,15 +728,18 @@ retry_page_get:
block->check_index_page_at_flush = TRUE;
page = buf_block_get_frame(block);
- if (srv_pass_corrupt_table && !page) {
+ SRV_CORRUPT_TABLE_CHECK(page,
+ {
page_cursor->block = 0;
page_cursor->rec = 0;
+
if (estimate) {
+
cursor->path_arr->nth_rec = ULINT_UNDEFINED;
}
+
goto func_exit;
- }
- ut_a(page);
+ });
if (rw_latch != RW_NO_LATCH) {
#ifdef UNIV_ZIP_DEBUG
@@ -943,15 +935,19 @@ btr_cur_open_at_index_side_func(
file, line, mtr);
page = buf_block_get_frame(block);
- if (srv_pass_corrupt_table && !page) {
+ SRV_CORRUPT_TABLE_CHECK(page,
+ {
page_cursor->block = 0;
page_cursor->rec = 0;
+
if (estimate) {
- cursor->path_arr->nth_rec = ULINT_UNDEFINED;
+
+ cursor->path_arr->nth_rec =
+ ULINT_UNDEFINED;
}
- break;
- }
- ut_a(page);
+ /* Can't use break with the macro */
+ goto exit_loop;
+ });
ut_ad(index->id == btr_page_get_index_id(page));
@@ -1021,6 +1017,7 @@ btr_cur_open_at_index_side_func(
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
}
+exit_loop:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1074,12 +1071,13 @@ btr_cur_open_at_rnd_pos_func(
file, line, mtr);
page = buf_block_get_frame(block);
- if (srv_pass_corrupt_table && !page) {
+ SRV_CORRUPT_TABLE_CHECK(page,
+ {
page_cursor->block = 0;
page_cursor->rec = 0;
- break;
- }
- ut_a(page);
+
+ goto exit_loop;
+ });
ut_ad(index->id == btr_page_get_index_id(page));
@@ -1112,6 +1110,7 @@ btr_cur_open_at_rnd_pos_func(
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
}
+exit_loop:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1300,10 +1299,7 @@ btr_cur_optimistic_insert(
block = btr_cur_get_block(cursor);
- if (srv_pass_corrupt_table && !block) {
- return(DB_CORRUPTION);
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return(DB_CORRUPTION););
page = buf_block_get_frame(block);
index = cursor->index;
@@ -3149,10 +3145,7 @@ btr_cur_optimistic_delete(
block = btr_cur_get_block(cursor);
- if (srv_pass_corrupt_table && !block) {
- return(DB_CORRUPTION);
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return(DB_CORRUPTION););
ut_ad(page_is_leaf(buf_block_get_frame(block)));
@@ -3868,10 +3861,7 @@ btr_estimate_number_of_different_key_vals(
page = btr_cur_get_page(&cursor);
- if (srv_pass_corrupt_table && !page) {
- break;
- }
- ut_a(page);
+ SRV_CORRUPT_TABLE_CHECK(page, goto exit_loop;);
rec = page_rec_get_next(page_get_infimum_rec(page));
@@ -3957,6 +3947,7 @@ btr_estimate_number_of_different_key_vals(
mtr_commit(&mtr);
}
+exit_loop:
/* If we saw k borders between different key values on
n_sample_pages leaf pages, we can estimate how many
there will be in index->stat_n_leaf_pages */
diff --git a/storage/xtradb/btr/btr0pcur.c b/storage/xtradb/btr/btr0pcur.c
index a1b7affdeb7..7c4ec2dd1ac 100644
--- a/storage/xtradb/btr/btr0pcur.c
+++ b/storage/xtradb/btr/btr0pcur.c
@@ -116,10 +116,7 @@ btr_pcur_store_position(
block = btr_pcur_get_block(cursor);
- if (srv_pass_corrupt_table && !block) {
- return;
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return;);
index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
@@ -439,14 +436,16 @@ btr_pcur_move_to_next_page(
btr_pcur_get_btr_cur(cursor)->index, mtr);
next_page = buf_block_get_frame(next_block);
- if (srv_pass_corrupt_table && !next_page) {
+ SRV_CORRUPT_TABLE_CHECK(next_page,
+ {
btr_leaf_page_release(btr_pcur_get_block(cursor),
cursor->latch_mode, mtr);
btr_pcur_get_page_cur(cursor)->block = 0;
btr_pcur_get_page_cur(cursor)->rec = 0;
+
return;
- }
- ut_a(next_page);
+ });
+
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_page) == page_is_comp(page));
ut_a(btr_page_get_prev(next_page, mtr)
diff --git a/storage/xtradb/btr/btr0sea.c b/storage/xtradb/btr/btr0sea.c
index 7e9449a6474..d53452bb959 100644
--- a/storage/xtradb/btr/btr0sea.c
+++ b/storage/xtradb/btr/btr0sea.c
@@ -649,10 +649,7 @@ btr_search_info_update_slow(
block = btr_cur_get_block(cursor);
- if (srv_pass_corrupt_table && !block) {
- return;
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return;);
/* NOTE that the following two function calls do NOT protect
info or block->n_fields etc. with any semaphore, to save CPU time!
diff --git a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c
index 5bcfb0f51b9..ae4b2fba98d 100644
--- a/storage/xtradb/buf/buf0buf.c
+++ b/storage/xtradb/buf/buf0buf.c
@@ -2002,27 +2002,6 @@ lookup:
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
}
- if (UNIV_UNLIKELY(bpage->space_was_being_deleted)) {
- /* This page is obsoleted, should discard and retry */
- rw_lock_s_unlock(&buf_pool->page_hash_latch);
-
- mutex_enter(&buf_pool->LRU_list_mutex);
- block_mutex = buf_page_get_mutex_enter(bpage);
-
- if (UNIV_UNLIKELY(!block_mutex)) {
- mutex_exit(&buf_pool->LRU_list_mutex);
- goto lookup;
- }
-
- buf_LRU_free_block(bpage, TRUE, TRUE);
-
- mutex_exit(&buf_pool->LRU_list_mutex);
- mutex_exit(block_mutex);
- block_mutex = NULL;
-
- goto lookup;
- }
-
if (UNIV_UNLIKELY(!bpage->zip.data)) {
/* There is no compressed page. */
err_exit:
@@ -2031,11 +2010,11 @@ err_exit:
return(NULL);
}
- if (srv_pass_corrupt_table <= 1) {
- if (bpage->is_corrupt) {
- rw_lock_s_unlock(&buf_pool->page_hash_latch);
- return(NULL);
- }
+ if (UNIV_UNLIKELY(bpage->is_corrupt && srv_pass_corrupt_table <= 1)) {
+
+ rw_lock_s_unlock(&buf_pool->page_hash_latch);
+
+ return(NULL);
}
block_mutex = buf_page_get_mutex_enter(bpage);
@@ -2533,26 +2512,6 @@ loop:
block = (buf_block_t*) buf_page_hash_get_low(
buf_pool, space, offset, fold);
if (block) {
- if (UNIV_UNLIKELY(block->page.space_was_being_deleted)) {
- /* This page is obsoleted, should discard and retry */
- rw_lock_s_unlock(&buf_pool->page_hash_latch);
-
- mutex_enter(&buf_pool->LRU_list_mutex);
- block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
-
- if (UNIV_UNLIKELY(!block_mutex)) {
- mutex_exit(&buf_pool->LRU_list_mutex);
- goto loop;
- }
-
- buf_LRU_free_block((buf_page_t*)block, TRUE, TRUE);
-
- mutex_exit(&buf_pool->LRU_list_mutex);
- mutex_exit(block_mutex);
- block_mutex = NULL;
-
- goto loop;
- }
block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
ut_a(block_mutex);
@@ -2640,11 +2599,12 @@ got_block:
return(NULL);
}
- if (srv_pass_corrupt_table <= 1) {
- if (block->page.is_corrupt) {
- mutex_exit(block_mutex);
- return(NULL);
- }
+ if (UNIV_UNLIKELY(block->page.is_corrupt &&
+ srv_pass_corrupt_table <= 1)) {
+
+ mutex_exit(block_mutex);
+
+ return(NULL);
}
switch (buf_block_get_state(block)) {
@@ -3487,28 +3447,12 @@ buf_page_init_for_read(
fold = buf_page_address_fold(space, offset);
-retry:
//buf_pool_mutex_enter(buf_pool);
mutex_enter(&buf_pool->LRU_list_mutex);
rw_lock_x_lock(&buf_pool->page_hash_latch);
watch_page = buf_page_hash_get_low(buf_pool, space, offset, fold);
- if (UNIV_UNLIKELY(watch_page && watch_page->space_was_being_deleted)) {
- mutex_t* block_mutex = buf_page_get_mutex_enter(watch_page);
-
- /* This page is obsoleted, should discard and retry */
- rw_lock_x_unlock(&buf_pool->page_hash_latch);
- ut_a(block_mutex);
-
- buf_LRU_free_block(watch_page, TRUE, TRUE);
-
- mutex_exit(&buf_pool->LRU_list_mutex);
- mutex_exit(block_mutex);
-
- goto retry;
- }
-
if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) {
/* The page is already in the buffer pool. */
watch_page = NULL;
@@ -3637,7 +3581,6 @@ err_exit:
bpage->state = BUF_BLOCK_ZIP_PAGE;
bpage->space = space;
bpage->offset = offset;
- bpage->space_was_being_deleted = FALSE;
#ifdef UNIV_DEBUG
bpage->in_page_hash = FALSE;
@@ -3722,7 +3665,6 @@ buf_page_create(
fold = buf_page_address_fold(space, offset);
-retry:
//buf_pool_mutex_enter(buf_pool);
mutex_enter(&buf_pool->LRU_list_mutex);
rw_lock_x_lock(&buf_pool->page_hash_latch);
@@ -3730,21 +3672,6 @@ retry:
block = (buf_block_t*) buf_page_hash_get_low(
buf_pool, space, offset, fold);
- if (UNIV_UNLIKELY(block && block->page.space_was_being_deleted)) {
- mutex_t* block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
-
- /* This page is obsoleted, should discard and retry */
- rw_lock_x_unlock(&buf_pool->page_hash_latch);
- ut_a(block_mutex);
-
- buf_LRU_free_block((buf_page_t*)block, TRUE, TRUE);
-
- mutex_exit(&buf_pool->LRU_list_mutex);
- mutex_exit(block_mutex);
-
- goto retry;
- }
-
if (block
&& buf_page_in_file(&block->page)
&& !buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
@@ -4001,7 +3928,8 @@ buf_page_io_complete(
(ulong) bpage->offset);
}
- if (!srv_pass_corrupt_table || !bpage->is_corrupt) {
+ if (UNIV_LIKELY(!bpage->is_corrupt ||
+ !srv_pass_corrupt_table)) {
/* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */
@@ -4086,13 +4014,26 @@ corrupt:
}
if (uncompressed && !recv_no_ibuf_operations) {
+
+ buf_block_t* block;
+ ibool update_ibuf_bitmap;
+
+ if (UNIV_UNLIKELY(bpage->is_corrupt &&
+ srv_pass_corrupt_table)) {
+
+ block = NULL;
+ update_ibuf_bitmap = FALSE;
+
+ } else {
+
+ block = (buf_block_t *) bpage;
+ update_ibuf_bitmap = TRUE;
+ }
+
ibuf_merge_or_delete_for_page(
- /* Delete possible entries, if bpage is_corrupt */
- (srv_pass_corrupt_table && bpage->is_corrupt) ? NULL :
- (buf_block_t*) bpage, bpage->space,
+ block, bpage->space,
bpage->offset, buf_page_get_zip_size(bpage),
- (srv_pass_corrupt_table && bpage->is_corrupt) ? FALSE :
- TRUE);
+ update_ibuf_bitmap);
}
}
diff --git a/storage/xtradb/buf/buf0flu.c b/storage/xtradb/buf/buf0flu.c
index 663e2d8f537..9452b53df38 100644
--- a/storage/xtradb/buf/buf0flu.c
+++ b/storage/xtradb/buf/buf0flu.c
@@ -459,7 +459,7 @@ buf_flush_ready_for_replace(
if (UNIV_LIKELY(bpage->in_LRU_list && buf_page_in_file(bpage))) {
- return((bpage->oldest_modification == 0 || bpage->space_was_being_deleted)
+ return(bpage->oldest_modification == 0
&& buf_page_get_io_fix(bpage) == BUF_IO_NONE
&& bpage->buf_fix_count == 0);
}
@@ -501,13 +501,6 @@ buf_flush_ready_for_flush(
&& buf_page_get_io_fix(bpage) == BUF_IO_NONE) {
ut_ad(bpage->in_flush_list);
- if (bpage->space_was_being_deleted) {
- /* should be removed from flush_list here */
- /* because buf_flush_try_neighbors() cannot flush without fil_space_get_size(space) */
- buf_flush_remove(bpage);
- return(FALSE);
- }
-
if (flush_type != BUF_FLUSH_LRU) {
return(TRUE);
diff --git a/storage/xtradb/buf/buf0lru.c b/storage/xtradb/buf/buf0lru.c
index cd99d3e4e13..8a35c87c92f 100644
--- a/storage/xtradb/buf/buf0lru.c
+++ b/storage/xtradb/buf/buf0lru.c
@@ -884,42 +884,6 @@ buf_LRU_flush_or_remove_pages(
}
}
-/******************************************************************//**
-*/
-UNIV_INTERN
-void
-buf_LRU_mark_space_was_deleted(
-/*===========================*/
- ulint id) /*!< in: space id */
-{
- ulint i;
-
- for (i = 0; i < srv_buf_pool_instances; i++) {
- buf_pool_t* buf_pool;
- buf_page_t* bpage;
-
- buf_pool = buf_pool_from_array(i);
-
- mutex_enter(&buf_pool->LRU_list_mutex);
-
- bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
-
- while (bpage != NULL) {
- if (buf_page_get_space(bpage) == id) {
- bpage->space_was_being_deleted = TRUE;
- }
- bpage = UT_LIST_GET_NEXT(LRU, bpage);
- }
-
- mutex_exit(&buf_pool->LRU_list_mutex);
-
- /* 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);
- }
-}
-
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
@@ -1891,10 +1855,6 @@ buf_LRU_free_block(
return(FALSE);
}
- if (bpage->space_was_being_deleted && bpage->oldest_modification != 0) {
- buf_flush_remove(bpage);
- }
-
#ifdef UNIV_IBUF_COUNT_DEBUG
ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0);
#endif /* UNIV_IBUF_COUNT_DEBUG */
diff --git a/storage/xtradb/buf/buf0rea.c b/storage/xtradb/buf/buf0rea.c
index cf0a029df92..5edbeadb64e 100644
--- a/storage/xtradb/buf/buf0rea.c
+++ b/storage/xtradb/buf/buf0rea.c
@@ -245,13 +245,7 @@ not_to_recover:
return(0);
}
- if (srv_pass_corrupt_table) {
- if (*err != DB_SUCCESS) {
- bpage->is_corrupt = TRUE;
- }
- } else {
- ut_a(*err == DB_SUCCESS);
- }
+ SRV_CORRUPT_TABLE_CHECK(*err == DB_SUCCESS, bpage->is_corrupt = TRUE;);
if (sync) {
/* The i/o is already completed when we arrive from
diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c
index 4c6875bca10..e07cc69aded 100644
--- a/storage/xtradb/dict/dict0dict.c
+++ b/storage/xtradb/dict/dict0dict.c
@@ -4438,7 +4438,7 @@ dict_reload_statistics(
while (index) {
mtr_t mtr;
- if (table->is_corrupt) {
+ if (UNIV_UNLIKELY(table->is_corrupt)) {
ut_a(srv_pass_corrupt_table);
mem_heap_free(heap);
return(FALSE);
@@ -4596,7 +4596,7 @@ dict_store_statistics(
heap = mem_heap_create(1000);
while (index) {
- if (table->is_corrupt) {
+ if (UNIV_UNLIKELY(table->is_corrupt)) {
ut_a(srv_pass_corrupt_table);
mem_heap_free(heap);
return;
@@ -4790,7 +4790,7 @@ dict_update_statistics(
mtr_t mtr;
ulint size;
- if (table->is_corrupt) {
+ if (UNIV_UNLIKELY(table->is_corrupt)) {
ut_a(srv_pass_corrupt_table);
dict_table_stats_unlock(table, RW_X_LATCH);
return;
diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c
index af8353cdf45..ff4e5b1b033 100644
--- a/storage/xtradb/fil/fil0fil.c
+++ b/storage/xtradb/fil/fil0fil.c
@@ -2426,15 +2426,11 @@ try_again:
To deal with potential read requests by checking the
::stop_new_ops flag in fil_io() */
- if (srv_lazy_drop_table) {
- buf_LRU_mark_space_was_deleted(id);
- } else {
buf_LRU_flush_or_remove_pages(
id, evict_all
? BUF_REMOVE_ALL_NO_WRITE
: BUF_REMOVE_FLUSH_NO_WRITE);
- }
#endif
/* printf("Deleting tablespace %s id %lu\n", space->name, id); */
@@ -4865,6 +4861,24 @@ fil_extend_space_to_desired_size(
start_page_no = space->size;
file_start_page_no = space->size - node->size;
+#ifdef HAVE_POSIX_FALLOCATE
+ if (srv_use_posix_fallocate) {
+ offset_high = size_after_extend * page_size / (4ULL*1024*1024*1024);
+ offset_low = size_after_extend * page_size % (4ULL*1024*1024*1024);
+
+ mutex_exit(&fil_system->mutex);
+ success = os_file_set_size(node->name, node->handle,
+ offset_low, offset_high);
+ mutex_enter(&fil_system->mutex);
+ if (success) {
+ node->size += (size_after_extend - start_page_no);
+ space->size += (size_after_extend - start_page_no);
+ os_has_said_disk_full = FALSE;
+ }
+ goto complete_io;
+ }
+#endif
+
/* Extend at most 64 pages at a time */
buf_size = ut_min(64, size_after_extend - start_page_no) * page_size;
buf2 = mem_alloc(buf_size + page_size);
@@ -4921,6 +4935,10 @@ fil_extend_space_to_desired_size(
mem_free(buf2);
+#ifdef HAVE_POSIX_FALLOCATE
+complete_io:
+#endif
+
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
*actual_size = space->size;
@@ -5304,22 +5322,6 @@ _fil_io(
srv_data_written+= len;
}
- /* if the table space was already deleted, space might not exist already. */
- if (message
- && space_id < SRV_LOG_SPACE_FIRST_ID
- && ((buf_page_t*)message)->space_was_being_deleted) {
-
- if (mode == OS_AIO_NORMAL) {
- buf_page_io_complete(message);
- return(DB_SUCCESS); /*fake*/
- }
- if (type == OS_FILE_READ) {
- return(DB_TABLESPACE_DELETED);
- } else {
- return(DB_SUCCESS); /*fake*/
- }
- }
-
/* Reserve the fil_system mutex and make sure that we can open at
least one file while holding it, if the file is not already open */
@@ -5423,35 +5425,38 @@ _fil_io(
ut_a(byte_offset % OS_MIN_LOG_BLOCK_SIZE == 0);
ut_a((len % OS_MIN_LOG_BLOCK_SIZE) == 0);
- if (srv_pass_corrupt_table == 1 && space->is_corrupt) {
+#ifndef UNIV_HOTBACKUP
+ if (UNIV_UNLIKELY(space->is_corrupt && srv_pass_corrupt_table)) {
+
/* should ignore i/o for the crashed space */
- mutex_enter(&fil_system->mutex);
- fil_node_complete_io(node, fil_system, type);
- mutex_exit(&fil_system->mutex);
- if (mode == OS_AIO_NORMAL) {
- ut_a(space->purpose == FIL_TABLESPACE);
- buf_page_io_complete(message);
+ if (srv_pass_corrupt_table == 1 ||
+ type == OS_FILE_WRITE) {
+
+ mutex_enter(&fil_system->mutex);
+ fil_node_complete_io(node, fil_system, type);
+ mutex_exit(&fil_system->mutex);
+ if (mode == OS_AIO_NORMAL) {
+ ut_a(space->purpose == FIL_TABLESPACE);
+ buf_page_io_complete(message);
+ }
}
- if (type == OS_FILE_READ) {
+
+ if (srv_pass_corrupt_table == 1 && type == OS_FILE_READ) {
+
return(DB_TABLESPACE_DELETED);
- } else {
+
+ } else if (type == OS_FILE_WRITE) {
+
return(DB_SUCCESS);
}
- } else {
- if (srv_pass_corrupt_table > 1 && space->is_corrupt) {
- /* should ignore write i/o for the crashed space */
- if (type == OS_FILE_WRITE) {
- mutex_enter(&fil_system->mutex);
- fil_node_complete_io(node, fil_system, type);
- mutex_exit(&fil_system->mutex);
- if (mode == OS_AIO_NORMAL) {
- ut_a(space->purpose == FIL_TABLESPACE);
- buf_page_io_complete(message);
- }
- return(DB_SUCCESS);
- }
- }
-#ifdef UNIV_HOTBACKUP
+ } /**/
+
+ /* Queue the aio request */
+ ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
+ offset_low, offset_high, len, node, message, space_id,
+ trx);
+
+#else
/* In ibbackup do normal i/o, not aio */
if (type == OS_FILE_READ) {
ret = os_file_read(node->handle, buf, offset_low, offset_high,
@@ -5460,26 +5465,7 @@ _fil_io(
ret = os_file_write(node->name, node->handle, buf,
offset_low, offset_high, len);
}
-#else
- /* Queue the aio request */
- ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
- offset_low, offset_high, len, node, message, space_id, trx);
#endif
- } /**/
-
- /* if the table space was already deleted, space might not exist already. */
- if (message
- && space_id < SRV_LOG_SPACE_FIRST_ID
- && ((buf_page_t*)message)->space_was_being_deleted) {
-
- if (mode == OS_AIO_SYNC) {
- if (type == OS_FILE_READ) {
- return(DB_TABLESPACE_DELETED);
- } else {
- return(DB_SUCCESS); /*fake*/
- }
- }
- }
ut_a(ret);
@@ -5603,21 +5589,6 @@ fil_aio_wait(
&message, &type, &space_id);
}
- /* if the table space was already deleted, fil_node might not exist already. */
- if (message
- && space_id < SRV_LOG_SPACE_FIRST_ID
- && ((buf_page_t*)message)->space_was_being_deleted) {
-
- /* intended not to be uncompress read page */
- ut_a(buf_page_get_io_fix_unlocked(message) == BUF_IO_WRITE
- || !buf_page_get_zip_size(message)
- || buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE);
-
- srv_set_io_thread_op_info(segment, "complete io for buf page");
- buf_page_io_complete(message);
- return;
- }
-
ut_a(ret);
if (UNIV_UNLIKELY(fil_node == NULL)) {
ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS);
diff --git a/storage/xtradb/fsp/fsp0fsp.c b/storage/xtradb/fsp/fsp0fsp.c
index 5cbc74b0862..d5717638f29 100644
--- a/storage/xtradb/fsp/fsp0fsp.c
+++ b/storage/xtradb/fsp/fsp0fsp.c
@@ -317,10 +317,7 @@ fsp_get_space_header(
block = buf_page_get(id, zip_size, 0, RW_X_LATCH, mtr);
- if (srv_pass_corrupt_table && !block) {
- return(0);
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return(0););
header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
@@ -728,10 +725,7 @@ xdes_get_descriptor(
block = buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr);
- if (srv_pass_corrupt_table && !block) {
- return(0);
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return(0););
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
@@ -1879,10 +1873,7 @@ fsp_seg_inode_page_find_free(
{
fseg_inode_t* inode;
- if (srv_pass_corrupt_table && !page) {
- return(ULINT_UNDEFINED);
- }
- ut_a(page);
+ SRV_CORRUPT_TABLE_CHECK(page, return(ULINT_UNDEFINED););
for (; i < FSP_SEG_INODES_PER_PAGE(zip_size); i++) {
@@ -1996,10 +1987,7 @@ fsp_alloc_seg_inode(
page = buf_block_get_frame(block);
- if (srv_pass_corrupt_table && !page) {
- return(0);
- }
- ut_a(page);
+ SRV_CORRUPT_TABLE_CHECK(page, return(0););
n = fsp_seg_inode_page_find_free(page, 0, zip_size, mtr);
@@ -2094,10 +2082,7 @@ fseg_inode_try_get(
inode = fut_get_ptr(space, zip_size, inode_addr, RW_X_LATCH, mtr);
- if (srv_pass_corrupt_table && !inode) {
- return(0);
- }
- ut_a(inode);
+ SRV_CORRUPT_TABLE_CHECK(inode, return(0););
if (UNIV_UNLIKELY(!mach_read_from_8(inode + FSEG_ID))) {
@@ -2125,7 +2110,7 @@ fseg_inode_get(
{
fseg_inode_t* inode
= fseg_inode_try_get(header, space, zip_size, mtr);
- ut_a(srv_pass_corrupt_table || inode);
+ SRV_CORRUPT_TABLE_CHECK(inode, ; /* do nothing */);
return(inode);
}
@@ -3317,12 +3302,12 @@ fseg_free_page_low(
descr = xdes_get_descriptor(space, zip_size, page, mtr);
- if (srv_pass_corrupt_table && !descr) {
+ SRV_CORRUPT_TABLE_CHECK(descr,
+ {
/* The page may be corrupt. pass it. */
return;
- }
+ });
- ut_a(descr);
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) {
fputs("InnoDB: Dump of the tablespace extent descriptor: ",
stderr);
@@ -3571,15 +3556,15 @@ fseg_free_step(
descr = xdes_get_descriptor(space, zip_size, header_page, mtr);
- if (srv_pass_corrupt_table && !descr) {
+ SRV_CORRUPT_TABLE_CHECK(descr,
+ {
/* The page may be corrupt. pass it. */
return(TRUE);
- }
+ });
/* Check that the header resides on a page which has not been
freed yet */
- ut_a(descr);
ut_a(xdes_get_bit(descr, XDES_FREE_BIT,
header_page % FSP_EXTENT_SIZE, mtr) == FALSE);
inode = fseg_inode_try_get(header, space, zip_size, mtr);
@@ -3660,11 +3645,11 @@ fseg_free_step_not_header(
inode = fseg_inode_get(header, space, zip_size, mtr);
- if (srv_pass_corrupt_table && !inode) {
+ SRV_CORRUPT_TABLE_CHECK(inode,
+ {
/* ignore the corruption */
return(TRUE);
- }
- ut_a(inode);
+ });
descr = fseg_get_first_extent(inode, space, zip_size, mtr);
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index a0f953a41f4..373fd0bc01c 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -217,6 +217,8 @@ static my_bool innobase_file_format_check = TRUE;
static my_bool innobase_log_archive = FALSE;
static char* innobase_log_arch_dir = NULL;
#endif /* UNIV_LOG_ARCHIVE */
+static my_bool innobase_use_atomic_writes = FALSE;
+static my_bool innobase_use_fallocate = TRUE;
static my_bool innobase_use_doublewrite = TRUE;
static my_bool innobase_use_checksums = TRUE;
static my_bool innobase_fast_checksum = FALSE;
@@ -233,6 +235,8 @@ static ulong innobase_sys_stats_root_page = 0;
#endif
static my_bool innobase_buffer_pool_shm_checksum = TRUE;
static uint innobase_buffer_pool_shm_key = 0;
+static ulint srv_lazy_drop_table = 0;
+
static char* internal_innobase_data_file_path = NULL;
@@ -1934,7 +1938,7 @@ trx_is_started(
/*===========*/
trx_t* trx) /* in: transaction */
{
- return(trx->conc_state != TRX_NOT_STARTED);
+ return(trx->state != TRX_NOT_STARTED);
}
/*********************************************************************//**
@@ -3048,6 +3052,12 @@ innobase_change_buffering_inited_ok:
"InnoDB: innodb_buffer_pool_shm_key was ignored.\n");
}
+ if (srv_lazy_drop_table) {
+ fprintf(stderr,
+ "InnoDB: Warning: "
+ "innodb_lazy_drop_table is deprecated and ignored.\n");
+ }
+
srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
srv_n_file_io_threads = (ulint) innobase_file_io_threads;
@@ -3113,6 +3123,38 @@ innobase_change_buffering_inited_ok:
srv_kill_idle_transaction = 0;
#endif
+#ifdef HAVE_POSIX_FALLOCATE
+ srv_use_posix_fallocate = (ibool) innobase_use_fallocate;
+#endif
+ srv_use_atomic_writes = (ibool) innobase_use_atomic_writes;
+ if (innobase_use_atomic_writes) {
+ fprintf(stderr, "InnoDB: using atomic writes.\n");
+
+ /* Force doublewrite buffer off, atomic writes replace it. */
+ if (srv_use_doublewrite_buf) {
+ fprintf(stderr, "InnoDB: Switching off doublewrite buffer "
+ "because of atomic writes.\n");
+ innobase_use_doublewrite = srv_use_doublewrite_buf = FALSE;
+ }
+
+ /* Force O_DIRECT on Unixes (on Windows writes are always unbuffered)*/
+#ifndef _WIN32
+ if(!innobase_file_flush_method ||
+ !strstr(innobase_file_flush_method, "O_DIRECT")) {
+ innobase_file_flush_method =
+ srv_file_flush_method_str = (char*)"O_DIRECT";
+ fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n");
+ }
+#endif
+#ifdef HAVE_POSIX_FALLOCATE
+ /* Due to a bug in directFS, using atomics needs
+ * posix_fallocate to extend the file
+ * pwrite() past end of the file won't work
+ */
+ srv_use_posix_fallocate = TRUE;
+#endif
+ }
+
#ifdef HAVE_PSI_INTERFACE
/* Register keys with MySQL performance schema */
if (PSI_server) {
@@ -4611,7 +4653,8 @@ ha_innobase::open(
DBUG_RETURN(1);
}
- if (srv_pass_corrupt_table <= 1 && share->ib_table && share->ib_table->is_corrupt) {
+ if (UNIV_UNLIKELY(share->ib_table && share->ib_table->is_corrupt &&
+ srv_pass_corrupt_table <= 1)) {
free_share(share);
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
@@ -4636,7 +4679,8 @@ retry:
/* Get pointer to a table object in InnoDB dictionary cache */
ib_table = dict_table_get(norm_name, TRUE);
- if (srv_pass_corrupt_table <= 1 && ib_table && ib_table->is_corrupt) {
+ if (UNIV_UNLIKELY(ib_table && ib_table->is_corrupt &&
+ srv_pass_corrupt_table <= 1)) {
free_share(share);
my_free(upd_buf);
upd_buf = NULL;
@@ -7431,7 +7475,8 @@ ha_innobase::index_read(
ha_statistic_increment(&SSV::ha_read_key_count);
- if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
+ if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
+ srv_pass_corrupt_table <= 1)) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -7502,7 +7547,8 @@ ha_innobase::index_read(
ret = DB_UNSUPPORTED;
}
- if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
+ if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
+ srv_pass_corrupt_table <= 1)) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -7620,7 +7666,8 @@ ha_innobase::change_active_index(
{
DBUG_ENTER("change_active_index");
- if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
+ if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
+ srv_pass_corrupt_table <= 1)) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -7738,7 +7785,8 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
- if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
+ if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
+ srv_pass_corrupt_table <= 1)) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -7751,7 +7799,8 @@ ha_innobase::general_fetch(
innodb_srv_conc_exit_innodb(prebuilt->trx);
- if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
+ if (UNIV_UNLIKELY(share->ib_table->is_corrupt &&
+ srv_pass_corrupt_table <= 1)) {
DBUG_RETURN(HA_ERR_CRASHED);
}
@@ -10154,7 +10203,7 @@ ha_innobase::info_low(
prebuilt->trx->op_info = "confirming rows of SYS_STATS to store statistics";
- ut_a(prebuilt->trx->conc_state == TRX_NOT_STARTED);
+ ut_a(!trx_is_started(prebuilt->trx));
for (index = dict_table_get_first_index(ib_table);
index != NULL;
@@ -10167,7 +10216,7 @@ ha_innobase::info_low(
innobase_commit_low(prebuilt->trx);
}
- ut_a(prebuilt->trx->conc_state == TRX_NOT_STARTED);
+ ut_a(!trx_is_started(prebuilt->trx));
}
prebuilt->trx->op_info = "updating table statistics";
@@ -13832,6 +13881,20 @@ static MYSQL_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
"Disable with --skip-innodb-doublewrite.",
NULL, NULL, TRUE);
+static MYSQL_SYSVAR_BOOL(use_atomic_writes, innobase_use_atomic_writes,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Prevent partial page writes, via atomic writes."
+ "The option is used to prevent partial writes in case of a crash/poweroff, "
+ "as faster alternative to doublewrite buffer."
+ "Currently this option works only "
+ "on Linux only with FusionIO device, and directFS filesystem.",
+ NULL, NULL, FALSE);
+
+static MYSQL_SYSVAR_BOOL(use_fallocate, innobase_use_fallocate,
+ PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
+ "Preallocate files fast, using operating system functionality. On POSIX systems, posix_fallocate system call is used.",
+ NULL, NULL, FALSE);
+
static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
PLUGIN_VAR_RQCMDARG,
"Number of IOPs the server can do. Tunes the background IO rate",
@@ -14475,8 +14538,7 @@ static MYSQL_SYSVAR_ENUM(corrupt_table_action, srv_pass_corrupt_table,
static MYSQL_SYSVAR_ULINT(lazy_drop_table, srv_lazy_drop_table,
PLUGIN_VAR_RQCMDARG,
- "At deleting tablespace, only miminum needed processes at the time are done. "
- "e.g. for http://bugs.mysql.com/51325",
+ "[Deprecated option] no effect",
NULL, NULL, 0, 0, 1, 0);
static MYSQL_SYSVAR_BOOL(locking_fake_changes, srv_fake_changes_locks,
@@ -14510,6 +14572,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(doublewrite_file),
MYSQL_SYSVAR(data_home_dir),
MYSQL_SYSVAR(doublewrite),
+ MYSQL_SYSVAR(use_atomic_writes),
+ MYSQL_SYSVAR(use_fallocate),
MYSQL_SYSVAR(recovery_stats),
MYSQL_SYSVAR(fast_shutdown),
MYSQL_SYSVAR(file_io_threads),
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index e868fb322a7..d64a95a969e 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -1210,7 +1210,7 @@ trx_i_s_common_fill_table(
DBUG_ENTER("trx_i_s_common_fill_table");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -1370,7 +1370,7 @@ i_s_cmp_fill_low(
DBUG_ENTER("i_s_cmp_fill_low");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -1642,7 +1642,7 @@ i_s_cmpmem_fill_low(
DBUG_ENTER("i_s_cmpmem_fill_low");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -2275,7 +2275,7 @@ i_s_innodb_buffer_stats_fill_table(
DBUG_ENTER("i_s_innodb_buffer_fill_general");
/* Only allow the PROCESS privilege holder to access the stats */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -2968,7 +2968,7 @@ i_s_innodb_buffer_page_fill_table(
DBUG_ENTER("i_s_innodb_buffer_page_fill_table");
/* deny access to user without PROCESS privilege */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -3513,7 +3513,7 @@ i_s_innodb_buf_page_lru_fill_table(
DBUG_ENTER("i_s_innodb_buf_page_lru_fill_table");
/* deny access to any users that do not hold PROCESS_ACL */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -3747,7 +3747,7 @@ i_s_sys_tables_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -4050,7 +4050,7 @@ i_s_sys_tables_fill_table_stats(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -4294,7 +4294,7 @@ i_s_sys_indexes_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -4531,7 +4531,7 @@ i_s_sys_columns_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -4733,7 +4733,7 @@ i_s_sys_fields_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -4962,7 +4962,7 @@ i_s_sys_foreign_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -5173,7 +5173,7 @@ i_s_sys_foreign_cols_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -5388,7 +5388,7 @@ i_s_sys_stats_fill_table(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -5574,7 +5574,7 @@ i_s_innodb_rseg_fill(
DBUG_ENTER("i_s_innodb_rseg_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -5798,7 +5798,7 @@ i_s_innodb_table_stats_fill(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -5863,7 +5863,7 @@ i_s_innodb_index_stats_fill(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -6055,7 +6055,7 @@ i_s_innodb_admin_command_fill(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -6432,7 +6432,7 @@ i_s_innodb_buffer_pool_pages_fill(
DBUG_ENTER("i_s_innodb_buffer_pool_pages_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -6537,7 +6537,7 @@ i_s_innodb_buffer_pool_pages_index_fill(
DBUG_ENTER("i_s_innodb_buffer_pool_pages_index_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -6606,7 +6606,7 @@ i_s_innodb_buffer_pool_pages_blob_fill(
DBUG_ENTER("i_s_innodb_buffer_pool_pages_blob_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -7010,7 +7010,7 @@ i_s_innodb_undo_logs_fill(
DBUG_ENTER("i_s_innodb_undo_logs_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
@@ -7336,7 +7336,7 @@ i_s_innodb_changed_pages_fill(
DBUG_ENTER("i_s_innodb_changed_pages_fill");
/* deny access to non-superusers */
- if (check_global_access(thd, PROCESS_ACL)) {
+ if (check_global_access(thd, PROCESS_ACL, true)) {
DBUG_RETURN(0);
}
diff --git a/storage/xtradb/include/btr0btr.ic b/storage/xtradb/include/btr0btr.ic
index 53c8159c448..798107628d7 100644
--- a/storage/xtradb/include/btr0btr.ic
+++ b/storage/xtradb/include/btr0btr.ic
@@ -59,7 +59,7 @@ btr_block_get_func(
block = buf_page_get_gen(space, zip_size, page_no, mode,
NULL, BUF_GET, file, line, mtr);
- ut_a(srv_pass_corrupt_table || block);
+ SRV_CORRUPT_TABLE_CHECK(block, ; /* do nothing */);
if (block && mode != RW_NO_LATCH) {
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index e0d7a974fc3..f00a06c8805 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -1589,7 +1589,6 @@ struct buf_page_struct{
0 if the block was never accessed
in the buffer pool. Protected by
block mutex */
- ibool space_was_being_deleted;
ibool is_corrupt;
# if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
ibool file_page_was_freed;
diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic
index 8d5c3edeef8..18c46b6412e 100644
--- a/storage/xtradb/include/buf0buf.ic
+++ b/storage/xtradb/include/buf0buf.ic
@@ -430,7 +430,6 @@ buf_block_set_file_page(
buf_block_set_state(block, BUF_BLOCK_FILE_PAGE);
block->page.space = space;
block->page.offset = page_no;
- block->page.space_was_being_deleted = FALSE;
}
/*********************************************************************//**
@@ -712,13 +711,7 @@ buf_block_get_frame(
/*================*/
const buf_block_t* block) /*!< in: pointer to the control block */
{
- ut_a(srv_pass_corrupt_table || block);
-
- if (srv_pass_corrupt_table && !block) {
- return(0);
- }
-
- ut_ad(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return(0););
switch (buf_block_get_state(block)) {
case BUF_BLOCK_ZIP_FREE:
diff --git a/storage/xtradb/include/buf0flu.ic b/storage/xtradb/include/buf0flu.ic
index 30e2cc8efe8..8228c025d23 100644
--- a/storage/xtradb/include/buf0flu.ic
+++ b/storage/xtradb/include/buf0flu.ic
@@ -70,7 +70,7 @@ buf_flush_note_modification(
ut_ad(!buf_pool_mutex_own(buf_pool));
ut_ad(!buf_flush_list_mutex_own(buf_pool));
- ut_ad(log_flush_order_mutex_own());
+ ut_ad(!mtr->made_dirty || log_flush_order_mutex_own());
ut_ad(mtr->start_lsn != 0);
ut_ad(mtr->modifications);
diff --git a/storage/xtradb/include/buf0lru.h b/storage/xtradb/include/buf0lru.h
index 2ea4f9b1ecf..8bb3aed4059 100644
--- a/storage/xtradb/include/buf0lru.h
+++ b/storage/xtradb/include/buf0lru.h
@@ -73,13 +73,6 @@ buf_LRU_flush_or_remove_pages(
enum buf_remove_t buf_remove);/*!< in: remove or flush
strategy */
-/******************************************************************//**
-*/
-UNIV_INTERN
-void
-buf_LRU_mark_space_was_deleted(
-/*===========================*/
- ulint id); /*!< in: space id */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */
diff --git a/storage/xtradb/include/fut0fut.ic b/storage/xtradb/include/fut0fut.ic
index 529f2a516d3..63e5736d99e 100644
--- a/storage/xtradb/include/fut0fut.ic
+++ b/storage/xtradb/include/fut0fut.ic
@@ -50,10 +50,7 @@ fut_get_ptr(
block = buf_page_get(space, zip_size, addr.page, rw_latch, mtr);
- if (srv_pass_corrupt_table && !block) {
- return(0);
- }
- ut_a(block);
+ SRV_CORRUPT_TABLE_CHECK(block, return(0););
ptr = buf_block_get_frame(block) + addr.boffset;
diff --git a/storage/xtradb/include/log0log.h b/storage/xtradb/include/log0log.h
index 9a149bcfa76..85285a77084 100644
--- a/storage/xtradb/include/log0log.h
+++ b/storage/xtradb/include/log0log.h
@@ -122,14 +122,22 @@ UNIV_INLINE
void
log_free_check(void);
/*================*/
+/**************************************************************************//**
+Locks the log mutex and opens the log for log_write_low. The log must be closed
+with log_close and released with log_release.
+@return start lsn of the log record */
+UNIV_INLINE
+ib_uint64_t
+log_reserve_and_open(
+/*=================*/
+ ulint len); /*!< in: length of data to be catenated */
/************************************************************//**
-Opens the log for log_write_low. The log must be closed with log_close and
-released with log_release.
+Opens the log for log_write_low. The log must be closed with log_close.
@return start lsn of the log record */
UNIV_INTERN
ib_uint64_t
-log_reserve_and_open(
-/*=================*/
+log_open(
+/*=====*/
ulint len); /*!< in: length of data to be catenated */
/************************************************************//**
Writes to the log the string given. It is assumed that the caller holds the
diff --git a/storage/xtradb/include/log0log.ic b/storage/xtradb/include/log0log.ic
index 67db6695cab..c39586dbcf9 100644
--- a/storage/xtradb/include/log0log.ic
+++ b/storage/xtradb/include/log0log.ic
@@ -332,10 +332,10 @@ log_reserve_and_write_fast(
if (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE) {
- /* The string does not fit within the current log block
- or the log block would become full */
-
- mutex_exit(&log_sys->mutex);
+ /* The string does not fit within the current log block or the
+ log block would become full. Do not release the log mutex,
+ because it has to be reacquired immediately for the "slow" write
+ procedure via log_write_low(). */
return(0);
}
@@ -382,6 +382,21 @@ log_reserve_and_write_fast(
return(log_sys->lsn);
}
+/**************************************************************************//**
+Locks the log mutex and opens the log for log_write_low. The log must be closed
+with log_close and released with log_release.
+@return start lsn of the log record */
+UNIV_INLINE
+ib_uint64_t
+log_reserve_and_open(
+/*=================*/
+ ulint len) /*!< in: length of data to be catenated */
+{
+ mutex_enter(&(log_sys->mutex));
+
+ return log_open(len);
+}
+
/***********************************************************************//**
Releases the log mutex. */
UNIV_INLINE
diff --git a/storage/xtradb/include/mtr0mtr.h b/storage/xtradb/include/mtr0mtr.h
index 46f1ff9310c..c51632e0ed5 100644
--- a/storage/xtradb/include/mtr0mtr.h
+++ b/storage/xtradb/include/mtr0mtr.h
@@ -375,6 +375,8 @@ struct mtr_struct{
ibool modifications;
/* TRUE if the mtr made modifications to
buffer pool pages */
+ ibool made_dirty;/*!< TRUE if mtr has made at least
+ one buffer pool page dirty */
ulint n_log_recs;
/* count of how many page initial log records
have been written to the mtr log */
diff --git a/storage/xtradb/include/mtr0mtr.ic b/storage/xtradb/include/mtr0mtr.ic
index a03a0271535..7b5d268b70f 100644
--- a/storage/xtradb/include/mtr0mtr.ic
+++ b/storage/xtradb/include/mtr0mtr.ic
@@ -29,6 +29,17 @@ Created 11/26/1995 Heikki Tuuri
#endif /* !UNIV_HOTBACKUP */
#include "mach0data.h"
+/***************************************************//**
+Checks if a mini-transaction is dirtying a clean page.
+@return TRUE if the mtr is dirtying a clean page. */
+UNIV_INTERN
+ibool
+mtr_block_dirtied(
+/*==============*/
+ const buf_block_t* block) /*!< in: block being x-fixed */
+ __attribute__((nonnull,warn_unused_result));
+
+
/***************************************************************//**
Starts a mini-transaction. */
UNIV_INLINE
@@ -47,6 +58,7 @@ mtr_start(
mtr->inside_ibuf = FALSE;
mtr->n_log_recs = 0;
mtr->n_freed_pages = 0;
+ mtr->made_dirty = FALSE;
ut_d(mtr->state = MTR_ACTIVE);
ut_d(mtr->magic_n = MTR_MAGIC_N);
@@ -65,6 +77,15 @@ mtr_memo_push(
dyn_array_t* memo;
mtr_memo_slot_t* slot;
+ /* If this mtr has x-fixed a clean page then we set
+ the made_dirty flag. This tells us if we need to
+ grab log_flush_order_mutex at mtr_commit so that we
+ can insert the dirtied page to the flush list. */
+ if (type == MTR_MEMO_PAGE_X_FIX && !mtr->made_dirty) {
+ mtr->made_dirty =
+ mtr_block_dirtied((const buf_block_t *)object);
+ }
+
ut_ad(object);
ut_ad(type >= MTR_MEMO_PAGE_S_FIX);
ut_ad(type <= MTR_MEMO_X_LOCK);
diff --git a/storage/xtradb/include/read0read.h b/storage/xtradb/include/read0read.h
index 0c9468d985e..dd378ecc997 100644
--- a/storage/xtradb/include/read0read.h
+++ b/storage/xtradb/include/read0read.h
@@ -32,6 +32,7 @@ Created 2/16/1997 Heikki Tuuri
#include "ut0byte.h"
#include "ut0lst.h"
#include "trx0trx.h"
+#include "trx0sys.h"
#include "read0types.h"
/*********************************************************************//**
@@ -44,8 +45,11 @@ read_view_open_now(
/*===============*/
trx_id_t cr_trx_id, /*!< in: trx_id of creating
transaction, or 0 used in purge */
- mem_heap_t* heap); /*!< in: memory heap from which
- allocated */
+ read_view_t* view, /*!< in: current read view or NULL if it
+ doesn't exist yet */
+ ibool exclude_self); /*!< in: TRUE, if cr_trx_id should be
+ excluded from the resulting view */
+
/*********************************************************************//**
Makes a copy of the oldest existing read view, or opens a new. The view
must be closed with ..._close.
@@ -56,8 +60,8 @@ read_view_oldest_copy_or_open_new(
/*==============================*/
trx_id_t cr_trx_id, /*!< in: trx_id of creating
transaction, or 0 used in purge */
- mem_heap_t* heap); /*!< in: memory heap from which
- allocated */
+ read_view_t* view); /*!< in: pre-allocated view array or
+ NULL if a new one needs to be created */
/*********************************************************************//**
Closes a read view. */
UNIV_INTERN
@@ -66,6 +70,13 @@ read_view_close(
/*============*/
read_view_t* view); /*!< in: read view */
/*********************************************************************//**
+Frees memory allocated by a read view. */
+UNIV_INTERN
+void
+read_view_free(
+/*===========*/
+ read_view_t* view); /*< in: read view */
+/*********************************************************************//**
Closes a consistent read view for MySQL. This function is called at an SQL
statement end if the trx isolation level is <= TRX_ISO_READ_COMMITTED. */
UNIV_INTERN
@@ -143,16 +154,20 @@ struct read_view_struct{
are strictly smaller (<) than this value.
In other words,
this is the "low water mark". */
- ulint n_trx_ids;
+ ulint n_descr;
/*!< Number of cells in the trx_ids array */
- trx_id_t* trx_ids;/*!< Additional trx ids which the read should
- not see: typically, these are the active
+ ulint max_descr;
+ /*!< Maximum number of cells in the trx_ids
+ array */
+ trx_id_t* descriptors;
+ /*!< Array of trx descriptors which the read
+ should not see: typically, these are the active
transactions at the time when the read is
serialized, except the reading transaction
itself; the trx ids in this array are in a
descending order. These trx_ids should be
- between the "low" and "high" water marks,
- that is, up_limit_id and low_limit_id. */
+ between the "low" and "high" water marks, that
+ is, up_limit_id and low_limit_id. */
trx_id_t creator_trx_id;
/*!< trx id of creating transaction, or
0 used in purge */
diff --git a/storage/xtradb/include/read0read.ic b/storage/xtradb/include/read0read.ic
index 5bb5249b591..ebcdb767406 100644
--- a/storage/xtradb/include/read0read.ic
+++ b/storage/xtradb/include/read0read.ic
@@ -25,6 +25,11 @@ Created 2/16/1997 Heikki Tuuri
/*********************************************************************//**
Gets the nth trx id in a read view.
+
+Upstream code stores array of trx_ids in the descending order. Percona Server
+keeps it in the ascending order for performance reasons. Let us keep the
+semantics.
+
@return trx id */
UNIV_INLINE
trx_id_t
@@ -33,13 +38,17 @@ read_view_get_nth_trx_id(
const read_view_t* view, /*!< in: read view */
ulint n) /*!< in: position */
{
- ut_ad(n < view->n_trx_ids);
+ ut_ad(n < view->n_descr);
- return(*(view->trx_ids + n));
+ return(view->descriptors[view->n_descr - 1 - n]);
}
/*********************************************************************//**
-Sets the nth trx id in a read view. */
+Sets the nth trx id in a read view.
+
+Upstream code stores array of trx_ids in the descending order. Percona Server
+keeps it in the ascending order for performance reasons. Let us keep the
+semantics. */
UNIV_INLINE
void
read_view_set_nth_trx_id(
@@ -48,9 +57,9 @@ read_view_set_nth_trx_id(
ulint n, /*!< in: position */
trx_id_t trx_id) /*!< in: trx id to set */
{
- ut_ad(n < view->n_trx_ids);
+ ut_ad(n < view->n_descr);
- *(view->trx_ids + n) = trx_id;
+ view->descriptors[view->n_descr - 1 - n] = trx_id;
}
/*********************************************************************//**
@@ -63,9 +72,6 @@ read_view_sees_trx_id(
const read_view_t* view, /*!< in: read view */
trx_id_t trx_id) /*!< in: trx id */
{
- ulint n_ids;
- ulint i;
-
if (trx_id < view->up_limit_id) {
return(TRUE);
@@ -76,21 +82,8 @@ read_view_sees_trx_id(
return(FALSE);
}
- /* We go through the trx ids in the array smallest first: this order
- may save CPU time, because if there was a very long running
- transaction in the trx id array, its trx id is looked at first, and
- the first two comparisons may well decide the visibility of trx_id. */
-
- n_ids = view->n_trx_ids;
-
- for (i = 0; i < n_ids; i++) {
- trx_id_t view_trx_id
- = read_view_get_nth_trx_id(view, n_ids - i - 1);
-
- if (trx_id <= view_trx_id) {
- return(trx_id != view_trx_id);
- }
- }
+ /* Do a binary search over this view's descriptors array */
- return(TRUE);
+ return(trx_find_descriptor(view->descriptors, view->n_descr,
+ trx_id) == NULL);
}
diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h
index f5573c64f75..52b625d8a76 100644
--- a/storage/xtradb/include/srv0srv.h
+++ b/storage/xtradb/include/srv0srv.h
@@ -253,6 +253,11 @@ extern ulong srv_sys_stats_root_page;
#endif
extern ibool srv_use_doublewrite_buf;
+extern ibool srv_use_atomic_writes;
+#ifdef HAVE_POSIX_FALLOCATE
+extern ibool srv_use_posix_fallocate;
+#endif
+
extern ibool srv_use_checksums;
extern ibool srv_fast_checksum;
@@ -273,9 +278,22 @@ extern ulong srv_adaptive_flushing_method;
extern ulong srv_expand_import;
extern ulong srv_pass_corrupt_table;
-extern ulint srv_dict_size_limit;
+/* Helper macro to support srv_pass_corrupt_table checks. If 'cond' is FALSE,
+execute 'code' if srv_pass_corrupt_table is non-zero, or trigger a fatal error
+otherwise. The break statement in 'code' will obviously not work as expected. */
+
+#define SRV_CORRUPT_TABLE_CHECK(cond,code) \
+ do { \
+ if (UNIV_UNLIKELY(!(cond))) { \
+ if (srv_pass_corrupt_table) { \
+ code \
+ } else { \
+ ut_error; \
+ } \
+ } \
+ } while(0)
-extern ulint srv_lazy_drop_table;
+extern ulint srv_dict_size_limit;
/*-------------------------------------------*/
extern ulint srv_n_rows_inserted;
diff --git a/storage/xtradb/include/trx0purge.h b/storage/xtradb/include/trx0purge.h
index 1e8acd65e01..1ddc9068b8e 100644
--- a/storage/xtradb/include/trx0purge.h
+++ b/storage/xtradb/include/trx0purge.h
@@ -143,6 +143,7 @@ struct trx_purge_struct{
obtaining an s-latch here. */
read_view_t* view; /*!< The purge will not remove undo logs
which are >= this view (purge view) */
+ read_view_t* prebuilt_view; /*!< Pre-built view array */
ulonglong n_pages_handled;/*!< Approximate number of undo log
pages processed in purge */
ulonglong handle_limit; /*!< Target of how many pages to get
diff --git a/storage/xtradb/include/trx0sys.h b/storage/xtradb/include/trx0sys.h
index 7ae3ba74478..4683c097b53 100644
--- a/storage/xtradb/include/trx0sys.h
+++ b/storage/xtradb/include/trx0sys.h
@@ -252,6 +252,17 @@ trx_id_t
trx_sys_get_new_trx_id(void);
/*========================*/
+/*************************************************************//**
+Find a slot for a given trx ID in a descriptors array.
+@return: slot pointer */
+UNIV_INLINE
+trx_id_t*
+trx_find_descriptor(
+/*================*/
+ const trx_id_t* descriptors, /*!< in: descriptors array */
+ ulint n_descr, /*!< in: array size */
+ trx_id_t trx_id); /*!< in: trx pointer */
+
#ifdef UNIV_DEBUG
/* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */
extern uint trx_rseg_n_slots_debug;
@@ -663,6 +674,8 @@ identifier is added to this 64-bit constant. */
| TRX_SYS_FILE_FORMAT_TAG_MAGIC_N_LOW)
/* @} */
+#define TRX_DESCR_ARRAY_INITIAL_SIZE 1000
+
#ifndef UNIV_HOTBACKUP
/** Doublewrite control struct */
struct trx_doublewrite_struct{
@@ -690,16 +703,41 @@ struct trx_sys_struct{
trx_id_t max_trx_id; /*!< The smallest number not yet
assigned as a transaction id or
transaction number */
+ char pad1[64]; /*!< Ensure max_trx_id does not share
+ cache line with other fields. */
+ trx_id_t* descriptors; /*!< Array of trx descriptors */
+ ulint descr_n_max; /*!< The current size of the descriptors
+ array. */
+ char pad2[64]; /*!< Ensure static descriptor fields
+ do not share cache lines with
+ descr_n_used */
+ ulint descr_n_used; /*!< Number of used elements in the
+ descriptors array. */
+ char pad3[64]; /*!< Ensure descriptors do not share
+ cache line with other fields */
UT_LIST_BASE_NODE_T(trx_t) trx_list;
/*!< List of active and committed in
memory transactions, sorted on trx id,
biggest first */
+ char pad4[64]; /*!< Ensure list base nodes do not
+ share cache line with other fields */
UT_LIST_BASE_NODE_T(trx_t) mysql_trx_list;
/*!< List of transactions created
for MySQL */
+ char pad5[64]; /*!< Ensure list base nodes do not
+ share cache line with other fields */
+ UT_LIST_BASE_NODE_T(trx_t) trx_serial_list;
+ /*!< trx->no ordered List of
+ transactions in either TRX_PREPARED or
+ TRX_ACTIVE which have already been
+ assigned a serialization number */
+ char pad6[64]; /*!< Ensure trx_serial_list does not
+ share cache line with other fields */
UT_LIST_BASE_NODE_T(trx_rseg_t) rseg_list;
/*!< List of rollback segment
objects */
+ char pad7[64]; /*!< Ensure list base nodes do not
+ share cache line with other fields */
trx_rseg_t* latest_rseg; /*!< Latest rollback segment in the
round-robin assignment of rollback
segments to transactions */
diff --git a/storage/xtradb/include/trx0sys.ic b/storage/xtradb/include/trx0sys.ic
index af05ab2f5ed..3af98cdf98b 100644
--- a/storage/xtradb/include/trx0sys.ic
+++ b/storage/xtradb/include/trx0sys.ic
@@ -367,28 +367,11 @@ trx_is_active(
/*==========*/
trx_id_t trx_id) /*!< in: trx id of the transaction */
{
- trx_t* trx;
-
ut_ad(mutex_own(&(kernel_mutex)));
- if (trx_id < trx_list_get_min_trx_id()) {
-
- return(FALSE);
- }
-
- if (UNIV_UNLIKELY(trx_id >= trx_sys->max_trx_id)) {
-
- /* There must be corruption: we return TRUE because this
- function is only called by lock_clust_rec_some_has_impl()
- and row_vers_impl_x_locked_off_kernel() and they have
- diagnostic prints in this case */
-
- return(TRUE);
- }
-
- trx = trx_get_on_id(trx_id);
- if (trx && (trx->conc_state == TRX_ACTIVE
- || trx->conc_state == TRX_PREPARED)) {
+ if (trx_find_descriptor(trx_sys->descriptors,
+ trx_sys->descr_n_used,
+ trx_id)) {
return(TRUE);
}
@@ -425,4 +408,27 @@ trx_sys_get_new_trx_id(void)
return(id);
}
+
+/*************************************************************//**
+Find a slot for a given trx ID in a descriptors array.
+@return: slot pointer */
+UNIV_INLINE
+trx_id_t*
+trx_find_descriptor(
+/*================*/
+ const trx_id_t* descriptors, /*!< in: descriptors array */
+ ulint n_descr, /*!< in: array size */
+ trx_id_t trx_id) /*!< in: trx pointer */
+{
+ ut_ad(descriptors != trx_sys->descriptors ||
+ mutex_own(&kernel_mutex));
+
+ if (UNIV_UNLIKELY(n_descr == 0)) {
+
+ return(NULL);
+ }
+
+ return((trx_id_t *) bsearch(&trx_id, descriptors, n_descr,
+ sizeof(trx_id_t), trx_descr_cmp));
+}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h
index 2a08fdf442b..1f5b8ebc993 100644
--- a/storage/xtradb/include/trx0trx.h
+++ b/storage/xtradb/include/trx0trx.h
@@ -447,6 +447,23 @@ trx_get_que_state_str(
/*==================*/
const trx_t* trx); /*!< in: transaction */
+/*************************************************************//**
+Callback function for trx_find_descriptor() to compare trx IDs. */
+UNIV_INTERN
+int
+trx_descr_cmp(
+/*==========*/
+ const void *a, /*!< in: pointer to first comparison argument */
+ const void *b); /*!< in: pointer to second comparison argument */
+
+/*************************************************************//**
+Release a slot for a given trx in the global descriptors array. */
+UNIV_INTERN
+void
+trx_release_descriptor(
+/*===================*/
+ trx_t* trx); /*!< in: trx pointer */
+
/* Signal to a transaction */
struct trx_sig_struct{
unsigned type:3; /*!< signal type */
@@ -477,10 +494,18 @@ struct trx_struct{
const char* op_info; /*!< English text describing the
current operation, or an empty
string */
- ulint conc_state; /*!< state of the trx from the point
- of view of concurrency control:
- TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
- ... */
+ ulint state; /*!< state of the trx from the point of
+ view of concurrency control: TRX_ACTIVE,
+ TRX_COMMITTED_IN_MEMORY, ... This was
+ called 'conc_state' in the upstream and
+ has been renamed in Percona Server,
+ because changing it's value to/from
+ either TRX_ACTIVE or TRX_PREPARED
+ requires calling
+ trx_reserve_descriptor() /
+ trx_release_descriptor(). Different name
+ ensures we notice any new code changing
+ the state. */
/*------------------------------*/
/* MySQL has a transaction coordinator to coordinate two phase
commit between multiple storage engines and the binary log. When
@@ -495,6 +520,9 @@ struct trx_struct{
also be set to 1. This is used in the
XA code */
unsigned called_commit_ordered:1;/* 1 if innobase_commit_ordered has run. */
+ unsigned is_in_trx_serial_list:1;
+ /* Set when transaction is in the
+ trx_serial_list */
/*------------------------------*/
ulint isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */
ulint check_foreigns; /* normally TRUE, but if the user
@@ -628,6 +656,9 @@ struct trx_struct{
UT_LIST_NODE_T(trx_t)
mysql_trx_list; /*!< list of transactions created for
MySQL */
+ UT_LIST_NODE_T(trx_t)
+ trx_serial_list;/*!< list node for
+ trx_sys->trx_serial_list */
/*------------------------------*/
ulint error_state; /*!< 0 if no error, otherwise error
number; NOTE That ONLY the thread
@@ -686,9 +717,6 @@ struct trx_struct{
UT_LIST_BASE_NODE_T(lock_t)
trx_locks; /*!< locks reserved by the transaction */
/*------------------------------*/
- mem_heap_t* global_read_view_heap;
- /* memory heap for the global read
- view */
read_view_t* global_read_view;
/* consistent read view associated
to a transaction or NULL */
@@ -698,6 +726,7 @@ struct trx_struct{
associated to a transaction (i.e.
same as global_read_view) or read view
associated to a cursor */
+ read_view_t* prebuilt_view; /* pre-built view array */
/*------------------------------*/
UT_LIST_BASE_NODE_T(trx_named_savept_t)
trx_savepoints; /*!< savepoints set with SAVEPOINT ...,
diff --git a/storage/xtradb/include/trx0trx.ic b/storage/xtradb/include/trx0trx.ic
index 4a1d3bcde0b..1a1fc91eac5 100644
--- a/storage/xtradb/include/trx0trx.ic
+++ b/storage/xtradb/include/trx0trx.ic
@@ -31,9 +31,9 @@ trx_start_if_not_started(
/*=====================*/
trx_t* trx) /*!< in: transaction */
{
- ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
+ ut_ad(trx->state != TRX_COMMITTED_IN_MEMORY);
- if (trx->conc_state == TRX_NOT_STARTED) {
+ if (trx->state == TRX_NOT_STARTED) {
trx_start(trx, ULINT_UNDEFINED);
}
@@ -48,9 +48,9 @@ trx_start_if_not_started_low(
/*=========================*/
trx_t* trx) /*!< in: transaction */
{
- ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
+ ut_ad(trx->state != TRX_COMMITTED_IN_MEMORY);
- if (trx->conc_state == TRX_NOT_STARTED) {
+ if (trx->state == TRX_NOT_STARTED) {
trx_start_low(trx, ULINT_UNDEFINED);
}
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 60c5cc79852..0fefdbaeb9a 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -64,7 +64,7 @@ component, i.e. we show M.N.P as M.N */
(INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR)
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 30.1
+#define PERCONA_INNODB_VERSION 30.2
#endif
#define INNODB_VERSION_STR MYSQL_SERVER_VERSION "-" IB_TO_STR(PERCONA_INNODB_VERSION)
diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c
index a38656200db..63478c98371 100644
--- a/storage/xtradb/lock/lock0lock.c
+++ b/storage/xtradb/lock/lock0lock.c
@@ -4925,7 +4925,7 @@ lock_print_info_all_transactions(
trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list);
while (trx) {
- if (trx->conc_state == TRX_NOT_STARTED) {
+ if (trx->state == TRX_NOT_STARTED) {
fputs("---", file);
trx_print(file, trx, 600);
}
@@ -5093,9 +5093,9 @@ lock_table_queue_validate(
lock = UT_LIST_GET_FIRST(table->locks);
while (lock) {
- ut_a(((lock->trx)->conc_state == TRX_ACTIVE)
- || ((lock->trx)->conc_state == TRX_PREPARED)
- || ((lock->trx)->conc_state == TRX_COMMITTED_IN_MEMORY));
+ ut_a(((lock->trx)->state == TRX_ACTIVE)
+ || ((lock->trx)->state == TRX_PREPARED)
+ || ((lock->trx)->state == TRX_COMMITTED_IN_MEMORY));
if (!lock_get_wait(lock)) {
@@ -5143,7 +5143,7 @@ lock_rec_queue_validate(
lock = lock_rec_get_first(block, heap_no);
while (lock) {
- switch(lock->trx->conc_state) {
+ switch(lock->trx->state) {
case TRX_ACTIVE:
case TRX_PREPARED:
case TRX_COMMITTED_IN_MEMORY:
@@ -5230,9 +5230,9 @@ lock_rec_queue_validate(
lock = lock_rec_get_first(block, heap_no);
while (lock) {
- ut_a(lock->trx->conc_state == TRX_ACTIVE
- || lock->trx->conc_state == TRX_PREPARED
- || lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
+ ut_a(lock->trx->state == TRX_ACTIVE
+ || lock->trx->state == TRX_PREPARED
+ || lock->trx->state == TRX_COMMITTED_IN_MEMORY);
ut_a(trx_in_trx_list(lock->trx));
if (index) {
@@ -5311,9 +5311,9 @@ loop:
}
ut_a(trx_in_trx_list(lock->trx));
- ut_a(lock->trx->conc_state == TRX_ACTIVE
- || lock->trx->conc_state == TRX_PREPARED
- || lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
+ ut_a(lock->trx->state == TRX_ACTIVE
+ || lock->trx->state == TRX_PREPARED
+ || lock->trx->state == TRX_COMMITTED_IN_MEMORY);
# ifdef UNIV_SYNC_DEBUG
/* Only validate the record queues when this thread is not
diff --git a/storage/xtradb/log/log0log.c b/storage/xtradb/log/log0log.c
index c91d39e6b38..e51ac7c4d5d 100644
--- a/storage/xtradb/log/log0log.c
+++ b/storage/xtradb/log/log0log.c
@@ -265,13 +265,12 @@ log_check_tracking_margin(
}
/************************************************************//**
-Opens the log for log_write_low. The log must be closed with log_close and
-released with log_release.
+Opens the log for log_write_low. The log must be closed with log_close.
@return start lsn of the log record */
UNIV_INTERN
ib_uint64_t
-log_reserve_and_open(
-/*=================*/
+log_open(
+/*=====*/
ulint len) /*!< in: length of data to be catenated */
{
log_t* log = log_sys;
@@ -284,7 +283,6 @@ log_reserve_and_open(
ut_a(len < log->buf_size / 2);
loop:
- mutex_enter(&(log->mutex));
ut_ad(!recv_no_log_write);
/* Calculate an upper limit for the space the string may take in the
@@ -305,6 +303,8 @@ loop:
ut_ad(++count < 50);
+ mutex_enter(&(log->mutex));
+
goto loop;
}
@@ -318,6 +318,8 @@ loop:
os_thread_sleep(10000);
+ mutex_enter(&(log->mutex));
+
goto loop;
}
@@ -338,6 +340,8 @@ loop:
ut_ad(++count < 50);
+ mutex_enter(&(log->mutex));
+
goto loop;
}
}
@@ -494,9 +498,12 @@ log_close(void)
if (tracked_lsn_age >= log->log_group_capacity) {
- fprintf(stderr, " InnoDB: Error: the age of the "
+ fprintf(stderr, "InnoDB: Error: the age of the "
"oldest untracked record exceeds the log "
"group capacity!\n");
+ fprintf(stderr, "InnoDB: Error: stopping the log "
+ "tracking thread at LSN %llu\n", tracked_lsn);
+ srv_track_changed_pages = FALSE;
}
}
diff --git a/storage/xtradb/mtr/mtr0mtr.c b/storage/xtradb/mtr/mtr0mtr.c
index 092bd702115..9eb7b18f301 100644
--- a/storage/xtradb/mtr/mtr0mtr.c
+++ b/storage/xtradb/mtr/mtr0mtr.c
@@ -38,6 +38,25 @@ Created 11/26/1995 Heikki Tuuri
#ifndef UNIV_HOTBACKUP
# include "log0recv.h"
+
+/***************************************************//**
+Checks if a mini-transaction is dirtying a clean page.
+@return TRUE if the mtr is dirtying a clean page. */
+UNIV_INTERN
+ibool
+mtr_block_dirtied(
+/*==============*/
+ const buf_block_t* block) /*!< in: block being x-fixed */
+{
+ ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
+ ut_ad(block->page.buf_fix_count > 0);
+
+ /* It is OK to read oldest_modification because no
+ other thread can be performing a write of it and it
+ is only during write that the value is reset to 0. */
+ return(block->page.oldest_modification == 0);
+}
+
/*****************************************************************//**
Releases the item in the slot given. */
static
@@ -126,7 +145,7 @@ mtr_memo_slot_note_modification(
buf_block_t* block = (buf_block_t*) slot->object;
#ifdef UNIV_DEBUG
- ut_ad(log_flush_order_mutex_own());
+ ut_ad(!mtr->made_dirty || log_flush_order_mutex_own());
#endif /* UNIV_DEBUG */
buf_flush_note_modification(block, mtr);
}
@@ -202,12 +221,14 @@ mtr_log_reserve_and_write(
Add pages to flush list and exit */
goto func_exit;
}
+ } else {
+ mutex_enter(&log_sys->mutex);
}
data_size = dyn_array_get_data_size(mlog);
/* Open the database log for log_write_low */
- mtr->start_lsn = log_reserve_and_open(data_size);
+ mtr->start_lsn = log_open(data_size);
if (mtr->log_mode == MTR_LOG_ALL) {
@@ -226,7 +247,15 @@ mtr_log_reserve_and_write(
mtr->end_lsn = log_close();
func_exit:
- log_flush_order_mutex_enter();
+
+ /* No need to acquire log_flush_order_mutex if this mtr has
+ not dirtied a clean page. log_flush_order_mutex is used to
+ ensure ordered insertions in the flush_list. We need to
+ insert in the flush_list iff the page in question was clean
+ before modifications. */
+ if (mtr->made_dirty) {
+ log_flush_order_mutex_enter();
+ }
/* It is now safe to release the log mutex because the
flush_order mutex will ensure that we are the first one
@@ -237,7 +266,9 @@ func_exit:
mtr_memo_note_modifications(mtr);
}
- log_flush_order_mutex_exit();
+ if (mtr->made_dirty) {
+ log_flush_order_mutex_exit();
+ }
}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/xtradb/os/os0file.c b/storage/xtradb/os/os0file.c
index 97777e21df8..8cdafb0aaef 100644
--- a/storage/xtradb/os/os0file.c
+++ b/storage/xtradb/os/os0file.c
@@ -1467,6 +1467,42 @@ os_file_set_nocache(
#endif
}
+
+#ifdef __linux__
+#include <sys/ioctl.h>
+#ifndef DFS_IOCTL_ATOMIC_WRITE_SET
+#define DFS_IOCTL_ATOMIC_WRITE_SET _IOW(0x95, 2, uint)
+#endif
+static int os_file_set_atomic_writes(os_file_t file, const char *name)
+{
+ int atomic_option = 1;
+
+ int ret = ioctl (file, DFS_IOCTL_ATOMIC_WRITE_SET, &atomic_option);
+
+ if (ret) {
+ fprintf(stderr,
+ "InnoDB : can't use atomic write on %s, errno %d\n",
+ name, errno);
+ return ret;
+ }
+ return ret;
+}
+#else
+static int os_file_set_atomic_writes(os_file_t file, const char *name)
+{
+ fprintf(stderr,
+ "InnoDB : can't use atomic writes on %s - not implemented on this platform."
+ "innodb_use_atomic_writes needs to be 0.\n",
+ name);
+#ifdef _WIN32
+ SetLastError(ERROR_INVALID_FUNCTION);
+#else
+ errno = EINVAL;
+#endif
+ return -1;
+}
+#endif
+
/****************************************************************//**
NOTE! Use the corresponding macro os_file_create(), not directly
this function!
@@ -1631,6 +1667,13 @@ try_again:
}
}
+ if (srv_use_atomic_writes && type == OS_DATA_FILE &&
+ os_file_set_atomic_writes(file, name)) {
+ CloseHandle(file);
+ *success = FALSE;
+ file = INVALID_HANDLE_VALUE;
+ }
+
return(file);
#else /* __WIN__ */
os_file_t file;
@@ -1752,6 +1795,12 @@ try_again:
file = -1;
}
#endif /* USE_FILE_LOCK */
+ if (srv_use_atomic_writes && type == OS_DATA_FILE
+ && os_file_set_atomic_writes(file, name)) {
+ close(file);
+ *success = FALSE;
+ file = -1;
+ }
return(file);
#endif /* __WIN__ */
@@ -2099,6 +2148,28 @@ os_file_set_size(
current_size = 0;
desired_size = (ib_int64_t)size + (((ib_int64_t)size_high) << 32);
+#ifdef HAVE_POSIX_FALLOCATE
+ if (srv_use_posix_fallocate) {
+ if (posix_fallocate(file, current_size, desired_size) == -1) {
+ fprintf(stderr,
+ "InnoDB: Error: preallocating data for"
+ " file %s failed at\n"
+ "InnoDB: offset 0 size %lld %lld. Operating system"
+ " error number %d.\n"
+ "InnoDB: Check that the disk is not full"
+ " or a disk quota exceeded.\n"
+ "InnoDB: Some operating system error numbers"
+ " are described at\n"
+ "InnoDB: "
+ REFMAN "operating-system-error-codes.html\n",
+ name, (long long)size_high, (long long)size, errno);
+
+ return (FALSE);
+ }
+ return (TRUE);
+ }
+#endif
+
/* Write up to 1 megabyte at a time. */
buf_size = ut_min(64, (ulint) (desired_size / UNIV_PAGE_SIZE))
* UNIV_PAGE_SIZE;
diff --git a/storage/xtradb/read/read0read.c b/storage/xtradb/read/read0read.c
index f049dd21e8d..c04dae51ff5 100644
--- a/storage/xtradb/read/read0read.c
+++ b/storage/xtradb/read/read0read.c
@@ -145,14 +145,27 @@ read_view_t*
read_view_create_low(
/*=================*/
ulint n, /*!< in: number of cells in the trx_ids array */
- mem_heap_t* heap) /*!< in: memory heap from which allocated */
+ read_view_t* view) /*!< in: pre-allocated view array or NULL if a
+ new one needs to be created */
{
- read_view_t* view;
+ if (view == NULL) {
+ view = ut_malloc(sizeof(read_view_t));
+ view->max_descr = 0;
+ view->descriptors = NULL;
+ }
+
+ if (UNIV_UNLIKELY(view->max_descr < n)) {
- view = mem_heap_alloc(heap, sizeof(read_view_t));
+ /* avoid frequent re-allocations by extending the array to the
+ desired size + 10% */
+
+ view->max_descr = n + n / 10;
+ view->descriptors = ut_realloc(view->descriptors,
+ view->max_descr *
+ sizeof(trx_id_t));
+ }
- view->n_trx_ids = n;
- view->trx_ids = mem_heap_alloc(heap, n * sizeof *view->trx_ids);
+ view->n_descr = n;
return(view);
}
@@ -169,8 +182,8 @@ read_view_oldest_copy_or_open_new(
/*==============================*/
trx_id_t cr_trx_id, /*!< in: trx_id of creating
transaction, or 0 used in purge */
- mem_heap_t* heap) /*!< in: memory heap from which
- allocated */
+ read_view_t* view) /*!< in: pre-allocated view array or
+ NULL if a new one needs to be created */
{
read_view_t* old_view;
read_view_t* view_copy;
@@ -185,10 +198,10 @@ read_view_oldest_copy_or_open_new(
if (old_view == NULL) {
- return(read_view_open_now(cr_trx_id, heap));
+ return(read_view_open_now(cr_trx_id, view, TRUE));
}
- n = old_view->n_trx_ids;
+ n = old_view->n_descr;
if (old_view->creator_trx_id) {
n++;
@@ -196,7 +209,7 @@ read_view_oldest_copy_or_open_new(
needs_insert = FALSE;
}
- view_copy = read_view_create_low(n, heap);
+ view_copy = read_view_create_low(n, view);
/* Insert the id of the creator in the right place of the descending
array of ids, if needs_insert is TRUE: */
@@ -204,7 +217,7 @@ read_view_oldest_copy_or_open_new(
i = 0;
while (i < n) {
if (needs_insert
- && (i >= old_view->n_trx_ids
+ && (i >= old_view->n_descr
|| old_view->creator_trx_id
> read_view_get_nth_trx_id(old_view, i))) {
@@ -251,16 +264,17 @@ read_view_open_now(
/*===============*/
trx_id_t cr_trx_id, /*!< in: trx_id of creating
transaction, or 0 used in purge */
- mem_heap_t* heap) /*!< in: memory heap from which
- allocated */
+ read_view_t* view, /*!< in: current read view or NULL if it
+ doesn't exist yet */
+ ibool exclude_self) /*!< in: TRUE, if cr_trx_id should be
+ excluded from the resulting view */
{
- read_view_t* view;
- trx_t* trx;
- ulint n;
+ trx_id_t* descr;
+ ulint i;
ut_ad(mutex_own(&kernel_mutex));
- view = read_view_create_low(UT_LIST_GET_LEN(trx_sys->trx_list), heap);
+ view = read_view_create_low(trx_sys->descr_n_used, view);
view->creator_trx_id = cr_trx_id;
view->type = VIEW_NORMAL;
@@ -271,40 +285,58 @@ read_view_open_now(
view->low_limit_no = trx_sys->max_trx_id;
view->low_limit_id = view->low_limit_no;
- n = 0;
- trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
+ /* No active transaction should be visible */
- /* No active transaction should be visible, except cr_trx */
+ descr = trx_find_descriptor(trx_sys->descriptors,
+ trx_sys->descr_n_used,
+ cr_trx_id);
- while (trx) {
- if (trx->id != cr_trx_id
- && (trx->conc_state == TRX_ACTIVE
- || trx->conc_state == TRX_PREPARED)) {
+ if (UNIV_LIKELY(exclude_self && descr != NULL)) {
- read_view_set_nth_trx_id(view, n, trx->id);
+ ut_ad(trx_sys->descr_n_used > 0);
+ ut_ad(view->n_descr > 0);
- n++;
+ view->n_descr--;
- /* NOTE that a transaction whose trx number is <
- trx_sys->max_trx_id can still be active, if it is
- in the middle of its commit! Note that when a
- transaction starts, we initialize trx->no to
- IB_ULONGLONG_MAX. */
+ i = descr - trx_sys->descriptors;
+ } else {
+ i = trx_sys->descr_n_used;
+ }
- if (view->low_limit_no > trx->no) {
+ if (UNIV_LIKELY(i > 0)) {
- view->low_limit_no = trx->no;
- }
- }
+ /* Copy the [0; i-1] range */
+ memcpy(view->descriptors, trx_sys->descriptors,
+ i * sizeof(trx_id_t));
+ }
- trx = UT_LIST_GET_NEXT(trx_list, trx);
+ if (UNIV_UNLIKELY(i + 1 < trx_sys->descr_n_used)) {
+
+ /* Copy the [i+1; descr_n_used-1] range */
+ memcpy(view->descriptors + i,
+ trx_sys->descriptors + i + 1,
+ (trx_sys->descr_n_used - i - 1) *
+ sizeof(trx_id_t));
}
- view->n_trx_ids = n;
+ /* NOTE that a transaction whose trx number is < trx_sys->max_trx_id can
+ still be active, if it is in the middle of its commit! Note that when a
+ transaction starts, we initialize trx->no to IB_ULONGLONG_MAX. */
- if (n > 0) {
+ if (UT_LIST_GET_LEN(trx_sys->trx_serial_list) > 0) {
+
+ trx_id_t trx_no;
+
+ trx_no = UT_LIST_GET_FIRST(trx_sys->trx_serial_list)->no;
+
+ if (trx_no < view->low_limit_no) {
+ view->low_limit_no = trx_no;
+ }
+ }
+
+ if (UNIV_LIKELY(view->n_descr > 0)) {
/* The last active transaction has the smallest id: */
- view->up_limit_id = read_view_get_nth_trx_id(view, n - 1);
+ view->up_limit_id = view->descriptors[0];
} else {
view->up_limit_id = view->low_limit_id;
}
@@ -329,6 +361,23 @@ read_view_close(
}
/*********************************************************************//**
+Frees resource allocated by a read view. */
+UNIV_INTERN
+void
+read_view_free(
+/*===========*/
+ read_view_t* view) /*< in: read view */
+{
+ ut_ad(mutex_own(&kernel_mutex));
+
+ if (view->descriptors != NULL) {
+ ut_free(view->descriptors);
+ }
+
+ ut_free(view);
+}
+
+/*********************************************************************//**
Closes a consistent read view for MySQL. This function is called at an SQL
statement end if the trx isolation level is <= TRX_ISO_READ_COMMITTED. */
UNIV_INTERN
@@ -343,8 +392,6 @@ read_view_close_for_mysql(
read_view_close(trx->global_read_view);
- mem_heap_empty(trx->global_read_view_heap);
-
trx->read_view = NULL;
trx->global_read_view = NULL;
@@ -382,7 +429,7 @@ read_view_print(
fprintf(file, "Read view individually stored trx ids:\n");
- n_ids = view->n_trx_ids;
+ n_ids = view->n_descr;
for (i = 0; i < n_ids; i++) {
fprintf(file, "Read view trx id " TRX_ID_FMT "\n",
@@ -404,8 +451,6 @@ read_cursor_view_create_for_mysql(
cursor_view_t* curview;
read_view_t* view;
mem_heap_t* heap;
- trx_t* trx;
- ulint n;
ut_a(cr_trx);
@@ -424,61 +469,14 @@ read_cursor_view_create_for_mysql(
mutex_enter(&kernel_mutex);
- curview->read_view = read_view_create_low(
- UT_LIST_GET_LEN(trx_sys->trx_list), curview->heap);
+ curview->read_view = read_view_open_now(cr_trx->id, NULL, FALSE);
+
+ mutex_exit(&kernel_mutex);
view = curview->read_view;
- view->creator_trx_id = cr_trx->id;
view->type = VIEW_HIGH_GRANULARITY;
view->undo_no = cr_trx->undo_no;
- /* No future transactions should be visible in the view */
-
- view->low_limit_no = trx_sys->max_trx_id;
- view->low_limit_id = view->low_limit_no;
-
- n = 0;
- trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
-
- /* No active transaction should be visible */
-
- while (trx) {
-
- if (trx->conc_state == TRX_ACTIVE
- || trx->conc_state == TRX_PREPARED) {
-
- read_view_set_nth_trx_id(view, n, trx->id);
-
- n++;
-
- /* NOTE that a transaction whose trx number is <
- trx_sys->max_trx_id can still be active, if it is
- in the middle of its commit! Note that when a
- transaction starts, we initialize trx->no to
- IB_ULONGLONG_MAX. */
-
- if (view->low_limit_no > trx->no) {
-
- view->low_limit_no = trx->no;
- }
- }
-
- trx = UT_LIST_GET_NEXT(trx_list, trx);
- }
-
- view->n_trx_ids = n;
-
- if (n > 0) {
- /* The last active transaction has the smallest id: */
- view->up_limit_id = read_view_get_nth_trx_id(view, n - 1);
- } else {
- view->up_limit_id = view->low_limit_id;
- }
-
- UT_LIST_ADD_FIRST(view_list, trx_sys->view_list, view);
-
- mutex_exit(&kernel_mutex);
-
return(curview);
}
@@ -503,6 +501,8 @@ read_cursor_view_close_for_mysql(
mutex_enter(&kernel_mutex);
read_view_close(curview->read_view);
+ read_view_free(curview->read_view);
+
trx->read_view = trx->global_read_view;
mutex_exit(&kernel_mutex);
diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c
index b459019a257..925446e4722 100644
--- a/storage/xtradb/row/row0ins.c
+++ b/storage/xtradb/row/row0ins.c
@@ -1364,11 +1364,11 @@ run_again:
const rec_t* rec = btr_pcur_get_rec(&pcur);
const buf_block_t* block = btr_pcur_get_block(&pcur);
- if (srv_pass_corrupt_table && !block) {
+ SRV_CORRUPT_TABLE_CHECK(block,
+ {
err = DB_CORRUPTION;
- break;
- }
- ut_a(block);
+ goto exit_loop;
+ });
if (page_rec_is_infimum(rec)) {
@@ -1499,6 +1499,7 @@ run_again:
}
} while (btr_pcur_move_to_next(&pcur, &mtr));
+exit_loop:
if (check_ref) {
row_ins_foreign_report_add_err(
trx, foreign, btr_pcur_get_rec(&pcur), entry);
diff --git a/storage/xtradb/row/row0merge.c b/storage/xtradb/row/row0merge.c
index 0b6a6302854..40e7d99b839 100644
--- a/storage/xtradb/row/row0merge.c
+++ b/storage/xtradb/row/row0merge.c
@@ -1298,11 +1298,11 @@ row_merge_read_clustered_index(
if (UNIV_LIKELY(has_next)) {
rec = btr_pcur_get_rec(&pcur);
- if (srv_pass_corrupt_table && !rec) {
+ SRV_CORRUPT_TABLE_CHECK(rec,
+ {
err = DB_CORRUPTION;
goto err_exit;
- }
- ut_a(rec);
+ });
offsets = rec_get_offsets(rec, clust_index, NULL,
ULINT_UNDEFINED, &row_heap);
diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c
index 858d50fd5a6..dec192585ce 100644
--- a/storage/xtradb/row/row0sel.c
+++ b/storage/xtradb/row/row0sel.c
@@ -3952,9 +3952,9 @@ release_search_latch_if_needed:
trx->has_search_latch = FALSE;
}
- ut_ad(prebuilt->sql_stat_start || trx->conc_state == TRX_ACTIVE);
- ut_ad(trx->conc_state == TRX_NOT_STARTED
- || trx->conc_state == TRX_ACTIVE);
+ ut_ad(prebuilt->sql_stat_start || trx->state == TRX_ACTIVE);
+ ut_ad(trx->state == TRX_NOT_STARTED
+ || trx->state == TRX_ACTIVE);
ut_ad(prebuilt->sql_stat_start
|| prebuilt->select_lock_type != LOCK_NONE
|| trx->read_view);
@@ -4137,11 +4137,11 @@ rec_loop:
rec = btr_pcur_get_rec(pcur);
- if (srv_pass_corrupt_table && !rec) {
+ SRV_CORRUPT_TABLE_CHECK(rec,
+ {
err = DB_CORRUPTION;
goto lock_wait_or_error;
- }
- ut_a(rec);
+ });
ut_ad(!!page_rec_is_comp(rec) == comp);
#ifdef UNIV_SEARCH_DEBUG
@@ -4278,8 +4278,9 @@ wrong_offs:
offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
- if (UNIV_UNLIKELY(srv_force_recovery > 0)
- || (srv_pass_corrupt_table == 2 && index->table->is_corrupt)) {
+ if (UNIV_UNLIKELY(srv_force_recovery > 0
+ || (index->table->is_corrupt &&
+ srv_pass_corrupt_table == 2))) {
if (!rec_validate(rec, offsets)
|| !btr_index_rec_validate(rec, index, FALSE)) {
fprintf(stderr,
@@ -5092,8 +5093,10 @@ row_search_check_if_query_cache_permitted(
if (trx->isolation_level >= TRX_ISO_REPEATABLE_READ
&& !trx->read_view) {
- trx->read_view = read_view_open_now(
- trx->id, trx->global_read_view_heap);
+ trx->read_view =
+ read_view_open_now(trx->id,
+ NULL, TRUE);
+
trx->global_read_view = trx->read_view;
}
}
diff --git a/storage/xtradb/row/row0vers.c b/storage/xtradb/row/row0vers.c
index 6d83dbaf8ee..3fd13b829a2 100644
--- a/storage/xtradb/row/row0vers.c
+++ b/storage/xtradb/row/row0vers.c
@@ -667,9 +667,9 @@ row_vers_build_for_semi_consistent_read(
mutex_enter(&kernel_mutex);
version_trx = trx_get_on_id(version_trx_id);
- if (version_trx
- && (version_trx->conc_state == TRX_COMMITTED_IN_MEMORY
- || version_trx->conc_state == TRX_NOT_STARTED)) {
+ if (version_trx &&
+ (version_trx->state == TRX_COMMITTED_IN_MEMORY
+ || version_trx->state == TRX_NOT_STARTED)) {
version_trx = NULL;
}
diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c
index 4ddb03f671d..83332ea6775 100644
--- a/storage/xtradb/srv/srv0srv.c
+++ b/storage/xtradb/srv/srv0srv.c
@@ -420,6 +420,10 @@ UNIV_INTERN ulong srv_sys_stats_root_page = 0;
#endif
UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
+UNIV_INTERN ibool srv_use_atomic_writes = FALSE;
+#ifdef HAVE_POSIX_FALLOCATE
+UNIV_INTERN ibool srv_use_posix_fallocate = TRUE;
+#endif
UNIV_INTERN ibool srv_use_checksums = TRUE;
UNIV_INTERN ibool srv_fast_checksum = FALSE;
@@ -441,8 +445,6 @@ UNIV_INTERN ulong srv_expand_import = 0; /* 0:disable 1:enable */
UNIV_INTERN ulong srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_dict_size_limit = 0;
-
-UNIV_INTERN ulint srv_lazy_drop_table = 0;
/*-------------------------------------------*/
UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
@@ -3071,7 +3073,7 @@ rescan_idle:
mutex_enter(&kernel_mutex);
trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list);
while (trx) {
- if (trx->conc_state == TRX_ACTIVE
+ if (trx->state == TRX_ACTIVE
&& trx->mysql_thd
&& innobase_thd_is_idle(trx->mysql_thd)) {
ib_int64_t start_time = innobase_thd_get_start_time(trx->mysql_thd);
diff --git a/storage/xtradb/sync/sync0sync.c b/storage/xtradb/sync/sync0sync.c
index efc43c4cbe5..25f96d9817a 100644
--- a/storage/xtradb/sync/sync0sync.c
+++ b/storage/xtradb/sync/sync0sync.c
@@ -315,9 +315,9 @@ mutex_create_func(
/* NOTE! The very first mutexes are not put to the mutex list */
- if ((mutex == &mutex_list_mutex)
+ if (mutex == &mutex_list_mutex
#ifdef UNIV_SYNC_DEBUG
- || (mutex == &sync_thread_mutex)
+ || mutex == &sync_thread_mutex
#endif /* UNIV_SYNC_DEBUG */
) {
diff --git a/storage/xtradb/trx/trx0purge.c b/storage/xtradb/trx/trx0purge.c
index b048dc66efe..1e119c6828b 100644
--- a/storage/xtradb/trx/trx0purge.c
+++ b/storage/xtradb/trx/trx0purge.c
@@ -263,8 +263,9 @@ trx_purge_sys_create(
purge_sys->query = trx_purge_graph_build();
- purge_sys->view = read_view_oldest_copy_or_open_new(0,
- purge_sys->heap);
+ purge_sys->prebuilt_view =
+ read_view_oldest_copy_or_open_new(0, NULL);
+ purge_sys->view = purge_sys->prebuilt_view;
}
/************************************************************************
@@ -279,7 +280,12 @@ trx_purge_sys_close(void)
que_graph_free(purge_sys->query);
ut_a(purge_sys->sess->trx->is_purge);
- purge_sys->sess->trx->conc_state = TRX_NOT_STARTED;
+ purge_sys->sess->trx->state = TRX_NOT_STARTED;
+
+ mutex_enter(&kernel_mutex);
+ trx_release_descriptor(purge_sys->sess->trx);
+ mutex_exit(&kernel_mutex);
+
sess_close(purge_sys->sess);
purge_sys->sess = NULL;
@@ -289,6 +295,8 @@ trx_purge_sys_close(void)
mutex_enter(&kernel_mutex);
read_view_close(purge_sys->view);
+ read_view_free(purge_sys->prebuilt_view);
+ purge_sys->prebuilt_view = NULL;
purge_sys->view = NULL;
mutex_exit(&kernel_mutex);
@@ -1177,7 +1185,7 @@ trx_purge(
}
purge_sys->view = read_view_oldest_copy_or_open_new(
- 0, purge_sys->heap);
+ 0, purge_sys->prebuilt_view);
mutex_exit(&kernel_mutex);
diff --git a/storage/xtradb/trx/trx0roll.c b/storage/xtradb/trx/trx0roll.c
index 3db63469cbe..4f001a91669 100644
--- a/storage/xtradb/trx/trx0roll.c
+++ b/storage/xtradb/trx/trx0roll.c
@@ -135,7 +135,7 @@ trx_rollback_for_mysql(
{
int err;
- if (trx->conc_state == TRX_NOT_STARTED) {
+ if (trx->state == TRX_NOT_STARTED) {
return(DB_SUCCESS);
}
@@ -170,7 +170,7 @@ trx_rollback_last_sql_stat_for_mysql(
{
int err;
- if (trx->conc_state == TRX_NOT_STARTED) {
+ if (trx->state == TRX_NOT_STARTED) {
return(DB_SUCCESS);
}
@@ -278,7 +278,7 @@ trx_rollback_to_savepoint_for_mysql(
return(DB_NO_SAVEPOINT);
}
- if (trx->conc_state == TRX_NOT_STARTED) {
+ if (trx->state == TRX_NOT_STARTED) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: transaction has a savepoint ", stderr);
ut_print_name(stderr, trx, FALSE, savep->name);
@@ -575,7 +575,7 @@ loop:
continue;
}
- switch (trx->conc_state) {
+ switch (trx->state) {
case TRX_NOT_STARTED:
case TRX_PREPARED:
continue;
diff --git a/storage/xtradb/trx/trx0sys.c b/storage/xtradb/trx/trx0sys.c
index 59b7da4083d..975e0caed60 100644
--- a/storage/xtradb/trx/trx0sys.c
+++ b/storage/xtradb/trx/trx0sys.c
@@ -1406,6 +1406,12 @@ trx_sys_init_at_db_start(void)
trx_sys = mem_zalloc(sizeof(*trx_sys));
+ /* Allocate the trx descriptors array */
+ trx_sys->descriptors = ut_malloc(sizeof(trx_id_t) *
+ TRX_DESCR_ARRAY_INITIAL_SIZE);
+ trx_sys->descr_n_max = TRX_DESCR_ARRAY_INITIAL_SIZE;
+ trx_sys->descr_n_used = 0;
+
sys_header = trx_sysf_get(&mtr);
trx_rseg_list_and_array_init(sys_header, ib_bh, &mtr);
@@ -1433,7 +1439,7 @@ trx_sys_init_at_db_start(void)
for (;;) {
- if (trx->conc_state != TRX_PREPARED) {
+ if (trx->state != TRX_PREPARED) {
rows_to_undo += trx->undo_no;
}
@@ -2115,6 +2121,9 @@ trx_sys_close(void)
ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0);
ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0);
+ ut_ad(trx_sys->descr_n_used == 0);
+ ut_free(trx_sys->descriptors);
+
mem_free(trx_sys);
trx_sys = NULL;
diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c
index 9d598db43ba..e74644943e0 100644
--- a/storage/xtradb/trx/trx0trx.c
+++ b/storage/xtradb/trx/trx0trx.c
@@ -85,6 +85,126 @@ trx_set_detailed_error_from_file(
sizeof(trx->detailed_error));
}
+/*************************************************************//**
+Callback function for trx_find_descriptor() to compare trx IDs. */
+UNIV_INTERN
+int
+trx_descr_cmp(
+/*==========*/
+ const void *a, /*!< in: pointer to first comparison argument */
+ const void *b) /*!< in: pointer to second comparison argument */
+{
+ const trx_id_t* da = (const trx_id_t*) a;
+ const trx_id_t* db = (const trx_id_t*) b;
+
+ if (*da < *db) {
+ return -1;
+ } else if (*da > *db) {
+ return 1;
+ }
+
+ return 0;
+}
+
+/*************************************************************//**
+Reserve a slot for a given trx in the global descriptors array. */
+UNIV_INLINE
+void
+trx_reserve_descriptor(
+/*===================*/
+ const trx_t* trx) /*!< in: trx pointer */
+{
+ ulint n_used;
+ ulint n_max;
+ trx_id_t* descr;
+
+ ut_ad(mutex_own(&kernel_mutex));
+ ut_ad(!trx_find_descriptor(trx_sys->descriptors,
+ trx_sys->descr_n_used,
+ trx->id));
+
+ n_used = trx_sys->descr_n_used + 1;
+ n_max = trx_sys->descr_n_max;
+
+ if (UNIV_UNLIKELY(n_used > n_max)) {
+
+ n_max = n_max * 2;
+
+ trx_sys->descriptors =
+ ut_realloc(trx_sys->descriptors,
+ n_max * sizeof(trx_id_t));
+
+ trx_sys->descr_n_max = n_max;
+ }
+
+ descr = trx_sys->descriptors + n_used - 1;
+
+ if (UNIV_UNLIKELY(n_used > 1 && trx->id < descr[-1])) {
+
+ /* Find the slot where it should be inserted. We could use a
+ binary search, but in reality linear search should be faster,
+ because the slot we are looking for is near the array end. */
+
+ trx_id_t* tdescr;
+
+ for (tdescr = descr - 1;
+ tdescr >= trx_sys->descriptors && *tdescr > trx->id;
+ tdescr--) {
+ }
+
+ tdescr++;
+
+ ut_memmove(tdescr + 1, tdescr, (descr - tdescr) *
+ sizeof(trx_id_t));
+
+ descr = tdescr;
+ }
+
+ *descr = trx->id;
+
+ trx_sys->descr_n_used = n_used;
+}
+
+/*************************************************************//**
+Release a slot for a given trx in the global descriptors array. */
+UNIV_INTERN
+void
+trx_release_descriptor(
+/*===================*/
+ trx_t* trx) /*!< in: trx pointer */
+{
+ ulint size;
+ trx_id_t* descr;
+
+ ut_ad(mutex_own(&kernel_mutex));
+
+ if (UNIV_LIKELY(trx->is_in_trx_serial_list)) {
+
+ UT_LIST_REMOVE(trx_serial_list, trx_sys->trx_serial_list,
+ trx);
+ trx->is_in_trx_serial_list = 0;
+ }
+
+ descr = trx_find_descriptor(trx_sys->descriptors,
+ trx_sys->descr_n_used,
+ trx->id);
+
+ if (UNIV_UNLIKELY(descr == NULL)) {
+
+ return;
+ }
+
+ size = (trx_sys->descriptors + trx_sys->descr_n_used - 1 - descr) *
+ sizeof(trx_id_t);
+
+ if (UNIV_LIKELY(size > 0)) {
+
+ ut_memmove(descr, descr + 1, size);
+ }
+
+ trx_sys->descr_n_used--;
+}
+
/****************************************************************//**
Creates and initializes a transaction object.
@return own: the transaction */
@@ -107,7 +227,7 @@ trx_create(
trx->is_purge = 0;
trx->is_recovered = 0;
- trx->conc_state = TRX_NOT_STARTED;
+ trx->state = TRX_NOT_STARTED;
trx->is_registered = 0;
trx->active_commit_ordered = 0;
@@ -118,6 +238,7 @@ trx_create(
trx->id = 0;
trx->no = IB_ULONGLONG_MAX;
+ trx->is_in_trx_serial_list = 0;
trx->support_xa = TRUE;
@@ -189,9 +310,9 @@ trx_create(
trx->declared_to_be_inside_innodb = FALSE;
trx->n_tickets_to_enter_innodb = 0;
- trx->global_read_view_heap = mem_heap_create(256);
trx->global_read_view = NULL;
trx->read_view = NULL;
+ trx->prebuilt_view = NULL;
trx->io_reads = 0;
trx->io_read = 0;
@@ -330,7 +451,7 @@ trx_free(
trx->magic_n = 11112222;
- ut_a(trx->conc_state == TRX_NOT_STARTED);
+ ut_a(trx->state == TRX_NOT_STARTED);
mutex_free(&(trx->undo_mutex));
@@ -357,18 +478,18 @@ trx_free(
ut_a(UT_LIST_GET_LEN(trx->trx_locks) == 0);
- if (trx->global_read_view_heap) {
- mem_heap_free(trx->global_read_view_heap);
+ if (trx->prebuilt_view != NULL) {
+ read_view_free(trx->prebuilt_view);
}
- trx->global_read_view = NULL;
-
ut_a(trx->read_view == NULL);
ut_a(ib_vector_is_empty(trx->autoinc_locks));
/* We allocated a dedicated heap for the vector. */
ib_vector_free(trx->autoinc_locks);
+ trx_release_descriptor(trx);
+
mem_free(trx);
}
@@ -381,7 +502,7 @@ trx_free_prepared(
trx_t* trx) /*!< in, own: trx object */
{
ut_ad(mutex_own(&kernel_mutex));
- ut_a(trx->conc_state == TRX_PREPARED);
+ ut_a(trx->state == TRX_PREPARED);
ut_a(trx->magic_n == TRX_MAGIC_N);
/* Prepared transactions are sort of active; they allow
@@ -414,15 +535,19 @@ trx_free_prepared(
mem_heap_free(trx->lock_heap);
}
- if (trx->global_read_view_heap) {
- mem_heap_free(trx->global_read_view_heap);
- }
-
ut_a(ib_vector_is_empty(trx->autoinc_locks));
ib_vector_free(trx->autoinc_locks);
+ trx_release_descriptor(trx);
+
+ if (trx->prebuilt_view != NULL) {
+ read_view_free(trx->prebuilt_view);
+ }
+
UT_LIST_REMOVE(trx_list, trx_sys->trx_list, trx);
+ ut_ad(trx_sys->descr_n_used <= UT_LIST_GET_LEN(trx_sys->trx_list));
+
mem_free(trx);
}
@@ -531,6 +656,7 @@ trx_lists_init_at_db_start(void)
ut_ad(mutex_own(&kernel_mutex));
UT_LIST_INIT(trx_sys->trx_list);
+ UT_LIST_INIT(trx_sys->trx_serial_list);
/* Look from the rollback segments if there exist undo logs for
transactions */
@@ -567,7 +693,7 @@ trx_lists_init_at_db_start(void)
if (srv_force_recovery == 0) {
- trx->conc_state = TRX_PREPARED;
+ trx->state = TRX_PREPARED;
trx_n_prepared++;
} else {
fprintf(stderr,
@@ -577,11 +703,12 @@ trx_lists_init_at_db_start(void)
" rollback it"
" anyway.\n");
- trx->conc_state = TRX_ACTIVE;
+ trx->state = TRX_ACTIVE;
}
+
+ trx_reserve_descriptor(trx);
} else {
- trx->conc_state
- = TRX_COMMITTED_IN_MEMORY;
+ trx->state = TRX_COMMITTED_IN_MEMORY;
}
/* We give a dummy value for the trx no;
@@ -593,12 +720,15 @@ trx_lists_init_at_db_start(void)
trx->no = trx->id;
} else {
- trx->conc_state = TRX_ACTIVE;
+ trx->state = TRX_ACTIVE;
/* A running transaction always has the number
field inited to IB_ULONGLONG_MAX */
trx->no = IB_ULONGLONG_MAX;
+
+ trx_reserve_descriptor(trx);
+
}
if (undo->dict_operation) {
@@ -643,7 +773,7 @@ trx_lists_init_at_db_start(void)
if (srv_force_recovery == 0) {
- trx->conc_state
+ trx->state
= TRX_PREPARED;
trx_n_prepared++;
} else {
@@ -654,11 +784,12 @@ trx_lists_init_at_db_start(void)
" rollback it"
" anyway.\n");
- trx->conc_state
- = TRX_ACTIVE;
+ trx->state = TRX_ACTIVE;
+ trx_reserve_descriptor(
+ trx);
}
} else {
- trx->conc_state
+ trx->state
= TRX_COMMITTED_IN_MEMORY;
}
@@ -667,13 +798,14 @@ trx_lists_init_at_db_start(void)
trx->no = trx->id;
} else {
- trx->conc_state = TRX_ACTIVE;
-
+ trx->state = TRX_ACTIVE;
/* A running transaction always has
the number field inited to
IB_ULONGLONG_MAX */
trx->no = IB_ULONGLONG_MAX;
+
+ trx_reserve_descriptor(trx);
}
trx->rseg = rseg;
@@ -744,13 +876,15 @@ trx_start_low(
if (trx->is_purge) {
trx->id = 0;
- trx->conc_state = TRX_ACTIVE;
+ /* Don't reserve a descriptor, since this trx is not added to
+ trx_list. */
+ trx->state = TRX_ACTIVE;
trx->start_time = time(NULL);
return(TRUE);
}
- ut_ad(trx->conc_state != TRX_ACTIVE);
+ ut_ad(trx->state != TRX_ACTIVE);
ut_a(rseg_id == ULINT_UNDEFINED);
@@ -770,7 +904,10 @@ trx_start_low(
trx->rseg = rseg;
- trx->conc_state = TRX_ACTIVE;
+ trx->state = TRX_ACTIVE;
+
+ trx_reserve_descriptor(trx);
+
trx->start_time = time(NULL);
UT_LIST_ADD_FIRST(trx_list, trx_sys->trx_list, trx);
@@ -827,6 +964,14 @@ trx_serialisation_number_get(
trx->no = trx_sys_get_new_trx_id();
+ if (UNIV_LIKELY(trx->is_in_trx_serial_list == 0)) {
+
+ UT_LIST_ADD_LAST(trx_serial_list, trx_sys->trx_serial_list,
+ trx);
+
+ trx->is_in_trx_serial_list = 1;
+ }
+
/* If the rollack segment is not empty then the
new trx_t::no can't be less than any trx_t::no
already in the rollback segment. User threads only
@@ -1016,10 +1161,10 @@ trx_commit_off_kernel(
lsn = 0;
}
- ut_ad(trx->conc_state == TRX_ACTIVE || trx->conc_state == TRX_PREPARED);
+ ut_ad(trx->state == TRX_ACTIVE || trx->state == TRX_PREPARED);
ut_ad(mutex_own(&kernel_mutex));
- if (UNIV_UNLIKELY(trx->conc_state == TRX_PREPARED)) {
+ if (UNIV_UNLIKELY(trx->state == TRX_PREPARED)) {
ut_a(trx_n_prepared > 0);
trx_n_prepared--;
}
@@ -1039,7 +1184,9 @@ trx_commit_off_kernel(
committed. */
/*--------------------------------------*/
- trx->conc_state = TRX_COMMITTED_IN_MEMORY;
+ trx->state = TRX_COMMITTED_IN_MEMORY;
+ /* The following also removes trx from trx_serial_list */
+ trx_release_descriptor(trx);
/*--------------------------------------*/
/* If we release kernel_mutex below and we are still doing
@@ -1060,7 +1207,6 @@ trx_commit_off_kernel(
if (trx->global_read_view) {
read_view_close(trx->global_read_view);
- mem_heap_empty(trx->global_read_view_heap);
trx->global_read_view = NULL;
}
@@ -1146,7 +1292,7 @@ trx_commit_off_kernel(
/* Free all savepoints */
trx_roll_free_all_savepoints(trx);
- trx->conc_state = TRX_NOT_STARTED;
+ trx->state = TRX_NOT_STARTED;
trx->rseg = NULL;
trx->undo_no = 0;
trx->last_sql_stat_start.least_undo_no = 0;
@@ -1162,6 +1308,8 @@ trx_commit_off_kernel(
#endif
UT_LIST_REMOVE(trx_list, trx_sys->trx_list, trx);
+ ut_ad(trx_sys->descr_n_used <= UT_LIST_GET_LEN(trx_sys->trx_list));
+
trx->error_state = DB_SUCCESS;
}
@@ -1180,12 +1328,15 @@ trx_cleanup_at_db_startup(
trx_undo_insert_cleanup(trx);
}
- trx->conc_state = TRX_NOT_STARTED;
+ trx->state = TRX_NOT_STARTED;
+ trx_release_descriptor(trx);
trx->rseg = NULL;
trx->undo_no = 0;
trx->last_sql_stat_start.least_undo_no = 0;
UT_LIST_REMOVE(trx_list, trx_sys->trx_list, trx);
+
+ ut_ad(trx_sys->descr_n_used <= UT_LIST_GET_LEN(trx_sys->trx_list));
}
/********************************************************************//**
@@ -1199,7 +1350,7 @@ trx_assign_read_view(
/*=================*/
trx_t* trx) /*!< in: active transaction */
{
- ut_ad(trx->conc_state == TRX_ACTIVE);
+ ut_ad(trx->state == TRX_ACTIVE);
if (trx->read_view) {
return(trx->read_view);
@@ -1207,11 +1358,9 @@ trx_assign_read_view(
mutex_enter(&kernel_mutex);
- if (!trx->read_view) {
- trx->read_view = read_view_open_now(
- trx->id, trx->global_read_view_heap);
- trx->global_read_view = trx->read_view;
- }
+ trx->read_view = read_view_open_now(trx->id, trx->prebuilt_view, TRUE);
+ trx->prebuilt_view = trx->read_view;
+ trx->global_read_view = trx->read_view;
mutex_exit(&kernel_mutex);
@@ -1576,7 +1725,7 @@ loop:
return;
}
- if (trx->conc_state == TRX_NOT_STARTED) {
+ if (trx->state == TRX_NOT_STARTED) {
trx_start_low(trx, ULINT_UNDEFINED);
}
@@ -1868,7 +2017,7 @@ trx_mark_sql_stat_end(
{
ut_a(trx);
- if (trx->conc_state == TRX_NOT_STARTED) {
+ if (trx->state == TRX_NOT_STARTED) {
trx->undo_no = 0;
}
@@ -1891,7 +2040,7 @@ trx_print(
fprintf(f, "TRANSACTION " TRX_ID_FMT, (ullint) trx->id);
- switch (trx->conc_state) {
+ switch (trx->state) {
case TRX_NOT_STARTED:
fputs(", not started", f);
break;
@@ -1907,7 +2056,7 @@ trx_print(
fputs(", COMMITTED IN MEMORY", f);
break;
default:
- fprintf(f, " state %lu", (ulong) trx->conc_state);
+ fprintf(f, " state %lu", (ulong) trx->state);
}
if (*trx->op_info) {
@@ -2102,7 +2251,11 @@ trx_prepare_off_kernel(
ut_ad(mutex_own(&kernel_mutex));
/*--------------------------------------*/
- trx->conc_state = TRX_PREPARED;
+ if (UNIV_UNLIKELY(trx->state != TRX_ACTIVE)) {
+
+ trx_reserve_descriptor(trx);
+ }
+ trx->state = TRX_PREPARED;
trx_n_prepared++;
/*--------------------------------------*/
@@ -2216,7 +2369,7 @@ trx_recover_for_mysql(
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
while (trx) {
- if (trx->conc_state == TRX_PREPARED) {
+ if (trx->state == TRX_PREPARED) {
xid_list[count] = trx->xid;
if (count == 0) {
@@ -2289,7 +2442,7 @@ trx_get_trx_by_xid(
the same */
if (trx->is_recovered
- && trx->conc_state == TRX_PREPARED
+ && trx->state == TRX_PREPARED
&& xid->gtrid_length == trx->xid.gtrid_length
&& xid->bqual_length == trx->xid.bqual_length
&& memcmp(xid->data, trx->xid.data,
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index d28d576c661..88a7f8b84e8 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -318,13 +318,16 @@ void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)),
#define INC_PTR(cs,A,B) (A)++
-int my_wildcmp_bin(CHARSET_INFO *cs,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many)
+static
+int my_wildcmp_bin_impl(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many, int recurse_level)
{
int result= -1; /* Not found, using wildcards */
-
+
+ if (my_string_stack_guard && my_string_stack_guard(recurse_level))
+ return 1;
while (wildstr != wildend)
{
while (*wildstr != w_many && *wildstr != w_one)
@@ -383,8 +386,8 @@ int my_wildcmp_bin(CHARSET_INFO *cs,
if (str++ == str_end)
return(-1);
{
- int tmp=my_wildcmp_bin(cs,str,str_end,wildstr,wildend,escape,w_one,
- w_many);
+ int tmp=my_wildcmp_bin_impl(cs,str,str_end,wildstr,wildend,escape,w_one,
+ w_many, recurse_level + 1);
if (tmp <= 0)
return(tmp);
}
@@ -395,6 +398,16 @@ int my_wildcmp_bin(CHARSET_INFO *cs,
return(str != str_end ? 1 : 0);
}
+int my_wildcmp_bin(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
+{
+ return my_wildcmp_bin_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, 1);
+}
+
static size_t my_strnxfrm_bin(CHARSET_INFO *cs __attribute__((unused)),
uchar *dest, size_t dstlen,
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index 5879bdf7978..0c0332ea3da 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -251,13 +251,16 @@ int my_strcasecmp_mb(CHARSET_INFO * cs,const char *s, const char *t)
#define likeconv(s,A) (uchar) (s)->sort_order[(uchar) (A)]
-int my_wildcmp_mb(CHARSET_INFO *cs,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many)
+static
+int my_wildcmp_mb_impl(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many, int recurse_level)
{
int result= -1; /* Not found, using wildcards */
+ if (my_string_stack_guard && my_string_stack_guard(recurse_level))
+ return 1;
while (wildstr != wildend)
{
while (*wildstr != w_many && *wildstr != w_one)
@@ -346,8 +349,8 @@ int my_wildcmp_mb(CHARSET_INFO *cs,
INC_PTR(cs,str, str_end);
}
{
- int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,
- w_many);
+ int tmp=my_wildcmp_mb_impl(cs,str,str_end,wildstr,wildend,escape,w_one,
+ w_many, recurse_level + 1);
if (tmp <= 0)
return (tmp);
}
@@ -358,6 +361,16 @@ int my_wildcmp_mb(CHARSET_INFO *cs,
return (str != str_end ? 1 : 0);
}
+int my_wildcmp_mb(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
+{
+ return my_wildcmp_mb_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, 1);
+}
+
size_t my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)),
const char *pos, const char *end)
@@ -987,14 +1000,15 @@ pad_min_max:
}
-int
-my_wildcmp_mb_bin(CHARSET_INFO *cs,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many)
+static int my_wildcmp_mb_bin_impl(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many, int recurse_level)
{
int result= -1; /* Not found, using wildcards */
+ if (my_string_stack_guard && my_string_stack_guard(recurse_level))
+ return 1;
while (wildstr != wildend)
{
while (*wildstr != w_many && *wildstr != w_one)
@@ -1081,7 +1095,9 @@ my_wildcmp_mb_bin(CHARSET_INFO *cs,
INC_PTR(cs,str, str_end);
}
{
- int tmp=my_wildcmp_mb_bin(cs,str,str_end,wildstr,wildend,escape,w_one,w_many);
+ int tmp=my_wildcmp_mb_bin_impl(cs,str,str_end,
+ wildstr,wildend,escape,
+ w_one,w_many, recurse_level+1);
if (tmp <= 0)
return (tmp);
}
@@ -1092,6 +1108,17 @@ my_wildcmp_mb_bin(CHARSET_INFO *cs,
return (str != str_end ? 1 : 0);
}
+int
+my_wildcmp_mb_bin(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
+{
+ return my_wildcmp_mb_bin_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, 1);
+}
+
/*
Data was produced from EastAsianWidth.txt
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index e25c0783abf..3cd6805158e 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -847,13 +847,16 @@ cnv:
#define INC_PTR(cs,A,B) (A)++
-int my_wildcmp_8bit(CHARSET_INFO *cs,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many)
+static
+int my_wildcmp_8bit_impl(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many, int recurse_level)
{
int result= -1; /* Not found, using wildcards */
+ if (my_string_stack_guard && my_string_stack_guard(recurse_level))
+ return 1;
while (wildstr != wildend)
{
while (*wildstr != w_many && *wildstr != w_one)
@@ -913,8 +916,9 @@ int my_wildcmp_8bit(CHARSET_INFO *cs,
str++;
if (str++ == str_end) return(-1);
{
- int tmp=my_wildcmp_8bit(cs,str,str_end,wildstr,wildend,escape,w_one,
- w_many);
+ int tmp=my_wildcmp_8bit_impl(cs,str,str_end,
+ wildstr,wildend,escape,w_one,
+ w_many, recurse_level+1);
if (tmp <= 0)
return(tmp);
}
@@ -925,6 +929,16 @@ int my_wildcmp_8bit(CHARSET_INFO *cs,
return(str != str_end ? 1 : 0);
}
+int my_wildcmp_8bit(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
+{
+ return my_wildcmp_8bit_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, 1);
+}
+
/*
** Calculate min_str and max_str that ranges a LIKE string.
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index e4a8d7a4067..020cfdfcbbe 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -7487,16 +7487,18 @@ static int my_uca_charcmp(CHARSET_INFO *cs, my_wc_t wc1, my_wc_t wc2)
*/
static
-int my_wildcmp_uca(CHARSET_INFO *cs,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many)
+int my_wildcmp_uca_impl(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many, int recurse_level)
{
int result= -1; /* Not found, using wildcards */
my_wc_t s_wc, w_wc;
int scan;
my_charset_conv_mb_wc mb_wc= cs->cset->mb_wc;
+ if (my_string_stack_guard && my_string_stack_guard(recurse_level))
+ return 1;
while (wildstr != wildend)
{
while (1)
@@ -7603,8 +7605,8 @@ int my_wildcmp_uca(CHARSET_INFO *cs,
if (str == str_end)
return -1;
- result= my_wildcmp_uca(cs, str, str_end, wildstr, wildend,
- escape, w_one, w_many);
+ result= my_wildcmp_uca_impl(cs, str, str_end, wildstr, wildend,
+ escape, w_one, w_many, recurse_level+1);
if (result <= 0)
return result;
@@ -7616,6 +7618,16 @@ int my_wildcmp_uca(CHARSET_INFO *cs,
return (str != str_end ? 1 : 0);
}
+int my_wildcmp_uca(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many)
+{
+ return my_wildcmp_uca_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, 1);
+}
+
/*
Collation language is implemented according to
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index 88bab1fac76..92b4bc52ee9 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -1920,11 +1920,12 @@ my_tosort_unicode(MY_UNICASE_INFO * const* uni_plane, my_wc_t *wc)
** 1 if matched with wildcard
*/
-int my_wildcmp_unicode(CHARSET_INFO *cs,
- const char *str,const char *str_end,
- const char *wildstr,const char *wildend,
- int escape, int w_one, int w_many,
- MY_UNICASE_INFO *const *weights)
+static
+int my_wildcmp_unicode_impl(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many,
+ MY_UNICASE_INFO *const *weights, int recurse_level)
{
int result= -1; /* Not found, using wildcards */
my_wc_t s_wc, w_wc;
@@ -1933,6 +1934,8 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
const uchar *, const uchar *);
mb_wc= cs->cset->mb_wc;
+ if (my_string_stack_guard && my_string_stack_guard(recurse_level))
+ return 1;
while (wildstr != wildend)
{
while (1)
@@ -2054,9 +2057,9 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
return -1;
str+= scan;
- result= my_wildcmp_unicode(cs, str, str_end, wildstr, wildend,
- escape, w_one, w_many,
- weights);
+ result= my_wildcmp_unicode_impl(cs, str, str_end, wildstr, wildend,
+ escape, w_one, w_many,
+ weights, recurse_level+1);
if (result <= 0)
return result;
}
@@ -2066,6 +2069,17 @@ int my_wildcmp_unicode(CHARSET_INFO *cs,
}
+int
+my_wildcmp_unicode(CHARSET_INFO *cs,
+ const char *str,const char *str_end,
+ const char *wildstr,const char *wildend,
+ int escape, int w_one, int w_many,
+ MY_UNICASE_INFO *const *weights)
+{
+ return my_wildcmp_unicode_impl(cs, str, str_end,
+ wildstr, wildend,
+ escape, w_one, w_many, weights, 1);
+}
/*
Store sorting weights using 2 bytes per character.
@@ -4353,6 +4367,10 @@ static const char filename_safe_char[128]=
#define MY_FILENAME_ESCAPE '@'
+/*
+ note, that we cannot trust 'e' here, it's may be fake,
+ see strconvert()
+*/
static int
my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e)
@@ -4374,7 +4392,7 @@ my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)),
return MY_CS_TOOSMALL3;
byte1= s[1];
- byte2= s[2];
+ byte2= byte1 ? s[2] : 0;
if (byte1 >= 0x30 && byte1 <= 0x7F &&
byte2 >= 0x30 && byte2 <= 0x7F)
@@ -4399,7 +4417,7 @@ my_mb_wc_filename(CHARSET_INFO *cs __attribute__((unused)),
(byte2= hexlo(byte2)) >= 0)
{
int byte3= hexlo(s[3]);
- int byte4= hexlo(s[4]);
+ int byte4= hexlo(s[3] ? s[4] : 0);
if (byte3 >=0 && byte4 >=0)
{
*pwc= (byte1 << 12) + (byte2 << 8) + (byte3 << 4) + byte4;
diff --git a/strings/ctype.c b/strings/ctype.c
index 6b6983ada60..23f18b6617b 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -38,6 +38,8 @@
*/
+int (*my_string_stack_guard)(int)= NULL;
+
static char *mstr(char *str,const char *src,size_t l1,size_t l2)
{
l1= l1<l2 ? l1 : l2;
diff --git a/strings/decimal.c b/strings/decimal.c
index 3245f224b44..c3cef4e3d50 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1,5 +1,5 @@
-/* Copyright (c) 2004, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009, 2011, Monty Program Ab
+/* Copyright (c) 2004, 2013, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2011, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -669,7 +669,7 @@ int decimal_shift(decimal_t *dec, int shift)
if (do_left)
{
do_mini_left_shift(dec, l_mini_shift, beg, end);
- mini_shift=- l_mini_shift;
+ mini_shift= -l_mini_shift;
}
else
{
diff --git a/support-files/MySQL-shared-compat.spec.sh b/support-files/MySQL-shared-compat.spec.sh
index b8b27863b3d..9e9bc26e294 100644
--- a/support-files/MySQL-shared-compat.spec.sh
+++ b/support-files/MySQL-shared-compat.spec.sh
@@ -42,7 +42,7 @@ Autoreqprov: on
Version: %{version_cur}
Release: 1
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Obsoletes: MySQL-shared, mysql-shared
+Obsoletes: mysql-shared
Provides: MySQL-shared
Summary: MySQL shared client libraries for MySQL %{version}, %{version41}, %{version40} and %{version3}
# We simply use the "MySQL-shared" subpackages as input sources instead of
diff --git a/support-files/compiler_warnings.supp b/support-files/compiler_warnings.supp
index 809369bc436..edccc6e5975 100644
--- a/support-files/compiler_warnings.supp
+++ b/support-files/compiler_warnings.supp
@@ -47,6 +47,8 @@ btr/btr0cur\.c: null argument where non-null required: 1800-3000
btr/btr0btr\.c: null argument where non-null required: 2500-3000
ibuf/ibuf0ibuf.c: null argument where non-null required: 700-1000
fsp0fsp\.c: result of 32-bit shift implicitly converted to 64 bits
+log/log0log\.c : passing arg 1 of `atomic_add_64_nv' from incompatible pointer type
+log/log0online\.c : passing arg 1 of `atomic_add_64_nv' from incompatible pointer type
#
# bdb is not critical to keep up to date
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index 1fcb9be71da..6187db21c76 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -262,9 +262,9 @@ Distribution: %{distro_description}
License: Copyright (c) 2000, @MYSQL_COPYRIGHT_YEAR@, %{mysql_vendor}. All rights reserved. Under %{license_type} license as shown in the Description field.
Source: http://www.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@/%{src_dir}.tar.gz
URL: http://www.mysql.com/
-Packager: MySQL Release Engineering <mysql-build@oss.oracle.com>
+Packager: MySQL Release Engineering <mysql-build@oss.oracle.com>
Vendor: %{mysql_vendor}
-Provides: msqlormysql MySQL-server mysql
+Provides: msqlormysql MySQL-server
BuildRequires: %{distro_buildreq}
# Regression tests may take a long time, override the default to skip them
@@ -302,14 +302,25 @@ documentation and the manual for more information.
Version: %{mysql_version}
#Release: %{wsrep_version}.%{release}
%endif
-Summary: MySQL: a very fast and reliable SQL database server
-Group: Applications/Databases
-Requires: %{distro_requires}
-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
+Summary: MySQL: a very fast and reliable SQL database server
+Group: Applications/Databases
+Requires: %{distro_requires}
+%if %{defined susever}
+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
+%else
+Obsoletes: MySQL < %{version}-%{release}
+Obsoletes: MySQL-server < %{version}-%{release}
+Obsoletes: MySQL-server-advanced < %{version}-%{release}
+Obsoletes: mysql mysql-server mysql-advanced mysql-server-advanced
+Obsoletes: MySQL-server-classic MySQL-server-community MySQL-server-enterprise
+Obsoletes: MySQL-server-advanced-gpl MySQL-server-enterprise-gpl
+Provides: msqlormysql MySQL MySQL-server MySQL-server-advanced
+Provides: mysql
+%endif
%description -n MySQL-server%{product_suffix}
The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
@@ -340,13 +351,23 @@ package "MySQL-client%{product_suffix}" as well!
# ----------------------------------------------------------------------------
%package -n MySQL-client%{product_suffix}
-Summary: MySQL - Client
-Group: Applications/Databases
-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
+Summary: MySQL - Client
+Group: Applications/Databases
+%if %{defined susever}
+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
+%else
+Obsoletes: mysql mysql-advanced
+Obsoletes: MySQL-client < %{version}-%{release}
+Obsoletes: MySQL-client-advanced < %{version}-%{release}
+Obsoletes: MySQL-client-classic MySQL-client-community MySQL-client-enterprise
+Obsoletes: MySQL-client-advanced-gpl MySQL-client-enterprise-gpl
+Provides: MySQL-client MySQL-client-advanced
+Provides: mysql
+%endif
%description -n MySQL-client%{product_suffix}
This package contains the standard MySQL clients and administration tools.
@@ -355,16 +376,28 @@ For a description of MySQL see the base MySQL RPM or http://www.mysql.com/
# ----------------------------------------------------------------------------
%package -n MySQL-test%{product_suffix}
-Summary: MySQL - Test suite
-Group: Applications/Databases
-Requires: MySQL-client perl
-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
-AutoReqProv: no
+Summary: MySQL - Test suite
+Group: Applications/Databases
+%if %{defined susever}
+Requires: MySQL-client perl
+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
+AutoReqProv: no
+%else
+Requires: MySQL-client perl
+Conflicts: mysql-test mysql-test-advanced
+Obsoletes: mysql-bench MySQL-bench
+Obsoletes: MySQL-test < %{version}-%{release}
+Obsoletes: MySQL-test-advanced < %{version}-%{release}
+Obsoletes: MySQL-test-classic MySQL-test-community MySQL-test-enterprise
+Obsoletes: MySQL-test-advanced-gpl MySQL-test-enterprise-gpl
+Provides: MySQL-test MySQL-test-advanced
+AutoReqProv: no
+%endif
%description -n MySQL-test%{product_suffix}
This package contains the MySQL regression test suite.
@@ -373,13 +406,22 @@ 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
-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
+Summary: MySQL - Development header files and libraries
+Group: Applications/Databases
+%if %{defined susever}
+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
+%else
+Conflicts: mysql-devel mysql-embedded-devel mysql-devel-advanced mysql-embedded-devel-advanced
+Obsoletes: MySQL-devel < %{version}-%{release}
+Obsoletes: MySQL-devel-advanced < %{version}-%{release}
+Obsoletes: MySQL-devel-classic MySQL-devel-community MySQL-devel-enterprise
+Obsoletes: MySQL-devel-advanced-gpl MySQL-devel-enterprise-gpl
+Provides: MySQL-devel MySQL-devel-advanced
+%endif
%description -n MySQL-devel%{product_suffix}
This package contains the development header files and libraries necessary
@@ -389,14 +431,25 @@ 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
-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
-Obsoletes: MySQL-shared-advanced MySQL-shared-advanced-gpl MySQL-shared-enterprise-gpl
+Summary: MySQL - Shared libraries
+Group: Applications/Databases
+%if %{defined susever}
+Provides: MySQL-shared
+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
+Obsoletes: MySQL-shared-advanced MySQL-shared-advanced-gpl MySQL-shared-enterprise-gpl
+%else
+Obsoletes: MySQL-shared-standard MySQL-shared-pro
+Obsoletes: MySQL-shared-pro-cert MySQL-shared-pro-gpl
+Obsoletes: MySQL-shared < %{version}-%{release}
+Obsoletes: MySQL-shared-advanced < %{version}-%{release}
+Obsoletes: MySQL-shared-pro-gpl-cert
+Obsoletes: MySQL-shared-classic MySQL-shared-community MySQL-shared-enterprise
+Obsoletes: MySQL-shared-advanced-gpl MySQL-shared-enterprise-gpl
+Provides: MySQL-shared MySQL-shared-advanced
+%endif
%description -n MySQL-shared%{product_suffix}
This package contains the shared libraries (*.so*) which certain languages
@@ -405,15 +458,26 @@ and applications need to dynamically load and use MySQL.
# ----------------------------------------------------------------------------
%if %{undefined with_wsrep}
%package -n MySQL-embedded%{product_suffix}
-Summary: MySQL - Embedded library
-Group: Applications/Databases
-Requires: MySQL-devel
-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
+Summary: MySQL - Embedded library
+Group: Applications/Databases
+%if %{defined susever}
+Requires: MySQL-devel
+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
+%else
+Requires: MySQL-devel
+Conflicts: mysql-embedded mysql-embedded-advanced
+Obsoletes: MySQL-embedded-pro
+Obsoletes: MySQL-embedded < %{version}-%{release}
+Obsoletes: MySQL-embedded-advanced < %{version}-%{release}
+Obsoletes: MySQL-embedded-classic MySQL-embedded-community MySQL-embedded-enterprise
+Obsoletes: MySQL-embedded-advanced-gpl MySQL-embedded-enterprise-gpl
+Provides: MySQL-embedded MySQL-embedded-advanced
+%endif
%description -n MySQL-embedded%{product_suffix}
This package contains the MySQL server as an embedded library.
@@ -758,13 +822,16 @@ if [ -d $mysql_datadir ] ; then
echo "MySQL RPM upgrade to version $NEW_VERSION" > $STATUS_FILE
echo "'pre' step running at `date`" >> $STATUS_FILE
echo >> $STATUS_FILE
- echo "ERR file(s):" >> $STATUS_FILE
- ls -ltr $mysql_datadir/*.err >> $STATUS_FILE
- echo >> $STATUS_FILE
- echo "Latest 'Version' line in latest file:" >> $STATUS_FILE
- grep '^Version' `ls -tr $mysql_datadir/*.err | tail -1` | \
+ fcount=`ls -ltr $mysql_datadir/*.err 2>/dev/null | wc -l`
+ if [ $fcount -gt 0 ] ; then
+ echo "ERR file(s):" >> $STATUS_FILE
+ ls -ltr $mysql_datadir/*.err >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ echo "Latest 'Version' line in latest file:" >> $STATUS_FILE
+ grep '^Version' `ls -tr $mysql_datadir/*.err | tail -1` | \
tail -1 >> $STATUS_FILE
- echo >> $STATUS_FILE
+ echo >> $STATUS_FILE
+ fi
if [ -n "$SERVER_TO_START" ] ; then
# There is only one PID file, race possibility ignored
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index f348ec4515b..57fde42a92e 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -6204,7 +6204,7 @@ static void test_date_dt()
static void test_pure_coverage()
{
MYSQL_STMT *stmt;
- MYSQL_BIND my_bind[1];
+ MYSQL_BIND my_bind[2];
int rc;
ulong length;
@@ -8880,7 +8880,7 @@ static void test_parse_error_and_bad_length()
DIE_UNLESS(rc);
if (!opt_silent)
fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
- rc= mysql_real_query(mysql, "SHOW DATABASES", 100);
+ rc= mysql_real_query(mysql, STRING_WITH_LEN("SHOW DATABASES\0AAAAAAAA"));
DIE_UNLESS(rc);
if (!opt_silent)
fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
@@ -8891,7 +8891,7 @@ static void test_parse_error_and_bad_length()
fprintf(stdout, "Got error (as expected): '%s'\n", mysql_error(mysql));
stmt= mysql_stmt_init(mysql);
DIE_UNLESS(stmt);
- rc= mysql_stmt_prepare(stmt, "SHOW DATABASES", 100);
+ rc= mysql_stmt_prepare(stmt, STRING_WITH_LEN("SHOW DATABASES\0AAAAAAA"));
DIE_UNLESS(rc != 0);
if (!opt_silent)
fprintf(stdout, "Got error (as expected): '%s'\n", mysql_stmt_error(stmt));
@@ -16903,13 +16903,14 @@ static void test_bug31418()
*/
#define LARGE_BUFFER_SIZE 2048
+#define OLD_USERNAME_CHAR_LENGTH 16
static void test_bug31669()
{
int rc;
static char buff[LARGE_BUFFER_SIZE+1];
#ifndef EMBEDDED_LIBRARY
- static char user[USERNAME_CHAR_LENGTH+1];
+ static char user[OLD_USERNAME_CHAR_LENGTH+1];
static char db[NAME_CHAR_LEN+1];
static char query[LARGE_BUFFER_SIZE*2];
#endif
@@ -16926,7 +16927,8 @@ static void test_bug31669()
rc= mysql_change_user(conn, "", "", "");
DIE_UNLESS(rc);
- memset(buff, 'a', sizeof(buff));
+ memset(buff, 'a', sizeof(buff) - 1);
+ buff[sizeof(buff) - 1]= 0;
mysql_close(conn);
conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
@@ -16945,7 +16947,7 @@ static void test_bug31669()
myquery(rc);
memset(user, 'b', sizeof(user));
- user[USERNAME_CHAR_LENGTH]= 0;
+ user[OLD_USERNAME_CHAR_LENGTH]= 0;
memset(buff, 'c', sizeof(buff));
buff[LARGE_BUFFER_SIZE]= 0;
strxmov(query, "GRANT ALL PRIVILEGES ON *.* TO '", user, "'@'%' IDENTIFIED BY "
@@ -16964,11 +16966,11 @@ static void test_bug31669()
rc= mysql_change_user(conn, user, buff, db);
DIE_UNLESS(!rc);
- user[USERNAME_CHAR_LENGTH-1]= 'a';
+ user[OLD_USERNAME_CHAR_LENGTH-1]= 'a';
rc= mysql_change_user(conn, user, buff, db);
DIE_UNLESS(rc);
- user[USERNAME_CHAR_LENGTH-1]= 'b';
+ user[OLD_USERNAME_CHAR_LENGTH-1]= 'b';
buff[LARGE_BUFFER_SIZE-1]= 'd';
rc= mysql_change_user(conn, user, buff, db);
DIE_UNLESS(rc);
@@ -17738,7 +17740,11 @@ static void test_bug43560(void)
fprintf(stdout, "Skipping test_bug43560: server not DEBUG version\n");
DBUG_VOID_RETURN;
}
-
+ if (opt_unix_socket)
+ {
+ fprintf(stdout, "Skipping test_bug43560: connected via UNIX socket\n");
+ DBUG_VOID_RETURN;
+ }
/*
Set up a separate connection for this test to avoid messing up the
general MYSQL object used in other subtests. Use TCP protocol to avoid
@@ -18849,6 +18855,109 @@ static void test_bug13001491()
myquery(rc);
}
+static void test_mdev4326()
+{
+ MYSQL_STMT *stmt;
+ MYSQL_BIND bind;
+ char query[]= "SELECT * FROM mysql.user LIMIT ?";
+ char str_data[]= "1";
+ unsigned long length= 0;
+ int int_data= 1;
+ int rc, count;
+ my_bool is_null= 0;
+ my_bool error= 0;
+ myheader("test_mdev4326");
+
+ rc= mysql_change_user(mysql, opt_user, opt_password, "mysql");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "SET GLOBAL general_log = 1");
+ myquery(rc);
+
+ stmt= mysql_stmt_init(mysql);
+ check_stmt(stmt);
+
+ /* Numeric parameter test */
+
+ rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ check_execute(stmt, rc);
+ check_stmt(stmt);
+ verify_param_count(stmt, 1);
+
+ memset((char *)&bind, 0, sizeof(bind));
+ bind.buffer_type= MYSQL_TYPE_LONG;
+ bind.buffer= (char *)&int_data;
+ bind.is_null= &is_null;
+ bind.length= &length;
+ bind.error= &error;
+
+ rc= mysql_stmt_bind_param(stmt, &bind);
+ check_execute(stmt, rc);
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ count= 0;
+ while (!(rc= mysql_stmt_fetch(stmt)))
+ count++;
+ DIE_UNLESS(count == 1);
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ count= 0;
+ while (!(rc= mysql_stmt_fetch(stmt)))
+ count++;
+ DIE_UNLESS(count == 1);
+ int_data= 0;
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ count= 0;
+ while (!(rc= mysql_stmt_fetch(stmt)))
+ count++;
+ DIE_UNLESS(count == 0);
+ rc= mysql_stmt_close(stmt);
+ check_execute(stmt, rc);
+
+ /* String parameter test */
+
+ stmt= mysql_stmt_init(mysql);
+ rc= mysql_stmt_prepare(stmt, query, strlen(query));
+ check_execute(stmt, rc);
+ check_stmt(stmt);
+ verify_param_count(stmt, 1);
+
+ memset((char *)&bind, 0, sizeof(bind));
+ bind.buffer_type= MYSQL_TYPE_STRING;
+ bind.buffer= (char *)str_data;
+ length= bind.buffer_length= sizeof(str_data);
+ bind.is_null= &is_null;
+ bind.length= &length;
+ bind.error= &error;
+
+ rc= mysql_stmt_bind_param(stmt, &bind);
+ check_execute(stmt, rc);
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ count= 0;
+ while (!(rc= mysql_stmt_fetch(stmt)))
+ count++;
+ DIE_UNLESS(count == 1);
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ count= 0;
+ while (!(rc= mysql_stmt_fetch(stmt)))
+ count++;
+ DIE_UNLESS(count == 1);
+ str_data[0]= '0';
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ count= 0;
+ while (!(rc= mysql_stmt_fetch(stmt)))
+ count++;
+ DIE_UNLESS(count == 0);
+ rc= mysql_stmt_close(stmt);
+ check_execute(stmt, rc);
+
+ rc= mysql_change_user(mysql, opt_user, opt_password, current_db);
+ myquery(rc);
+}
static struct my_tests_st my_tests[]= {
{ "disable_query_logs", disable_query_logs },
@@ -19114,6 +19223,7 @@ static struct my_tests_st my_tests[]= {
{ "test_progress_reporting", test_progress_reporting },
{ "test_bug11754979", test_bug11754979 },
{ "test_bug13001491", test_bug13001491 },
+ { "test_mdev4326", test_mdev4326 },
{ 0, 0 }
};
diff --git a/vio/viossl.c b/vio/viossl.c
index 48881cc2903..ad20a6ab5c3 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -183,6 +183,9 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
SSL_clear(ssl);
SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout);
SSL_set_fd(ssl, vio->sd);
+#if !defined(HAVE_YASSL) && defined(SSL_OP_NO_COMPRESSION)
+ SSL_set_options(ssl, SSL_OP_NO_COMPRESSION);
+#endif
if ((r= connect_accept_func(ssl)) < 1)
{
diff --git a/win/packaging/ca/CustomAction.cpp b/win/packaging/ca/CustomAction.cpp
index 50b39adc0b1..67a17c2cc19 100644
--- a/win/packaging/ca/CustomAction.cpp
+++ b/win/packaging/ca/CustomAction.cpp
@@ -895,7 +895,7 @@ extern "C" UINT __stdcall CheckServiceUpgrades(MSIHANDLE hInstall)
Only look for services that have mysqld.exe outside of the current
installation directory.
*/
- if(strstr(props.mysqld_exe,installDir) == 0)
+ if(installDir[0] == 0 || strstr(props.mysqld_exe,installDir) == 0)
{
WcaLog(LOGMSG_STANDARD, "found service %S, major=%d, minor=%d",
info[i].lpServiceName, props.version_major, props.version_minor);
diff --git a/win/packaging/extra.wxs.in b/win/packaging/extra.wxs.in
index ff1a529a2ee..da4ac6aa9ac 100644
--- a/win/packaging/extra.wxs.in
+++ b/win/packaging/extra.wxs.in
@@ -151,6 +151,9 @@
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="&amp;Next">
<Publish Event="Remove" Value="DBInstance">CreateOrUpgradeChoice = "Upgrade" </Publish>
<Publish Event="AddLocal" Value="DBInstance">CreateOrUpgradeChoice = "Create"</Publish>
+ <Publish Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="[NonExistentProperty]">CreateOrUpgradeChoice = "Create"</Publish>
+ <Publish Property="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="[NonExistentProperty]">CreateOrUpgradeChoice = "Create"</Publish>
+ <Publish Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1">CreateOrUpgradeChoice = "Upgrade"</Publish>
<Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
@@ -634,6 +637,7 @@
</Component>
<?if $(var.HaveUpgradeWizard) != "0" ?>
<ComponentRef Id='C.bin.mysql_upgrade_wizard.exe'/>
+ <!--
<Component Id="c.shortcuts.upgrade_wizard" Guid="*" Directory="ShortcutFolder" Transitive="yes">
<RegistryValue
Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
@@ -646,6 +650,7 @@
Description="Upgrades older instances of MariaDB/MySQL services to version @MAJOR_VERSION@.@MINOR_VERSION@"
Advertise="no"/>
</Component>
+ -->
<?endif?>
</Feature>
@@ -689,7 +694,7 @@
<CustomAction Id='PresetDatabaseProperties' BinaryKey='wixca.dll' DllEntry='PresetDatabaseProperties' />
<CustomAction Id="CreateDatabaseCommand" Property="CreateDatabase"
Value=
- "&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; --port=[PORT] &quot;--password=[ESCAPEDPASSWORD]&quot; &quot;--datadir=[DATADIR]\&quot; [SKIPNETWORKING] [ALLOWREMOTEROOTACCESS] [DEFAULTUSER]"
+ "&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; --port=[PORT] &quot;--password=[ESCAPEDPASSWORD]&quot; &quot;--datadir=[DATADIR]\&quot; [SKIPNETWORKING] [ALLOWREMOTEROOTACCESS] [DEFAULTUSER] --verbose-bootstrap"
Execute="immediate"
HideTarget="yes"
/>
@@ -823,7 +828,7 @@
<Property
Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
Value="Launch wizard to upgrade existing MariaDB or MySQL services." />
- <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>
+ <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="0"/>
<Property Id="WixShellExecTarget" Value="[#F.bin.mysql_upgrade_wizard.exe]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
@@ -835,16 +840,16 @@
Execute="immediate" />
<InstallUISequence>
<Custom Action="CheckServiceUpgrades" After="CostFinalize">
- $C.bin.mysql_upgrade_wizard.exe = 3 AND NOT Installed
+ $C.bin.mysql_upgrade_wizard.exe = 3 AND NOT Installed AND NOT OLDERVERSIONBEINGUPGRADED
</Custom>
</InstallUISequence>
<SetProperty Before="ExecuteAction" Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
Sequence="ui" Value="[NonExistentProperty]">
- <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed]]>
+ <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed OR OLDERVERSIONBEINGUPGRADED]]>
</SetProperty>
<SetProperty Before="ExecuteAction" Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX"
Sequence="ui" Value="[NonExistentProperty]">
- <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed]]>
+ <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed OR OLDERVERSIONBEINGUPGRADED]]>
</SetProperty>
<?endif ?> <!-- HaveUpgradeWizard -->
diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake
index f826c9a6633..124f85bb87e 100644
--- a/win/packaging/heidisql.cmake
+++ b/win/packaging/heidisql.cmake
@@ -1,4 +1,4 @@
-SET(HEIDISQL_BASE_NAME "HeidiSQL_7.0_Portable")
+SET(HEIDISQL_BASE_NAME "HeidiSQL_8.0_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://heidisql.googlecode.com/files/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})