summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in4
-rw-r--r--include/my_global.h2
-rw-r--r--include/my_sys.h2
-rw-r--r--include/mysql/plugin.h39
-rw-r--r--include/mysql/plugin.h.pp3
-rw-r--r--mysql-test/include/have_innodb_plugin.inc4
-rw-r--r--mysql-test/include/mtr_warnings.sql2
-rw-r--r--mysql-test/lib/mtr_cases.pm125
-rwxr-xr-xmysql-test/mysql-test-run.pl2
-rw-r--r--mysql-test/r/bug46261.result8
-rw-r--r--mysql-test/r/ctype_ucs.result8
-rw-r--r--mysql-test/r/error_simulation.result23
-rw-r--r--mysql-test/r/explain.result12
-rw-r--r--mysql-test/r/innodb_mysql.result28
-rw-r--r--mysql-test/r/join.result20
-rw-r--r--[-rwxr-xr-x]mysql-test/r/loaddata.result6
-rw-r--r--mysql-test/r/ps.result25
-rw-r--r--mysql-test/r/row.result9
-rw-r--r--mysql-test/r/trigger.result23
-rw-r--r--mysql-test/r/variables_debug.result13
-rw-r--r--mysql-test/r/view.result8
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed.test2
-rw-r--r--mysql-test/suite/engines/README12
-rw-r--r--mysql-test/suite/engines/funcs/t/disabled.def6
-rw-r--r--mysql-test/suite/engines/iuds/r/insert_year.result4
-rw-r--r--mysql-test/suite/engines/iuds/r/update_delete_calendar.result3
-rw-r--r--mysql-test/suite/engines/iuds/t/disabled.def1
-rw-r--r--mysql-test/suite/engines/iuds/t/insert_number.test5
-rw-r--r--mysql-test/suite/engines/iuds/t/update_delete_calendar.test5
-rw-r--r--mysql-test/suite/innodb/include/have_innodb_plugin.inc4
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc-44030.result (renamed from mysql-test/r/innodb-autoinc-44030.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result (renamed from storage/innodb_plugin/mysql-test/innodb-autoinc.result)379
-rw-r--r--mysql-test/suite/innodb/r/innodb-lock.result (renamed from storage/innodb_plugin/mysql-test/innodb-lock.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb-replace.result (renamed from storage/innodb_plugin/mysql-test/innodb-replace.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb-semi-consistent.result (renamed from storage/innodb_plugin/mysql-test/innodb-semi-consistent.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug21704.result (renamed from mysql-test/r/innodb_bug21704.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug34053.result (renamed from storage/innodb_plugin/mysql-test/innodb_bug34053.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug35220.result (renamed from storage/innodb_plugin/mysql-test/innodb_bug35220.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug38231.result (renamed from mysql-test/r/innodb_bug38231.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug39438.result (renamed from mysql-test/r/innodb_bug39438.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug40565.result (renamed from mysql-test/r/innodb_bug40565.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug42101-nonzero.result (renamed from mysql-test/r/innodb_bug42101-nonzero.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug42101.result (renamed from mysql-test/r/innodb_bug42101.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug44369.result18
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug45357.result (renamed from mysql-test/r/innodb_bug45357.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug46000.result (renamed from mysql-test/r/innodb_bug46000.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug47621.result (renamed from mysql-test/r/innodb_bug47621.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug47777.result (renamed from mysql-test/r/innodb_bug47777.result)0
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug51920.result13
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug52663.result26
-rw-r--r--mysql-test/suite/innodb/r/innodb_misc1.result880
-rw-r--r--mysql-test/suite/innodb/r/innodb_trx_weight.result (renamed from storage/innodb_plugin/mysql-test/innodb_trx_weight.result)0
-rw-r--r--mysql-test/suite/innodb/t/disabled.def16
-rw-r--r--mysql-test/suite/innodb/t/innodb-analyze.test66
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc-44030.test (renamed from mysql-test/t/innodb-autoinc-44030.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test (renamed from storage/innodb_plugin/mysql-test/innodb-autoinc.test)190
-rw-r--r--mysql-test/suite/innodb/t/innodb-consistent-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb-index_ucs2.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-lock.test (renamed from storage/innodb_plugin/mysql-test/innodb-lock.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb-master.opt (renamed from storage/innodb_plugin/mysql-test/innodb-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb-replace.test (renamed from storage/innodb_plugin/mysql-test/innodb-replace.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb-semi-consistent-master.opt (renamed from storage/innodb_plugin/mysql-test/innodb-semi-consistent-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb-semi-consistent.test (renamed from storage/innodb_plugin/mysql-test/innodb-semi-consistent.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb-timeout.test65
-rw-r--r--mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt2
-rw-r--r--mysql-test/suite/innodb/t/innodb-use-sys-malloc.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug21704.test (renamed from mysql-test/t/innodb_bug21704.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug34053.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug34053.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug35220.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug35220.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug36169.test1159
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug36172.test31
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug38231.test (renamed from mysql-test/t/innodb_bug38231.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug39438-master.opt (renamed from mysql-test/t/innodb_bug39438-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug39438.test (renamed from mysql-test/t/innodb_bug39438.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug40565.test (renamed from mysql-test/t/innodb_bug40565.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug42101-nonzero-master.opt (renamed from mysql-test/t/innodb_bug42101-nonzero-master.opt)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug42101-nonzero.test (renamed from mysql-test/t/innodb_bug42101-nonzero.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug42101.test (renamed from mysql-test/t/innodb_bug42101.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug44369.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug44369.test)13
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug45357.test (renamed from mysql-test/t/innodb_bug45357.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug46000.test (renamed from mysql-test/t/innodb_bug46000.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug47621.test (renamed from mysql-test/t/innodb_bug47621.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug47777.test (renamed from mysql-test/t/innodb_bug47777.test)0
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug51920.test43
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug52663-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug52663.test34
-rw-r--r--mysql-test/suite/innodb/t/innodb_misc1-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_misc1.test1206
-rw-r--r--mysql-test/suite/innodb/t/innodb_trx_weight.test (renamed from storage/innodb_plugin/mysql-test/innodb_trx_weight.test)0
-rw-r--r--mysql-test/suite/innodb_plugin/include/ctype_innodb_like.inc (renamed from storage/innodb_plugin/mysql-test/ctype_innodb_like.inc)0
-rw-r--r--mysql-test/suite/innodb_plugin/include/innodb-index.inc (renamed from mysql-test/suite/innodb/include/innodb-index.inc)0
-rw-r--r--mysql-test/suite/innodb_plugin/include/innodb_trx_weight.inc (renamed from storage/innodb_plugin/mysql-test/innodb_trx_weight.inc)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-analyze.result (renamed from mysql-test/suite/innodb/r/innodb-analyze.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-autoinc-44030.result30
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-autoinc.result1246
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-consistent.result (renamed from mysql-test/suite/innodb/r/innodb-consistent.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-index.result (renamed from mysql-test/suite/innodb/r/innodb-index.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-index_ucs2.result (renamed from mysql-test/suite/innodb/r/innodb-index_ucs2.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-lock.result57
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-replace.result13
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-semi-consistent.result47
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-timeout.result (renamed from mysql-test/suite/innodb/r/innodb-timeout.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-use-sys-malloc.result (renamed from mysql-test/suite/innodb/r/innodb-use-sys-malloc.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb-zip.result (renamed from mysql-test/suite/innodb/r/innodb-zip.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb.result (renamed from storage/innodb_plugin/mysql-test/innodb.result)13
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug21704.result (renamed from storage/innodb_plugin/mysql-test/innodb_bug21704.result)12
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug34053.result (renamed from mysql-test/suite/innodb/r/innodb_bug36172.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug34300.result (renamed from storage/innodb_plugin/mysql-test/innodb_bug34300.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug35220.result (renamed from storage/innodb_plugin/mysql-test/innodb_bug36172.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug36169.result (renamed from mysql-test/suite/innodb/r/innodb_bug36169.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug36172.result1
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug38231.result11
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug39438.result1
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug40360.result (renamed from mysql-test/suite/innodb/r/innodb_bug40360.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug40565.result (renamed from storage/innodb_plugin/mysql-test/innodb_bug40565.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug41904.result (renamed from mysql-test/suite/innodb/r/innodb_bug41904.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug42101-nonzero.result (renamed from storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug42101.result (renamed from storage/innodb_plugin/mysql-test/innodb_bug42101.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug44032.result (renamed from mysql-test/r/innodb_bug44032.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug44369.result (renamed from mysql-test/r/innodb_bug44369.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug44571.result (renamed from mysql-test/suite/innodb/r/innodb_bug44571.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug45357.result (renamed from storage/innodb_plugin/mysql-test/innodb_bug45357.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug46000.result19
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug46676.result (renamed from mysql-test/suite/innodb/r/innodb_bug46676.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug47167.result (renamed from mysql-test/suite/innodb/r/innodb_bug47167.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug47621.result21
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug47622.result (renamed from mysql-test/suite/innodb/r/innodb_bug47622.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug47777.result13
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug51378.result (renamed from mysql-test/suite/innodb/r/innodb_bug51378.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug51920.result13
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug52663.result26
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_bug52745.result130
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_file_format.result (renamed from storage/innodb_plugin/mysql-test/innodb_file_format.result)2
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_information_schema.result (renamed from mysql-test/suite/innodb/r/innodb_information_schema.result)0
-rw-r--r--mysql-test/suite/innodb_plugin/r/innodb_trx_weight.result1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-analyze.test (renamed from storage/innodb_plugin/mysql-test/innodb-analyze.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-autoinc-44030.test43
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-autoinc.test673
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-consistent-master.opt (renamed from storage/innodb_plugin/mysql-test/innodb-consistent-master.opt)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-consistent.test (renamed from mysql-test/suite/innodb/t/innodb-consistent.test)3
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-index.test (renamed from mysql-test/suite/innodb/t/innodb-index.test)4
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-index_ucs2.test5
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-lock.test102
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-master.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-replace.test22
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-semi-consistent-master.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-semi-consistent.test68
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-timeout.test (renamed from storage/innodb_plugin/mysql-test/innodb-timeout.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-use-sys-malloc-master.opt (renamed from storage/innodb_plugin/mysql-test/innodb-use-sys-malloc-master.opt)1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-use-sys-malloc.test (renamed from storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.test)4
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb-zip.test (renamed from mysql-test/suite/innodb/t/innodb-zip.test)6
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb.test (renamed from storage/innodb_plugin/mysql-test/innodb.test)23
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug21704.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug21704.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug34053.test50
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug34300.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug34300.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug35220.test16
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug36169.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug36169.test)3
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug36172.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug36172.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug38231.test112
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug39438-master.opt1
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug39438.test51
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug40360.test (renamed from mysql-test/suite/innodb/t/innodb_bug40360.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug40565.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug40565.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug41904.test (renamed from mysql-test/suite/innodb/t/innodb_bug41904.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug42101-nonzero-master.opt (renamed from storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero-master.opt)0
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug42101-nonzero.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug42101.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug42101.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug44032.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug44032.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug44369.test (renamed from mysql-test/t/innodb_bug44369.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug44571.test (renamed from mysql-test/suite/innodb/t/innodb_bug44571.test)3
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug45357.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug45357.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug46000.test (renamed from storage/innodb_plugin/mysql-test/innodb_bug46000.test)14
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug46676.test (renamed from mysql-test/suite/innodb/t/innodb_bug46676.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug47167.test (renamed from mysql-test/suite/innodb/t/innodb_bug47167.test)3
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug47621.test57
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug47622.test (renamed from mysql-test/suite/innodb/t/innodb_bug47622.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug47777.test24
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug51378.test (renamed from mysql-test/suite/innodb/t/innodb_bug51378.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug51920.test43
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug52663.test34
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_bug52745.test109
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_file_format.test (renamed from storage/innodb_plugin/mysql-test/innodb_file_format.test)2
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_information_schema.test (renamed from mysql-test/suite/innodb/t/innodb_information_schema.test)3
-rw-r--r--mysql-test/suite/innodb_plugin/t/innodb_trx_weight.test108
-rw-r--r--mysql-test/suite/rpl/r/rpl_do_grant.result14
-rw-r--r--mysql-test/suite/rpl/t/rpl_do_grant.test29
-rw-r--r--mysql-test/suite/sys_vars/r/secure_file_priv.result22
-rw-r--r--mysql-test/suite/sys_vars/t/secure_file_priv-master.opt1
-rw-r--r--mysql-test/suite/sys_vars/t/secure_file_priv.test21
-rw-r--r--mysql-test/t/bug46261-master.opt1
-rw-r--r--mysql-test/t/bug46261.test16
-rw-r--r--mysql-test/t/ctype_ucs.test9
-rw-r--r--mysql-test/t/disabled.def2
-rw-r--r--mysql-test/t/error_simulation.test16
-rw-r--r--mysql-test/t/explain.test15
-rw-r--r--mysql-test/t/innodb-use-sys-malloc.test51
-rw-r--r--mysql-test/t/innodb_bug44032.test13
-rw-r--r--mysql-test/t/innodb_mysql.test28
-rw-r--r--mysql-test/t/join.test22
-rw-r--r--mysql-test/t/loaddata.test14
-rw-r--r--mysql-test/t/partition_innodb_plugin.test1
-rw-r--r--mysql-test/t/ps.test14
-rw-r--r--mysql-test/t/row.test11
-rw-r--r--mysql-test/t/trigger.test31
-rw-r--r--mysql-test/t/variables_debug.test13
-rw-r--r--mysql-test/t/view.test9
-rw-r--r--mysys/mf_loadpath.c16
-rw-r--r--mysys/my_file.c2
-rw-r--r--mysys/my_getwd.c7
-rw-r--r--mysys/my_symlink.c5
-rw-r--r--scripts/mysqld_safe.sh7
-rw-r--r--scripts/mysqlhotcopy.sh8
-rwxr-xr-xsql/CMakeLists.txt4
-rw-r--r--sql/field.cc12
-rw-r--r--sql/ha_ndbcluster.cc11
-rw-r--r--sql/handler.cc12
-rw-r--r--sql/handler.h2
-rw-r--r--sql/item.cc23
-rw-r--r--sql/item.h4
-rw-r--r--sql/item_cmpfunc.h14
-rw-r--r--sql/item_strfunc.cc3
-rw-r--r--sql/item_subselect.cc15
-rw-r--r--sql/item_subselect.h1
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/mysqld.cc63
-rw-r--r--sql/slave.cc28
-rw-r--r--sql/sp_head.cc34
-rw-r--r--sql/sp_head.h4
-rw-r--r--sql/sql_acl.cc10
-rw-r--r--sql/sql_class.cc34
-rw-r--r--sql/sql_class.h6
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_load.cc13
-rw-r--r--sql/sql_parse.cc5
-rw-r--r--sql/sql_plugin.cc31
-rw-r--r--sql/sql_repl.cc21
-rw-r--r--sql/sql_select.cc3
-rw-r--r--sql/sql_table.cc7
-rw-r--r--sql/sql_update.cc18
-rw-r--r--sql/table.cc16
-rw-r--r--[-rwxr-xr-x]storage/innobase/CMakeLists.txt2
-rw-r--r--storage/innobase/buf/buf0buf.c2
-rw-r--r--storage/innobase/handler/ha_innodb.cc22
-rw-r--r--storage/innobase/include/mem0mem.h11
-rw-r--r--storage/innobase/include/mem0mem.ic17
-rw-r--r--storage/innobase/include/trx0sys.ic2
-rw-r--r--storage/innobase/include/univ.i11
-rw-r--r--storage/innobase/lock/lock0lock.c27
-rw-r--r--storage/innobase/log/log0recv.c4
-rw-r--r--storage/innobase/row/row0ins.c6
-rw-r--r--storage/innobase/row/row0mysql.c2
-rw-r--r--storage/innobase/row/row0sel.c27
-rw-r--r--storage/innobase/srv/srv0srv.c12
-rw-r--r--storage/innobase/srv/srv0start.c2
-rw-r--r--storage/innodb_plugin/CMakeLists.txt3
-rw-r--r--storage/innodb_plugin/ChangeLog74
-rw-r--r--storage/innodb_plugin/btr/btr0btr.c117
-rw-r--r--storage/innodb_plugin/btr/btr0cur.c19
-rw-r--r--storage/innodb_plugin/buf/buf0buf.c18
-rw-r--r--storage/innodb_plugin/buf/buf0flu.c6
-rw-r--r--storage/innodb_plugin/data/data0data.c15
-rw-r--r--storage/innodb_plugin/dict/dict0boot.c4
-rw-r--r--storage/innodb_plugin/dict/dict0crea.c7
-rw-r--r--storage/innodb_plugin/dict/dict0dict.c74
-rw-r--r--storage/innodb_plugin/ha/ha0ha.c4
-rw-r--r--storage/innodb_plugin/handler/ha_innodb.cc41
-rw-r--r--storage/innodb_plugin/handler/handler0alter.cc13
-rw-r--r--storage/innodb_plugin/include/dict0boot.h2
-rw-r--r--storage/innodb_plugin/include/dict0dict.h21
-rw-r--r--storage/innodb_plugin/include/log0recv.h4
-rw-r--r--storage/innodb_plugin/include/trx0trx.h8
-rw-r--r--storage/innodb_plugin/include/univ.i11
-rw-r--r--storage/innodb_plugin/lock/lock0lock.c25
-rw-r--r--storage/innodb_plugin/log/log0recv.c6
-rw-r--r--storage/innodb_plugin/mysql-test/have_innodb.inc4
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-analyze.result2
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-consistent.result35
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-consistent.test58
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-index.inc26
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-index.result1170
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-index.test534
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-index_ucs2.result116
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-index_ucs2.test5
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-timeout.result38
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.result48
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-zip.result421
-rw-r--r--storage/innodb_plugin/mysql-test/innodb-zip.test343
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_bug36169.result2
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_bug40360.result4
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_bug40360.test16
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_bug41904.result4
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_bug41904.test14
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_bug44032.result7
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_bug44369.result14
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_bug44571.result9
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_bug44571.test17
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_bug46000.result17
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_information_schema.result23
-rw-r--r--storage/innodb_plugin/mysql-test/innodb_information_schema.test145
-rw-r--r--storage/innodb_plugin/mysql-test/patches/innodb-index.diff62
-rw-r--r--storage/innodb_plugin/plug.in.disabled2
-rw-r--r--storage/innodb_plugin/rem/rem0rec.c68
-rw-r--r--storage/innodb_plugin/row/row0merge.c2
-rw-r--r--storage/innodb_plugin/row/row0mysql.c2
-rw-r--r--storage/innodb_plugin/row/row0sel.c31
-rw-r--r--storage/innodb_plugin/srv/srv0srv.c12
-rw-r--r--storage/innodb_plugin/trx/trx0rec.c21
-rw-r--r--storage/innodb_plugin/trx/trx0trx.c2
-rw-r--r--storage/pbxt/src/ha_pbxt.cc4
309 files changed, 7466 insertions, 5067 deletions
diff --git a/configure.in b/configure.in
index 833bec5cd46..4e6b71a06fd 100644
--- a/configure.in
+++ b/configure.in
@@ -12,7 +12,7 @@ dnl
dnl When changing the major version number please also check the switch
dnl statement in mysqlbinlog::check_master_version(). You may also need
dnl to update version.c in ndb.
-AC_INIT([MariaDB Server], [5.1.46-MariaDB], [], [mysql])
+AC_INIT([MariaDB Server], [5.1.47-MariaDB], [], [mysql])
AC_CONFIG_SRCDIR([sql/mysqld.cc])
AC_CANONICAL_SYSTEM
@@ -831,7 +831,7 @@ AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h ieeefp.h limits.h \
memory.h pwd.h select.h fnmatch.h \
- stdlib.h stddef.h sys/stat.h \
+ stdlib.h stddef.h sys/stat.h valgrind/memcheck.h \
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
diff --git a/include/my_global.h b/include/my_global.h
index 6c11a4b461a..2c64f25626b 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -772,7 +772,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#endif
#define MY_NFILE 64 /* This is only used to save filenames */
#ifndef OS_FILE_LIMIT
-#define OS_FILE_LIMIT 65535
+#define OS_FILE_LIMIT UINT_MAX
#endif
/* #define EXT_IN_LIBNAME */
diff --git a/include/my_sys.h b/include/my_sys.h
index d1017f055f6..519204455e1 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -145,7 +145,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
#define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
#define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C)
-#define TRASH(A,B) bfill(A, B, 0x8F)
+
#define QUICK_SAFEMALLOC sf_malloc_quick=1
#define NORMAL_SAFEMALLOC sf_malloc_quick=0
extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index b110f6dd62f..e1852f2929e 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -807,30 +807,37 @@ void mysql_query_cache_invalidate4(MYSQL_THD thd,
const char *key, unsigned int key_length,
int using_trx);
-#ifdef __cplusplus
-}
-#endif
-#ifdef __cplusplus
/**
Provide a handler data getter to simplify coding
*/
-inline
-void *
-thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton)
-{
- return *thd_ha_data(thd, hton);
-}
+void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
+
/**
Provide a handler data setter to simplify coding
+
+ @details
+ Set ha_data pointer (storage engine per-connection information).
+
+ To avoid unclean deactivation (uninstall) of storage engine plugin
+ in the middle of transaction, additional storage engine plugin
+ lock is acquired.
+
+ If ha_data is not null and storage engine plugin was not locked
+ by thd_set_ha_data() in this connection before, storage engine
+ plugin gets locked.
+
+ If ha_data is null and storage engine plugin was locked by
+ thd_set_ha_data() in this connection before, storage engine
+ plugin lock gets released.
+
+ If handlerton::close_connection() didn't reset ha_data, server does
+ it immediately after calling handlerton::close_connection().
*/
-inline
-void
-thd_set_ha_data(const MYSQL_THD thd, const struct handlerton *hton,
- const void *ha_data)
-{
- *thd_ha_data(thd, hton)= (void*) ha_data;
+void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton,
+ const void *ha_data);
+#ifdef __cplusplus
}
#endif
diff --git a/include/mysql/plugin.h.pp b/include/mysql/plugin.h.pp
index 2f44870b479..ac86f687723 100644
--- a/include/mysql/plugin.h.pp
+++ b/include/mysql/plugin.h.pp
@@ -139,3 +139,6 @@ void thd_get_xid(const void* thd, MYSQL_XID *xid);
void mysql_query_cache_invalidate4(void* thd,
const char *key, unsigned int key_length,
int using_trx);
+void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
+void thd_set_ha_data(void* thd, const struct handlerton *hton,
+ const void *ha_data);
diff --git a/mysql-test/include/have_innodb_plugin.inc b/mysql-test/include/have_innodb_plugin.inc
new file mode 100644
index 00000000000..99a79465f52
--- /dev/null
+++ b/mysql-test/include/have_innodb_plugin.inc
@@ -0,0 +1,4 @@
+disable_query_log;
+--require r/true.require
+SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active';
+enable_query_log;
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
index df519e9bda1..39ba623f247 100644
--- a/mysql-test/include/mtr_warnings.sql
+++ b/mysql-test/include/mtr_warnings.sql
@@ -193,6 +193,8 @@ INSERT INTO global_suppressions VALUES
("==[0-9]*== For more details"),
/* This comes with innodb plugin tests */
("==[0-9]*== Warning: set address range perms: large range"),
+ /* valgrind-3.5.0 dumps this */
+ ("==[0-9]*== Command: "),
/* valgrind warnings: invalid file descriptor -1 in syscall
write()/read(). Bug #50414 */
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
index 1a39255d7e3..260b03479e3 100644
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
@@ -70,11 +70,20 @@ my $skip_test_reg;
# Related to adding InnoDB plugin combinations
my $lib_innodb_plugin;
-my $do_innodb_plugin;
# If "Quick collect", set to 1 once a test to run has been found.
my $some_test_found;
+sub find_innodb_plugin {
+ $lib_innodb_plugin=
+ my_find_file($::basedir,
+ ["storage/innodb_plugin", "storage/innodb_plugin/.libs",
+ "lib/mysql/plugin", "lib/mariadb/plugin", "lib/plugin"],
+ ["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
+ "ha_innodb_plugin.sl"],
+ NOT_REQUIRED);
+}
+
sub init_pattern {
my ($from, $what)= @_;
return undef unless defined $from;
@@ -107,16 +116,7 @@ sub collect_test_cases ($$$) {
$do_test_reg= init_pattern($do_test, "--do-test");
$skip_test_reg= init_pattern($skip_test, "--skip-test");
- $lib_innodb_plugin=
- my_find_file($::basedir,
- ["storage/innodb_plugin", "storage/innodb_plugin/.libs",
- "lib/mysql/plugin", "lib/mariadb/plugin", "lib/plugin"],
- ["ha_innodb_plugin.dll", "ha_innodb_plugin.so",
- "ha_innodb_plugin.sl"],
- NOT_REQUIRED);
- $do_innodb_plugin= ($::mysql_version_id >= 50100 &&
- !(IS_WINDOWS && $::opt_embedded_server) &&
- $lib_innodb_plugin);
+ &find_innodb_plugin;
# If not reordering, we also shouldn't group by suites, unless
# no test cases were named.
@@ -508,73 +508,6 @@ sub collect_one_suite
}
}
- # ----------------------------------------------------------------------
- # Testing InnoDB plugin.
- # ----------------------------------------------------------------------
- if ($do_innodb_plugin)
- {
- my @new_cases;
- my $sep= (IS_WINDOWS) ? ';' : ':';
-
- foreach my $test (@cases)
- {
- next if (!$test->{'innodb_test'});
- # If skipped due to no builtin innodb, we can still run it with plugin
- next if ($test->{'skip'} && $test->{comment} ne "No innodb support");
- # Exceptions
- next if ($test->{'name'} eq 'main.innodb'); # Failed with wrong errno (fk)
- next if ($test->{'name'} eq 'main.index_merge_innodb'); # Explain diff
- # innodb_file_per_table is rw with innodb_plugin
- next if ($test->{'name'} eq 'sys_vars.innodb_file_per_table_basic');
- # innodb_lock_wait_timeout is rw with innodb_plugin
- next if ($test->{'name'} eq 'sys_vars.innodb_lock_wait_timeout_basic');
- # Diff around innodb_thread_concurrency variable
- next if ($test->{'name'} eq 'sys_vars.innodb_thread_concurrency_basic');
- # Can't work with InnoPlug. Test framework needs to be re-designed.
- next if ($test->{'name'} eq 'main.innodb_bug46000');
- # Fails with innodb plugin
- next if ($test->{'name'} eq 'main.innodb-autoinc');
- # Fails with innodb plugin: r6185 Testcases changes not included
- next if ($test->{'name'} eq 'main.innodb_bug44369');
- # Fix for BUG47621 is not in InnoDB plugin
- next if ($test->{'name'} eq 'main.innodb_bug21704');
- next if ($test->{'name'} eq 'main.innodb_bug47621');
- # Copy test options
- my $new_test= My::Test->new();
- while (my ($key, $value) = each(%$test))
- {
- if (ref $value eq "ARRAY")
- {
- push(@{$new_test->{$key}}, @$value);
- }
- else
- {
- $new_test->{$key}= $value unless ($key eq 'skip');
- }
- }
- my $plugin_filename= basename($lib_innodb_plugin);
- my $plugin_list= "innodb=$plugin_filename" . $sep . "innodb_locks=$plugin_filename";
- push(@{$new_test->{master_opt}}, '--ignore-builtin-innodb');
- push(@{$new_test->{master_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
- push(@{$new_test->{master_opt}}, "--plugin_load=$plugin_list");
- push(@{$new_test->{slave_opt}}, '--ignore-builtin-innodb');
- push(@{$new_test->{slave_opt}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
- push(@{$new_test->{slave_opt}}, "--plugin_load=$plugin_list");
- if ($new_test->{combination})
- {
- $new_test->{combination}.= '+innodb_plugin';
- }
- else
- {
- $new_test->{combination}= 'innodb_plugin';
- }
- push(@new_cases, $new_test);
- }
- push(@cases, @new_cases);
- }
- # ----------------------------------------------------------------------
- # End of testing InnoDB plugin.
- # ----------------------------------------------------------------------
optimize_cases(\@cases);
#print_testcases(@cases);
@@ -1029,11 +962,38 @@ sub collect_one_test_case {
{
# innodb is not supported, skip it
$tinfo->{'skip'}= 1;
- # This comment is checked for running with innodb plugin (see above),
- # please keep that in mind if changing the text.
$tinfo->{'comment'}= "No innodb support";
- # But continue processing if we may run it with innodb plugin
- return $tinfo unless $do_innodb_plugin;
+ return $tinfo;
+ }
+ }
+ elsif ( $tinfo->{'innodb_plugin_test'} )
+ {
+ # This is a test that needs the innodb plugin
+ if (!&find_innodb_plugin)
+ {
+ # innodb plugin is not supported, skip it
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "No innodb plugin support";
+ return $tinfo;
+ }
+
+ my $sep= (IS_WINDOWS) ? ';' : ':';
+ my $plugin_filename= basename($lib_innodb_plugin);
+ my $plugin_list=
+ "innodb=$plugin_filename$sep" .
+ "innodb_trx=$plugin_filename$sep" .
+ "innodb_locks=$plugin_filename$sep" .
+ "innodb_lock_waits=$plugin_filename$sep" .
+ "innodb_cmp=$plugin_filename$sep" .
+ "innodb_cmp_reset=$plugin_filename$sep" .
+ "innodb_cmpmem=$plugin_filename$sep" .
+ "innodb_cmpmem_reset=$plugin_filename";
+
+ foreach my $k ('master_opt', 'slave_opt')
+ {
+ push(@{$tinfo->{$k}}, '--ignore-builtin-innodb');
+ push(@{$tinfo->{$k}}, '--plugin-dir=' . dirname($lib_innodb_plugin));
+ push(@{$tinfo->{$k}}, "--plugin-load=$plugin_list");
}
}
else
@@ -1205,6 +1165,7 @@ my @tags=
["include/have_innodb.inc", "innodb_test", 1],
["include/have_pbxt.inc", "pbxt_test", 1],
+ ["include/have_innodb_plugin.inc", "innodb_plugin_test", 1],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
["include/have_ndb.inc", "ndb_test", 1],
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index bd68175034d..e3b11e22332 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -1592,6 +1592,8 @@ sub collect_mysqld_features {
my $cmd= join(" ", $exe_mysqld, @$args);
my $list= `$cmd`;
+ print "cmd: $cmd\n";
+
foreach my $line (split('\n', $list))
{
# First look for version
diff --git a/mysql-test/r/bug46261.result b/mysql-test/r/bug46261.result
new file mode 100644
index 00000000000..f54b698e08f
--- /dev/null
+++ b/mysql-test/r/bug46261.result
@@ -0,0 +1,8 @@
+#
+# Bug#46261 Plugins can be installed with --skip-grant-tables
+#
+INSTALL PLUGIN example SONAME 'ha_example.so';
+ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
+UNINSTALL PLUGIN example;
+ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
+End of 5.1 tests
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 1e6153d9f92..cc33980c1a2 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -1230,6 +1230,14 @@ SELECT HEX(DAYNAME(19700101));
HEX(DAYNAME(19700101))
0427043504420432043504400433
SET character_set_connection=latin1;
+#
+# Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
+#
+CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1);
+CREATE VIEW v1 AS SELECT 1 from t1
+WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
+DROP VIEW v1;
+DROP TABLE t1;
End of 5.0 tests
Start of 5.1 tests
SET NAMES utf8;
diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result
index 6153dad2534..27e51a33112 100644
--- a/mysql-test/r/error_simulation.result
+++ b/mysql-test/r/error_simulation.result
@@ -18,3 +18,26 @@ SELECT MAX(a) FROM t1 GROUP BY a,b;
ERROR 23000: Can't write; duplicate key in table 'tmp_table'
set tmp_table_size=default;
DROP TABLE t1;
+#
+# Bug #50946: fast index creation still seems to copy the table
+#
+CREATE TABLE t1 (a INT(100) NOT NULL);
+INSERT INTO t1 VALUES (1), (0), (2);
+SET SESSION debug='+d,alter_table_only_index_change';
+ALTER TABLE t1 ADD INDEX a(a);
+SET SESSION debug=DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(100) NOT NULL,
+ KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+a
+0
+1
+2
+DROP TABLE t1;
+#
+# End of 5.1 tests
+#
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index b8db8b53e06..8f2d704b312 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -226,4 +226,16 @@ Warnings:
Note 1276 Field or reference 'test.t1.c' of SELECT #2 was resolved in SELECT #1
Note 1003 select (select 1 from `test`.`t2` where (`test`.`t2`.`d` = NULL)) AS `(SELECT 1 FROM t2 WHERE d = c)` from `test`.`t1`
DROP TABLE t1, t2;
+#
+# Bug #48419: another explain crash..
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b BLOB, KEY b(b(100)));
+INSERT INTO t2 VALUES ('1'), ('2'), ('3');
+FLUSH TABLES;
+EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND t.a);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+DROP TABLE t1, t2;
End of 5.1 tests.
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index 60273c08e6d..7a19d913231 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -2358,4 +2358,32 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY NULL NULL NULL 1 Impossible ON condition
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
drop table t1,t2;
+#
+# Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
+# JOINed during an UPDATE
+#
+CREATE TABLE t1 (d INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, b INT,
+c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
+set up our data elements
+INSERT INTO t1 (d) VALUES (1);
+INSERT INTO t2 (a,b) VALUES (1,1);
+SELECT SECOND(c) INTO @bug47453 FROM t2;
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+SECOND(c)-@bug47453
+0
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+SECOND(c)-@bug47453
+0
+SELECT SLEEP(1);
+SLEEP(1)
+0
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+#should be 0
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+SECOND(c)-@bug47453
+0
+DROP TABLE t1, t2;
End of 5.1 tests
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 940b3b4102e..c60c6bfb3c8 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -1146,6 +1146,16 @@ ROW(t1.b, 1111.11) <=> ROW('','');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1;
+#
+# Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
+#
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
+INSERT INTO t1 VALUES (0,0), (1,1);
+SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
+a b a b
+0 0 0 0
+1 1 1 1
+DROP TABLE t1;
End of 5.0 tests.
CREATE TABLE t1 (f1 int);
CREATE TABLE t2 (f1 int);
@@ -1174,14 +1184,4 @@ NULL
NULL
1
DROP TABLE t1, t2, mm1;
-#
-# Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
-#
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
-INSERT INTO t1 VALUES (0,0), (1,1);
-SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
-a b a b
-0 0 0 0
-1 1 1 1
-DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index ef206565db5..b3487d376a1 100755..100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -202,12 +202,6 @@ select * from t1;
a b c
10 NULL Ten
15 NULL Fifteen
-show variables like "secure_file_pri%";
-Variable_name Value
-secure_file_priv MYSQLTEST_VARDIR/
-select @@secure_file_priv;
-@@secure_file_priv
-MYSQLTEST_VARDIR/
set @@secure_file_priv= 0;
ERROR HY000: Variable 'secure_file_priv' is a read only variable
truncate table t1;
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index cf08d763e5c..f21f1d83acd 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -155,24 +155,24 @@ execute stmt1 ;
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
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
-5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
-4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
execute stmt1 ;
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
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
-5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
-4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain SELECT (SELECT SUM(c1 + c12 + 0.0) FROM t2 where (t1.c2 - 0e-3) = t2.c2 GROUP BY t1.c15 LIMIT 1) as scalar_s, exists (select 1.0e+0 from t2 where t2.c3 * 9.0000000000 = t1.c4) as exists_s, c5 * 4 in (select c6 + 0.3e+1 from t2) as in_s, (c7 - 4, c8 - 4) in (select c9 + 4.0, c10 + 40e-1 from t2) as in_row_s FROM t1, (select c25 x, c32 y from t2) tt WHERE x * 1 = c25;
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
6 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
-5 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
-4 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+5 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+4 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
deallocate prepare stmt1;
@@ -2988,4 +2988,17 @@ select @plaintext;
bcd
deallocate prepare encode;
deallocate prepare decode;
+#
+# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+#
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (0, 0),(0, 0);
+PREPARE stmt FROM "SELECT 1 FROM t1 WHERE
+ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))";
+EXECUTE stmt;
+1
+EXECUTE stmt;
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
End of 5.1 tests.
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 2eaec67c547..2962123fcb2 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -457,3 +457,12 @@ abc 1 abc 1
select host,user from mysql.user where (host,user) = ('localhost','test');
host user
drop table t1,t2;
+#
+# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+#
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (0, 0),(0, 0);
+SELECT 1 FROM t1 WHERE ROW(a, b) >=
+ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 47711746262..98208cdfbeb 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -2101,4 +2101,27 @@ Warning 1048 Column 'id' cannot be null
Warning 1048 Column 'id' cannot be null
DROP TRIGGER t1_bu;
DROP TABLE t1,t2;
+#
+# Bug#50755: Crash if stored routine def contains version comments
+#
+DROP DATABASE IF EXISTS db1;
+DROP TRIGGER IF EXISTS trg1;
+DROP TABLE IF EXISTS t1, t2;
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE t1 (b INT);
+CREATE TABLE t2 (a INT);
+CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1);
+# Used to crash
+SHOW TRIGGERS IN db1;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+Warnings:
+Warning 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUES (1)' at line 1
+INSERT INTO t2 VALUES (1);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUES (1)' at line 1
+SELECT * FROM t1;
+b
+# Work around Bug#45235
+DROP DATABASE db1;
+USE test;
End of 5.1 tests.
diff --git a/mysql-test/r/variables_debug.result b/mysql-test/r/variables_debug.result
index 9cd133dddb1..85eaf34b033 100644
--- a/mysql-test/r/variables_debug.result
+++ b/mysql-test/r/variables_debug.result
@@ -10,3 +10,16 @@ set debug= '-P';
select @@debug;
@@debug
T
+#
+# Bug #52629: memory leak from sys_var_thd_dbug in
+# binlog.binlog_write_error
+#
+SET GLOBAL debug='d,injecting_fault_writing';
+SELECT @@global.debug;
+@@global.debug
+d,injecting_fault_writing
+SET GLOBAL debug='';
+SELECT @@global.debug;
+@@global.debug
+
+End of 5.1 tests
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index f84186743f4..ad87dda53fe 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -3874,6 +3874,14 @@ CREATE VIEW v1 AS SELECT 1 FROM t1 WHERE
ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' )));
DROP VIEW v1;
DROP TABLE t1;
+#
+# Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
+#
+CREATE TABLE t1 (a CHAR(1) CHARSET latin1, b CHAR(1) CHARSET utf8);
+CREATE VIEW v1 AS SELECT 1 from t1
+WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
+DROP VIEW v1;
+DROP TABLE t1;
# -----------------------------------------------------------------
# -- End of 5.1 tests.
# -----------------------------------------------------------------
diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test
index e2db326129d..ce6d344af32 100644
--- a/mysql-test/suite/binlog/t/binlog_killed.test
+++ b/mysql-test/suite/binlog/t/binlog_killed.test
@@ -202,7 +202,7 @@ eval kill query $ID;
rollback;
connection con2;
---error 0,ER_QUERY_INTERRUPTED
+--error 0,ER_QUERY_INTERRUPTED,ER_LOCK_WAIT_TIMEOUT
reap;
# todo 1,2 above
rollback;
diff --git a/mysql-test/suite/engines/README b/mysql-test/suite/engines/README
index 3ff6fccc689..0f89d5af67f 100644
--- a/mysql-test/suite/engines/README
+++ b/mysql-test/suite/engines/README
@@ -50,22 +50,22 @@ The following suites are included:
Known Issues
------------
-1) The 'funcs' and 'iuds' suites currently runs only against MySQL 5.1 server.
- Running them against MySQL 5.5 will generate errors.
-
-2) The folowing tests in the 'iuds' suite:
+1) The folowing tests in the 'iuds' suite:
- delete_decimal
- insert_decimal
- update_decimal
will return a 'Warning 1264 - Out of range value...' warning if run in a 32-bit environment.
Add the '--force' option to prevent the test run from aborting.
-3) The following tests in the 'funcs' suite will fail when run against the innodb_plugin:
+2) The following tests in the 'funcs' suite will fail when run against the innodb_plugin:
- crash_manycolumns_string (bug 50495)
- ix_unique_lob (bug 52056, masked by an 'Out of memory error' on some 32-bit platforms)
- ix_unique_string_length (bug 52056, masked by an 'Out of memory error' on some 32-bit platforms)
Add the '--force' option to prevent the test run from aborting.
-4) Some of the rpl_xxx tests in the 'funcs' suite require a secific binlog_forat setting and will be
+3) Some of the rpl_xxx tests in the 'funcs' suite require a secific binlog_forat setting and will be
skipped otherwise.
+4) Some of the rpl_xxx tests in the 'funcs' suite will report a 'Statement unsafe for replication' warning
+ when run againsr a server configured to use statement based replication.
+
diff --git a/mysql-test/suite/engines/funcs/t/disabled.def b/mysql-test/suite/engines/funcs/t/disabled.def
index 76b45ca76bf..2aca7006b4e 100644
--- a/mysql-test/suite/engines/funcs/t/disabled.def
+++ b/mysql-test/suite/engines/funcs/t/disabled.def
@@ -1,3 +1,7 @@
# List of disabled tests
# test name : comment
-#rpl_redirect : Fails due to bug#49978
+rpl_redirect : Fails due to bug#49978
+crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb
+ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
+ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
+
diff --git a/mysql-test/suite/engines/iuds/r/insert_year.result b/mysql-test/suite/engines/iuds/r/insert_year.result
index a365375b390..69d1139c037 100644
--- a/mysql-test/suite/engines/iuds/r/insert_year.result
+++ b/mysql-test/suite/engines/iuds/r/insert_year.result
@@ -986,7 +986,7 @@ c1 c2 c3 c4
2155 2155 1998-12-26 1998-12-26 11:30:45
SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2;
total_rows min_value max(c2)
-20 1901 2155
+20 0 2155
SELECT * FROM t2 WHERE c3 = '1998-12-11';
c1 c2 c3 c4
1990 1990 1998-12-11 1998-12-11 11:30:45
@@ -1400,7 +1400,7 @@ c1 c2 c3 c4
2155 2155 1998-12-26 1998-12-26 11:30:45
SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2;
total_rows min_value max(c2)
-20 1901 2155
+20 0 2155
SELECT * FROM t2 WHERE c3 = '1998-12-11';
c1 c2 c3 c4
1990 1990 1998-12-11 1998-12-11 11:30:45
diff --git a/mysql-test/suite/engines/iuds/r/update_delete_calendar.result b/mysql-test/suite/engines/iuds/r/update_delete_calendar.result
index a04585dfd72..e2dd83e03b4 100644
--- a/mysql-test/suite/engines/iuds/r/update_delete_calendar.result
+++ b/mysql-test/suite/engines/iuds/r/update_delete_calendar.result
@@ -791,9 +791,6 @@ Warning 1292 Truncated incorrect datetime value: '2009-01-10 23:60:59'
SELECT count(*) FROM t1 WHERE c2='2001-01-11 23:59:60' /* returns 0 */;
count(*)
0
-Warnings:
-Warning 1292 Incorrect datetime value: '2001-01-11 23:59:60' for column 'c2' at row 1
-Warning 1292 Incorrect datetime value: '2001-01-11 23:59:60' for column 'c2' at row 1
SELECT * FROM t1 WHERE c1='0000-00-00 00:00:00' OR c2='0000-00-00 00:00:00';
c1 c2 c3
0000-00-00 00:00:00 0000-00-00 00:00:00 6
diff --git a/mysql-test/suite/engines/iuds/t/disabled.def b/mysql-test/suite/engines/iuds/t/disabled.def
index e69de29bb2d..f45104cc984 100644
--- a/mysql-test/suite/engines/iuds/t/disabled.def
+++ b/mysql-test/suite/engines/iuds/t/disabled.def
@@ -0,0 +1 @@
+insert_calendar : Bug #52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
diff --git a/mysql-test/suite/engines/iuds/t/insert_number.test b/mysql-test/suite/engines/iuds/t/insert_number.test
index 8c5283fa8b7..b55bd8dc98a 100644
--- a/mysql-test/suite/engines/iuds/t/insert_number.test
+++ b/mysql-test/suite/engines/iuds/t/insert_number.test
@@ -7812,10 +7812,15 @@ SELECT * FROM t2 ORDER BY c1,c6 LIMIT 2;
SELECT * FROM t2 ORDER BY c1,c6 DESC LIMIT 2;
## ref type access
+
+# Bug#52283 : Remove the following --disable_warnings
+# command when the bug is fixed
+--disable_warnings
SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6;
SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6 LIMIT 2;
SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6 DESC;
SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6 DESC LIMIT 2;
+--enable_warnings
## Range access, ordered ##
SELECT * FROM t2 WHERE c1 <> 18446744073709551616 ORDER BY c1,c6;
diff --git a/mysql-test/suite/engines/iuds/t/update_delete_calendar.test b/mysql-test/suite/engines/iuds/t/update_delete_calendar.test
index aa695953ce1..c6a22511766 100644
--- a/mysql-test/suite/engines/iuds/t/update_delete_calendar.test
+++ b/mysql-test/suite/engines/iuds/t/update_delete_calendar.test
@@ -300,7 +300,12 @@ INSERT INTO t1 VALUES('2001-01-09','2001-01-10',6),('2001-01-11','2001-01-12',7)
UPDATE t1 SET c1='2001-01-09 24:59:59',c2='2009-01-10 23:60:59' WHERE c1='2001-01-09';
UPDATE t1 SET c2='2001-01-11 23:59:60' WHERE c1='2001-01-11';
SELECT count(*) FROM t1 WHERE c1='2001-01-09 24:59:59' AND c2='2009-01-10 23:60:59';
+
+# Bug#52283 : Remove the following --disable_warnings
+# command when the bug is fixed
+--disable_warnings
SELECT count(*) FROM t1 WHERE c2='2001-01-11 23:59:60' /* returns 0 */;
+--enable_warnings
--sorted_result
SELECT * FROM t1 WHERE c1='0000-00-00 00:00:00' OR c2='0000-00-00 00:00:00';
diff --git a/mysql-test/suite/innodb/include/have_innodb_plugin.inc b/mysql-test/suite/innodb/include/have_innodb_plugin.inc
deleted file mode 100644
index 24af3274ada..00000000000
--- a/mysql-test/suite/innodb/include/have_innodb_plugin.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-disable_query_log;
---require r/true.require
-select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB';
-enable_query_log;
diff --git a/mysql-test/r/innodb-autoinc-44030.result b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result
index c0695bf0be0..c0695bf0be0 100644
--- a/mysql-test/r/innodb-autoinc-44030.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc-44030.result
diff --git a/storage/innodb_plugin/mysql-test/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index d2e8eb19e0c..a36b3a1a865 100644
--- a/storage/innodb_plugin/mysql-test/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -867,25 +867,380 @@ INSERT INTO t2 SELECT NULL FROM t1;
Got one of the listed errors
DROP TABLE t1;
DROP TABLE t2;
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (null);
-INSERT INTO t1 VALUES (null);
-ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyint(4) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-127 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-127, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32767, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` smallint(6) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-32767 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-32757, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-8388607 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
SELECT * FROM t1;
-d1
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-2147483647 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-9223372036854775807 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
+CREATE INDEX i1 on t1(c2);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ `c2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ KEY `i1` (`c2`)
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
+INSERT INTO t1 (c2) values (0);
+SELECT * FROM t1;
+c1 c2
+10 0
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
+INSERT INTO t1(C2) VALUES ('innodb');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `C1` double NOT NULL AUTO_INCREMENT,
+ `C2` char(10) DEFAULT NULL,
+ PRIMARY KEY (`C1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
+INSERT INTO t1(C2) VALUES ('innodb');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `C1` float NOT NULL AUTO_INCREMENT,
+ `C2` char(10) DEFAULT NULL,
+ PRIMARY KEY (`C1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 SET c1 = 1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+INSERT INTO t1 SET c1 = 2;
+INSERT INTO t1 SET c1 = -1;
+SELECT * FROM t1;
+c1
+-1
1
-3
+2
+INSERT INTO t1 SET c1 = -1;
+Got one of the listed errors
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+REPLACE INTO t1 VALUES (-1);
+SELECT * FROM t1;
+c1
+-1
+1
+2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
SELECT * FROM t1;
-d1
+c1
+-685113344
1
+2
3
-INSERT INTO t1 VALUES(null);
-Got one of the listed errors
-ALTER TABLE t1 AUTO_INCREMENT = 3;
-INSERT INTO t1 VALUES(null);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
+SELECT * FROM t1;
+c1
+-685113344
+2
+3
+4
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
+INSERT INTO t1 VALUES (4), (5), (6), (NULL);
SELECT * FROM t1;
-d1
+c1
+-685113344
1
+2
3
4
+5
+6
+7
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
+SELECT * FROM t1;
+c1
+-685113344
+1
+2
+5
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
+SELECT * FROM t1;
+c1
+-685113344
+1
+2
+3
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
DROP TABLE t1;
diff --git a/storage/innodb_plugin/mysql-test/innodb-lock.result b/mysql-test/suite/innodb/r/innodb-lock.result
index 4ace4065c34..4ace4065c34 100644
--- a/storage/innodb_plugin/mysql-test/innodb-lock.result
+++ b/mysql-test/suite/innodb/r/innodb-lock.result
diff --git a/storage/innodb_plugin/mysql-test/innodb-replace.result b/mysql-test/suite/innodb/r/innodb-replace.result
index c926bb89a2e..c926bb89a2e 100644
--- a/storage/innodb_plugin/mysql-test/innodb-replace.result
+++ b/mysql-test/suite/innodb/r/innodb-replace.result
diff --git a/storage/innodb_plugin/mysql-test/innodb-semi-consistent.result b/mysql-test/suite/innodb/r/innodb-semi-consistent.result
index ca0e362ef80..ca0e362ef80 100644
--- a/storage/innodb_plugin/mysql-test/innodb-semi-consistent.result
+++ b/mysql-test/suite/innodb/r/innodb-semi-consistent.result
diff --git a/mysql-test/r/innodb_bug21704.result b/mysql-test/suite/innodb/r/innodb_bug21704.result
index b8e0b15d50d..b8e0b15d50d 100644
--- a/mysql-test/r/innodb_bug21704.result
+++ b/mysql-test/suite/innodb/r/innodb_bug21704.result
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug34053.result b/mysql-test/suite/innodb/r/innodb_bug34053.result
index 195775f74c8..195775f74c8 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug34053.result
+++ b/mysql-test/suite/innodb/r/innodb_bug34053.result
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug35220.result b/mysql-test/suite/innodb/r/innodb_bug35220.result
index 195775f74c8..195775f74c8 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug35220.result
+++ b/mysql-test/suite/innodb/r/innodb_bug35220.result
diff --git a/mysql-test/r/innodb_bug38231.result b/mysql-test/suite/innodb/r/innodb_bug38231.result
index 2f909779755..2f909779755 100644
--- a/mysql-test/r/innodb_bug38231.result
+++ b/mysql-test/suite/innodb/r/innodb_bug38231.result
diff --git a/mysql-test/r/innodb_bug39438.result b/mysql-test/suite/innodb/r/innodb_bug39438.result
index 195775f74c8..195775f74c8 100644
--- a/mysql-test/r/innodb_bug39438.result
+++ b/mysql-test/suite/innodb/r/innodb_bug39438.result
diff --git a/mysql-test/r/innodb_bug40565.result b/mysql-test/suite/innodb/r/innodb_bug40565.result
index 21e923d9336..21e923d9336 100644
--- a/mysql-test/r/innodb_bug40565.result
+++ b/mysql-test/suite/innodb/r/innodb_bug40565.result
diff --git a/mysql-test/r/innodb_bug42101-nonzero.result b/mysql-test/suite/innodb/r/innodb_bug42101-nonzero.result
index 277dfffdd35..277dfffdd35 100644
--- a/mysql-test/r/innodb_bug42101-nonzero.result
+++ b/mysql-test/suite/innodb/r/innodb_bug42101-nonzero.result
diff --git a/mysql-test/r/innodb_bug42101.result b/mysql-test/suite/innodb/r/innodb_bug42101.result
index 805097ffe9d..805097ffe9d 100644
--- a/mysql-test/r/innodb_bug42101.result
+++ b/mysql-test/suite/innodb/r/innodb_bug42101.result
diff --git a/mysql-test/suite/innodb/r/innodb_bug44369.result b/mysql-test/suite/innodb/r/innodb_bug44369.result
new file mode 100644
index 00000000000..dc5463d5223
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug44369.result
@@ -0,0 +1,18 @@
+create table bug44369 (DB_ROW_ID int) engine=innodb;
+ERROR 42000: Incorrect column name 'DB_ROW_ID'
+show warnings;
+Level Code Message
+Error 1166 Incorrect column name 'DB_ROW_ID'
+Error 1005 Can't create table 'test.bug44369' (errno: -1)
+create table bug44369 (db_row_id int) engine=innodb;
+ERROR 42000: Incorrect column name 'db_row_id'
+show warnings;
+Level Code Message
+Error 1166 Incorrect column name 'db_row_id'
+Error 1005 Can't create table 'test.bug44369' (errno: -1)
+create table bug44369 (db_TRX_Id int) engine=innodb;
+ERROR 42000: Incorrect column name 'db_TRX_Id'
+show warnings;
+Level Code Message
+Error 1166 Incorrect column name 'db_TRX_Id'
+Error 1005 Can't create table 'test.bug44369' (errno: -1)
diff --git a/mysql-test/r/innodb_bug45357.result b/mysql-test/suite/innodb/r/innodb_bug45357.result
index 7adeff2062f..7adeff2062f 100644
--- a/mysql-test/r/innodb_bug45357.result
+++ b/mysql-test/suite/innodb/r/innodb_bug45357.result
diff --git a/mysql-test/r/innodb_bug46000.result b/mysql-test/suite/innodb/r/innodb_bug46000.result
index b27b3d7443b..b27b3d7443b 100644
--- a/mysql-test/r/innodb_bug46000.result
+++ b/mysql-test/suite/innodb/r/innodb_bug46000.result
diff --git a/mysql-test/r/innodb_bug47621.result b/mysql-test/suite/innodb/r/innodb_bug47621.result
index c5f56c09788..c5f56c09788 100644
--- a/mysql-test/r/innodb_bug47621.result
+++ b/mysql-test/suite/innodb/r/innodb_bug47621.result
diff --git a/mysql-test/r/innodb_bug47777.result b/mysql-test/suite/innodb/r/innodb_bug47777.result
index fbba47edcfc..fbba47edcfc 100644
--- a/mysql-test/r/innodb_bug47777.result
+++ b/mysql-test/suite/innodb/r/innodb_bug47777.result
diff --git a/mysql-test/suite/innodb/r/innodb_bug51920.result b/mysql-test/suite/innodb/r/innodb_bug51920.result
new file mode 100644
index 00000000000..7ded141c239
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug51920.result
@@ -0,0 +1,13 @@
+CREATE TABLE bug51920 (i INT) ENGINE=InnoDB;
+INSERT INTO bug51920 VALUES (1);
+BEGIN;
+SELECT * FROM bug51920 FOR UPDATE;
+i
+1
+UPDATE bug51920 SET i=2;
+SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE INFO="UPDATE bug51920 SET i=2"
+INTO @thread_id;
+KILL @thread_id;
+Got one of the listed errors
+DROP TABLE bug51920;
diff --git a/mysql-test/suite/innodb/r/innodb_bug52663.result b/mysql-test/suite/innodb/r/innodb_bug52663.result
new file mode 100644
index 00000000000..89add18617b
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bug52663.result
@@ -0,0 +1,26 @@
+set session transaction isolation level read committed;
+create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
+(what, id)) engine=innodb;
+insert into innodb_bug52663 values ('total', 0, 0);
+begin;
+set session transaction isolation level read committed;
+begin;
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+select * from innodb_bug52663;
+what id count
+total 0 1
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from innodb_bug52663;
+what id count
+total 0 0
+commit;
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+commit;
+select * from innodb_bug52663;
+what id count
+total 0 2
+select * from innodb_bug52663;
+what id count
+total 0 2
+drop table innodb_bug52663;
diff --git a/mysql-test/suite/innodb/r/innodb_misc1.result b/mysql-test/suite/innodb/r/innodb_misc1.result
new file mode 100644
index 00000000000..40d13c9726a
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_misc1.result
@@ -0,0 +1,880 @@
+drop table if exists t1,t2,t3,t4;
+drop database if exists mysqltest;
+create table t1 (v varchar(16384)) engine=innodb;
+drop table t1;
+create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
+insert into t1 values ('8', '6'), ('4', '7');
+select min(a) from t1;
+min(a)
+4
+select min(b) from t1 where a='8';
+min(b)
+6
+drop table t1;
+CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb;
+insert into t1 (b) values (1);
+replace into t1 (b) values (2), (1), (3);
+select * from t1;
+a b
+3 1
+2 2
+4 3
+truncate table t1;
+insert into t1 (b) values (1);
+replace into t1 (b) values (2);
+replace into t1 (b) values (1);
+replace into t1 (b) values (3);
+select * from t1;
+a b
+3 1
+2 2
+4 3
+drop table t1;
+create table t1 (rowid int not null auto_increment, val int not null,primary
+key (rowid), unique(val)) engine=innodb;
+replace into t1 (val) values ('1'),('2');
+replace into t1 (val) values ('1'),('2');
+insert into t1 (val) values ('1'),('2');
+ERROR 23000: Duplicate entry '1' for key 'val'
+select * from t1;
+rowid val
+3 1
+4 2
+drop table t1;
+create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
+insert into t1 (val) values (1);
+update t1 set a=2 where a=1;
+insert into t1 (val) values (1);
+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
+select * from t1;
+a val
+2 1
+drop table t1;
+CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB;
+INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
+SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300;
+GRADE
+252
+SELECT GRADE FROM t1 WHERE GRADE= 151;
+GRADE
+151
+DROP TABLE t1;
+create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=innodb;
+create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=innodb;
+insert into t2 values ('aa','cc');
+insert into t1 values ('aa','bb'),('aa','cc');
+delete t1 from t1,t2 where f1=f3 and f4='cc';
+select * from t1;
+f1 f2
+drop table t1,t2;
+CREATE TABLE t1 (
+id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+id INTEGER NOT NULL,
+FOREIGN KEY (id) REFERENCES t1 (id)
+) ENGINE=InnoDB;
+INSERT INTO t1 (id) VALUES (NULL);
+SELECT * FROM t1;
+id
+1
+TRUNCATE t1;
+INSERT INTO t1 (id) VALUES (NULL);
+SELECT * FROM t1;
+id
+1
+DELETE FROM t1;
+TRUNCATE t1;
+INSERT INTO t1 (id) VALUES (NULL);
+SELECT * FROM t1;
+id
+1
+DROP TABLE t2, t1;
+CREATE TABLE t1
+(
+id INT PRIMARY KEY
+) ENGINE=InnoDB;
+CREATE TEMPORARY TABLE t2
+(
+id INT NOT NULL PRIMARY KEY,
+b INT,
+FOREIGN KEY (b) REFERENCES test.t1(id)
+) ENGINE=InnoDB;
+Got one of the listed errors
+DROP TABLE t1;
+create table t1 (col1 varchar(2000), index (col1(767)))
+character set = latin1 engine = innodb;
+create table t2 (col1 char(255), index (col1))
+character set = latin1 engine = innodb;
+create table t3 (col1 binary(255), index (col1))
+character set = latin1 engine = innodb;
+create table t4 (col1 varchar(767), index (col1))
+character set = latin1 engine = innodb;
+create table t5 (col1 varchar(767) primary key)
+character set = latin1 engine = innodb;
+create table t6 (col1 varbinary(767) primary key)
+character set = latin1 engine = innodb;
+create table t7 (col1 text, index(col1(767)))
+character set = latin1 engine = innodb;
+create table t8 (col1 blob, index(col1(767)))
+character set = latin1 engine = innodb;
+create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
+character set = latin1 engine = innodb;
+show create table t9;
+Table Create Table
+t9 CREATE TABLE `t9` (
+ `col1` varchar(512) DEFAULT NULL,
+ `col2` varchar(512) DEFAULT NULL,
+ KEY `col1` (`col1`,`col2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
+create table t1 (col1 varchar(768), index(col1))
+character set = latin1 engine = innodb;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 767 bytes
+create table t2 (col1 varbinary(768), index(col1))
+character set = latin1 engine = innodb;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 767 bytes
+create table t3 (col1 text, index(col1(768)))
+character set = latin1 engine = innodb;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 767 bytes
+create table t4 (col1 blob, index(col1(768)))
+character set = latin1 engine = innodb;
+Warnings:
+Warning 1071 Specified key was too long; max key length is 767 bytes
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `col1` varchar(768) DEFAULT NULL,
+ KEY `col1` (`col1`(767))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1, t2, t3, t4;
+create table t1 (col1 varchar(768) primary key)
+character set = latin1 engine = innodb;
+ERROR 42000: Specified key was too long; max key length is 767 bytes
+create table t2 (col1 varbinary(768) primary key)
+character set = latin1 engine = innodb;
+ERROR 42000: Specified key was too long; max key length is 767 bytes
+create table t3 (col1 text, primary key(col1(768)))
+character set = latin1 engine = innodb;
+ERROR 42000: Specified key was too long; max key length is 767 bytes
+create table t4 (col1 blob, primary key(col1(768)))
+character set = latin1 engine = innodb;
+ERROR 42000: Specified key was too long; max key length is 767 bytes
+CREATE TABLE t1
+(
+id INT PRIMARY KEY
+) ENGINE=InnoDB;
+CREATE TABLE t2
+(
+v INT,
+CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(2);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1);
+DELETE FROM t1 WHERE id = 1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+DROP TABLE t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE t1;
+SET FOREIGN_KEY_CHECKS=1;
+INSERT INTO t2 VALUES(3);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+DROP TABLE t2;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2);
+set autocommit=0;
+checksum table t1;
+Table Checksum
+test.t1 1531596814
+insert into t1 values(3);
+checksum table t1;
+Table Checksum
+test.t1 1531596814
+commit;
+checksum table t1;
+Table Checksum
+test.t1 2050879373
+commit;
+drop table t1;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2);
+set autocommit=1;
+checksum table t1;
+Table Checksum
+test.t1 1531596814
+set autocommit=1;
+insert into t1 values(3);
+checksum table t1;
+Table Checksum
+test.t1 2050879373
+drop table t1;
+set foreign_key_checks=0;
+create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
+create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
+ERROR HY000: Can't create table 'test.t1' (errno: 150)
+set foreign_key_checks=1;
+drop table t2;
+set foreign_key_checks=0;
+create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
+create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
+ERROR HY000: Can't create table 'test.t2' (errno: 150)
+set foreign_key_checks=1;
+drop table t1;
+set foreign_key_checks=0;
+create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
+create table t1(a varchar(10) primary key) engine = innodb;
+alter table t1 modify column a int;
+Got one of the listed errors
+set foreign_key_checks=1;
+drop table t2,t1;
+set foreign_key_checks=0;
+create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
+create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
+alter table t1 convert to character set utf8;
+set foreign_key_checks=1;
+drop table t2,t1;
+set foreign_key_checks=0;
+create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
+create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
+rename table t3 to t1;
+ERROR HY000: Error on rename of './test/t3' to './test/t1' (errno: 150)
+set foreign_key_checks=1;
+drop table t2,t3;
+create table t1(a int primary key) row_format=redundant engine=innodb;
+create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb;
+create table t3(a int primary key) row_format=compact engine=innodb;
+create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb;
+insert into t1 values(1);
+insert into t3 values(1);
+insert into t2 values(2);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+insert into t4 values(2);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+insert into t2 values(1);
+insert into t4 values(1);
+update t1 set a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+update t2 set a=2;
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+update t3 set a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+update t4 set a=2;
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+truncate t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+truncate t3;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+truncate t2;
+truncate t4;
+truncate t1;
+truncate t3;
+drop table t4,t3,t2,t1;
+create table t1 (a varchar(255) character set utf8,
+b varchar(255) character set utf8,
+c varchar(255) character set utf8,
+d varchar(255) character set utf8,
+key (a,b,c,d)) engine=innodb;
+drop table t1;
+create table t1 (a varchar(255) character set utf8,
+b varchar(255) character set utf8,
+c varchar(255) character set utf8,
+d varchar(255) character set utf8,
+e varchar(255) character set utf8,
+key (a,b,c,d,e)) engine=innodb;
+ERROR 42000: Specified key was too long; max key length is 3072 bytes
+create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
+create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
+create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
+create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
+insert into t1 values (0x41),(0x4120),(0x4100);
+insert into t2 values (0x41),(0x4120),(0x4100);
+ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
+insert into t2 values (0x41),(0x4120);
+insert into t3 values (0x41),(0x4120),(0x4100);
+ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY'
+insert into t3 values (0x41),(0x4100);
+insert into t4 values (0x41),(0x4120),(0x4100);
+ERROR 23000: Duplicate entry 'A' for key 'PRIMARY'
+insert into t4 values (0x41),(0x4100);
+select hex(s1) from t1;
+hex(s1)
+41
+4100
+4120
+select hex(s1) from t2;
+hex(s1)
+4100
+4120
+select hex(s1) from t3;
+hex(s1)
+4100
+41
+select hex(s1) from t4;
+hex(s1)
+4100
+41
+drop table t1,t2,t3,t4;
+create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
+create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
+insert into t2 values(0x42);
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+insert into t2 values(0x41);
+select hex(s1) from t2;
+hex(s1)
+4100
+update t1 set s1=0x123456 where a=2;
+select hex(s1) from t2;
+hex(s1)
+4100
+update t1 set s1=0x12 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+update t1 set s1=0x12345678 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+update t1 set s1=0x123457 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+update t1 set s1=0x1220 where a=1;
+select hex(s1) from t2;
+hex(s1)
+1220
+update t1 set s1=0x1200 where a=1;
+select hex(s1) from t2;
+hex(s1)
+1200
+update t1 set s1=0x4200 where a=1;
+select hex(s1) from t2;
+hex(s1)
+4200
+delete from t1 where a=1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+delete from t1 where a=2;
+update t2 set s1=0x4120;
+delete from t1;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+delete from t1 where a!=3;
+select a,hex(s1) from t1;
+a hex(s1)
+3 4120
+select hex(s1) from t2;
+hex(s1)
+4120
+drop table t2,t1;
+create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
+create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+insert into t1 values(1,0x4100),(2,0x41);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+hex(s1)
+41
+update t1 set s1=0x1234 where a=1;
+select hex(s1) from t2;
+hex(s1)
+41
+update t1 set s1=0x12 where a=2;
+select hex(s1) from t2;
+hex(s1)
+12
+delete from t1 where a=1;
+delete from t1 where a=2;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+select a,hex(s1) from t1;
+a hex(s1)
+2 12
+select hex(s1) from t2;
+hex(s1)
+12
+drop table t2,t1;
+CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
+CREATE TABLE t2(a INT) ENGINE=InnoDB;
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
+ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
+ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
+ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL,
+ KEY `t2_ibfk_0` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t2,t1;
+create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+insert into t1(a) values (1),(2),(3);
+commit;
+set autocommit = 0;
+update t1 set b = 5 where a = 2;
+create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
+set autocommit = 0;
+insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
+(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
+(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
+(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
+(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
+commit;
+commit;
+drop trigger t1t;
+drop table t1;
+create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+insert into t1(a) values (1),(2),(3);
+insert into t2(a) values (1),(2),(3);
+insert into t3(a) values (1),(2),(3);
+insert into t4(a) values (1),(2),(3);
+insert into t3(a) values (5),(7),(8);
+insert into t4(a) values (5),(7),(8);
+insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
+create trigger t1t before insert on t1 for each row begin
+INSERT INTO t2 SET a = NEW.a;
+end |
+create trigger t2t before insert on t2 for each row begin
+DELETE FROM t3 WHERE a = NEW.a;
+end |
+create trigger t3t before delete on t3 for each row begin
+UPDATE t4 SET b = b + 1 WHERE a = OLD.a;
+end |
+create trigger t4t before update on t4 for each row begin
+UPDATE t5 SET b = b + 1 where a = NEW.a;
+end |
+commit;
+set autocommit = 0;
+update t1 set b = b + 5 where a = 1;
+update t2 set b = b + 5 where a = 1;
+update t3 set b = b + 5 where a = 1;
+update t4 set b = b + 5 where a = 1;
+insert into t5(a) values(20);
+set autocommit = 0;
+insert into t1(a) values(7);
+insert into t2(a) values(8);
+delete from t2 where a = 3;
+update t4 set b = b + 1 where a = 3;
+commit;
+drop trigger t1t;
+drop trigger t2t;
+drop trigger t3t;
+drop trigger t4t;
+drop table t1, t2, t3, t4, t5;
+CREATE TABLE t1 (
+field1 varchar(8) NOT NULL DEFAULT '',
+field2 varchar(8) NOT NULL DEFAULT '',
+PRIMARY KEY (field1, field2)
+) ENGINE=InnoDB;
+CREATE TABLE t2 (
+field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
+FOREIGN KEY (field1) REFERENCES t1 (field1)
+ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('old', 'somevalu');
+INSERT INTO t1 VALUES ('other', 'anyvalue');
+INSERT INTO t2 VALUES ('old');
+INSERT INTO t2 VALUES ('other');
+UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
+ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 1 would lead to a duplicate entry
+DROP TABLE t2;
+DROP TABLE t1;
+create table t1 (
+c1 bigint not null,
+c2 bigint not null,
+primary key (c1),
+unique key (c2)
+) engine=innodb;
+create table t2 (
+c1 bigint not null,
+primary key (c1)
+) engine=innodb;
+alter table t1 add constraint c2_fk foreign key (c2)
+references t2(c1) on delete cascade;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL,
+ `c2` bigint(20) NOT NULL,
+ PRIMARY KEY (`c1`),
+ UNIQUE KEY `c2` (`c2`),
+ CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t1 drop foreign key c2_fk;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL,
+ `c2` bigint(20) NOT NULL,
+ PRIMARY KEY (`c1`),
+ UNIQUE KEY `c2` (`c2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1(a date) engine=innodb;
+create table t2(a date, key(a)) engine=innodb;
+insert into t1 values('2005-10-01');
+insert into t2 values('2005-10-01');
+select * from t1, t2
+where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
+a a
+2005-10-01 2005-10-01
+drop table t1, t2;
+create table t1 (id int not null, f_id int not null, f int not null,
+primary key(f_id, id)) engine=innodb;
+create table t2 (id int not null,s_id int not null,s varchar(200),
+primary key(id)) engine=innodb;
+INSERT INTO t1 VALUES (8, 1, 3);
+INSERT INTO t1 VALUES (1, 2, 1);
+INSERT INTO t2 VALUES (1, 0, '');
+INSERT INTO t2 VALUES (8, 1, '');
+commit;
+DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
+WHERE mm.id IS NULL;
+select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
+where mm.id is null lock in share mode;
+id f_id f
+drop table t1,t2;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
+commit;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+update t1 set b = 5 where b = 1;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+select * from t1 where a = 7 and b = 3 for update;
+a b
+7 3
+commit;
+commit;
+drop table t1;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
+commit;
+set autocommit = 0;
+select * from t1 lock in share mode;
+a b
+1 1
+2 2
+3 1
+4 2
+5 1
+6 2
+update t1 set b = 5 where b = 1;
+set autocommit = 0;
+select * from t1 where a = 2 and b = 2 for update;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+commit;
+commit;
+drop table t1;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(d int not null, e int, primary key(d)) engine=innodb;
+insert into t2 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+d e
+3 1
+8 6
+12 1
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+insert into t1 select * from t2;
+update t1 set b = (select e from t2 where a = d);
+create table t3(d int not null, e int, primary key(d)) engine=innodb
+select * from t2;
+commit;
+commit;
+drop table t1, t2, t3;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(a int not null, b int, primary key(a)) engine=innodb;
+insert into t2 values (8,6),(12,1),(3,1);
+create table t3(d int not null, b int, primary key(d)) engine=innodb;
+insert into t3 values (8,6),(12,1),(3,1);
+create table t5(a int not null, b int, primary key(a)) engine=innodb;
+insert into t5 values (1,2),(5,3),(4,2);
+create table t6(d int not null, e int, primary key(d)) engine=innodb;
+insert into t6 values (8,6),(12,1),(3,1);
+create table t8(a int not null, b int, primary key(a)) engine=innodb;
+insert into t8 values (1,2),(5,3),(4,2);
+create table t9(d int not null, e int, primary key(d)) engine=innodb;
+insert into t9 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+a b
+3 1
+8 6
+12 1
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+insert into t1 select * from t2;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+update t3 set b = (select b from t2 where a = d);
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+insert into t5 (select * from t2 lock in share mode);
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+update t6 set e = (select b from t2 where a = d lock in share mode);
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+insert into t8 (select * from t2 for update);
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+update t9 set e = (select b from t2 where a = d for update);
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+commit;
+drop table t1, t2, t3, t5, t6, t8, t9;
+CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
+ERROR 42000: Incorrect column name 'DB_ROW_ID'
+CREATE TABLE t1 (
+a BIGINT(20) NOT NULL,
+PRIMARY KEY (a)
+) ENGINE=INNODB DEFAULT CHARSET=UTF8;
+CREATE TABLE t2 (
+a BIGINT(20) NOT NULL,
+b VARCHAR(128) NOT NULL,
+c TEXT NOT NULL,
+PRIMARY KEY (a,b),
+KEY idx_t2_b_c (b,c(200)),
+CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
+ON DELETE CASCADE
+) ENGINE=INNODB DEFAULT CHARSET=UTF8;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1, 'bar', 'vbar');
+INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
+INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
+INSERT INTO t2 VALUES (1, 'customer_over', '1');
+SELECT * FROM t2 WHERE b = 'customer_over';
+a b c
+1 customer_over 1
+SELECT * FROM t2 WHERE BINARY b = 'customer_over';
+a b c
+1 customer_over 1
+SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
+a
+1
+/* Bang: Empty result set, above was expected: */
+SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
+a
+1
+SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
+a
+1
+drop table t2, t1;
+CREATE TABLE t1 ( a int ) ENGINE=innodb;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
+test.t1 optimize status OK
+DROP TABLE t1;
+CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB;
+CREATE TABLE t2 (id int PRIMARY KEY, f INT NOT NULL,
+CONSTRAINT t2_t1 FOREIGN KEY (id) REFERENCES t1 (id)
+ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
+ALTER TABLE t2 ADD FOREIGN KEY (f) REFERENCES t1 (f) ON
+DELETE CASCADE ON UPDATE CASCADE;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `f` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `f` (`f`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t2, t1;
+CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
+ALTER TABLE t2 MODIFY a INT NOT NULL;
+ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
+DELETE FROM t1;
+DROP TABLE t2,t1;
+CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
+DELETE FROM t1;
+INSERT INTO t1 VALUES ('DDD');
+SELECT * FROM t1;
+a
+DDD
+DROP TABLE t1;
+CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB
+AUTO_INCREMENT=42;
+INSERT INTO t1 VALUES (0),(347),(0);
+SELECT * FROM t1;
+id
+42
+347
+348
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
+CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(42),(347),(348);
+ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`id`),
+ CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1
+DROP TABLE t1,t2;
+CREATE TABLE t1 (
+c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
+c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
+c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255),
+c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255),
+c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255),
+c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255),
+c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
+c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
+) ENGINE = InnoDB;
+ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1(
+id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(-10);
+SELECT * FROM t1;
+id
+-10
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+id
+-10
+1
+DROP TABLE t1;
+SET binlog_format='MIXED';
+SET TX_ISOLATION='read-committed';
+SET AUTOCOMMIT=0;
+DROP TABLE IF EXISTS t1, t2;
+Warnings:
+Note 1051 Unknown table 't1'
+Note 1051 Unknown table 't2'
+CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+SELECT * FROM t2;
+a
+SET binlog_format='MIXED';
+SET TX_ISOLATION='read-committed';
+SET AUTOCOMMIT=0;
+INSERT INTO t1 VALUES (1);
+COMMIT;
+SELECT * FROM t1 WHERE a=1;
+a
+1
+SET binlog_format='MIXED';
+SET TX_ISOLATION='read-committed';
+SET AUTOCOMMIT=0;
+SELECT * FROM t2;
+a
+SET binlog_format='MIXED';
+SET TX_ISOLATION='read-committed';
+SET AUTOCOMMIT=0;
+INSERT INTO t1 VALUES (2);
+COMMIT;
+SELECT * FROM t1 WHERE a=2;
+a
+2
+SELECT * FROM t1 WHERE a=2;
+a
+2
+DROP TABLE t1;
+DROP TABLE t2;
+create table t1 (i int, j int) engine=innodb;
+insert into t1 (i, j) values (1, 1), (2, 2);
+update t1 set j = 2;
+affected rows: 1
+info: Rows matched: 2 Changed: 1 Warnings: 0
+drop table t1;
+create table t1 (id int) comment='this is a comment' engine=innodb;
+select table_comment, data_free > 0 as data_free_is_set
+from information_schema.tables
+where table_schema='test' and table_name = 't1';
+table_comment data_free_is_set
+this is a comment 1
+drop table t1;
+CREATE TABLE t1 (
+c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+c2 VARCHAR(128) NOT NULL,
+PRIMARY KEY(c1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100;
+CREATE TABLE t2 (
+c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+c2 INT(10) UNSIGNED DEFAULT NULL,
+PRIMARY KEY(c1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200;
+SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
+AUTO_INCREMENT
+200
+ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1);
+SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
+AUTO_INCREMENT
+200
+DROP TABLE t2;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 int default NULL,
+c2 int default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+TRUNCATE TABLE t1;
+affected rows: 0
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+affected rows: 5
+info: Records: 5 Duplicates: 0 Warnings: 0
+TRUNCATE TABLE t1;
+affected rows: 0
+DROP TABLE t1;
+Variable_name Value
+Handler_update 0
+Variable_name Value
+Handler_delete 0
+Variable_name Value
+Handler_update 1
+Variable_name Value
+Handler_delete 1
diff --git a/storage/innodb_plugin/mysql-test/innodb_trx_weight.result b/mysql-test/suite/innodb/r/innodb_trx_weight.result
index 195775f74c8..195775f74c8 100644
--- a/storage/innodb_plugin/mysql-test/innodb_trx_weight.result
+++ b/mysql-test/suite/innodb/r/innodb_trx_weight.result
diff --git a/mysql-test/suite/innodb/t/disabled.def b/mysql-test/suite/innodb/t/disabled.def
index baf8c89f539..79c8192aeae 100644
--- a/mysql-test/suite/innodb/t/disabled.def
+++ b/mysql-test/suite/innodb/t/disabled.def
@@ -1 +1,15 @@
-innodb-index: InnoDB: Error: table `test`.`t1#1` already exists in InnoDB internal
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+innodb : Bug#53306 2010-04-30 VasilDimov valgrind warnings
+innodb_bug52663 : Waiting for merge with XtraDB
+innodb_bug51920 : Waiting for merge with XtraDB
+innodb-autoinc : Automatic file format change to Barracuda
diff --git a/mysql-test/suite/innodb/t/innodb-analyze.test b/mysql-test/suite/innodb/t/innodb-analyze.test
deleted file mode 100644
index 870e6434797..00000000000
--- a/mysql-test/suite/innodb/t/innodb-analyze.test
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Test that mysqld does not crash when running ANALYZE TABLE with
-# different values of the parameter innodb_stats_sample_pages.
-#
-
--- source include/have_innodb.inc
--- source suite/innodb/include/have_innodb_plugin.inc
-
-# we care only that the following SQL commands do not produce errors
-# and do not crash the server
--- disable_query_log
--- disable_result_log
--- enable_warnings
-
-SET GLOBAL innodb_stats_sample_pages=0;
-
-# check that the value has been adjusted to 1
--- enable_result_log
-SHOW VARIABLES LIKE 'innodb_stats_sample_pages';
--- disable_result_log
-
-CREATE TABLE innodb_analyze (
- a INT,
- b INT,
- KEY(a),
- KEY(b,a)
-) ENGINE=InnoDB;
-
-# test with empty table
-
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=2;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=4;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=8;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=16;
-ANALYZE TABLE innodb_analyze;
-
-INSERT INTO innodb_analyze VALUES
-(1,1), (1,1), (1,2), (1,3), (1,4), (1,5),
-(8,1), (8,8), (8,2), (7,1), (1,4), (3,5);
-
-SET GLOBAL innodb_stats_sample_pages=1;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=2;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=4;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=8;
-ANALYZE TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=16;
-ANALYZE TABLE innodb_analyze;
-
-DROP TABLE innodb_analyze;
-
-SET GLOBAL innodb_stats_sample_pages=DEFAULT;
diff --git a/mysql-test/t/innodb-autoinc-44030.test b/mysql-test/suite/innodb/t/innodb-autoinc-44030.test
index 2524ceb4009..2524ceb4009 100644
--- a/mysql-test/t/innodb-autoinc-44030.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc-44030.test
diff --git a/storage/innodb_plugin/mysql-test/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index 61c42f45733..ef0359b78b0 100644
--- a/storage/innodb_plugin/mysql-test/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -478,23 +478,187 @@ INSERT INTO t2 SELECT c1 FROM t1;
INSERT INTO t2 SELECT NULL FROM t1;
DROP TABLE t1;
DROP TABLE t2;
+
+# If the user has specified negative values for an AUTOINC column then
+# InnoDB should ignore those values when setting the table's max value.
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+# TINYINT
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# SMALLINT
+#
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32767, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32757, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# MEDIUMINT
+#
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# INT
+#
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# BIGINT
+#
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# End negative number check
+
+##
+# 47125: auto_increment start value is ignored if an index is created
+# and engine=innodb
#
-# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
-# the index (PRIMARY)
-# This test requires a restart of the server
-CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (null);
-INSERT INTO t1 VALUES (null);
-ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
+CREATE INDEX i1 on t1(c2);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (c2) values (0);
SELECT * FROM t1;
+DROP TABLE t1;
+
+##
+# 49032: Use the correct function to read the AUTOINC column value
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
# Restart the server
-- source include/restart_mysqld.inc
-# The MySQL and InnoDB data dictionaries should now be out of sync.
-# The select should print message to the error log
+INSERT INTO t1(C2) VALUES ('innodb');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
+# Restart the server
+-- source include/restart_mysqld.inc
+INSERT INTO t1(C2) VALUES ('innodb');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+##
+# 47720: REPLACE INTO Autoincrement column with negative values
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 SET c1 = 1;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 SET c1 = 2;
+INSERT INTO t1 SET c1 = -1;
SELECT * FROM t1;
--- error ER_AUTOINC_READ_FAILED,1467
-INSERT INTO t1 VALUES(null);
-ALTER TABLE t1 AUTO_INCREMENT = 3;
-INSERT INTO t1 VALUES(null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 SET c1 = -1;
+SHOW CREATE TABLE t1;
+REPLACE INTO t1 VALUES (-1);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+##
+# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
+INSERT INTO t1 VALUES (4), (5), (6), (NULL);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-consistent-master.opt b/mysql-test/suite/innodb/t/innodb-consistent-master.opt
deleted file mode 100644
index cb48f1aaf60..00000000000
--- a/mysql-test/suite/innodb/t/innodb-consistent-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb_lock_wait_timeout=2
diff --git a/mysql-test/suite/innodb/t/innodb-index_ucs2.test b/mysql-test/suite/innodb/t/innodb-index_ucs2.test
deleted file mode 100644
index db4626ac346..00000000000
--- a/mysql-test/suite/innodb/t/innodb-index_ucs2.test
+++ /dev/null
@@ -1,5 +0,0 @@
--- source include/have_innodb.inc
--- source include/have_ucs2.inc
-
--- let charset = ucs2
--- source suite/innodb/include/innodb-index.inc
diff --git a/storage/innodb_plugin/mysql-test/innodb-lock.test b/mysql-test/suite/innodb/t/innodb-lock.test
index eacf7e562be..eacf7e562be 100644
--- a/storage/innodb_plugin/mysql-test/innodb-lock.test
+++ b/mysql-test/suite/innodb/t/innodb-lock.test
diff --git a/storage/innodb_plugin/mysql-test/innodb-master.opt b/mysql-test/suite/innodb/t/innodb-master.opt
index 4901efb416c..4901efb416c 100644
--- a/storage/innodb_plugin/mysql-test/innodb-master.opt
+++ b/mysql-test/suite/innodb/t/innodb-master.opt
diff --git a/storage/innodb_plugin/mysql-test/innodb-replace.test b/mysql-test/suite/innodb/t/innodb-replace.test
index 8c3aacde5e8..8c3aacde5e8 100644
--- a/storage/innodb_plugin/mysql-test/innodb-replace.test
+++ b/mysql-test/suite/innodb/t/innodb-replace.test
diff --git a/storage/innodb_plugin/mysql-test/innodb-semi-consistent-master.opt b/mysql-test/suite/innodb/t/innodb-semi-consistent-master.opt
index e76299453d3..e76299453d3 100644
--- a/storage/innodb_plugin/mysql-test/innodb-semi-consistent-master.opt
+++ b/mysql-test/suite/innodb/t/innodb-semi-consistent-master.opt
diff --git a/storage/innodb_plugin/mysql-test/innodb-semi-consistent.test b/mysql-test/suite/innodb/t/innodb-semi-consistent.test
index 61ad7815ca9..61ad7815ca9 100644
--- a/storage/innodb_plugin/mysql-test/innodb-semi-consistent.test
+++ b/mysql-test/suite/innodb/t/innodb-semi-consistent.test
diff --git a/mysql-test/suite/innodb/t/innodb-timeout.test b/mysql-test/suite/innodb/t/innodb-timeout.test
deleted file mode 100644
index 1ee1ad63180..00000000000
--- a/mysql-test/suite/innodb/t/innodb-timeout.test
+++ /dev/null
@@ -1,65 +0,0 @@
--- source include/have_innodb.inc
--- source suite/innodb/include/have_innodb_plugin.inc
-
-let $timeout=`select @@innodb_lock_wait_timeout`;
-set global innodb_lock_wait_timeout=42;
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-
-connection a;
-select @@innodb_lock_wait_timeout;
-set innodb_lock_wait_timeout=1;
-select @@innodb_lock_wait_timeout;
-
-connection b;
-select @@innodb_lock_wait_timeout;
-set global innodb_lock_wait_timeout=347;
-select @@innodb_lock_wait_timeout;
-set innodb_lock_wait_timeout=1;
-select @@innodb_lock_wait_timeout;
-
-connect (c,localhost,root,,);
-connection c;
-select @@innodb_lock_wait_timeout;
-connection default;
-disconnect c;
-
-connection a;
-create table t1(a int primary key)engine=innodb;
-begin;
-insert into t1 values(1),(2),(3);
-
-connection b;
---send
-select * from t1 for update;
-
-connection a;
-commit;
-
-connection b;
-reap;
-
-connection a;
-begin;
-insert into t1 values(4);
-
-connection b;
---send
-select * from t1 for update;
-
-connection a;
-sleep 2;
-commit;
-
-connection b;
---error ER_LOCK_WAIT_TIMEOUT
-reap;
-drop table t1;
-
-connection default;
-
-disconnect a;
-disconnect b;
-
-eval set global innodb_lock_wait_timeout=$timeout;
diff --git a/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt b/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt
deleted file mode 100644
index 8ec086387f8..00000000000
--- a/mysql-test/suite/innodb/t/innodb-use-sys-malloc-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---loose-innodb-use-sys-malloc=true
---loose-innodb-use-sys-malloc=true
diff --git a/mysql-test/suite/innodb/t/innodb-use-sys-malloc.test b/mysql-test/suite/innodb/t/innodb-use-sys-malloc.test
index d876969f8f3..07ccf261713 100644
--- a/mysql-test/suite/innodb/t/innodb-use-sys-malloc.test
+++ b/mysql-test/suite/innodb/t/innodb-use-sys-malloc.test
@@ -1,5 +1,4 @@
--source include/have_innodb.inc
--- source suite/innodb/include/have_innodb_plugin.inc
# XtraDB has lots of "still reachable" memory leak warnings at shutdown when
# --innodb-use-sys-malloc
--source include/not_valgrind.inc
diff --git a/mysql-test/t/innodb_bug21704.test b/mysql-test/suite/innodb/t/innodb_bug21704.test
index c649b61034c..c649b61034c 100644
--- a/mysql-test/t/innodb_bug21704.test
+++ b/mysql-test/suite/innodb/t/innodb_bug21704.test
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug34053.test b/mysql-test/suite/innodb/t/innodb_bug34053.test
index b935e45c06d..b935e45c06d 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug34053.test
+++ b/mysql-test/suite/innodb/t/innodb_bug34053.test
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug35220.test b/mysql-test/suite/innodb/t/innodb_bug35220.test
index 26f7d6b1ddd..26f7d6b1ddd 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug35220.test
+++ b/mysql-test/suite/innodb/t/innodb_bug35220.test
diff --git a/mysql-test/suite/innodb/t/innodb_bug36169.test b/mysql-test/suite/innodb/t/innodb_bug36169.test
deleted file mode 100644
index da852b816f4..00000000000
--- a/mysql-test/suite/innodb/t/innodb_bug36169.test
+++ /dev/null
@@ -1,1159 +0,0 @@
-#
-# Bug#36169 create innodb compressed table with too large row size crashed
-# http://bugs.mysql.com/36169
-#
-
--- source include/have_innodb.inc
--- source suite/innodb/include/have_innodb_plugin.inc
-
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
-
-#
-# The following is copied from http://bugs.mysql.com/36169
-# (http://bugs.mysql.com/file.php?id=9121)
-# Probably it can be simplified but that is not obvious.
-#
-
-# we care only that the following SQL commands do produce errors
-# as expected and do not crash the server
--- disable_query_log
--- disable_result_log
-
-# Generating 10 tables
-# Creating a table with 94 columns and 24 indexes
-DROP TABLE IF EXISTS `table0`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table0`
-(`col0` BOOL,
-`col1` BOOL,
-`col2` TINYINT,
-`col3` DATE,
-`col4` TIME,
-`col5` SET ('test1','test2','test3'),
-`col6` TIME,
-`col7` TEXT,
-`col8` DECIMAL,
-`col9` SET ('test1','test2','test3'),
-`col10` FLOAT,
-`col11` DOUBLE PRECISION,
-`col12` ENUM ('test1','test2','test3'),
-`col13` TINYBLOB,
-`col14` YEAR,
-`col15` SET ('test1','test2','test3'),
-`col16` NUMERIC,
-`col17` NUMERIC,
-`col18` BLOB,
-`col19` DATETIME,
-`col20` DOUBLE PRECISION,
-`col21` DECIMAL,
-`col22` DATETIME,
-`col23` NUMERIC,
-`col24` NUMERIC,
-`col25` LONGTEXT,
-`col26` TINYBLOB,
-`col27` TIME,
-`col28` TINYBLOB,
-`col29` ENUM ('test1','test2','test3'),
-`col30` SMALLINT,
-`col31` REAL,
-`col32` FLOAT,
-`col33` CHAR (175),
-`col34` TINYTEXT,
-`col35` TINYTEXT,
-`col36` TINYBLOB,
-`col37` TINYBLOB,
-`col38` TINYTEXT,
-`col39` MEDIUMBLOB,
-`col40` TIMESTAMP,
-`col41` DOUBLE,
-`col42` SMALLINT,
-`col43` LONGBLOB,
-`col44` VARCHAR (80),
-`col45` MEDIUMTEXT,
-`col46` NUMERIC,
-`col47` BIGINT,
-`col48` DATE,
-`col49` TINYBLOB,
-`col50` DATE,
-`col51` BOOL,
-`col52` MEDIUMINT,
-`col53` FLOAT,
-`col54` TINYBLOB,
-`col55` LONGTEXT,
-`col56` SMALLINT,
-`col57` ENUM ('test1','test2','test3'),
-`col58` DATETIME,
-`col59` MEDIUMTEXT,
-`col60` VARCHAR (232),
-`col61` NUMERIC,
-`col62` YEAR,
-`col63` SMALLINT,
-`col64` TIMESTAMP,
-`col65` BLOB,
-`col66` LONGBLOB,
-`col67` INT,
-`col68` LONGTEXT,
-`col69` ENUM ('test1','test2','test3'),
-`col70` INT,
-`col71` TIME,
-`col72` TIMESTAMP,
-`col73` TIMESTAMP,
-`col74` VARCHAR (170),
-`col75` SET ('test1','test2','test3'),
-`col76` TINYBLOB,
-`col77` BIGINT,
-`col78` NUMERIC,
-`col79` DATETIME,
-`col80` YEAR,
-`col81` NUMERIC,
-`col82` LONGBLOB,
-`col83` TEXT,
-`col84` CHAR (83),
-`col85` DECIMAL,
-`col86` FLOAT,
-`col87` INT,
-`col88` VARCHAR (145),
-`col89` DATE,
-`col90` DECIMAL,
-`col91` DECIMAL,
-`col92` MEDIUMBLOB,
-`col93` TIME,
-KEY `idx0` (`col69`,`col90`,`col8`),
-KEY `idx1` (`col60`),
-KEY `idx2` (`col60`,`col70`,`col74`),
-KEY `idx3` (`col22`,`col32`,`col72`,`col30`),
-KEY `idx4` (`col29`),
-KEY `idx5` (`col19`,`col45`(143)),
-KEY `idx6` (`col46`,`col48`,`col5`,`col39`(118)),
-KEY `idx7` (`col48`,`col61`),
-KEY `idx8` (`col93`),
-KEY `idx9` (`col31`),
-KEY `idx10` (`col30`,`col21`),
-KEY `idx11` (`col67`),
-KEY `idx12` (`col44`,`col6`,`col8`,`col38`(226)),
-KEY `idx13` (`col71`,`col41`,`col15`,`col49`(88)),
-KEY `idx14` (`col78`),
-KEY `idx15` (`col63`,`col67`,`col64`),
-KEY `idx16` (`col17`,`col86`),
-KEY `idx17` (`col77`,`col56`,`col10`,`col55`(24)),
-KEY `idx18` (`col62`),
-KEY `idx19` (`col31`,`col57`,`col56`,`col53`),
-KEY `idx20` (`col46`),
-KEY `idx21` (`col83`(54)),
-KEY `idx22` (`col51`,`col7`(120)),
-KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`)
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 10 columns and 32 indexes
-DROP TABLE IF EXISTS `table1`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table1`
-(`col0` CHAR (113),
-`col1` FLOAT,
-`col2` BIGINT,
-`col3` DECIMAL,
-`col4` BLOB,
-`col5` LONGTEXT,
-`col6` SET ('test1','test2','test3'),
-`col7` BIGINT,
-`col8` BIGINT,
-`col9` TINYBLOB,
-KEY `idx0` (`col5`(101),`col7`,`col8`),
-KEY `idx1` (`col8`),
-KEY `idx2` (`col4`(177),`col9`(126),`col6`,`col3`),
-KEY `idx3` (`col5`(160)),
-KEY `idx4` (`col9`(242)),
-KEY `idx5` (`col4`(139),`col2`,`col3`),
-KEY `idx6` (`col7`),
-KEY `idx7` (`col6`,`col2`,`col0`,`col3`),
-KEY `idx8` (`col9`(66)),
-KEY `idx9` (`col5`(253)),
-KEY `idx10` (`col1`,`col7`,`col2`),
-KEY `idx11` (`col9`(242),`col0`,`col8`,`col5`(163)),
-KEY `idx12` (`col8`),
-KEY `idx13` (`col0`,`col9`(37)),
-KEY `idx14` (`col0`),
-KEY `idx15` (`col5`(111)),
-KEY `idx16` (`col8`,`col0`,`col5`(13)),
-KEY `idx17` (`col4`(139)),
-KEY `idx18` (`col5`(189),`col2`,`col3`,`col9`(136)),
-KEY `idx19` (`col0`,`col3`,`col1`,`col8`),
-KEY `idx20` (`col8`),
-KEY `idx21` (`col0`,`col7`,`col9`(227),`col3`),
-KEY `idx22` (`col0`),
-KEY `idx23` (`col2`),
-KEY `idx24` (`col3`),
-KEY `idx25` (`col2`,`col3`),
-KEY `idx26` (`col0`),
-KEY `idx27` (`col5`(254)),
-KEY `idx28` (`col3`),
-KEY `idx29` (`col3`),
-KEY `idx30` (`col7`,`col3`,`col0`,`col4`(220)),
-KEY `idx31` (`col4`(1),`col0`)
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 141 columns and 18 indexes
-DROP TABLE IF EXISTS `table2`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table2`
-(`col0` BOOL,
-`col1` MEDIUMINT,
-`col2` VARCHAR (209),
-`col3` MEDIUMBLOB,
-`col4` CHAR (13),
-`col5` DOUBLE,
-`col6` TINYTEXT,
-`col7` REAL,
-`col8` SMALLINT,
-`col9` BLOB,
-`col10` TINYINT,
-`col11` DECIMAL,
-`col12` BLOB,
-`col13` DECIMAL,
-`col14` LONGBLOB,
-`col15` SMALLINT,
-`col16` LONGBLOB,
-`col17` TINYTEXT,
-`col18` FLOAT,
-`col19` CHAR (78),
-`col20` MEDIUMTEXT,
-`col21` SET ('test1','test2','test3'),
-`col22` MEDIUMINT,
-`col23` INT,
-`col24` MEDIUMBLOB,
-`col25` ENUM ('test1','test2','test3'),
-`col26` TINYBLOB,
-`col27` VARCHAR (116),
-`col28` TIMESTAMP,
-`col29` BLOB,
-`col30` SMALLINT,
-`col31` DOUBLE PRECISION,
-`col32` DECIMAL,
-`col33` DECIMAL,
-`col34` TEXT,
-`col35` MEDIUMINT,
-`col36` MEDIUMINT,
-`col37` BIGINT,
-`col38` VARCHAR (253),
-`col39` TINYBLOB,
-`col40` MEDIUMBLOB,
-`col41` BIGINT,
-`col42` DOUBLE,
-`col43` TEXT,
-`col44` BLOB,
-`col45` TIME,
-`col46` MEDIUMINT,
-`col47` DOUBLE PRECISION,
-`col48` SET ('test1','test2','test3'),
-`col49` DOUBLE PRECISION,
-`col50` VARCHAR (97),
-`col51` TEXT,
-`col52` NUMERIC,
-`col53` ENUM ('test1','test2','test3'),
-`col54` MEDIUMTEXT,
-`col55` MEDIUMINT,
-`col56` DATETIME,
-`col57` DATETIME,
-`col58` MEDIUMTEXT,
-`col59` CHAR (244),
-`col60` LONGBLOB,
-`col61` MEDIUMBLOB,
-`col62` DOUBLE,
-`col63` SMALLINT,
-`col64` BOOL,
-`col65` SMALLINT,
-`col66` VARCHAR (212),
-`col67` TIME,
-`col68` REAL,
-`col69` BOOL,
-`col70` BIGINT,
-`col71` DATE,
-`col72` TINYINT,
-`col73` ENUM ('test1','test2','test3'),
-`col74` DATE,
-`col75` TIME,
-`col76` DATETIME,
-`col77` BOOL,
-`col78` TINYTEXT,
-`col79` MEDIUMINT,
-`col80` NUMERIC,
-`col81` LONGTEXT,
-`col82` SET ('test1','test2','test3'),
-`col83` DOUBLE PRECISION,
-`col84` NUMERIC,
-`col85` VARCHAR (184),
-`col86` DOUBLE PRECISION,
-`col87` MEDIUMTEXT,
-`col88` MEDIUMBLOB,
-`col89` BOOL,
-`col90` SMALLINT,
-`col91` TINYINT,
-`col92` ENUM ('test1','test2','test3'),
-`col93` BOOL,
-`col94` TIMESTAMP,
-`col95` BOOL,
-`col96` MEDIUMTEXT,
-`col97` DECIMAL,
-`col98` BOOL,
-`col99` DECIMAL,
-`col100` MEDIUMINT,
-`col101` DOUBLE PRECISION,
-`col102` TINYINT,
-`col103` BOOL,
-`col104` MEDIUMINT,
-`col105` DECIMAL,
-`col106` NUMERIC,
-`col107` TIMESTAMP,
-`col108` MEDIUMBLOB,
-`col109` TINYBLOB,
-`col110` SET ('test1','test2','test3'),
-`col111` YEAR,
-`col112` TIMESTAMP,
-`col113` CHAR (201),
-`col114` BOOL,
-`col115` TINYINT,
-`col116` DOUBLE,
-`col117` TINYINT,
-`col118` TIMESTAMP,
-`col119` SET ('test1','test2','test3'),
-`col120` SMALLINT,
-`col121` TINYBLOB,
-`col122` TIMESTAMP,
-`col123` BLOB,
-`col124` DATE,
-`col125` SMALLINT,
-`col126` ENUM ('test1','test2','test3'),
-`col127` MEDIUMBLOB,
-`col128` DOUBLE PRECISION,
-`col129` REAL,
-`col130` VARCHAR (159),
-`col131` MEDIUMBLOB,
-`col132` BIGINT,
-`col133` INT,
-`col134` SET ('test1','test2','test3'),
-`col135` CHAR (198),
-`col136` SET ('test1','test2','test3'),
-`col137` MEDIUMTEXT,
-`col138` SMALLINT,
-`col139` BLOB,
-`col140` LONGBLOB,
-KEY `idx0` (`col14`(139),`col24`(208),`col38`,`col35`),
-KEY `idx1` (`col48`,`col118`,`col29`(131),`col100`),
-KEY `idx2` (`col86`,`col67`,`col43`(175)),
-KEY `idx3` (`col19`),
-KEY `idx4` (`col40`(220),`col67`),
-KEY `idx5` (`col99`,`col56`),
-KEY `idx6` (`col68`,`col28`,`col137`(157)),
-KEY `idx7` (`col51`(160),`col99`,`col45`,`col39`(9)),
-KEY `idx8` (`col15`,`col52`,`col90`,`col94`),
-KEY `idx9` (`col24`(3),`col139`(248),`col108`(118),`col41`),
-KEY `idx10` (`col36`,`col92`,`col114`),
-KEY `idx11` (`col115`,`col9`(116)),
-KEY `idx12` (`col130`,`col93`,`col134`),
-KEY `idx13` (`col123`(65)),
-KEY `idx14` (`col44`(90),`col86`,`col119`),
-KEY `idx15` (`col69`),
-KEY `idx16` (`col132`,`col81`(118),`col18`),
-KEY `idx17` (`col24`(250),`col7`,`col92`,`col45`)
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 199 columns and 1 indexes
-DROP TABLE IF EXISTS `table3`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table3`
-(`col0` SMALLINT,
-`col1` SET ('test1','test2','test3'),
-`col2` TINYTEXT,
-`col3` DOUBLE,
-`col4` NUMERIC,
-`col5` DATE,
-`col6` BIGINT,
-`col7` DOUBLE,
-`col8` TEXT,
-`col9` INT,
-`col10` REAL,
-`col11` TINYINT,
-`col12` NUMERIC,
-`col13` NUMERIC,
-`col14` TIME,
-`col15` DOUBLE,
-`col16` REAL,
-`col17` MEDIUMBLOB,
-`col18` YEAR,
-`col19` TINYTEXT,
-`col20` YEAR,
-`col21` CHAR (250),
-`col22` TINYINT,
-`col23` TINYINT,
-`col24` SMALLINT,
-`col25` DATETIME,
-`col26` MEDIUMINT,
-`col27` LONGBLOB,
-`col28` VARCHAR (106),
-`col29` FLOAT,
-`col30` MEDIUMTEXT,
-`col31` TINYBLOB,
-`col32` BIGINT,
-`col33` YEAR,
-`col34` REAL,
-`col35` MEDIUMBLOB,
-`col36` LONGTEXT,
-`col37` LONGBLOB,
-`col38` BIGINT,
-`col39` FLOAT,
-`col40` TIME,
-`col41` DATETIME,
-`col42` BOOL,
-`col43` BIGINT,
-`col44` SMALLINT,
-`col45` TIME,
-`col46` DOUBLE PRECISION,
-`col47` TIME,
-`col48` TINYTEXT,
-`col49` DOUBLE PRECISION,
-`col50` BIGINT,
-`col51` NUMERIC,
-`col52` TINYBLOB,
-`col53` DATE,
-`col54` DECIMAL,
-`col55` SMALLINT,
-`col56` TINYTEXT,
-`col57` ENUM ('test1','test2','test3'),
-`col58` YEAR,
-`col59` TIME,
-`col60` TINYINT,
-`col61` DECIMAL,
-`col62` DOUBLE,
-`col63` DATE,
-`col64` LONGTEXT,
-`col65` DOUBLE,
-`col66` VARCHAR (88),
-`col67` MEDIUMTEXT,
-`col68` DATE,
-`col69` MEDIUMINT,
-`col70` DECIMAL,
-`col71` MEDIUMTEXT,
-`col72` LONGTEXT,
-`col73` REAL,
-`col74` DOUBLE,
-`col75` TIME,
-`col76` DATE,
-`col77` DECIMAL,
-`col78` MEDIUMBLOB,
-`col79` NUMERIC,
-`col80` BIGINT,
-`col81` YEAR,
-`col82` SMALLINT,
-`col83` MEDIUMINT,
-`col84` TINYINT,
-`col85` MEDIUMBLOB,
-`col86` TIME,
-`col87` MEDIUMBLOB,
-`col88` LONGTEXT,
-`col89` BOOL,
-`col90` BLOB,
-`col91` LONGBLOB,
-`col92` YEAR,
-`col93` BLOB,
-`col94` INT,
-`col95` TINYTEXT,
-`col96` TINYINT,
-`col97` DECIMAL,
-`col98` ENUM ('test1','test2','test3'),
-`col99` MEDIUMINT,
-`col100` TINYINT,
-`col101` MEDIUMBLOB,
-`col102` TINYINT,
-`col103` SET ('test1','test2','test3'),
-`col104` TIMESTAMP,
-`col105` TEXT,
-`col106` DATETIME,
-`col107` MEDIUMTEXT,
-`col108` CHAR (220),
-`col109` TIME,
-`col110` VARCHAR (131),
-`col111` DECIMAL,
-`col112` FLOAT,
-`col113` SMALLINT,
-`col114` BIGINT,
-`col115` LONGBLOB,
-`col116` SET ('test1','test2','test3'),
-`col117` ENUM ('test1','test2','test3'),
-`col118` BLOB,
-`col119` MEDIUMTEXT,
-`col120` SET ('test1','test2','test3'),
-`col121` DATETIME,
-`col122` FLOAT,
-`col123` VARCHAR (242),
-`col124` YEAR,
-`col125` MEDIUMBLOB,
-`col126` TIME,
-`col127` BOOL,
-`col128` TINYBLOB,
-`col129` DOUBLE,
-`col130` TINYINT,
-`col131` BIGINT,
-`col132` SMALLINT,
-`col133` INT,
-`col134` DOUBLE PRECISION,
-`col135` MEDIUMBLOB,
-`col136` SET ('test1','test2','test3'),
-`col137` TINYTEXT,
-`col138` DOUBLE PRECISION,
-`col139` NUMERIC,
-`col140` BLOB,
-`col141` SET ('test1','test2','test3'),
-`col142` INT,
-`col143` VARCHAR (26),
-`col144` BLOB,
-`col145` REAL,
-`col146` SET ('test1','test2','test3'),
-`col147` LONGBLOB,
-`col148` TEXT,
-`col149` BLOB,
-`col150` CHAR (189),
-`col151` LONGTEXT,
-`col152` INT,
-`col153` FLOAT,
-`col154` LONGTEXT,
-`col155` DATE,
-`col156` LONGBLOB,
-`col157` TINYBLOB,
-`col158` REAL,
-`col159` DATE,
-`col160` TIME,
-`col161` YEAR,
-`col162` DOUBLE,
-`col163` VARCHAR (90),
-`col164` FLOAT,
-`col165` NUMERIC,
-`col166` ENUM ('test1','test2','test3'),
-`col167` DOUBLE PRECISION,
-`col168` DOUBLE PRECISION,
-`col169` TINYBLOB,
-`col170` TIME,
-`col171` SMALLINT,
-`col172` TINYTEXT,
-`col173` SMALLINT,
-`col174` DOUBLE,
-`col175` VARCHAR (14),
-`col176` VARCHAR (90),
-`col177` REAL,
-`col178` MEDIUMINT,
-`col179` TINYBLOB,
-`col180` FLOAT,
-`col181` TIMESTAMP,
-`col182` REAL,
-`col183` DOUBLE PRECISION,
-`col184` BIGINT,
-`col185` INT,
-`col186` MEDIUMTEXT,
-`col187` TIME,
-`col188` FLOAT,
-`col189` TIME,
-`col190` INT,
-`col191` FLOAT,
-`col192` MEDIUMINT,
-`col193` TINYINT,
-`col194` MEDIUMTEXT,
-`col195` DATE,
-`col196` TIME,
-`col197` YEAR,
-`col198` CHAR (206),
-KEY `idx0` (`col39`,`col23`)
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 133 columns and 16 indexes
-DROP TABLE IF EXISTS `table4`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table4`
-(`col0` VARCHAR (60),
-`col1` NUMERIC,
-`col2` LONGTEXT,
-`col3` MEDIUMTEXT,
-`col4` LONGTEXT,
-`col5` LONGBLOB,
-`col6` LONGBLOB,
-`col7` DATETIME,
-`col8` TINYTEXT,
-`col9` BLOB,
-`col10` BOOL,
-`col11` BIGINT,
-`col12` TEXT,
-`col13` VARCHAR (213),
-`col14` TINYBLOB,
-`col15` BOOL,
-`col16` MEDIUMTEXT,
-`col17` DOUBLE,
-`col18` TEXT,
-`col19` BLOB,
-`col20` SET ('test1','test2','test3'),
-`col21` TINYINT,
-`col22` DATETIME,
-`col23` TINYINT,
-`col24` ENUM ('test1','test2','test3'),
-`col25` REAL,
-`col26` BOOL,
-`col27` FLOAT,
-`col28` LONGBLOB,
-`col29` DATETIME,
-`col30` FLOAT,
-`col31` SET ('test1','test2','test3'),
-`col32` LONGBLOB,
-`col33` NUMERIC,
-`col34` YEAR,
-`col35` VARCHAR (146),
-`col36` BIGINT,
-`col37` DATETIME,
-`col38` DATE,
-`col39` SET ('test1','test2','test3'),
-`col40` CHAR (112),
-`col41` FLOAT,
-`col42` YEAR,
-`col43` TIME,
-`col44` DOUBLE,
-`col45` NUMERIC,
-`col46` FLOAT,
-`col47` DECIMAL,
-`col48` BIGINT,
-`col49` DECIMAL,
-`col50` YEAR,
-`col51` MEDIUMTEXT,
-`col52` LONGBLOB,
-`col53` SET ('test1','test2','test3'),
-`col54` BLOB,
-`col55` FLOAT,
-`col56` REAL,
-`col57` REAL,
-`col58` TEXT,
-`col59` MEDIUMBLOB,
-`col60` INT,
-`col61` INT,
-`col62` DATE,
-`col63` TEXT,
-`col64` DATE,
-`col65` ENUM ('test1','test2','test3'),
-`col66` DOUBLE PRECISION,
-`col67` TINYTEXT,
-`col68` TINYBLOB,
-`col69` FLOAT,
-`col70` BLOB,
-`col71` DATETIME,
-`col72` DOUBLE,
-`col73` LONGTEXT,
-`col74` TIME,
-`col75` DATETIME,
-`col76` VARCHAR (122),
-`col77` MEDIUMTEXT,
-`col78` MEDIUMTEXT,
-`col79` BOOL,
-`col80` LONGTEXT,
-`col81` TINYTEXT,
-`col82` NUMERIC,
-`col83` DOUBLE PRECISION,
-`col84` DATE,
-`col85` YEAR,
-`col86` BLOB,
-`col87` TINYTEXT,
-`col88` DOUBLE PRECISION,
-`col89` MEDIUMINT,
-`col90` MEDIUMTEXT,
-`col91` NUMERIC,
-`col92` DATETIME,
-`col93` NUMERIC,
-`col94` SET ('test1','test2','test3'),
-`col95` TINYTEXT,
-`col96` SET ('test1','test2','test3'),
-`col97` YEAR,
-`col98` MEDIUMINT,
-`col99` TEXT,
-`col100` TEXT,
-`col101` TIME,
-`col102` VARCHAR (225),
-`col103` TINYTEXT,
-`col104` TEXT,
-`col105` MEDIUMTEXT,
-`col106` TINYINT,
-`col107` TEXT,
-`col108` LONGBLOB,
-`col109` LONGTEXT,
-`col110` TINYTEXT,
-`col111` CHAR (56),
-`col112` YEAR,
-`col113` ENUM ('test1','test2','test3'),
-`col114` TINYBLOB,
-`col115` DATETIME,
-`col116` DATE,
-`col117` TIME,
-`col118` MEDIUMTEXT,
-`col119` DOUBLE PRECISION,
-`col120` FLOAT,
-`col121` TIMESTAMP,
-`col122` MEDIUMINT,
-`col123` YEAR,
-`col124` DATE,
-`col125` TEXT,
-`col126` FLOAT,
-`col127` TINYTEXT,
-`col128` BOOL,
-`col129` NUMERIC,
-`col130` TIMESTAMP,
-`col131` INT,
-`col132` MEDIUMBLOB,
-KEY `idx0` (`col130`),
-KEY `idx1` (`col30`,`col55`,`col19`(31)),
-KEY `idx2` (`col104`(186)),
-KEY `idx3` (`col131`),
-KEY `idx4` (`col64`,`col93`,`col2`(11)),
-KEY `idx5` (`col34`,`col121`,`col22`),
-KEY `idx6` (`col33`,`col55`,`col83`),
-KEY `idx7` (`col17`,`col87`(245),`col99`(17)),
-KEY `idx8` (`col65`,`col120`),
-KEY `idx9` (`col82`),
-KEY `idx10` (`col9`(72)),
-KEY `idx11` (`col88`),
-KEY `idx12` (`col128`,`col9`(200),`col71`,`col66`),
-KEY `idx13` (`col77`(126)),
-KEY `idx14` (`col105`(26),`col13`,`col117`),
-KEY `idx15` (`col4`(246),`col130`,`col115`,`col3`(141))
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 176 columns and 13 indexes
-DROP TABLE IF EXISTS `table5`;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table5`
-(`col0` MEDIUMTEXT,
-`col1` VARCHAR (90),
-`col2` TINYTEXT,
-`col3` TIME,
-`col4` BOOL,
-`col5` TINYTEXT,
-`col6` BOOL,
-`col7` TIMESTAMP,
-`col8` TINYBLOB,
-`col9` TINYINT,
-`col10` YEAR,
-`col11` SET ('test1','test2','test3'),
-`col12` TEXT,
-`col13` CHAR (248),
-`col14` BIGINT,
-`col15` TEXT,
-`col16` TINYINT,
-`col17` NUMERIC,
-`col18` SET ('test1','test2','test3'),
-`col19` LONGBLOB,
-`col20` FLOAT,
-`col21` INT,
-`col22` TEXT,
-`col23` BOOL,
-`col24` DECIMAL,
-`col25` DOUBLE PRECISION,
-`col26` FLOAT,
-`col27` TINYBLOB,
-`col28` NUMERIC,
-`col29` MEDIUMBLOB,
-`col30` DATE,
-`col31` LONGTEXT,
-`col32` DATE,
-`col33` FLOAT,
-`col34` BIGINT,
-`col35` TINYTEXT,
-`col36` MEDIUMTEXT,
-`col37` TIME,
-`col38` INT,
-`col39` TINYINT,
-`col40` SET ('test1','test2','test3'),
-`col41` CHAR (130),
-`col42` SMALLINT,
-`col43` INT,
-`col44` MEDIUMTEXT,
-`col45` VARCHAR (126),
-`col46` INT,
-`col47` DOUBLE PRECISION,
-`col48` BIGINT,
-`col49` MEDIUMTEXT,
-`col50` TINYBLOB,
-`col51` MEDIUMINT,
-`col52` TEXT,
-`col53` VARCHAR (208),
-`col54` VARCHAR (207),
-`col55` NUMERIC,
-`col56` DATETIME,
-`col57` ENUM ('test1','test2','test3'),
-`col58` NUMERIC,
-`col59` TINYBLOB,
-`col60` VARCHAR (73),
-`col61` MEDIUMTEXT,
-`col62` TINYBLOB,
-`col63` DATETIME,
-`col64` NUMERIC,
-`col65` MEDIUMINT,
-`col66` DATETIME,
-`col67` NUMERIC,
-`col68` TINYINT,
-`col69` VARCHAR (58),
-`col70` DECIMAL,
-`col71` MEDIUMTEXT,
-`col72` DATE,
-`col73` TIME,
-`col74` DOUBLE PRECISION,
-`col75` DECIMAL,
-`col76` MEDIUMBLOB,
-`col77` REAL,
-`col78` YEAR,
-`col79` YEAR,
-`col80` LONGBLOB,
-`col81` BLOB,
-`col82` BIGINT,
-`col83` ENUM ('test1','test2','test3'),
-`col84` NUMERIC,
-`col85` SET ('test1','test2','test3'),
-`col86` MEDIUMTEXT,
-`col87` LONGBLOB,
-`col88` TIME,
-`col89` ENUM ('test1','test2','test3'),
-`col90` DECIMAL,
-`col91` FLOAT,
-`col92` DATETIME,
-`col93` TINYTEXT,
-`col94` TIMESTAMP,
-`col95` TIMESTAMP,
-`col96` TEXT,
-`col97` REAL,
-`col98` VARCHAR (198),
-`col99` TIME,
-`col100` TINYINT,
-`col101` BIGINT,
-`col102` LONGBLOB,
-`col103` LONGBLOB,
-`col104` MEDIUMINT,
-`col105` MEDIUMTEXT,
-`col106` TIMESTAMP,
-`col107` SMALLINT,
-`col108` NUMERIC,
-`col109` DECIMAL,
-`col110` FLOAT,
-`col111` DECIMAL,
-`col112` REAL,
-`col113` TINYTEXT,
-`col114` FLOAT,
-`col115` VARCHAR (7),
-`col116` LONGTEXT,
-`col117` DATE,
-`col118` BIGINT,
-`col119` TEXT,
-`col120` BIGINT,
-`col121` BLOB,
-`col122` CHAR (110),
-`col123` NUMERIC,
-`col124` MEDIUMBLOB,
-`col125` NUMERIC,
-`col126` NUMERIC,
-`col127` BOOL,
-`col128` TIME,
-`col129` TINYBLOB,
-`col130` TINYBLOB,
-`col131` DATE,
-`col132` INT,
-`col133` VARCHAR (123),
-`col134` CHAR (238),
-`col135` VARCHAR (225),
-`col136` LONGTEXT,
-`col137` LONGBLOB,
-`col138` REAL,
-`col139` TINYBLOB,
-`col140` DATETIME,
-`col141` TINYTEXT,
-`col142` LONGBLOB,
-`col143` BIGINT,
-`col144` VARCHAR (236),
-`col145` TEXT,
-`col146` YEAR,
-`col147` DECIMAL,
-`col148` TEXT,
-`col149` MEDIUMBLOB,
-`col150` TINYINT,
-`col151` BOOL,
-`col152` VARCHAR (72),
-`col153` INT,
-`col154` VARCHAR (165),
-`col155` TINYINT,
-`col156` MEDIUMTEXT,
-`col157` DOUBLE PRECISION,
-`col158` TIME,
-`col159` MEDIUMBLOB,
-`col160` LONGBLOB,
-`col161` DATETIME,
-`col162` DOUBLE PRECISION,
-`col163` BLOB,
-`col164` ENUM ('test1','test2','test3'),
-`col165` TIMESTAMP,
-`col166` DATE,
-`col167` TINYBLOB,
-`col168` TINYBLOB,
-`col169` LONGBLOB,
-`col170` DATETIME,
-`col171` BIGINT,
-`col172` VARCHAR (30),
-`col173` LONGTEXT,
-`col174` TIME,
-`col175` FLOAT,
-KEY `idx0` (`col16`,`col156`(139),`col97`,`col120`),
-KEY `idx1` (`col24`,`col0`(108)),
-KEY `idx2` (`col117`,`col173`(34),`col132`,`col82`),
-KEY `idx3` (`col2`(86)),
-KEY `idx4` (`col2`(43)),
-KEY `idx5` (`col83`,`col35`(87),`col111`),
-KEY `idx6` (`col6`,`col134`,`col92`),
-KEY `idx7` (`col56`),
-KEY `idx8` (`col30`,`col53`,`col129`(66)),
-KEY `idx9` (`col53`,`col113`(211),`col32`,`col15`(75)),
-KEY `idx10` (`col34`),
-KEY `idx11` (`col126`),
-KEY `idx12` (`col24`)
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-# Creating a table with 179 columns and 46 indexes
-DROP TABLE IF EXISTS `table6`;
--- error ER_TOO_BIG_ROWSIZE
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE IF NOT EXISTS `table6`
-(`col0` ENUM ('test1','test2','test3'),
-`col1` MEDIUMBLOB,
-`col2` MEDIUMBLOB,
-`col3` DATETIME,
-`col4` DATE,
-`col5` YEAR,
-`col6` REAL,
-`col7` NUMERIC,
-`col8` MEDIUMBLOB,
-`col9` TEXT,
-`col10` TIMESTAMP,
-`col11` DOUBLE,
-`col12` DOUBLE,
-`col13` SMALLINT,
-`col14` TIMESTAMP,
-`col15` DECIMAL,
-`col16` DATE,
-`col17` TEXT,
-`col18` LONGBLOB,
-`col19` BIGINT,
-`col20` FLOAT,
-`col21` DATETIME,
-`col22` TINYINT,
-`col23` MEDIUMBLOB,
-`col24` SET ('test1','test2','test3'),
-`col25` TIME,
-`col26` TEXT,
-`col27` LONGTEXT,
-`col28` BIGINT,
-`col29` REAL,
-`col30` YEAR,
-`col31` MEDIUMBLOB,
-`col32` MEDIUMINT,
-`col33` FLOAT,
-`col34` TEXT,
-`col35` DATE,
-`col36` TIMESTAMP,
-`col37` REAL,
-`col38` BLOB,
-`col39` BLOB,
-`col40` BLOB,
-`col41` TINYBLOB,
-`col42` INT,
-`col43` TINYINT,
-`col44` REAL,
-`col45` BIGINT,
-`col46` TIMESTAMP,
-`col47` BLOB,
-`col48` ENUM ('test1','test2','test3'),
-`col49` BOOL,
-`col50` CHAR (109),
-`col51` DOUBLE,
-`col52` DOUBLE PRECISION,
-`col53` ENUM ('test1','test2','test3'),
-`col54` FLOAT,
-`col55` DOUBLE PRECISION,
-`col56` CHAR (166),
-`col57` TEXT,
-`col58` TIME,
-`col59` DECIMAL,
-`col60` TEXT,
-`col61` ENUM ('test1','test2','test3'),
-`col62` LONGTEXT,
-`col63` YEAR,
-`col64` DOUBLE,
-`col65` CHAR (87),
-`col66` DATE,
-`col67` BOOL,
-`col68` MEDIUMBLOB,
-`col69` DATETIME,
-`col70` DECIMAL,
-`col71` TIME,
-`col72` REAL,
-`col73` LONGTEXT,
-`col74` BLOB,
-`col75` REAL,
-`col76` INT,
-`col77` INT,
-`col78` FLOAT,
-`col79` DOUBLE,
-`col80` MEDIUMINT,
-`col81` ENUM ('test1','test2','test3'),
-`col82` VARCHAR (221),
-`col83` BIGINT,
-`col84` TINYINT,
-`col85` BIGINT,
-`col86` FLOAT,
-`col87` MEDIUMBLOB,
-`col88` CHAR (126),
-`col89` MEDIUMBLOB,
-`col90` DATETIME,
-`col91` TINYINT,
-`col92` DOUBLE,
-`col93` NUMERIC,
-`col94` DATE,
-`col95` BLOB,
-`col96` DATETIME,
-`col97` TIME,
-`col98` LONGBLOB,
-`col99` INT,
-`col100` SET ('test1','test2','test3'),
-`col101` TINYBLOB,
-`col102` INT,
-`col103` MEDIUMBLOB,
-`col104` MEDIUMTEXT,
-`col105` FLOAT,
-`col106` TINYBLOB,
-`col107` VARCHAR (26),
-`col108` TINYINT,
-`col109` TIME,
-`col110` TINYBLOB,
-`col111` LONGBLOB,
-`col112` TINYTEXT,
-`col113` FLOAT,
-`col114` TINYINT,
-`col115` NUMERIC,
-`col116` TIME,
-`col117` SET ('test1','test2','test3'),
-`col118` DATE,
-`col119` SMALLINT,
-`col120` BLOB,
-`col121` TINYTEXT,
-`col122` REAL,
-`col123` YEAR,
-`col124` REAL,
-`col125` BOOL,
-`col126` BLOB,
-`col127` REAL,
-`col128` MEDIUMBLOB,
-`col129` TIMESTAMP,
-`col130` LONGBLOB,
-`col131` MEDIUMBLOB,
-`col132` YEAR,
-`col133` YEAR,
-`col134` INT,
-`col135` MEDIUMINT,
-`col136` MEDIUMINT,
-`col137` TINYTEXT,
-`col138` TINYBLOB,
-`col139` BLOB,
-`col140` SET ('test1','test2','test3'),
-`col141` ENUM ('test1','test2','test3'),
-`col142` ENUM ('test1','test2','test3'),
-`col143` TINYTEXT,
-`col144` DATETIME,
-`col145` TEXT,
-`col146` DOUBLE PRECISION,
-`col147` DECIMAL,
-`col148` MEDIUMTEXT,
-`col149` TINYTEXT,
-`col150` SET ('test1','test2','test3'),
-`col151` MEDIUMTEXT,
-`col152` CHAR (126),
-`col153` DOUBLE,
-`col154` CHAR (243),
-`col155` SET ('test1','test2','test3'),
-`col156` SET ('test1','test2','test3'),
-`col157` DATETIME,
-`col158` DOUBLE,
-`col159` NUMERIC,
-`col160` DECIMAL,
-`col161` FLOAT,
-`col162` LONGBLOB,
-`col163` LONGTEXT,
-`col164` INT,
-`col165` TIME,
-`col166` CHAR (27),
-`col167` VARCHAR (63),
-`col168` TEXT,
-`col169` TINYBLOB,
-`col170` TINYBLOB,
-`col171` ENUM ('test1','test2','test3'),
-`col172` INT,
-`col173` TIME,
-`col174` DECIMAL,
-`col175` DOUBLE,
-`col176` MEDIUMBLOB,
-`col177` LONGBLOB,
-`col178` CHAR (43),
-KEY `idx0` (`col131`(219)),
-KEY `idx1` (`col67`,`col122`,`col59`,`col87`(33)),
-KEY `idx2` (`col83`,`col42`,`col57`(152)),
-KEY `idx3` (`col106`(124)),
-KEY `idx4` (`col173`,`col80`,`col165`,`col89`(78)),
-KEY `idx5` (`col174`,`col145`(108),`col23`(228),`col141`),
-KEY `idx6` (`col157`,`col140`),
-KEY `idx7` (`col130`(188),`col15`),
-KEY `idx8` (`col52`),
-KEY `idx9` (`col144`),
-KEY `idx10` (`col155`),
-KEY `idx11` (`col62`(230),`col1`(109)),
-KEY `idx12` (`col151`(24),`col95`(85)),
-KEY `idx13` (`col114`),
-KEY `idx14` (`col42`,`col98`(56),`col146`),
-KEY `idx15` (`col147`,`col39`(254),`col35`),
-KEY `idx16` (`col79`),
-KEY `idx17` (`col65`),
-KEY `idx18` (`col149`(165),`col168`(119),`col32`,`col117`),
-KEY `idx19` (`col64`),
-KEY `idx20` (`col93`),
-KEY `idx21` (`col64`,`col113`,`col104`(182)),
-KEY `idx22` (`col52`,`col111`(189)),
-KEY `idx23` (`col45`),
-KEY `idx24` (`col154`,`col107`,`col110`(159)),
-KEY `idx25` (`col149`(1),`col87`(131)),
-KEY `idx26` (`col58`,`col115`,`col63`),
-KEY `idx27` (`col95`(9),`col0`,`col87`(113)),
-KEY `idx28` (`col92`,`col130`(1)),
-KEY `idx29` (`col151`(129),`col137`(254),`col13`),
-KEY `idx30` (`col49`),
-KEY `idx31` (`col28`),
-KEY `idx32` (`col83`,`col146`),
-KEY `idx33` (`col155`,`col90`,`col17`(245)),
-KEY `idx34` (`col174`,`col169`(44),`col107`),
-KEY `idx35` (`col113`),
-KEY `idx36` (`col52`),
-KEY `idx37` (`col16`,`col120`(190)),
-KEY `idx38` (`col28`),
-KEY `idx39` (`col131`(165)),
-KEY `idx40` (`col135`,`col26`(86)),
-KEY `idx41` (`col69`,`col94`),
-KEY `idx42` (`col105`,`col151`(38),`col97`),
-KEY `idx43` (`col88`),
-KEY `idx44` (`col176`(100),`col42`,`col73`(189),`col94`),
-KEY `idx45` (`col2`(27),`col27`(116))
-)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-
-DROP TABLE IF EXISTS table0;
-DROP TABLE IF EXISTS table1;
-DROP TABLE IF EXISTS table2;
-DROP TABLE IF EXISTS table3;
-DROP TABLE IF EXISTS table4;
-DROP TABLE IF EXISTS table5;
-DROP TABLE IF EXISTS table6;
-
-SET GLOBAL innodb_file_per_table=DEFAULT;
-SET GLOBAL innodb_file_format='Antelope';
-SET GLOBAL innodb_file_format_check='Antelope';
diff --git a/mysql-test/suite/innodb/t/innodb_bug36172.test b/mysql-test/suite/innodb/t/innodb_bug36172.test
deleted file mode 100644
index 9e1308d5fc3..00000000000
--- a/mysql-test/suite/innodb/t/innodb_bug36172.test
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Test case for bug 36172
-#
-
--- source include/not_embedded.inc
--- source include/have_innodb.inc
--- source suite/innodb/include/have_innodb_plugin.inc
-
-SET storage_engine=InnoDB;
-
-# we do not really care about what gets printed, we are only
-# interested in getting success or failure according to our
-# expectations
-
--- disable_query_log
--- disable_result_log
-
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=on;
-
-DROP TABLE IF EXISTS `table0`;
-CREATE TABLE `table0` ( `col0` tinyint(1) DEFAULT NULL, `col1` tinyint(1) DEFAULT NULL, `col2` tinyint(4) DEFAULT NULL, `col3` date DEFAULT NULL, `col4` time DEFAULT NULL, `col5` set('test1','test2','test3') DEFAULT NULL, `col6` time DEFAULT NULL, `col7` text, `col8` decimal(10,0) DEFAULT NULL, `col9` set('test1','test2','test3') DEFAULT NULL, `col10` float DEFAULT NULL, `col11` double DEFAULT NULL, `col12` enum('test1','test2','test3') DEFAULT NULL, `col13` tinyblob, `col14` year(4) DEFAULT NULL, `col15` set('test1','test2','test3') DEFAULT NULL, `col16` decimal(10,0) DEFAULT NULL, `col17` decimal(10,0) DEFAULT NULL, `col18` blob, `col19` datetime DEFAULT NULL, `col20` double DEFAULT NULL, `col21` decimal(10,0) DEFAULT NULL, `col22` datetime DEFAULT NULL, `col23` decimal(10,0) DEFAULT NULL, `col24` decimal(10,0) DEFAULT NULL, `col25` longtext, `col26` tinyblob, `col27` time DEFAULT NULL, `col28` tinyblob, `col29` enum('test1','test2','test3') DEFAULT NULL, `col30` smallint(6) DEFAULT NULL, `col31` double DEFAULT NULL, `col32` float DEFAULT NULL, `col33` char(175) DEFAULT NULL, `col34` tinytext, `col35` tinytext, `col36` tinyblob, `col37` tinyblob, `col38` tinytext, `col39` mediumblob, `col40` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `col41` double DEFAULT NULL, `col42` smallint(6) DEFAULT NULL, `col43` longblob, `col44` varchar(80) DEFAULT NULL, `col45` mediumtext, `col46` decimal(10,0) DEFAULT NULL, `col47` bigint(20) DEFAULT NULL, `col48` date DEFAULT NULL, `col49` tinyblob, `col50` date DEFAULT NULL, `col51` tinyint(1) DEFAULT NULL, `col52` mediumint(9) DEFAULT NULL, `col53` float DEFAULT NULL, `col54` tinyblob, `col55` longtext, `col56` smallint(6) DEFAULT NULL, `col57` enum('test1','test2','test3') DEFAULT NULL, `col58` datetime DEFAULT NULL, `col59` mediumtext, `col60` varchar(232) DEFAULT NULL, `col61` decimal(10,0) DEFAULT NULL, `col62` year(4) DEFAULT NULL, `col63` smallint(6) DEFAULT NULL, `col64` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col65` blob, `col66` longblob, `col67` int(11) DEFAULT NULL, `col68` longtext, `col69` enum('test1','test2','test3') DEFAULT NULL, `col70` int(11) DEFAULT NULL, `col71` time DEFAULT NULL, `col72` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col73` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col74` varchar(170) DEFAULT NULL, `col75` set('test1','test2','test3') DEFAULT NULL, `col76` tinyblob, `col77` bigint(20) DEFAULT NULL, `col78` decimal(10,0) DEFAULT NULL, `col79` datetime DEFAULT NULL, `col80` year(4) DEFAULT NULL, `col81` decimal(10,0) DEFAULT NULL, `col82` longblob, `col83` text, `col84` char(83) DEFAULT NULL, `col85` decimal(10,0) DEFAULT NULL, `col86` float DEFAULT NULL, `col87` int(11) DEFAULT NULL, `col88` varchar(145) DEFAULT NULL, `col89` date DEFAULT NULL, `col90` decimal(10,0) DEFAULT NULL, `col91` decimal(10,0) DEFAULT NULL, `col92` mediumblob, `col93` time DEFAULT NULL, KEY `idx0` (`col69`,`col90`,`col8`), KEY `idx1` (`col60`), KEY `idx2` (`col60`,`col70`,`col74`), KEY `idx3` (`col22`,`col32`,`col72`,`col30`), KEY `idx4` (`col29`), KEY `idx5` (`col19`,`col45`(143)), KEY `idx6` (`col46`,`col48`,`col5`,`col39`(118)), KEY `idx7` (`col48`,`col61`), KEY `idx8` (`col93`), KEY `idx9` (`col31`), KEY `idx10` (`col30`,`col21`), KEY `idx11` (`col67`), KEY `idx12` (`col44`,`col6`,`col8`,`col38`(226)), KEY `idx13` (`col71`,`col41`,`col15`,`col49`(88)), KEY `idx14` (`col78`), KEY `idx15` (`col63`,`col67`,`col64`), KEY `idx16` (`col17`,`col86`), KEY `idx17` (`col77`,`col56`,`col10`,`col55`(24)), KEY `idx18` (`col62`), KEY `idx19` (`col31`,`col57`,`col56`,`col53`), KEY `idx20` (`col46`), KEY `idx21` (`col83`(54)), KEY `idx22` (`col51`,`col7`(120)), KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2;
-insert ignore into `table0` set `col23` = 7887371.5084383683, `col24` = 4293854615.6906948000, `col25` = 'vitalist', `col26` = 'widespread', `col27` = '3570490', `col28` = 'habitual', `col30` = -5471, `col31` = 4286985783.6771750000, `col32` = 6354540.9826654866, `col33` = 'defoliation', `col34` = 'logarithms', `col35` = 'tegument\'s', `col36` = 'scouting\'s', `col37` = 'intermittency', `col38` = 'elongates', `col39` = 'prophecies', `col40` = '20560103035939', `col41` = 4292809130.0544143000, `col42` = 22057, `col43` = 'Hess\'s', `col44` = 'bandstand', `col45` = 'phenylketonuria', `col46` = 6338767.4018677324, `col47` = 5310247, `col48` = '12592418', `col49` = 'churchman\'s', `col50` = '32226125', `col51` = -58, `col52` = -6207968, `col53` = 1244839.3255104220, `col54` = 'robotized', `col55` = 'monotonous', `col56` = -26909, `col58` = '20720107023550', `col59` = 'suggestiveness\'s', `col60` = 'gemology', `col61` = 4287800670.2229986000, `col62` = '1944', `col63` = -16827, `col64` = '20700107212324', `col65` = 'Nicolais', `col66` = 'apteryx', `col67` = 6935317, `col68` = 'stroganoff', `col70` = 3316430, `col71` = '3277608', `col72` = '19300511045918', `col73` = '20421201003327', `col74` = 'attenuant', `col75` = '15173', `col76` = 'upstroke\'s', `col77` = 8118987, `col78` = 6791516.2735374002, `col79` = '20780701144624', `col80` = '2134', `col81` = 4290682351.3127537000, `col82` = 'unexplainably', `col83` = 'Storm', `col84` = 'Greyso\'s', `col85` = 4289119212.4306774000, `col86` = 7617575.8796655172, `col87` = -6325335, `col88` = 'fondue\'s', `col89` = '40608940', `col90` = 1659421.8093508712, `col91` = 8346904.6584368423, `col92` = 'reloads', `col93` = '5188366';
-CHECK TABLE table0 EXTENDED;
-INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.9055146948, `col21` = 4293243420.5621204000, `col22` = '20511211123705', `col23` = 4289899778.6573381000, `col24` = 4293449279.0540481000, `col25` = 'emphysemic', `col26` = 'dentally', `col27` = '2347406', `col28` = 'eruct', `col30` = 1222, `col31` = 4294372994.9941406000, `col32` = 4291385574.1173744000, `col33` = 'borrowing\'s', `col34` = 'septics', `col35` = 'ratter\'s', `col36` = 'Kaye', `col37` = 'Florentia', `col38` = 'allium', `col39` = 'barkeep', `col40` = '19510407003441', `col41` = 4293559200.4215522000, `col42` = 22482, `col43` = 'decussate', `col44` = 'Brom\'s', `col45` = 'violated', `col46` = 4925506.4635456400, `col47` = 930549, `col48` = '51296066', `col49` = 'voluminously', `col50` = '29306676', `col51` = -88, `col52` = -2153690, `col53` = 4290250202.1464887000, `col54` = 'expropriation', `col55` = 'Aberdeen\'s', `col56` = 20343, `col58` = '19640415171532', `col59` = 'extern', `col60` = 'Ubana', `col61` = 4290487961.8539081000, `col62` = '2147', `col63` = -24271, `col64` = '20750801194548', `col65` = 'Cunaxa\'s', `col66` = 'pasticcio', `col67` = 2795817, `col68` = 'Indore\'s', `col70` = 6864127, `col71` = '1817832', `col72` = '20540506114211', `col73` = '20040101012300', `col74` = 'rationalized', `col75` = '45522', `col76` = 'indene', `col77` = -6964559, `col78` = 4247535.5266884370, `col79` = '20720416124357', `col80` = '2143', `col81` = 4292060102.4466386000, `col82` = 'striving', `col83` = 'boneblack\'s', `col84` = 'redolent', `col85` = 6489697.9009369183, `col86` = 4287473465.9731131000, `col87` = 7726015, `col88` = 'perplexed', `col89` = '17153791', `col90` = 5478587.1108127078, `col91` = 4287091404.7004304000, `col92` = 'Boulez\'s', `col93` = '2931278';
-CHECK TABLE table0 EXTENDED;
-DROP TABLE table0;
-
-SET GLOBAL innodb_file_per_table=DEFAULT;
-SET GLOBAL innodb_file_format='Antelope';
-SET GLOBAL innodb_file_format_check='Antelope';
diff --git a/mysql-test/t/innodb_bug38231.test b/mysql-test/suite/innodb/t/innodb_bug38231.test
index 1611cb56203..1611cb56203 100644
--- a/mysql-test/t/innodb_bug38231.test
+++ b/mysql-test/suite/innodb/t/innodb_bug38231.test
diff --git a/mysql-test/t/innodb_bug39438-master.opt b/mysql-test/suite/innodb/t/innodb_bug39438-master.opt
index 43fac202fd4..43fac202fd4 100644
--- a/mysql-test/t/innodb_bug39438-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_bug39438-master.opt
diff --git a/mysql-test/t/innodb_bug39438.test b/mysql-test/suite/innodb/t/innodb_bug39438.test
index 2a51e5fcbb8..2a51e5fcbb8 100644
--- a/mysql-test/t/innodb_bug39438.test
+++ b/mysql-test/suite/innodb/t/innodb_bug39438.test
diff --git a/mysql-test/t/innodb_bug40565.test b/mysql-test/suite/innodb/t/innodb_bug40565.test
index d7aa0fd514a..d7aa0fd514a 100644
--- a/mysql-test/t/innodb_bug40565.test
+++ b/mysql-test/suite/innodb/t/innodb_bug40565.test
diff --git a/mysql-test/t/innodb_bug42101-nonzero-master.opt b/mysql-test/suite/innodb/t/innodb_bug42101-nonzero-master.opt
index 455d66a06b8..455d66a06b8 100644
--- a/mysql-test/t/innodb_bug42101-nonzero-master.opt
+++ b/mysql-test/suite/innodb/t/innodb_bug42101-nonzero-master.opt
diff --git a/mysql-test/t/innodb_bug42101-nonzero.test b/mysql-test/suite/innodb/t/innodb_bug42101-nonzero.test
index 685fdf20489..685fdf20489 100644
--- a/mysql-test/t/innodb_bug42101-nonzero.test
+++ b/mysql-test/suite/innodb/t/innodb_bug42101-nonzero.test
diff --git a/mysql-test/t/innodb_bug42101.test b/mysql-test/suite/innodb/t/innodb_bug42101.test
index b6536490d48..b6536490d48 100644
--- a/mysql-test/t/innodb_bug42101.test
+++ b/mysql-test/suite/innodb/t/innodb_bug42101.test
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44369.test b/mysql-test/suite/innodb/t/innodb_bug44369.test
index 495059eb5e6..ec3c8a40141 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug44369.test
+++ b/mysql-test/suite/innodb/t/innodb_bug44369.test
@@ -6,16 +6,15 @@
--source include/have_innodb.inc
# This create table operation should fail.
---error ER_CANT_CREATE_TABLE
+--error ER_WRONG_COLUMN_NAME
create table bug44369 (DB_ROW_ID int) engine=innodb;
+show warnings;
# This create should fail as well
---error ER_CANT_CREATE_TABLE
+--error ER_WRONG_COLUMN_NAME
create table bug44369 (db_row_id int) engine=innodb;
+show warnings;
-show errors;
-
---error ER_CANT_CREATE_TABLE
+--error ER_WRONG_COLUMN_NAME
create table bug44369 (db_TRX_Id int) engine=innodb;
-
-show errors;
+show warnings;
diff --git a/mysql-test/t/innodb_bug45357.test b/mysql-test/suite/innodb/t/innodb_bug45357.test
index 81727f352dd..81727f352dd 100644
--- a/mysql-test/t/innodb_bug45357.test
+++ b/mysql-test/suite/innodb/t/innodb_bug45357.test
diff --git a/mysql-test/t/innodb_bug46000.test b/mysql-test/suite/innodb/t/innodb_bug46000.test
index 03942c86c98..03942c86c98 100644
--- a/mysql-test/t/innodb_bug46000.test
+++ b/mysql-test/suite/innodb/t/innodb_bug46000.test
diff --git a/mysql-test/t/innodb_bug47621.test b/mysql-test/suite/innodb/t/innodb_bug47621.test
index 4863cc6bba1..4863cc6bba1 100644
--- a/mysql-test/t/innodb_bug47621.test
+++ b/mysql-test/suite/innodb/t/innodb_bug47621.test
diff --git a/mysql-test/t/innodb_bug47777.test b/mysql-test/suite/innodb/t/innodb_bug47777.test
index 8f2985b2cf0..8f2985b2cf0 100644
--- a/mysql-test/t/innodb_bug47777.test
+++ b/mysql-test/suite/innodb/t/innodb_bug47777.test
diff --git a/mysql-test/suite/innodb/t/innodb_bug51920.test b/mysql-test/suite/innodb/t/innodb_bug51920.test
new file mode 100644
index 00000000000..bc3bb006c1c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug51920.test
@@ -0,0 +1,43 @@
+#
+# Bug #51920: InnoDB connections in lock wait ignore KILL until timeout
+#
+-- source include/not_embedded.inc
+-- source include/have_innodb.inc
+
+CREATE TABLE bug51920 (i INT) ENGINE=InnoDB;
+INSERT INTO bug51920 VALUES (1);
+
+BEGIN;
+SELECT * FROM bug51920 FOR UPDATE;
+
+connect (con1,localhost,root,,);
+
+connection con1;
+--send
+UPDATE bug51920 SET i=2;
+
+connection default;
+let $wait_condition =
+ SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE INFO="UPDATE bug51920 SET i=2";
+-- source include/wait_condition.inc
+
+SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE INFO="UPDATE bug51920 SET i=2"
+INTO @thread_id;
+
+KILL @thread_id;
+let $wait_condition =
+ SELECT COUNT(*)=0 FROM information_schema.processlist WHERE ID=@thread_id;
+-- source include/wait_condition.inc
+
+#
+# Bug#19723: kill of active connection yields different error code
+# depending on platform.
+#
+connection con1;
+-- error 1317, 2006, 2013
+reap;
+connection default;
+DROP TABLE bug51920;
+-- disconnect con1
diff --git a/mysql-test/suite/innodb/t/innodb_bug52663-master.opt b/mysql-test/suite/innodb/t/innodb_bug52663-master.opt
new file mode 100644
index 00000000000..462f8fbe828
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug52663-master.opt
@@ -0,0 +1 @@
+--innodb_lock_wait_timeout=1
diff --git a/mysql-test/suite/innodb/t/innodb_bug52663.test b/mysql-test/suite/innodb/t/innodb_bug52663.test
new file mode 100644
index 00000000000..fcf97531e00
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bug52663.test
@@ -0,0 +1,34 @@
+--source include/have_innodb.inc
+
+set session transaction isolation level read committed;
+
+create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
+(what, id)) engine=innodb;
+insert into innodb_bug52663 values ('total', 0, 0);
+begin;
+
+connect (addconroot, localhost, root,,);
+connection addconroot;
+set session transaction isolation level read committed;
+begin;
+
+connection default;
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+select * from innodb_bug52663;
+
+connection addconroot;
+--error ER_LOCK_WAIT_TIMEOUT
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+select * from innodb_bug52663;
+
+connection default;
+commit;
+
+connection addconroot;
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+commit;
+select * from innodb_bug52663;
+
+connection default;
+select * from innodb_bug52663;
+drop table innodb_bug52663;
diff --git a/mysql-test/suite/innodb/t/innodb_misc1-master.opt b/mysql-test/suite/innodb/t/innodb_misc1-master.opt
new file mode 100644
index 00000000000..4901efb416c
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_misc1-master.opt
@@ -0,0 +1 @@
+--binlog_cache_size=32768 --innodb_lock_wait_timeout=1
diff --git a/mysql-test/suite/innodb/t/innodb_misc1.test b/mysql-test/suite/innodb/t/innodb_misc1.test
new file mode 100644
index 00000000000..30f9c129570
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_misc1.test
@@ -0,0 +1,1206 @@
+#######################################################################
+# #
+# Please, DO NOT TOUCH this file as well as the innodb.result file. #
+# These files are to be modified ONLY BY INNOBASE guys. #
+# #
+# Use innodb_mysql.[test|result] files instead. #
+# #
+# If nevertheless you need to make some changes here, please, forward #
+# your commit message #
+# To: innodb_dev_ww@oracle.com #
+# Cc: dev-innodb@mysql.com #
+# (otherwise your changes may be erased). #
+# #
+#######################################################################
+
+-- source include/have_innodb.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+# Save the original values of some variables in order to be able to
+# estimate how much they have changed during the tests. Previously this
+# test assumed that e.g. rows_deleted is 0 here and after deleting 23
+# rows it expected that rows_deleted will be 23. Now we do not make
+# assumptions about the values of the variables at the beginning, e.g.
+# rows_deleted should be 23 + "rows_deleted before the test". This allows
+# the test to be run multiple times without restarting the mysqld server.
+# See Bug#43309 Test main.innodb can't be run twice
+-- disable_query_log
+SET @innodb_thread_concurrency_orig = @@innodb_thread_concurrency;
+-- enable_query_log
+
+--disable_warnings
+drop table if exists t1,t2,t3,t4;
+drop database if exists mysqltest;
+--enable_warnings
+
+# InnoDB specific varchar tests
+create table t1 (v varchar(16384)) engine=innodb;
+drop table t1;
+
+#
+# BUG#11039 Wrong key length in min()
+#
+
+create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
+insert into t1 values ('8', '6'), ('4', '7');
+select min(a) from t1;
+select min(b) from t1 where a='8';
+drop table t1;
+
+#
+# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error
+#
+
+CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb;
+insert into t1 (b) values (1);
+replace into t1 (b) values (2), (1), (3);
+select * from t1;
+truncate table t1;
+insert into t1 (b) values (1);
+replace into t1 (b) values (2);
+replace into t1 (b) values (1);
+replace into t1 (b) values (3);
+select * from t1;
+drop table t1;
+
+create table t1 (rowid int not null auto_increment, val int not null,primary
+key (rowid), unique(val)) engine=innodb;
+replace into t1 (val) values ('1'),('2');
+replace into t1 (val) values ('1'),('2');
+--error ER_DUP_ENTRY
+insert into t1 (val) values ('1'),('2');
+select * from t1;
+drop table t1;
+
+#
+# Test that update does not change internal auto-increment value
+#
+
+create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB;
+insert into t1 (val) values (1);
+update t1 set a=2 where a=1;
+# We should get the following error because InnoDB does not update the counter
+--error ER_DUP_ENTRY
+insert into t1 (val) values (1);
+select * from t1;
+drop table t1;
+#
+# Bug #10465
+#
+
+--disable_warnings
+CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB;
+--enable_warnings
+INSERT INTO t1 (GRADE) VALUES (151),(252),(343);
+SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300;
+SELECT GRADE FROM t1 WHERE GRADE= 151;
+DROP TABLE t1;
+
+#
+# Bug #12340 multitable delete deletes only one record
+#
+create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=innodb;
+create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=innodb;
+insert into t2 values ('aa','cc');
+insert into t1 values ('aa','bb'),('aa','cc');
+delete t1 from t1,t2 where f1=f3 and f4='cc';
+select * from t1;
+drop table t1,t2;
+
+#
+# Test that the slow TRUNCATE implementation resets autoincrement columns
+# (bug #11946)
+#
+
+CREATE TABLE t1 (
+id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)
+) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+id INTEGER NOT NULL,
+FOREIGN KEY (id) REFERENCES t1 (id)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 (id) VALUES (NULL);
+SELECT * FROM t1;
+TRUNCATE t1;
+INSERT INTO t1 (id) VALUES (NULL);
+SELECT * FROM t1;
+
+# continued from above; test that doing a slow TRUNCATE on a table with 0
+# rows resets autoincrement columns
+DELETE FROM t1;
+TRUNCATE t1;
+INSERT INTO t1 (id) VALUES (NULL);
+SELECT * FROM t1;
+DROP TABLE t2, t1;
+
+# Test that foreign keys in temporary tables are not accepted (bug #12084)
+CREATE TABLE t1
+(
+ id INT PRIMARY KEY
+) ENGINE=InnoDB;
+
+--error 1005,1005
+CREATE TEMPORARY TABLE t2
+(
+ id INT NOT NULL PRIMARY KEY,
+ b INT,
+ FOREIGN KEY (b) REFERENCES test.t1(id)
+) ENGINE=InnoDB;
+DROP TABLE t1;
+
+#
+# Test that index column max sizes are honored (bug #13315)
+#
+
+# prefix index
+create table t1 (col1 varchar(2000), index (col1(767)))
+ character set = latin1 engine = innodb;
+
+# normal indexes
+create table t2 (col1 char(255), index (col1))
+ character set = latin1 engine = innodb;
+create table t3 (col1 binary(255), index (col1))
+ character set = latin1 engine = innodb;
+create table t4 (col1 varchar(767), index (col1))
+ character set = latin1 engine = innodb;
+create table t5 (col1 varchar(767) primary key)
+ character set = latin1 engine = innodb;
+create table t6 (col1 varbinary(767) primary key)
+ character set = latin1 engine = innodb;
+create table t7 (col1 text, index(col1(767)))
+ character set = latin1 engine = innodb;
+create table t8 (col1 blob, index(col1(767)))
+ character set = latin1 engine = innodb;
+
+# multi-column indexes are allowed to be longer
+create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2))
+ character set = latin1 engine = innodb;
+
+show create table t9;
+
+drop table t1, t2, t3, t4, t5, t6, t7, t8, t9;
+
+# these should have their index length trimmed
+create table t1 (col1 varchar(768), index(col1))
+ character set = latin1 engine = innodb;
+create table t2 (col1 varbinary(768), index(col1))
+ character set = latin1 engine = innodb;
+create table t3 (col1 text, index(col1(768)))
+ character set = latin1 engine = innodb;
+create table t4 (col1 blob, index(col1(768)))
+ character set = latin1 engine = innodb;
+
+show create table t1;
+
+drop table t1, t2, t3, t4;
+
+# these should be refused
+--error 1071
+create table t1 (col1 varchar(768) primary key)
+ character set = latin1 engine = innodb;
+--error 1071
+create table t2 (col1 varbinary(768) primary key)
+ character set = latin1 engine = innodb;
+--error 1071
+create table t3 (col1 text, primary key(col1(768)))
+ character set = latin1 engine = innodb;
+--error 1071
+create table t4 (col1 blob, primary key(col1(768)))
+ character set = latin1 engine = innodb;
+
+#
+# Test improved foreign key error messages (bug #3443)
+#
+
+CREATE TABLE t1
+(
+ id INT PRIMARY KEY
+) ENGINE=InnoDB;
+
+CREATE TABLE t2
+(
+ v INT,
+ CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
+) ENGINE=InnoDB;
+
+--error 1452
+INSERT INTO t2 VALUES(2);
+
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1);
+
+--error 1451
+DELETE FROM t1 WHERE id = 1;
+
+--error 1217
+DROP TABLE t1;
+
+SET FOREIGN_KEY_CHECKS=0;
+DROP TABLE t1;
+SET FOREIGN_KEY_CHECKS=1;
+
+--error 1452
+INSERT INTO t2 VALUES(3);
+
+DROP TABLE t2;
+#
+# Test that checksum table uses a consistent read Bug #12669
+#
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2);
+set autocommit=0;
+checksum table t1;
+connection b;
+insert into t1 values(3);
+connection a;
+#
+# Here checksum should not see insert
+#
+checksum table t1;
+connection a;
+commit;
+checksum table t1;
+commit;
+drop table t1;
+#
+# autocommit = 1
+#
+connection a;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2);
+set autocommit=1;
+checksum table t1;
+connection b;
+set autocommit=1;
+insert into t1 values(3);
+connection a;
+#
+# Here checksum sees insert
+#
+checksum table t1;
+drop table t1;
+
+connection default;
+disconnect a;
+disconnect b;
+
+# tests for bugs #9802 and #13778
+
+# test that FKs between invalid types are not accepted
+
+set foreign_key_checks=0;
+create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
+# Embedded server doesn't chdir to data directory
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
+-- error 1005
+create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
+set foreign_key_checks=1;
+drop table t2;
+
+# test that FKs between different charsets are not accepted in CREATE even
+# when f_k_c is 0
+
+set foreign_key_checks=0;
+create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
+# Embedded server doesn't chdir to data directory
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
+-- error 1005
+create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
+set foreign_key_checks=1;
+drop table t1;
+
+# test that invalid datatype conversions with ALTER are not allowed
+
+set foreign_key_checks=0;
+create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb;
+create table t1(a varchar(10) primary key) engine = innodb;
+-- error 1025,1025
+alter table t1 modify column a int;
+set foreign_key_checks=1;
+drop table t2,t1;
+
+# test that charset conversions with ALTER are allowed when f_k_c is 0
+
+set foreign_key_checks=0;
+create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
+create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
+alter table t1 convert to character set utf8;
+set foreign_key_checks=1;
+drop table t2,t1;
+
+# test that RENAME does not allow invalid charsets when f_k_c is 0
+
+set foreign_key_checks=0;
+create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
+create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
+# Embedded server doesn't chdir to data directory
+--replace_result $MYSQLD_DATADIR ./ master-data/ ''
+-- error 1025
+rename table t3 to t1;
+set foreign_key_checks=1;
+drop table t2,t3;
+
+# test that foreign key errors are reported correctly (Bug #15550)
+
+create table t1(a int primary key) row_format=redundant engine=innodb;
+create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb;
+create table t3(a int primary key) row_format=compact engine=innodb;
+create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb;
+
+insert into t1 values(1);
+insert into t3 values(1);
+-- error 1452
+insert into t2 values(2);
+-- error 1452
+insert into t4 values(2);
+insert into t2 values(1);
+insert into t4 values(1);
+-- error 1451
+update t1 set a=2;
+-- error 1452
+update t2 set a=2;
+-- error 1451
+update t3 set a=2;
+-- error 1452
+update t4 set a=2;
+-- error 1451
+truncate t1;
+-- error 1451
+truncate t3;
+truncate t2;
+truncate t4;
+truncate t1;
+truncate t3;
+
+drop table t4,t3,t2,t1;
+
+
+#
+# Test that we can create a large (>1K) key
+#
+create table t1 (a varchar(255) character set utf8,
+ b varchar(255) character set utf8,
+ c varchar(255) character set utf8,
+ d varchar(255) character set utf8,
+ key (a,b,c,d)) engine=innodb;
+drop table t1;
+--error ER_TOO_LONG_KEY
+create table t1 (a varchar(255) character set utf8,
+ b varchar(255) character set utf8,
+ c varchar(255) character set utf8,
+ d varchar(255) character set utf8,
+ e varchar(255) character set utf8,
+ key (a,b,c,d,e)) engine=innodb;
+
+
+# test the padding of BINARY types and collations (Bug #14189)
+
+create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb;
+create table t2 (s1 binary(2),primary key (s1)) engine=innodb;
+create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb;
+create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb;
+
+insert into t1 values (0x41),(0x4120),(0x4100);
+-- error ER_DUP_ENTRY
+insert into t2 values (0x41),(0x4120),(0x4100);
+insert into t2 values (0x41),(0x4120);
+-- error ER_DUP_ENTRY
+insert into t3 values (0x41),(0x4120),(0x4100);
+insert into t3 values (0x41),(0x4100);
+-- error ER_DUP_ENTRY
+insert into t4 values (0x41),(0x4120),(0x4100);
+insert into t4 values (0x41),(0x4100);
+select hex(s1) from t1;
+select hex(s1) from t2;
+select hex(s1) from t3;
+select hex(s1) from t4;
+drop table t1,t2,t3,t4;
+
+create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb;
+create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+
+insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
+-- error 1452
+insert into t2 values(0x42);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+update t1 set s1=0x123456 where a=2;
+select hex(s1) from t2;
+-- error 1451
+update t1 set s1=0x12 where a=1;
+-- error 1451
+update t1 set s1=0x12345678 where a=1;
+-- error 1451
+update t1 set s1=0x123457 where a=1;
+update t1 set s1=0x1220 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x1200 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x4200 where a=1;
+select hex(s1) from t2;
+-- error 1451
+delete from t1 where a=1;
+delete from t1 where a=2;
+update t2 set s1=0x4120;
+-- error 1451
+delete from t1;
+delete from t1 where a!=3;
+select a,hex(s1) from t1;
+select hex(s1) from t2;
+
+drop table t2,t1;
+
+create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb;
+create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
+
+insert into t1 values(1,0x4100),(2,0x41);
+insert into t2 values(0x41);
+select hex(s1) from t2;
+update t1 set s1=0x1234 where a=1;
+select hex(s1) from t2;
+update t1 set s1=0x12 where a=2;
+select hex(s1) from t2;
+delete from t1 where a=1;
+-- error 1451
+delete from t1 where a=2;
+select a,hex(s1) from t1;
+select hex(s1) from t2;
+
+drop table t2,t1;
+# Ensure that <tablename>_ibfk_0 is not mistreated as a
+# generated foreign key identifier. (Bug #16387)
+
+CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
+CREATE TABLE t2(a INT) ENGINE=InnoDB;
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
+ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1;
+ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a);
+ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0;
+SHOW CREATE TABLE t2;
+DROP TABLE t2,t1;
+
+#
+# Test case for bug #16229: MySQL/InnoDB uses full explicit table locks in trigger processing
+#
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+insert into t1(a) values (1),(2),(3);
+commit;
+connection b;
+set autocommit = 0;
+update t1 set b = 5 where a = 2;
+connection a;
+delimiter |;
+create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end |
+delimiter ;|
+set autocommit = 0;
+connection a;
+insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100),
+(11),(21),(31),(41),(51),(61),(71),(81),(91),(101),
+(12),(22),(32),(42),(52),(62),(72),(82),(92),(102),
+(13),(23),(33),(43),(53),(63),(73),(83),(93),(103),
+(14),(24),(34),(44),(54),(64),(74),(84),(94),(104);
+connection b;
+commit;
+connection a;
+commit;
+drop trigger t1t;
+drop table t1;
+disconnect a;
+disconnect b;
+#
+# Another trigger test
+#
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb;
+insert into t1(a) values (1),(2),(3);
+insert into t2(a) values (1),(2),(3);
+insert into t3(a) values (1),(2),(3);
+insert into t4(a) values (1),(2),(3);
+insert into t3(a) values (5),(7),(8);
+insert into t4(a) values (5),(7),(8);
+insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12);
+
+delimiter |;
+create trigger t1t before insert on t1 for each row begin
+ INSERT INTO t2 SET a = NEW.a;
+end |
+
+create trigger t2t before insert on t2 for each row begin
+ DELETE FROM t3 WHERE a = NEW.a;
+end |
+
+create trigger t3t before delete on t3 for each row begin
+ UPDATE t4 SET b = b + 1 WHERE a = OLD.a;
+end |
+
+create trigger t4t before update on t4 for each row begin
+ UPDATE t5 SET b = b + 1 where a = NEW.a;
+end |
+delimiter ;|
+commit;
+set autocommit = 0;
+update t1 set b = b + 5 where a = 1;
+update t2 set b = b + 5 where a = 1;
+update t3 set b = b + 5 where a = 1;
+update t4 set b = b + 5 where a = 1;
+insert into t5(a) values(20);
+connection b;
+set autocommit = 0;
+insert into t1(a) values(7);
+insert into t2(a) values(8);
+delete from t2 where a = 3;
+update t4 set b = b + 1 where a = 3;
+commit;
+drop trigger t1t;
+drop trigger t2t;
+drop trigger t3t;
+drop trigger t4t;
+drop table t1, t2, t3, t4, t5;
+connection default;
+disconnect a;
+disconnect b;
+
+#
+# Test that cascading updates leading to duplicate keys give the correct
+# error message (bug #9680)
+#
+
+CREATE TABLE t1 (
+ field1 varchar(8) NOT NULL DEFAULT '',
+ field2 varchar(8) NOT NULL DEFAULT '',
+ PRIMARY KEY (field1, field2)
+) ENGINE=InnoDB;
+
+CREATE TABLE t2 (
+ field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
+ FOREIGN KEY (field1) REFERENCES t1 (field1)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES ('old', 'somevalu');
+INSERT INTO t1 VALUES ('other', 'anyvalue');
+
+INSERT INTO t2 VALUES ('old');
+INSERT INTO t2 VALUES ('other');
+
+--error ER_FOREIGN_DUPLICATE_KEY
+UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
+
+DROP TABLE t2;
+DROP TABLE t1;
+
+#
+# Bug#18477 - MySQL/InnoDB Ignoring Foreign Keys in ALTER TABLE
+#
+create table t1 (
+ c1 bigint not null,
+ c2 bigint not null,
+ primary key (c1),
+ unique key (c2)
+) engine=innodb;
+#
+create table t2 (
+ c1 bigint not null,
+ primary key (c1)
+) engine=innodb;
+#
+alter table t1 add constraint c2_fk foreign key (c2)
+ references t2(c1) on delete cascade;
+show create table t1;
+#
+alter table t1 drop foreign key c2_fk;
+show create table t1;
+#
+drop table t1, t2;
+
+#
+# Bug #14360: problem with intervals
+#
+
+create table t1(a date) engine=innodb;
+create table t2(a date, key(a)) engine=innodb;
+insert into t1 values('2005-10-01');
+insert into t2 values('2005-10-01');
+select * from t1, t2
+ where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
+drop table t1, t2;
+
+create table t1 (id int not null, f_id int not null, f int not null,
+primary key(f_id, id)) engine=innodb;
+create table t2 (id int not null,s_id int not null,s varchar(200),
+primary key(id)) engine=innodb;
+INSERT INTO t1 VALUES (8, 1, 3);
+INSERT INTO t1 VALUES (1, 2, 1);
+INSERT INTO t2 VALUES (1, 0, '');
+INSERT INTO t2 VALUES (8, 1, '');
+commit;
+DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id)
+WHERE mm.id IS NULL;
+select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id)
+where mm.id is null lock in share mode;
+drop table t1,t2;
+
+#
+# Test case where X-locks on unused rows should be released in a
+# update (because READ COMMITTED isolation level)
+#
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3);
+commit;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+update t1 set b = 5 where b = 1;
+connection b;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+#
+# X-lock to record (7,3) should be released in a update
+#
+select * from t1 where a = 7 and b = 3 for update;
+connection a;
+commit;
+connection b;
+commit;
+drop table t1;
+connection default;
+disconnect a;
+disconnect b;
+
+#
+# Test case where no locks should be released (because we are not
+# using READ COMMITTED isolation level)
+#
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2);
+commit;
+set autocommit = 0;
+select * from t1 lock in share mode;
+update t1 set b = 5 where b = 1;
+connection b;
+set autocommit = 0;
+#
+# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update
+#
+--error 1205
+select * from t1 where a = 2 and b = 2 for update;
+#
+# X-lock to record (1,1),(3,1),(5,1) should not be released in a update
+#
+--error 1205
+connection a;
+commit;
+connection b;
+commit;
+connection default;
+disconnect a;
+disconnect b;
+drop table t1;
+
+#
+# Consistent read should be used in following selects
+#
+# 1) INSERT INTO ... SELECT
+# 2) UPDATE ... = ( SELECT ...)
+# 3) CREATE ... SELECT
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(d int not null, e int, primary key(d)) engine=innodb;
+insert into t2 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+connection b;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+insert into t1 select * from t2;
+update t1 set b = (select e from t2 where a = d);
+create table t3(d int not null, e int, primary key(d)) engine=innodb
+select * from t2;
+commit;
+connection a;
+commit;
+connection default;
+disconnect a;
+disconnect b;
+drop table t1, t2, t3;
+
+#
+# Consistent read should not be used if
+#
+# (a) isolation level is serializable OR
+# (b) select ... lock in share mode OR
+# (c) select ... for update
+#
+# in following queries:
+#
+# 1) INSERT INTO ... SELECT
+# 2) UPDATE ... = ( SELECT ...)
+# 3) CREATE ... SELECT
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connect (c,localhost,root,,);
+connect (d,localhost,root,,);
+connect (e,localhost,root,,);
+connect (f,localhost,root,,);
+connect (g,localhost,root,,);
+connect (h,localhost,root,,);
+connect (i,localhost,root,,);
+connect (j,localhost,root,,);
+connection a;
+create table t1(a int not null, b int, primary key(a)) engine=innodb;
+insert into t1 values (1,2),(5,3),(4,2);
+create table t2(a int not null, b int, primary key(a)) engine=innodb;
+insert into t2 values (8,6),(12,1),(3,1);
+create table t3(d int not null, b int, primary key(d)) engine=innodb;
+insert into t3 values (8,6),(12,1),(3,1);
+create table t5(a int not null, b int, primary key(a)) engine=innodb;
+insert into t5 values (1,2),(5,3),(4,2);
+create table t6(d int not null, e int, primary key(d)) engine=innodb;
+insert into t6 values (8,6),(12,1),(3,1);
+create table t8(a int not null, b int, primary key(a)) engine=innodb;
+insert into t8 values (1,2),(5,3),(4,2);
+create table t9(d int not null, e int, primary key(d)) engine=innodb;
+insert into t9 values (8,6),(12,1),(3,1);
+commit;
+set autocommit = 0;
+select * from t2 for update;
+connection b;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+insert into t1 select * from t2;
+connection c;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+update t3 set b = (select b from t2 where a = d);
+connection d;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+--send
+create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2;
+connection e;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+insert into t5 (select * from t2 lock in share mode);
+connection f;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+update t6 set e = (select b from t2 where a = d lock in share mode);
+connection g;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode;
+connection h;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+insert into t8 (select * from t2 for update);
+connection i;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+update t9 set e = (select b from t2 where a = d for update);
+connection j;
+SET binlog_format='MIXED';
+set autocommit = 0;
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+--send
+create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update;
+
+connection b;
+--error 1205
+reap;
+
+connection c;
+--error 1205
+reap;
+
+connection d;
+--error 1205
+reap;
+
+connection e;
+--error 1205
+reap;
+
+connection f;
+--error 1205
+reap;
+
+connection g;
+--error 1205
+reap;
+
+connection h;
+--error 1205
+reap;
+
+connection i;
+--error 1205
+reap;
+
+connection j;
+--error 1205
+reap;
+
+connection a;
+commit;
+
+connection default;
+disconnect a;
+disconnect b;
+disconnect c;
+disconnect d;
+disconnect e;
+disconnect f;
+disconnect g;
+disconnect h;
+disconnect i;
+disconnect j;
+drop table t1, t2, t3, t5, t6, t8, t9;
+
+# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
+--error ER_WRONG_COLUMN_NAME
+CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
+
+#
+# Bug #17152: Wrong result with BINARY comparison on aliased column
+#
+
+CREATE TABLE t1 (
+ a BIGINT(20) NOT NULL,
+ PRIMARY KEY (a)
+ ) ENGINE=INNODB DEFAULT CHARSET=UTF8;
+
+CREATE TABLE t2 (
+ a BIGINT(20) NOT NULL,
+ b VARCHAR(128) NOT NULL,
+ c TEXT NOT NULL,
+ PRIMARY KEY (a,b),
+ KEY idx_t2_b_c (b,c(200)),
+ CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a)
+ ON DELETE CASCADE
+ ) ENGINE=INNODB DEFAULT CHARSET=UTF8;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1, 'bar', 'vbar');
+INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR');
+INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi');
+INSERT INTO t2 VALUES (1, 'customer_over', '1');
+
+SELECT * FROM t2 WHERE b = 'customer_over';
+SELECT * FROM t2 WHERE BINARY b = 'customer_over';
+SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over';
+/* Bang: Empty result set, above was expected: */
+SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
+SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
+
+drop table t2, t1;
+
+#
+# Test optimize on table with open transaction
+#
+
+CREATE TABLE t1 ( a int ) ENGINE=innodb;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
+
+#
+# Bug #24741 (existing cascade clauses disappear when adding foreign keys)
+#
+
+CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB;
+
+CREATE TABLE t2 (id int PRIMARY KEY, f INT NOT NULL,
+ CONSTRAINT t2_t1 FOREIGN KEY (id) REFERENCES t1 (id)
+ ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB;
+
+ALTER TABLE t2 ADD FOREIGN KEY (f) REFERENCES t1 (f) ON
+DELETE CASCADE ON UPDATE CASCADE;
+
+SHOW CREATE TABLE t2;
+DROP TABLE t2, t1;
+
+#
+# Bug #25927: Prevent ALTER TABLE ... MODIFY ... NOT NULL on columns
+# for which there is a foreign key constraint ON ... SET NULL.
+#
+
+CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
+# mysqltest first does replace_regex, then replace_result
+--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
+# Embedded server doesn't chdir to data directory
+--replace_result $MYSQLD_DATADIR ./ master-data/ ''
+--error 1025
+ALTER TABLE t2 MODIFY a INT NOT NULL;
+DELETE FROM t1;
+DROP TABLE t2,t1;
+
+#
+# Bug #26835: table corruption after delete+insert
+#
+
+CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
+DELETE FROM t1;
+INSERT INTO t1 VALUES ('DDD');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Bug #23313 (AUTO_INCREMENT=# not reported back for InnoDB tables)
+# Bug #21404 (AUTO_INCREMENT value reset when Adding FKEY (or ALTER?))
+#
+
+CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB
+AUTO_INCREMENT=42;
+
+INSERT INTO t1 VALUES (0),(347),(0);
+SELECT * FROM t1;
+
+SHOW CREATE TABLE t1;
+
+CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(42),(347),(348);
+ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id);
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1,t2;
+
+#
+# Bug #21101 (Prints wrong error message if max row size is too large)
+#
+--error 1118
+CREATE TABLE t1 (
+ c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255),
+ c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255),
+ c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255),
+ c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255),
+ c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255),
+ c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255),
+ c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255),
+ c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255)
+ ) ENGINE = InnoDB;
+
+#
+# Bug #31860 InnoDB assumes AUTOINC values can only be positive.
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(
+ id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY
+ ) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(-10);
+SELECT * FROM t1;
+#
+# NOTE: The server really needs to be restarted at this point
+# for the test to be useful.
+#
+# Without the fix InnoDB would trip over an assertion here.
+INSERT INTO t1 VALUES(NULL);
+# The next value should be 1 and not -9 or a -ve number
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Bug #21409 Incorrect result returned when in READ-COMMITTED with
+# query_cache ON
+#
+CONNECT (c1,localhost,root,,);
+CONNECT (c2,localhost,root,,);
+CONNECTION c1;
+SET binlog_format='MIXED';
+SET TX_ISOLATION='read-committed';
+SET AUTOCOMMIT=0;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+SELECT * FROM t2;
+CONNECTION c2;
+SET binlog_format='MIXED';
+SET TX_ISOLATION='read-committed';
+SET AUTOCOMMIT=0;
+INSERT INTO t1 VALUES (1);
+COMMIT;
+CONNECTION c1;
+SELECT * FROM t1 WHERE a=1;
+DISCONNECT c1;
+DISCONNECT c2;
+CONNECT (c1,localhost,root,,);
+CONNECT (c2,localhost,root,,);
+CONNECTION c1;
+SET binlog_format='MIXED';
+SET TX_ISOLATION='read-committed';
+SET AUTOCOMMIT=0;
+SELECT * FROM t2;
+CONNECTION c2;
+SET binlog_format='MIXED';
+SET TX_ISOLATION='read-committed';
+SET AUTOCOMMIT=0;
+INSERT INTO t1 VALUES (2);
+COMMIT;
+CONNECTION c1;
+# The result set below should be the same for both selects
+SELECT * FROM t1 WHERE a=2;
+SELECT * FROM t1 WHERE a=2;
+DROP TABLE t1;
+DROP TABLE t2;
+DISCONNECT c1;
+DISCONNECT c2;
+CONNECTION default;
+
+#
+# Bug #29157 UPDATE, changed rows incorrect
+#
+create table t1 (i int, j int) engine=innodb;
+insert into t1 (i, j) values (1, 1), (2, 2);
+--enable_info
+update t1 set j = 2;
+--disable_info
+drop table t1;
+
+#
+# Bug #32440 InnoDB free space info does not appear in SHOW TABLE STATUS or
+# I_S
+#
+create table t1 (id int) comment='this is a comment' engine=innodb;
+select table_comment, data_free > 0 as data_free_is_set
+ from information_schema.tables
+ where table_schema='test' and table_name = 't1';
+drop table t1;
+
+#
+# Bug 34920 test
+#
+CONNECTION default;
+CREATE TABLE t1 (
+ c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ c2 VARCHAR(128) NOT NULL,
+ PRIMARY KEY(c1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100;
+
+CREATE TABLE t2 (
+ c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ c2 INT(10) UNSIGNED DEFAULT NULL,
+ PRIMARY KEY(c1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200;
+
+SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
+ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1);
+SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2';
+DROP TABLE t2;
+DROP TABLE t1;
+# End 34920 test
+#
+# Bug #29507 TRUNCATE shows to many rows effected
+#
+CONNECTION default;
+CREATE TABLE t1 (c1 int default NULL,
+ c2 int default NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--enable_info
+TRUNCATE TABLE t1;
+
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+TRUNCATE TABLE t1;
+
+--disable_info
+DROP TABLE t1;
+#
+# Bug#35537 Innodb doesn't increment handler_update and handler_delete.
+#
+-- disable_query_log
+-- disable_result_log
+
+CONNECT (c1,localhost,root,,);
+
+DROP TABLE IF EXISTS bug35537;
+CREATE TABLE bug35537 (
+ c1 int
+) ENGINE=InnoDB;
+
+INSERT INTO bug35537 VALUES (1);
+
+-- enable_result_log
+
+SHOW SESSION STATUS LIKE 'Handler_update%';
+SHOW SESSION STATUS LIKE 'Handler_delete%';
+
+UPDATE bug35537 SET c1 = 2 WHERE c1 = 1;
+DELETE FROM bug35537 WHERE c1 = 2;
+
+SHOW SESSION STATUS LIKE 'Handler_update%';
+SHOW SESSION STATUS LIKE 'Handler_delete%';
+
+DROP TABLE bug35537;
+
+DISCONNECT c1;
+CONNECTION default;
+
+SET GLOBAL innodb_thread_concurrency = @innodb_thread_concurrency_orig;
+
+#######################################################################
+# #
+# Please, DO NOT TOUCH this file as well as the innodb.result file. #
+# These files are to be modified ONLY BY INNOBASE guys. #
+# #
+# Use innodb_mysql.[test|result] files instead. #
+# #
+# If nevertheless you need to make some changes here, please, forward #
+# your commit message #
+# To: innodb_dev_ww@oracle.com #
+# Cc: dev-innodb@mysql.com #
+# (otherwise your changes may be erased). #
+# #
+#######################################################################
diff --git a/storage/innodb_plugin/mysql-test/innodb_trx_weight.test b/mysql-test/suite/innodb/t/innodb_trx_weight.test
index b72eaad345f..b72eaad345f 100644
--- a/storage/innodb_plugin/mysql-test/innodb_trx_weight.test
+++ b/mysql-test/suite/innodb/t/innodb_trx_weight.test
diff --git a/storage/innodb_plugin/mysql-test/ctype_innodb_like.inc b/mysql-test/suite/innodb_plugin/include/ctype_innodb_like.inc
index ae43342885a..ae43342885a 100644
--- a/storage/innodb_plugin/mysql-test/ctype_innodb_like.inc
+++ b/mysql-test/suite/innodb_plugin/include/ctype_innodb_like.inc
diff --git a/mysql-test/suite/innodb/include/innodb-index.inc b/mysql-test/suite/innodb_plugin/include/innodb-index.inc
index 37de3162abe..37de3162abe 100644
--- a/mysql-test/suite/innodb/include/innodb-index.inc
+++ b/mysql-test/suite/innodb_plugin/include/innodb-index.inc
diff --git a/storage/innodb_plugin/mysql-test/innodb_trx_weight.inc b/mysql-test/suite/innodb_plugin/include/innodb_trx_weight.inc
index 56d3d47da36..56d3d47da36 100644
--- a/storage/innodb_plugin/mysql-test/innodb_trx_weight.inc
+++ b/mysql-test/suite/innodb_plugin/include/innodb_trx_weight.inc
diff --git a/mysql-test/suite/innodb/r/innodb-analyze.result b/mysql-test/suite/innodb_plugin/r/innodb-analyze.result
index 2aee004a2d6..2aee004a2d6 100644
--- a/mysql-test/suite/innodb/r/innodb-analyze.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb-analyze.result
diff --git a/mysql-test/suite/innodb_plugin/r/innodb-autoinc-44030.result b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-44030.result
new file mode 100644
index 00000000000..54e972843f5
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-44030.result
@@ -0,0 +1,30 @@
+drop table if exists t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (null);
+INSERT INTO t1 VALUES (null);
+ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
+SELECT * FROM t1;
+d1
+1
+2
+SELECT * FROM t1;
+d1
+1
+2
+INSERT INTO t1 VALUES(null);
+ALTER TABLE t1 AUTO_INCREMENT = 3;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `d1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`d1`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(null);
+SELECT * FROM t1;
+d1
+1
+2
+3
+4
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb-autoinc.result b/mysql-test/suite/innodb_plugin/r/innodb-autoinc.result
new file mode 100644
index 00000000000..a36b3a1a865
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb-autoinc.result
@@ -0,0 +1,1246 @@
+drop table if exists t1;
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (9223372036854775807, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+9223372036854775807 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (127, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+127 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (255, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+255 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (32767, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+32767 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (65535, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+65535 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (8388607, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+8388607 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (16777215, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+16777215 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2147483647, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+2147483647 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (4294967295, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+4294967295 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (9223372036854775807, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+9223372036854775807 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (18446744073709551615, null);
+INSERT INTO t1 (c2) VALUES ('innodb');
+Got one of the listed errors
+SELECT * FROM t1;
+c1 c2
+18446744073709551615 NULL
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+c1
+1
+2
+3
+4
+5
+6
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
+TRUNCATE TABLE t1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+c1
+1
+2
+3
+4
+5
+6
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+c1
+1
+2
+3
+4
+5
+6
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
+DELETE FROM t1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+c1
+1
+2
+3
+7
+8
+9
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL, 1);
+DELETE FROM t1 WHERE c1 = 1;
+INSERT INTO t1 VALUES (2,1);
+INSERT INTO t1 VALUES (NULL,8);
+SELECT * FROM t1;
+c1 c2
+2 1
+3 8
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL, 1);
+DELETE FROM t1 WHERE c1 = 1;
+INSERT INTO t1 VALUES (2,1), (NULL, 8);
+INSERT INTO t1 VALUES (NULL,9);
+SELECT * FROM t1;
+c1 c2
+2 1
+3 8
+5 9
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 100
+auto_increment_offset 10
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL),(5),(NULL);
+INSERT INTO t1 VALUES (250),(NULL);
+SELECT * FROM t1;
+c1
+5
+10
+110
+250
+310
+INSERT INTO t1 VALUES (1000);
+SET @@INSERT_ID=400;
+INSERT INTO t1 VALUES(NULL),(NULL);
+SELECT * FROM t1;
+c1
+5
+10
+110
+250
+310
+400
+410
+1000
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(0);
+SELECT * FROM t1;
+c1
+1
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL);
+INSERT INTO t1 VALUES (250),(NULL);
+SELECT * FROM t1;
+c1
+-1
+1
+2
+10
+110
+250
+410
+SET @@INSERT_ID=400;
+INSERT INTO t1 VALUES(NULL),(NULL);
+Got one of the listed errors
+SELECT * FROM t1;
+c1
+-1
+1
+2
+10
+110
+250
+410
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(-1);
+SELECT * FROM t1;
+c1
+-1
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 100
+auto_increment_offset 10
+INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL);
+INSERT INTO t1 VALUES (250),(NULL);
+SELECT * FROM t1;
+c1
+-2
+-1
+1
+2
+10
+250
+310
+INSERT INTO t1 VALUES (1000);
+SET @@INSERT_ID=400;
+INSERT INTO t1 VALUES(NULL),(NULL);
+SELECT * FROM t1;
+c1
+-2
+-1
+1
+2
+10
+250
+310
+400
+410
+1000
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(-1);
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t1;
+c1
+1
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 100
+auto_increment_offset 10
+INSERT INTO t1 VALUES (-2);
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (250);
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1;
+c1
+1
+2
+10
+110
+210
+250
+310
+INSERT INTO t1 VALUES (1000);
+SET @@INSERT_ID=400;
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+c1
+1
+2
+10
+110
+210
+250
+310
+400
+1000
+1010
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(-1);
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+SELECT * FROM t1;
+c1
+1
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 100
+auto_increment_offset 10
+INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL);
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (250),(NULL);
+SELECT * FROM t1;
+c1
+1
+2
+10
+110
+210
+250
+410
+INSERT INTO t1 VALUES (1000);
+SET @@INSERT_ID=400;
+INSERT INTO t1 VALUES(NULL),(NULL);
+Got one of the listed errors
+SELECT * FROM t1;
+c1
+1
+2
+10
+110
+210
+250
+410
+1000
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES (9223372036854775794);
+SELECT * FROM t1;
+c1
+1
+9223372036854775794
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 2
+auto_increment_offset 10
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+SELECT * FROM t1;
+c1
+1
+9223372036854775794
+9223372036854775796
+9223372036854775798
+9223372036854775800
+9223372036854775802
+9223372036854775804
+9223372036854775806
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES (18446744073709551603);
+SELECT * FROM t1;
+c1
+1
+18446744073709551603
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 2
+auto_increment_offset 10
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+SELECT * FROM t1;
+c1
+1
+18446744073709551603
+18446744073709551604
+18446744073709551606
+18446744073709551608
+18446744073709551610
+18446744073709551612
+18446744073709551614
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES (18446744073709551603);
+SELECT * FROM t1;
+c1
+1
+18446744073709551603
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 5
+auto_increment_offset 7
+INSERT INTO t1 VALUES (NULL),(NULL);
+SELECT * FROM t1;
+c1
+1
+18446744073709551603
+18446744073709551607
+18446744073709551612
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES(-9223372036854775806);
+INSERT INTO t1 VALUES(-9223372036854775807);
+INSERT INTO t1 VALUES(-9223372036854775808);
+SELECT * FROM t1;
+c1
+-9223372036854775808
+-9223372036854775807
+-9223372036854775806
+1
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 3
+auto_increment_offset 3
+INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
+SELECT * FROM t1;
+c1
+-9223372036854775808
+-9223372036854775807
+-9223372036854775806
+1
+3
+6
+9
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES (18446744073709551610);
+SELECT * FROM t1;
+c1
+1
+18446744073709551610
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
+Warnings:
+Warning 1292 Truncated incorrect auto_increment_increment value: '1152921504606846976'
+Warning 1292 Truncated incorrect auto_increment_offset value: '1152921504606846976'
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 65535
+auto_increment_offset 65535
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1;
+c1
+1
+18446744073709551610
+18446744073709551615
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL, 1);
+INSERT INTO t1 VALUES(NULL, 2);
+SELECT * FROM t1;
+c1 c2
+1 1
+2 2
+ALTER TABLE t1 CHANGE c1 c1 SERIAL;
+SELECT * FROM t1;
+c1 c2
+1 1
+2 2
+INSERT INTO t1 VALUES(NULL, 3);
+INSERT INTO t1 VALUES(NULL, 4);
+SELECT * FROM t1;
+c1 c2
+1 1
+2 2
+3 3
+4 4
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL, 1);
+INSERT INTO t1 VALUES(NULL, 2);
+SELECT * FROM t1;
+c1 c2
+1 1
+2 2
+ALTER TABLE t1 CHANGE c1 c1 SERIAL;
+SELECT * FROM t1;
+c1 c2
+1 1
+2 2
+INSERT INTO t1 VALUES(NULL, 3);
+INSERT INTO t1 VALUES(NULL, 4);
+SELECT * FROM t1;
+c1 c2
+1 1
+2 2
+3 3
+4 4
+DROP TABLE t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+DROP TABLE IF EXISTS t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t1 (
+a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
+b INT(10) UNSIGNED NOT NULL,
+c ENUM('FALSE','TRUE') DEFAULT NULL,
+PRIMARY KEY (a)) ENGINE = InnoDB;
+CREATE TABLE t2 (
+m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
+n INT(10) UNSIGNED NOT NULL,
+o enum('FALSE','TRUE') DEFAULT NULL,
+PRIMARY KEY (m)) ENGINE = InnoDB;
+INSERT INTO t2 (n,o) VALUES
+(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
+(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `m` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `n` int(10) unsigned NOT NULL,
+ `o` enum('FALSE','TRUE') DEFAULT NULL,
+ PRIMARY KEY (`m`)
+) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(10) unsigned NOT NULL,
+ `c` enum('FALSE','TRUE') DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
+SELECT * FROM t1;
+a b c
+1 1 TRUE
+2 1 FALSE
+3 2 TRUE
+4 2 FALSE
+5 3 TRUE
+6 3 FALSE
+7 4 TRUE
+8 4 FALSE
+9 5 TRUE
+10 5 FALSE
+13 1 TRUE
+14 1 FALSE
+15 2 TRUE
+16 2 FALSE
+17 3 TRUE
+18 3 FALSE
+19 4 TRUE
+20 4 FALSE
+21 5 TRUE
+22 5 FALSE
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(10) unsigned NOT NULL,
+ `c` enum('FALSE','TRUE') DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
+SELECT * FROM t1;
+a b c
+1 1 TRUE
+2 1 FALSE
+3 2 TRUE
+4 2 FALSE
+5 3 TRUE
+6 3 FALSE
+7 4 TRUE
+8 4 FALSE
+9 5 TRUE
+10 5 FALSE
+13 1 TRUE
+14 1 FALSE
+15 2 TRUE
+16 2 FALSE
+17 3 TRUE
+18 3 FALSE
+19 4 TRUE
+20 4 FALSE
+21 5 TRUE
+22 5 FALSE
+23 1 FALSE
+24 2 FALSE
+25 3 FALSE
+26 4 FALSE
+27 5 FALSE
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(10) unsigned NOT NULL,
+ `c` enum('FALSE','TRUE') DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
+SELECT * FROM t1;
+a b c
+1 1 TRUE
+2 1 FALSE
+3 2 TRUE
+4 2 FALSE
+5 3 TRUE
+6 3 FALSE
+7 4 TRUE
+8 4 FALSE
+9 5 TRUE
+10 5 FALSE
+13 1 TRUE
+14 1 FALSE
+15 2 TRUE
+16 2 FALSE
+17 3 TRUE
+18 3 FALSE
+19 4 TRUE
+20 4 FALSE
+21 5 TRUE
+22 5 FALSE
+23 1 FALSE
+24 2 FALSE
+25 3 FALSE
+26 4 FALSE
+27 5 FALSE
+30 1 FALSE
+31 2 FALSE
+32 3 FALSE
+33 4 FALSE
+34 5 FALSE
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(10) unsigned NOT NULL,
+ `c` enum('FALSE','TRUE') DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(10) unsigned NOT NULL,
+ `c` enum('FALSE','TRUE') DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(10) unsigned NOT NULL,
+ `c` enum('FALSE','TRUE') DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=latin1
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
+SELECT * FROM t1;
+a b c
+1 1 TRUE
+2 1 FALSE
+3 2 TRUE
+4 2 FALSE
+5 3 TRUE
+6 3 FALSE
+7 4 TRUE
+8 4 FALSE
+9 5 TRUE
+10 5 FALSE
+13 1 TRUE
+14 1 FALSE
+15 2 TRUE
+16 2 FALSE
+17 3 TRUE
+18 3 FALSE
+19 4 TRUE
+20 4 FALSE
+21 5 TRUE
+22 5 FALSE
+23 1 FALSE
+24 2 FALSE
+25 3 FALSE
+26 4 FALSE
+27 5 FALSE
+30 1 FALSE
+31 2 FALSE
+32 3 FALSE
+33 4 FALSE
+34 5 FALSE
+37 1 FALSE
+38 2 FALSE
+39 3 FALSE
+40 4 FALSE
+41 5 FALSE
+44 1 FALSE
+45 2 FALSE
+46 3 FALSE
+47 4 FALSE
+48 5 FALSE
+51 1 FALSE
+52 2 FALSE
+53 3 FALSE
+54 4 FALSE
+55 5 FALSE
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) unsigned NOT NULL AUTO_INCREMENT,
+ `b` int(10) unsigned NOT NULL,
+ `c` enum('FALSE','TRUE') DEFAULT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+DROP TABLE IF EXISTS t2;
+Warnings:
+Note 1051 Unknown table 't2'
+CREATE TABLE t1(
+c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
+PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+CREATE TABLE t2(
+c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT
+PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 SELECT c1 FROM t1;
+Got one of the listed errors
+INSERT INTO t2 SELECT NULL FROM t1;
+Got one of the listed errors
+DROP TABLE t1;
+DROP TABLE t2;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+Variable_name Value
+auto_increment_increment 1
+auto_increment_offset 1
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyint(4) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-127 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-127, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32767, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` smallint(6) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-32767 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-32757, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` mediumint(9) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-8388607 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-2147483647 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+-9223372036854775807 innodb
+-1 innodb
+1 NULL
+2 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+Warnings:
+Warning 1264 Out of range value for column 'c1' at row 1
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `c2` varchar(10) DEFAULT NULL,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2
+1 NULL
+2 innodb
+3 innodb
+4 NULL
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
+CREATE INDEX i1 on t1(c2);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ `c2` int(11) DEFAULT NULL,
+ PRIMARY KEY (`c1`),
+ KEY `i1` (`c2`)
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
+INSERT INTO t1 (c2) values (0);
+SELECT * FROM t1;
+c1 c2
+10 0
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
+INSERT INTO t1(C2) VALUES ('innodb');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `C1` double NOT NULL AUTO_INCREMENT,
+ `C2` char(10) DEFAULT NULL,
+ PRIMARY KEY (`C1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
+INSERT INTO t1(C2) VALUES ('innodb');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `C1` float NOT NULL AUTO_INCREMENT,
+ `C2` char(10) DEFAULT NULL,
+ PRIMARY KEY (`C1`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 SET c1 = 1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+INSERT INTO t1 SET c1 = 2;
+INSERT INTO t1 SET c1 = -1;
+SELECT * FROM t1;
+c1
+-1
+1
+2
+INSERT INTO t1 SET c1 = -1;
+Got one of the listed errors
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+REPLACE INTO t1 VALUES (-1);
+SELECT * FROM t1;
+c1
+-1
+1
+2
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
+SELECT * FROM t1;
+c1
+-685113344
+1
+2
+3
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
+SELECT * FROM t1;
+c1
+-685113344
+2
+3
+4
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
+INSERT INTO t1 VALUES (4), (5), (6), (NULL);
+SELECT * FROM t1;
+c1
+-685113344
+1
+2
+3
+4
+5
+6
+7
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
+SELECT * FROM t1;
+c1
+-685113344
+1
+2
+5
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
+SELECT * FROM t1;
+c1
+-685113344
+1
+2
+3
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/innodb-consistent.result b/mysql-test/suite/innodb_plugin/r/innodb-consistent.result
index 9115791b99c..9115791b99c 100644
--- a/mysql-test/suite/innodb/r/innodb-consistent.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb-consistent.result
diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb_plugin/r/innodb-index.result
index f86fcd4a8ef..f86fcd4a8ef 100644
--- a/mysql-test/suite/innodb/r/innodb-index.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb-index.result
diff --git a/mysql-test/suite/innodb/r/innodb-index_ucs2.result b/mysql-test/suite/innodb_plugin/r/innodb-index_ucs2.result
index c8a1e8c7da1..c8a1e8c7da1 100644
--- a/mysql-test/suite/innodb/r/innodb-index_ucs2.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb-index_ucs2.result
diff --git a/mysql-test/suite/innodb_plugin/r/innodb-lock.result b/mysql-test/suite/innodb_plugin/r/innodb-lock.result
new file mode 100644
index 00000000000..4ace4065c34
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb-lock.result
@@ -0,0 +1,57 @@
+set global innodb_table_locks=1;
+select @@innodb_table_locks;
+@@innodb_table_locks
+1
+drop table if exists t1;
+set @@innodb_table_locks=1;
+create table t1 (id integer, x integer) engine=INNODB;
+insert into t1 values(0, 0);
+set autocommit=0;
+SELECT * from t1 where id = 0 FOR UPDATE;
+id x
+0 0
+set autocommit=0;
+lock table t1 write;
+update t1 set x=1 where id = 0;
+select * from t1;
+id x
+0 1
+commit;
+update t1 set x=2 where id = 0;
+commit;
+unlock tables;
+select * from t1;
+id x
+0 2
+commit;
+drop table t1;
+set @@innodb_table_locks=0;
+create table t1 (id integer primary key, x integer) engine=INNODB;
+insert into t1 values(0, 0),(1,1),(2,2);
+commit;
+SELECT * from t1 where id = 0 FOR UPDATE;
+id x
+0 0
+set autocommit=0;
+set @@innodb_table_locks=0;
+lock table t1 write;
+update t1 set x=10 where id = 2;
+SELECT * from t1 where id = 2;
+id x
+2 2
+UPDATE t1 set x=3 where id = 2;
+commit;
+SELECT * from t1;
+id x
+0 0
+1 1
+2 3
+commit;
+unlock tables;
+commit;
+select * from t1;
+id x
+0 0
+1 1
+2 10
+drop table t1;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb-replace.result b/mysql-test/suite/innodb_plugin/r/innodb-replace.result
new file mode 100644
index 00000000000..c926bb89a2e
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb-replace.result
@@ -0,0 +1,13 @@
+drop table if exists t1;
+create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
+select * from t1;
+c1 c2 stamp
+replace delayed into t1 (c1, c2) values ( "text1","11");
+ERROR HY000: DELAYED option not supported for table 't1'
+select * from t1;
+c1 c2 stamp
+replace delayed into t1 (c1, c2) values ( "text1","12");
+ERROR HY000: DELAYED option not supported for table 't1'
+select * from t1;
+c1 c2 stamp
+drop table t1;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb-semi-consistent.result b/mysql-test/suite/innodb_plugin/r/innodb-semi-consistent.result
new file mode 100644
index 00000000000..ca0e362ef80
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb-semi-consistent.result
@@ -0,0 +1,47 @@
+drop table if exists t1;
+set binlog_format=mixed;
+set session transaction isolation level repeatable read;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2),(3),(4),(5),(6),(7);
+set autocommit=0;
+select * from t1 where a=3 lock in share mode;
+a
+3
+set binlog_format=mixed;
+set session transaction isolation level repeatable read;
+set autocommit=0;
+update t1 set a=10 where a=5;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+commit;
+set session transaction isolation level read committed;
+update t1 set a=10 where a=5;
+select * from t1 where a=2 for update;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from t1 where a=2 limit 1 for update;
+a
+2
+update t1 set a=11 where a=6;
+update t1 set a=12 where a=2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+update t1 set a=13 where a=1;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+commit;
+update t1 set a=14 where a=1;
+commit;
+select * from t1;
+a
+14
+2
+3
+4
+10
+11
+7
+drop table t1;
+create table t1 (a int, b int) engine=myisam;
+create table t2 (c int, d int, key (c)) engine=innodb;
+insert into t1 values (1,1);
+insert into t2 values (1,2);
+set session transaction isolation level read committed;
+delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
+drop table t1, t2;
diff --git a/mysql-test/suite/innodb/r/innodb-timeout.result b/mysql-test/suite/innodb_plugin/r/innodb-timeout.result
index be9a688cd72..be9a688cd72 100644
--- a/mysql-test/suite/innodb/r/innodb-timeout.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb-timeout.result
diff --git a/mysql-test/suite/innodb/r/innodb-use-sys-malloc.result b/mysql-test/suite/innodb_plugin/r/innodb-use-sys-malloc.result
index 2ec4c7c8130..2ec4c7c8130 100644
--- a/mysql-test/suite/innodb/r/innodb-use-sys-malloc.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb-use-sys-malloc.result
diff --git a/mysql-test/suite/innodb/r/innodb-zip.result b/mysql-test/suite/innodb_plugin/r/innodb-zip.result
index 21396d81ba8..21396d81ba8 100644
--- a/mysql-test/suite/innodb/r/innodb-zip.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb-zip.result
diff --git a/storage/innodb_plugin/mysql-test/innodb.result b/mysql-test/suite/innodb_plugin/r/innodb.result
index bdae7633fd1..e435c0f68ca 100644
--- a/storage/innodb_plugin/mysql-test/innodb.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb.result
@@ -692,6 +692,8 @@ select count(*) from t1 where sca_pic is null;
count(*)
2
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
+alter table t1 drop index sca_pic;
+alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
@@ -699,6 +701,9 @@ select count(*) from t1 where cat_code='E';
count(*)
0
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
+ERROR 42000: Incorrect index name 'sca_pic'
+alter table t1 drop index sca_pic;
+alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
count(*)
1
@@ -1747,7 +1752,7 @@ variable_value - @innodb_rows_deleted_orig
71
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
variable_value - @innodb_rows_inserted_orig
-1084
+1087
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
variable_value - @innodb_rows_updated_orig
885
@@ -1833,6 +1838,7 @@ show variables like "innodb_thread_sleep_delay";
Variable_name Value
innodb_thread_sleep_delay 10000
set storage_engine=INNODB;
+set session old_alter_table=1;
drop table if exists t1,t2,t3;
--- Testing varchar ---
--- Testing varchar ---
@@ -1970,7 +1976,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref v v 13 const # Using where; Using index
alter table t1 add unique(v);
-ERROR 23000: Duplicate entry 'v' for key 'v_2'
+ERROR 23000: Duplicate entry '{ ' for key 'v_2'
alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
qq
@@ -2406,6 +2412,7 @@ select * from t1 where a=20 and b is null;
a b
20 NULL
drop table t1;
+set session old_alter_table=0;
create table t1 (v varchar(65530), key(v));
Warnings:
Warning 1071 Specified key was too long; max key length is 767 bytes
@@ -3088,7 +3095,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
commit;
drop table t1, t2, t3, t5, t6, t8, t9;
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
-ERROR HY000: Can't create table 'test.t1' (errno: -1)
+ERROR 42000: Incorrect column name 'DB_ROW_ID'
CREATE TABLE t1 (
a BIGINT(20) NOT NULL,
PRIMARY KEY (a)
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug21704.result b/mysql-test/suite/innodb_plugin/r/innodb_bug21704.result
index b8e0b15d50d..ffbfa8a337e 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug21704.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug21704.result
@@ -25,8 +25,8 @@ ALTER TABLE t1 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t1 CHANGE b c INT;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
# Test renaming the column in the referencing table
@@ -34,8 +34,8 @@ ALTER TABLE t2 CHANGE a c INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t2 CHANGE b c INT;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
# Test with self-referential constraints
@@ -45,8 +45,8 @@ ALTER TABLE t3 CHANGE b d INT;
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
# Ensure that online column rename works.
ALTER TABLE t3 CHANGE c d INT;
-affected rows: 0
-info: Records: 0 Duplicates: 0 Warnings: 0
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
# Cleanup.
diff --git a/mysql-test/suite/innodb/r/innodb_bug36172.result b/mysql-test/suite/innodb_plugin/r/innodb_bug34053.result
index 195775f74c8..195775f74c8 100644
--- a/mysql-test/suite/innodb/r/innodb_bug36172.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug34053.result
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug34300.result b/mysql-test/suite/innodb_plugin/r/innodb_bug34300.result
index ae9fee81ad7..ae9fee81ad7 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug34300.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug34300.result
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug36172.result b/mysql-test/suite/innodb_plugin/r/innodb_bug35220.result
index 195775f74c8..195775f74c8 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug36172.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug35220.result
diff --git a/mysql-test/suite/innodb/r/innodb_bug36169.result b/mysql-test/suite/innodb_plugin/r/innodb_bug36169.result
index aa80e4d7aa4..aa80e4d7aa4 100644
--- a/mysql-test/suite/innodb/r/innodb_bug36169.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug36169.result
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug36172.result b/mysql-test/suite/innodb_plugin/r/innodb_bug36172.result
new file mode 100644
index 00000000000..195775f74c8
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug36172.result
@@ -0,0 +1 @@
+SET storage_engine=InnoDB;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug38231.result b/mysql-test/suite/innodb_plugin/r/innodb_bug38231.result
new file mode 100644
index 00000000000..2f909779755
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug38231.result
@@ -0,0 +1,11 @@
+SET storage_engine=InnoDB;
+INSERT INTO bug38231 VALUES (1), (10), (300);
+SET autocommit=0;
+SELECT * FROM bug38231 FOR UPDATE;
+a
+1
+10
+300
+TRUNCATE TABLE bug38231;
+COMMIT;
+DROP TABLE bug38231;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug39438.result b/mysql-test/suite/innodb_plugin/r/innodb_bug39438.result
new file mode 100644
index 00000000000..195775f74c8
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug39438.result
@@ -0,0 +1 @@
+SET storage_engine=InnoDB;
diff --git a/mysql-test/suite/innodb/r/innodb_bug40360.result b/mysql-test/suite/innodb_plugin/r/innodb_bug40360.result
index ef4cf463903..ef4cf463903 100644
--- a/mysql-test/suite/innodb/r/innodb_bug40360.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug40360.result
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug40565.result b/mysql-test/suite/innodb_plugin/r/innodb_bug40565.result
index 21e923d9336..21e923d9336 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug40565.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug40565.result
diff --git a/mysql-test/suite/innodb/r/innodb_bug41904.result b/mysql-test/suite/innodb_plugin/r/innodb_bug41904.result
index 6070d32d181..6070d32d181 100644
--- a/mysql-test/suite/innodb/r/innodb_bug41904.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug41904.result
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.result b/mysql-test/suite/innodb_plugin/r/innodb_bug42101-nonzero.result
index 277dfffdd35..277dfffdd35 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug42101-nonzero.result
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug42101.result b/mysql-test/suite/innodb_plugin/r/innodb_bug42101.result
index 805097ffe9d..805097ffe9d 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug42101.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug42101.result
diff --git a/mysql-test/r/innodb_bug44032.result b/mysql-test/suite/innodb_plugin/r/innodb_bug44032.result
index da2a000b06e..da2a000b06e 100644
--- a/mysql-test/r/innodb_bug44032.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug44032.result
diff --git a/mysql-test/r/innodb_bug44369.result b/mysql-test/suite/innodb_plugin/r/innodb_bug44369.result
index ff25c774aa2..ff25c774aa2 100644
--- a/mysql-test/r/innodb_bug44369.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug44369.result
diff --git a/mysql-test/suite/innodb/r/innodb_bug44571.result b/mysql-test/suite/innodb_plugin/r/innodb_bug44571.result
index 7ee7820a02d..7ee7820a02d 100644
--- a/mysql-test/suite/innodb/r/innodb_bug44571.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug44571.result
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug45357.result b/mysql-test/suite/innodb_plugin/r/innodb_bug45357.result
index 7adeff2062f..7adeff2062f 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug45357.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug45357.result
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug46000.result b/mysql-test/suite/innodb_plugin/r/innodb_bug46000.result
new file mode 100644
index 00000000000..c8e3db8d641
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug46000.result
@@ -0,0 +1,19 @@
+create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
+ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
+create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
+ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
+show warnings;
+Level Code Message
+Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
+Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
+Error 1005 Can't create table 'test.bug46000' (errno: -1)
+create table bug46000(id int) engine=innodb;
+create index GEN_CLUST_INDEX on bug46000(id);
+ERROR 42000: Incorrect index name 'GEN_CLUST_INDEX'
+show warnings;
+Level Code Message
+Warning 1280 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
+Error 1280 Incorrect index name 'GEN_CLUST_INDEX'
+Error 1030 Got error -1 from storage engine
+create index idx on bug46000(id);
+drop table bug46000;
diff --git a/mysql-test/suite/innodb/r/innodb_bug46676.result b/mysql-test/suite/innodb_plugin/r/innodb_bug46676.result
index 996799ce931..996799ce931 100644
--- a/mysql-test/suite/innodb/r/innodb_bug46676.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug46676.result
diff --git a/mysql-test/suite/innodb/r/innodb_bug47167.result b/mysql-test/suite/innodb_plugin/r/innodb_bug47167.result
index cbec363d78f..cbec363d78f 100644
--- a/mysql-test/suite/innodb/r/innodb_bug47167.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug47167.result
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug47621.result b/mysql-test/suite/innodb_plugin/r/innodb_bug47621.result
new file mode 100644
index 00000000000..c5f56c09788
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug47621.result
@@ -0,0 +1,21 @@
+CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB;
+ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT;
+create index orgs on bug47621(sales_acct_id);
+ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT;
+drop table bug47621;
+CREATE TABLE bug47621_sale (
+salesperson INT,
+PRIMARY KEY(salesperson)) engine = innodb;
+CREATE TABLE bug47621_shirt(
+id SMALLINT,
+owner INT,
+FOREIGN KEY(owner)
+references bug47621_sale(salesperson) ON DELETE RESTRICT)
+engine = innodb;
+insert into bug47621_sale values(9);
+insert into bug47621_shirt values(1, 9);
+ALTER TABLE bug47621_shirt CHANGE id new_id INT;
+drop table bug47621_shirt;
+ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
+ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id);
+drop table bug47621_sale;
diff --git a/mysql-test/suite/innodb/r/innodb_bug47622.result b/mysql-test/suite/innodb_plugin/r/innodb_bug47622.result
index f5d13711c52..f5d13711c52 100644
--- a/mysql-test/suite/innodb/r/innodb_bug47622.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug47622.result
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug47777.result b/mysql-test/suite/innodb_plugin/r/innodb_bug47777.result
new file mode 100644
index 00000000000..fbba47edcfc
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug47777.result
@@ -0,0 +1,13 @@
+create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
+insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+count(*)
+1
+update bug47777 set c2=GeomFromText('POINT(1 1)');
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+count(*)
+0
+select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
+count(*)
+1
+drop table bug47777;
diff --git a/mysql-test/suite/innodb/r/innodb_bug51378.result b/mysql-test/suite/innodb_plugin/r/innodb_bug51378.result
index a3ca73c16a9..a3ca73c16a9 100644
--- a/mysql-test/suite/innodb/r/innodb_bug51378.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug51378.result
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug51920.result b/mysql-test/suite/innodb_plugin/r/innodb_bug51920.result
new file mode 100644
index 00000000000..7ded141c239
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug51920.result
@@ -0,0 +1,13 @@
+CREATE TABLE bug51920 (i INT) ENGINE=InnoDB;
+INSERT INTO bug51920 VALUES (1);
+BEGIN;
+SELECT * FROM bug51920 FOR UPDATE;
+i
+1
+UPDATE bug51920 SET i=2;
+SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE INFO="UPDATE bug51920 SET i=2"
+INTO @thread_id;
+KILL @thread_id;
+Got one of the listed errors
+DROP TABLE bug51920;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug52663.result b/mysql-test/suite/innodb_plugin/r/innodb_bug52663.result
new file mode 100644
index 00000000000..89add18617b
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug52663.result
@@ -0,0 +1,26 @@
+set session transaction isolation level read committed;
+create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
+(what, id)) engine=innodb;
+insert into innodb_bug52663 values ('total', 0, 0);
+begin;
+set session transaction isolation level read committed;
+begin;
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+select * from innodb_bug52663;
+what id count
+total 0 1
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select * from innodb_bug52663;
+what id count
+total 0 0
+commit;
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+commit;
+select * from innodb_bug52663;
+what id count
+total 0 2
+select * from innodb_bug52663;
+what id count
+total 0 2
+drop table innodb_bug52663;
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_bug52745.result b/mysql-test/suite/innodb_plugin/r/innodb_bug52745.result
new file mode 100644
index 00000000000..254c6525257
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug52745.result
@@ -0,0 +1,130 @@
+SET GLOBAL innodb_file_format='Barracuda';
+SET GLOBAL innodb_file_per_table=on;
+CREATE TABLE bug52745 (
+a2 int(10) unsigned DEFAULT NULL,
+col37 time DEFAULT NULL,
+col38 char(229) CHARACTER SET utf8 DEFAULT NULL,
+col39 text,
+col40 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+col41 int(10) unsigned DEFAULT NULL,
+col42 varchar(248) CHARACTER SET utf8 DEFAULT NULL,
+col43 smallint(5) unsigned zerofill DEFAULT NULL,
+col44 varchar(150) CHARACTER SET utf8 DEFAULT NULL,
+col45 float unsigned zerofill DEFAULT NULL,
+col46 binary(1) DEFAULT NULL,
+col47 tinyint(4) DEFAULT NULL,
+col48 tinyint(1) DEFAULT NULL,
+col49 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+col50 binary(1) DEFAULT NULL,
+col51 double unsigned zerofill DEFAULT NULL,
+col52 int(10) unsigned DEFAULT NULL,
+col53 time DEFAULT NULL,
+col54 double unsigned DEFAULT NULL,
+col55 time DEFAULT NULL,
+col56 mediumtext CHARACTER SET latin2,
+col57 blob,
+col58 decimal(52,16) unsigned zerofill NOT NULL DEFAULT '000000000000000000000000000000000000.0000000000000000',
+col59 binary(1) DEFAULT NULL,
+col60 longblob,
+col61 time DEFAULT NULL,
+col62 longtext CHARACTER SET utf8 COLLATE utf8_persian_ci,
+col63 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+col64 int(10) unsigned DEFAULT NULL,
+col65 date DEFAULT NULL,
+col66 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+col67 binary(1) DEFAULT NULL,
+col68 tinyblob,
+col69 date DEFAULT NULL,
+col70 tinyint(3) unsigned zerofill DEFAULT NULL,
+col71 varchar(44) CHARACTER SET utf8 DEFAULT NULL,
+col72 datetime DEFAULT NULL,
+col73 smallint(5) unsigned zerofill DEFAULT NULL,
+col74 longblob,
+col75 bit(34) DEFAULT NULL,
+col76 float unsigned zerofill DEFAULT NULL,
+col77 year(2) DEFAULT NULL,
+col78 tinyint(3) unsigned DEFAULT NULL,
+col79 set('msfheowh','tbpxbgf','by','wahnrjw','myqfasxz','rsokyumrt') CHARACTER SET latin2 DEFAULT NULL,
+col80 datetime DEFAULT NULL,
+col81 smallint(6) DEFAULT NULL,
+col82 enum('xtaurnqfqz','rifrse','kuzwpbvb','niisabk','zxavro','rbvasv','','uulrfaove','','') DEFAULT NULL,
+col83 bigint(20) unsigned zerofill DEFAULT NULL,
+col84 float unsigned zerofill DEFAULT NULL,
+col85 double DEFAULT NULL,
+col86 enum('ylannv','','vlkhycqc','snke','cxifustp','xiaxaswzp','oxl') CHARACTER SET latin1 COLLATE latin1_german2_ci DEFAULT NULL,
+col87 varbinary(221) DEFAULT NULL,
+col88 double unsigned DEFAULT NULL,
+col89 float unsigned zerofill DEFAULT NULL,
+col90 tinyblob
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+Warnings:
+Note 1291 Column 'col82' has duplicated value '' in ENUM
+Note 1291 Column 'col82' has duplicated value '' in ENUM
+INSERT INTO bug52745 SET
+col40='0000-00-00 00:00:00',
+col51=16547,
+col53='7711484',
+col54=-28604,
+col55='7112612',
+col56='wakefulness\'',
+col57=repeat('absorbefacient\'',106),
+col58=11027,
+col59='AM09gW7',
+col60=repeat('Noelani\'',16),
+col61='2520576',
+col62='substitutiv',
+col63='19950106155112',
+col64=-12038,
+col65='86238806',
+col66='19600719080256',
+col68=repeat('Sagittarius\'',54),
+col69='38943902',
+col70=1232,
+col71='Elora\'',
+col74=repeat('zipp',11),
+col75='0',
+col76=23254,
+col78=13247,
+col79='56219',
+col80='20500609035724',
+col81=11632,
+col82=7,
+col84=-23863,
+col85=6341,
+col87='HZdkf.4 s7t,5Rmq 8so fmr,ruGLUG25TrtI.yQ 2SuHq0ML7rw7.4 b2yf2E5TJxOtBBZImezDnzpj,uPYfznnEUDN1e9aQoO 2DsplB7TFWy oQJ br HLF :F,eQ p4i1oWsr lL3PG,hjCz6hYqN h1QTjLCjrv:QCdSzpYBibJAtZCxLOk3l6Blsh.W',
+col88=16894,
+col89=6161,
+col90=repeat('gale',48);
+Warnings:
+Warning 1265 Data truncated for column 'col53' at row 1
+Warning 1264 Out of range value for column 'col54' at row 1
+Warning 1265 Data truncated for column 'col59' at row 1
+Warning 1265 Data truncated for column 'col61' at row 1
+Warning 1264 Out of range value for column 'col64' at row 1
+Warning 1265 Data truncated for column 'col65' at row 1
+Warning 1264 Out of range value for column 'col66' at row 1
+Warning 1265 Data truncated for column 'col68' at row 1
+Warning 1265 Data truncated for column 'col69' at row 1
+Warning 1264 Out of range value for column 'col70' at row 1
+Warning 1264 Out of range value for column 'col78' at row 1
+Warning 1265 Data truncated for column 'col79' at row 1
+Warning 1264 Out of range value for column 'col84' at row 1
+SHOW WARNINGS;
+Level Code Message
+Warning 1265 Data truncated for column 'col53' at row 1
+Warning 1264 Out of range value for column 'col54' at row 1
+Warning 1265 Data truncated for column 'col59' at row 1
+Warning 1265 Data truncated for column 'col61' at row 1
+Warning 1264 Out of range value for column 'col64' at row 1
+Warning 1265 Data truncated for column 'col65' at row 1
+Warning 1264 Out of range value for column 'col66' at row 1
+Warning 1265 Data truncated for column 'col68' at row 1
+Warning 1265 Data truncated for column 'col69' at row 1
+Warning 1264 Out of range value for column 'col70' at row 1
+Warning 1264 Out of range value for column 'col78' at row 1
+Warning 1265 Data truncated for column 'col79' at row 1
+Warning 1264 Out of range value for column 'col84' at row 1
+DROP TABLE bug52745;
+SET GLOBAL innodb_file_format=Antelope;
+SET GLOBAL innodb_file_format_check=Antelope;
+SET GLOBAL innodb_file_per_table=0;
diff --git a/storage/innodb_plugin/mysql-test/innodb_file_format.result b/mysql-test/suite/innodb_plugin/r/innodb_file_format.result
index 8e9a317308b..86d60706084 100644
--- a/storage/innodb_plugin/mysql-test/innodb_file_format.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_file_format.result
@@ -30,8 +30,6 @@ select @@innodb_file_format_check;
@@innodb_file_format_check
Barracuda
set global innodb_file_format_check=default;
-Warnings:
-Warning 1210 Ignoring SET innodb_file_format=on
select @@innodb_file_format_check;
@@innodb_file_format_check
Barracuda
diff --git a/mysql-test/suite/innodb/r/innodb_information_schema.result b/mysql-test/suite/innodb_plugin/r/innodb_information_schema.result
index 396cae579ce..396cae579ce 100644
--- a/mysql-test/suite/innodb/r/innodb_information_schema.result
+++ b/mysql-test/suite/innodb_plugin/r/innodb_information_schema.result
diff --git a/mysql-test/suite/innodb_plugin/r/innodb_trx_weight.result b/mysql-test/suite/innodb_plugin/r/innodb_trx_weight.result
new file mode 100644
index 00000000000..195775f74c8
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/r/innodb_trx_weight.result
@@ -0,0 +1 @@
+SET storage_engine=InnoDB;
diff --git a/storage/innodb_plugin/mysql-test/innodb-analyze.test b/mysql-test/suite/innodb_plugin/t/innodb-analyze.test
index 9bdb9db697c..a79c36850dd 100644
--- a/storage/innodb_plugin/mysql-test/innodb-analyze.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb-analyze.test
@@ -3,7 +3,7 @@
# different values of the parameter innodb_stats_sample_pages.
#
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
# we care only that the following SQL commands do not produce errors
# and do not crash the server
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-autoinc-44030.test b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-44030.test
new file mode 100644
index 00000000000..99cdac72e2e
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-44030.test
@@ -0,0 +1,43 @@
+-- source include/have_innodb_plugin.inc
+# embedded server ignores 'delayed', so skip this
+-- source include/not_embedded.inc
+
+let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from
+# the index (PRIMARY)
+# This test requires a restart of the server
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (null);
+INSERT INTO t1 VALUES (null);
+ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT;
+SELECT * FROM t1;
+# Restart the server
+-- source include/restart_mysqld.inc
+# The MySQL and InnoDB data dictionaries should now be out of sync.
+# The select should print message to the error log
+SELECT * FROM t1;
+# MySQL have made a change (http://lists.mysql.com/commits/75268) that no
+# longer results in the two data dictionaries being out of sync. If they
+# revert their changes then this check for ER_AUTOINC_READ_FAILED will need
+# to be enabled. Also, see http://bugs.mysql.com/bug.php?id=47621.
+# -- error ER_AUTOINC_READ_FAILED,1467
+INSERT INTO t1 VALUES(null);
+ALTER TABLE t1 AUTO_INCREMENT = 3;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES(null);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# restore environment to the state it was before this test execution
+#
+
+-- disable_query_log
+eval set global innodb_file_format_check=$innodb_file_format_check_orig;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-autoinc.test b/mysql-test/suite/innodb_plugin/t/innodb-autoinc.test
new file mode 100644
index 00000000000..5a83ffe3617
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc.test
@@ -0,0 +1,673 @@
+-- source include/have_innodb_plugin.inc
+# embedded server ignores 'delayed', so skip this
+-- source include/not_embedded.inc
+
+let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug #34335
+#
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (9223372036854775807, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+## Test AUTOINC overflow
+##
+
+# TINYINT
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (127, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (255, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# SMALLINT
+#
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (32767, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (65535, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# MEDIUMINT
+#
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (8388607, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (16777215, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# INT
+#
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (2147483647, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (4294967295, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# BIGINT
+#
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (9223372036854775807, null);
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (18446744073709551615, null);
+-- error ER_AUTOINC_READ_FAILED,1467
+INSERT INTO t1 (c2) VALUES ('innodb');
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Bug 37531
+# After truncate, auto_increment behaves incorrectly for InnoDB
+#
+CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+SHOW CREATE TABLE t1;
+TRUNCATE TABLE t1;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+#
+# Deleting all records should not reset the AUTOINC counter.
+#
+CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+SHOW CREATE TABLE t1;
+DELETE FROM t1;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES (1), (2), (3);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
+SELECT c1 FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+#
+# Bug 38839
+# Reset the last value generated at end of statement
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL, 1);
+DELETE FROM t1 WHERE c1 = 1;
+INSERT INTO t1 VALUES (2,1);
+INSERT INTO t1 VALUES (NULL,8);
+SELECT * FROM t1;
+DROP TABLE t1;
+# Bug 38839 -- same as above but for multi value insert
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL, 1);
+DELETE FROM t1 WHERE c1 = 1;
+INSERT INTO t1 VALUES (2,1), (NULL, 8);
+INSERT INTO t1 VALUES (NULL,9);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Test changes to AUTOINC next value calculation
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL),(5),(NULL);
+INSERT INTO t1 VALUES (250),(NULL);
+SELECT * FROM t1;
+INSERT INTO t1 VALUES (1000);
+SET @@INSERT_ID=400;
+INSERT INTO t1 VALUES(NULL),(NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Test with SIGNED INT column, by inserting a 0 for the first column value
+# 0 is treated in the same was NULL.
+# Reset the AUTOINC session variables
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(0);
+SELECT * FROM t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL);
+INSERT INTO t1 VALUES (250),(NULL);
+SELECT * FROM t1;
+SET @@INSERT_ID=400;
+# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 VALUES(NULL),(NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Test with SIGNED INT column
+# Reset the AUTOINC session variables
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(-1);
+SELECT * FROM t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL);
+INSERT INTO t1 VALUES (250),(NULL);
+SELECT * FROM t1;
+INSERT INTO t1 VALUES (1000);
+SET @@INSERT_ID=400;
+INSERT INTO t1 VALUES(NULL),(NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Test with UNSIGNED INT column, single insert
+# The sign in the value is ignored and a new column value is generated
+# Reset the AUTOINC session variables
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(-1);
+SELECT * FROM t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+INSERT INTO t1 VALUES (-2);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t1 VALUES (250);
+INSERT INTO t1 VALUES (NULL);
+SELECT * FROM t1;
+INSERT INTO t1 VALUES (1000);
+SET @@INSERT_ID=400;
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES(NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Test with UNSIGNED INT column, multi-value inserts
+# The sign in the value is ignored and a new column value is generated
+# Reset the AUTOINC session variables
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(-1);
+SELECT * FROM t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL);
+INSERT INTO t1 VALUES (250),(NULL);
+SELECT * FROM t1;
+INSERT INTO t1 VALUES (1000);
+SET @@INSERT_ID=400;
+# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 VALUES(NULL),(NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Check for overflow handling when increment is > 1
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+# TODO: Fix the autoinc init code
+# We have to do this because of a bug in the AUTOINC init code.
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14
+SELECT * FROM t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+# This should just fit
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Check for overflow handling when increment and offser are > 1
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+# TODO: Fix the autoinc init code
+# We have to do this because of a bug in the AUTOINC init code.
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
+SELECT * FROM t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
+SHOW VARIABLES LIKE "%auto_inc%";
+# This should fail because of overflow but it doesn't, it seems to be
+# a MySQL server bug. It wraps around to 0 for the last value.
+# See MySQL Bug# 39828
+#
+# Instead of wrapping around, it asserts when MySQL is compiled --with-debug
+# (see sql/handler.cc:handler::update_auto_increment()). Don't test for
+# overflow until Bug #39828 is fixed.
+#
+# Since this asserts when compiled --with-debug, we can't properly test this
+# until Bug #39828 is fixed. For now, this test is meaningless.
+#if Bug #39828 is fixed
+#INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+#else
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+#endif
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Check for overflow handling when increment and offset are odd numbers
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+# TODO: Fix the autoinc init code
+# We have to do this because of a bug in the AUTOINC init code.
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
+SELECT * FROM t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7;
+SHOW VARIABLES LIKE "%auto_inc%";
+# This should fail because of overflow but it doesn't. It fails with
+# a duplicate entry message because of a MySQL server bug, it wraps
+# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace
+# the ER_DUP_ENTRY, 1062 below with the appropriate error message
+#
+# Since this asserts when compiled --with-debug, we can't properly test this
+# until Bug #39828 is fixed. For now, this test is meaningless.
+#if Bug #39828 is fixed
+# Still need to fix this error code, error should mention overflow
+#-- error ER_DUP_ENTRY,1062
+#INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
+#else
+INSERT INTO t1 VALUES (NULL),(NULL);
+#endif
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Check for overflow handling when increment and offset are odd numbers
+# and check for large -ve numbers
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+# TODO: Fix the autoinc init code
+# We have to do this because of a bug in the AUTOINC init code.
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES(-9223372036854775806); #-- -2^63 + 2
+INSERT INTO t1 VALUES(-9223372036854775807); #-- -2^63 + 1
+INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63
+SELECT * FROM t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3;
+SHOW VARIABLES LIKE "%auto_inc%";
+INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# Check for overflow handling when increment and offset are very
+# large numbers 2^60
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
+# TODO: Fix the autoinc init code
+# We have to do this because of a bug in the AUTOINC init code.
+INSERT INTO t1 VALUES(NULL);
+INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
+SELECT * FROM t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
+SHOW VARIABLES LIKE "%auto_inc%";
+# This should fail because of overflow but it doesn't. It wraps around
+# and the autoinc values look bogus too.
+# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error
+# code expected test.
+# -- error ER_AUTOINC_READ_FAILED,1467
+#
+# Since this asserts when compiled --with-debug, we can't properly test this
+# until Bug #39828 is fixed. For now, this test is meaningless.
+#if Bug #39828 is fixed
+#-- error ER_AUTOINC_READ_FAILED,1467
+#INSERT INTO t1 VALUES (NULL),(NULL);
+#else
+INSERT INTO t1 VALUES (NULL);
+#endif
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Check for floating point autoinc column handling
+#
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SET @@INSERT_ID=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL, 1);
+INSERT INTO t1 VALUES(NULL, 2);
+SELECT * FROM t1;
+ALTER TABLE t1 CHANGE c1 c1 SERIAL;
+SELECT * FROM t1;
+INSERT INTO t1 VALUES(NULL, 3);
+INSERT INTO t1 VALUES(NULL, 4);
+SELECT * FROM t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(NULL, 1);
+INSERT INTO t1 VALUES(NULL, 2);
+SELECT * FROM t1;
+ALTER TABLE t1 CHANGE c1 c1 SERIAL;
+SELECT * FROM t1;
+INSERT INTO t1 VALUES(NULL, 3);
+INSERT INTO t1 VALUES(NULL, 4);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# Bug# 42714: AUTOINC column calculated next value not greater than highest
+# value stored in table.
+#
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1 (
+ a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
+ b INT(10) UNSIGNED NOT NULL,
+ c ENUM('FALSE','TRUE') DEFAULT NULL,
+ PRIMARY KEY (a)) ENGINE = InnoDB;
+CREATE TABLE t2 (
+ m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
+ n INT(10) UNSIGNED NOT NULL,
+ o enum('FALSE','TRUE') DEFAULT NULL,
+ PRIMARY KEY (m)) ENGINE = InnoDB;
+INSERT INTO t2 (n,o) VALUES
+ (1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
+ (3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
+SHOW CREATE TABLE t2;
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+DROP TABLE t2;
+#
+# 43203: Overflow from auto incrementing causes server segv
+#
+
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+CREATE TABLE t1(
+ c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
+ PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
+CREATE TABLE t2(
+ c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT
+ PRIMARY KEY) ENGINE=InnoDB;
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t2 SELECT c1 FROM t1;
+-- error ER_DUP_ENTRY,1467
+INSERT INTO t2 SELECT NULL FROM t1;
+DROP TABLE t1;
+DROP TABLE t2;
+
+# If the user has specified negative values for an AUTOINC column then
+# InnoDB should ignore those values when setting the table's max value.
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+SHOW VARIABLES LIKE "%auto_inc%";
+# TINYINT
+CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-127, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# SMALLINT
+#
+CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32767, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-32757, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# MEDIUMINT
+#
+CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-8388607, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# INT
+#
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-2147483647, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# BIGINT
+#
+CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1, NULL);
+INSERT INTO t1 VALUES (-1, 'innodb');
+INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
+INSERT INTO t1 VALUES (NULL, NULL);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+#
+# End negative number check
+
+##
+# 47125: auto_increment start value is ignored if an index is created
+# and engine=innodb
+#
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
+CREATE INDEX i1 on t1(c2);
+SHOW CREATE TABLE t1;
+INSERT INTO t1 (c2) values (0);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+##
+# 49032: Use the correct function to read the AUTOINC column value
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
+# Restart the server
+-- source include/restart_mysqld.inc
+INSERT INTO t1(C2) VALUES ('innodb');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
+INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
+# Restart the server
+-- source include/restart_mysqld.inc
+INSERT INTO t1(C2) VALUES ('innodb');
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+##
+# 47720: REPLACE INTO Autoincrement column with negative values
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 SET c1 = 1;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 SET c1 = 2;
+INSERT INTO t1 SET c1 = -1;
+SELECT * FROM t1;
+-- error ER_DUP_ENTRY,1062
+INSERT INTO t1 SET c1 = -1;
+SHOW CREATE TABLE t1;
+REPLACE INTO t1 VALUES (-1);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+##
+# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
+INSERT INTO t1 VALUES (4), (5), (6), (NULL);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
+SELECT * FROM t1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+#
+# restore environment to the state it was before this test execution
+#
+
+-- disable_query_log
+eval set global innodb_file_format_check=$innodb_file_format_check_orig;
diff --git a/storage/innodb_plugin/mysql-test/innodb-consistent-master.opt b/mysql-test/suite/innodb_plugin/t/innodb-consistent-master.opt
index 8cca44767da..e76299453d3 100644
--- a/storage/innodb_plugin/mysql-test/innodb-consistent-master.opt
+++ b/mysql-test/suite/innodb_plugin/t/innodb-consistent-master.opt
@@ -1 +1 @@
---innodb_lock_wait_timeout=2
+--innodb_lock_wait_timeout=2
diff --git a/mysql-test/suite/innodb/t/innodb-consistent.test b/mysql-test/suite/innodb_plugin/t/innodb-consistent.test
index 25bdf78e96b..475b506525e 100644
--- a/mysql-test/suite/innodb/t/innodb-consistent.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb-consistent.test
@@ -1,6 +1,5 @@
-- source include/not_embedded.inc
--- source include/have_innodb.inc
--- source suite/innodb/include/have_innodb_plugin.inc
+-- source include/have_innodb_plugin.inc
--disable_warnings
drop table if exists t1;
diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb_plugin/t/innodb-index.test
index eeadc0f4783..717c7d4e032 100644
--- a/mysql-test/suite/innodb/t/innodb-index.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb-index.test
@@ -1,4 +1,4 @@
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
let $MYSQLD_DATADIR= `select @@datadir`;
@@ -163,7 +163,7 @@ select * from t2;
drop table t2,t4,t3,t1;
-- let charset = utf8
--- source suite/innodb/include/innodb-index.inc
+-- source suite/innodb_plugin/include/innodb-index.inc
create table t1(a int not null, b int) engine = innodb;
insert into t1 values (1,1),(1,1),(1,1),(1,1);
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-index_ucs2.test b/mysql-test/suite/innodb_plugin/t/innodb-index_ucs2.test
new file mode 100644
index 00000000000..355e12f2f72
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb-index_ucs2.test
@@ -0,0 +1,5 @@
+-- source include/have_innodb_plugin.inc
+-- source include/have_ucs2.inc
+
+-- let charset = ucs2
+-- source suite/innodb_plugin/include/innodb-index.inc
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-lock.test b/mysql-test/suite/innodb_plugin/t/innodb-lock.test
new file mode 100644
index 00000000000..20467236b1c
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb-lock.test
@@ -0,0 +1,102 @@
+-- source include/have_innodb_plugin.inc
+
+#
+# Check and select innodb lock type
+#
+
+set global innodb_table_locks=1;
+
+select @@innodb_table_locks;
+
+#
+# Testing of explicit table locks with enforced table locks
+#
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Testing of explicit table locks with enforced table locks
+#
+
+set @@innodb_table_locks=1;
+
+connection con1;
+create table t1 (id integer, x integer) engine=INNODB;
+insert into t1 values(0, 0);
+set autocommit=0;
+SELECT * from t1 where id = 0 FOR UPDATE;
+
+connection con2;
+set autocommit=0;
+
+# The following statement should hang because con1 is locking the page
+--send
+lock table t1 write;
+--sleep 2
+
+connection con1;
+update t1 set x=1 where id = 0;
+select * from t1;
+commit;
+
+connection con2;
+reap;
+update t1 set x=2 where id = 0;
+commit;
+unlock tables;
+
+connection con1;
+select * from t1;
+commit;
+
+drop table t1;
+
+#
+# Try with old lock method (where LOCK TABLE is ignored by InnoDB)
+#
+
+set @@innodb_table_locks=0;
+
+create table t1 (id integer primary key, x integer) engine=INNODB;
+insert into t1 values(0, 0),(1,1),(2,2);
+commit;
+SELECT * from t1 where id = 0 FOR UPDATE;
+
+connection con2;
+set autocommit=0;
+set @@innodb_table_locks=0;
+
+# The following statement should work becase innodb doesn't check table locks
+lock table t1 write;
+
+connection con1;
+
+# This will be locked by MySQL
+--send
+update t1 set x=10 where id = 2;
+--sleep 2
+
+connection con2;
+
+# Note that we will get a deadlock if we try to select any rows marked
+# for update by con1 !
+
+SELECT * from t1 where id = 2;
+UPDATE t1 set x=3 where id = 2;
+commit;
+SELECT * from t1;
+commit;
+unlock tables;
+
+connection con1;
+reap;
+commit;
+select * from t1;
+drop table t1;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-master.opt b/mysql-test/suite/innodb_plugin/t/innodb-master.opt
new file mode 100644
index 00000000000..4901efb416c
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb-master.opt
@@ -0,0 +1 @@
+--binlog_cache_size=32768 --innodb_lock_wait_timeout=1
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-replace.test b/mysql-test/suite/innodb_plugin/t/innodb-replace.test
new file mode 100644
index 00000000000..91019a4db16
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb-replace.test
@@ -0,0 +1,22 @@
+-- source include/have_innodb_plugin.inc
+# embedded server ignores 'delayed', so skip this
+-- source include/not_embedded.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug #1078
+#
+create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
+select * from t1;
+--error ER_DELAYED_NOT_SUPPORTED
+replace delayed into t1 (c1, c2) values ( "text1","11");
+select * from t1;
+--error ER_DELAYED_NOT_SUPPORTED
+replace delayed into t1 (c1, c2) values ( "text1","12");
+select * from t1;
+drop table t1;
+
+# End of 4.1 tests
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-semi-consistent-master.opt b/mysql-test/suite/innodb_plugin/t/innodb-semi-consistent-master.opt
new file mode 100644
index 00000000000..e76299453d3
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb-semi-consistent-master.opt
@@ -0,0 +1 @@
+--innodb_lock_wait_timeout=2
diff --git a/mysql-test/suite/innodb_plugin/t/innodb-semi-consistent.test b/mysql-test/suite/innodb_plugin/t/innodb-semi-consistent.test
new file mode 100644
index 00000000000..00131ffdf54
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb-semi-consistent.test
@@ -0,0 +1,68 @@
+-- source include/not_embedded.inc
+-- source include/have_innodb_plugin.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+# basic tests of semi-consistent reads
+
+connect (a,localhost,root,,);
+connect (b,localhost,root,,);
+connection a;
+set binlog_format=mixed;
+set session transaction isolation level repeatable read;
+create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
+insert into t1 values (1),(2),(3),(4),(5),(6),(7);
+set autocommit=0;
+# this should lock the entire table
+select * from t1 where a=3 lock in share mode;
+connection b;
+set binlog_format=mixed;
+set session transaction isolation level repeatable read;
+set autocommit=0;
+-- error ER_LOCK_WAIT_TIMEOUT
+update t1 set a=10 where a=5;
+connection a;
+commit;
+connection b;
+# perform a semi-consisent read (and unlock non-matching rows)
+set session transaction isolation level read committed;
+update t1 set a=10 where a=5;
+connection a;
+-- error ER_LOCK_WAIT_TIMEOUT
+select * from t1 where a=2 for update;
+# this should lock the records (1),(2)
+select * from t1 where a=2 limit 1 for update;
+connection b;
+# semi-consistent read will skip non-matching locked rows a=1, a=2
+update t1 set a=11 where a=6;
+-- error ER_LOCK_WAIT_TIMEOUT
+update t1 set a=12 where a=2;
+-- error ER_LOCK_WAIT_TIMEOUT
+update t1 set a=13 where a=1;
+connection a;
+commit;
+connection b;
+update t1 set a=14 where a=1;
+commit;
+connection a;
+select * from t1;
+drop table t1;
+
+connection default;
+disconnect a;
+disconnect b;
+
+# Bug 39320
+create table t1 (a int, b int) engine=myisam;
+create table t2 (c int, d int, key (c)) engine=innodb;
+insert into t1 values (1,1);
+insert into t2 values (1,2);
+connect (a,localhost,root,,);
+connection a;
+set session transaction isolation level read committed;
+delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
+connection default;
+disconnect a;
+drop table t1, t2;
diff --git a/storage/innodb_plugin/mysql-test/innodb-timeout.test b/mysql-test/suite/innodb_plugin/t/innodb-timeout.test
index f23fe3cff2d..34eda7279b2 100644
--- a/storage/innodb_plugin/mysql-test/innodb-timeout.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb-timeout.test
@@ -1,4 +1,4 @@
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
let $timeout=`select @@innodb_lock_wait_timeout`;
set global innodb_lock_wait_timeout=42;
diff --git a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc-master.opt b/mysql-test/suite/innodb_plugin/t/innodb-use-sys-malloc-master.opt
index 889834add01..acf3b8729ed 100644
--- a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc-master.opt
+++ b/mysql-test/suite/innodb_plugin/t/innodb-use-sys-malloc-master.opt
@@ -1,2 +1 @@
--innodb-use-sys-malloc=true
---innodb-use-sys-malloc=true
diff --git a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.test b/mysql-test/suite/innodb_plugin/t/innodb-use-sys-malloc.test
index 325dd19d086..bc042587287 100644
--- a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb-use-sys-malloc.test
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
#display current value of innodb_use_sys_malloc
SELECT @@GLOBAL.innodb_use_sys_malloc;
@@ -22,7 +22,7 @@ create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
select * from t1;
drop table t1;
---source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
#display current value of innodb_use_sys_malloc
SELECT @@GLOBAL.innodb_use_sys_malloc;
diff --git a/mysql-test/suite/innodb/t/innodb-zip.test b/mysql-test/suite/innodb_plugin/t/innodb-zip.test
index c27392ac4fa..4980af437e6 100644
--- a/mysql-test/suite/innodb/t/innodb-zip.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb-zip.test
@@ -1,5 +1,4 @@
--- source include/have_innodb.inc
--- source suite/innodb/include/have_innodb_plugin.inc
+-- source include/have_innodb_plugin.inc
let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;
@@ -86,7 +85,8 @@ SELECT table_schema, table_name, row_format
FROM information_schema.tables WHERE engine='innodb';
drop table t1,t2;
-# The following should fail even in non-strict mode.
+# The following should fail in non-strict mode too.
+# (The fix of Bug #50945 only affects REDUNDANT and COMPACT tables.)
SET SESSION innodb_strict_mode = off;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE t1(
diff --git a/storage/innodb_plugin/mysql-test/innodb.test b/mysql-test/suite/innodb_plugin/t/innodb.test
index f46a3a70b56..6cfc0f0cb9a 100644
--- a/storage/innodb_plugin/mysql-test/innodb.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb.test
@@ -13,7 +13,9 @@
# #
#######################################################################
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
+
+let $MYSQLD_DATADIR= `select @@datadir`;
# Save the original values of some variables in order to be able to
# estimate how much they have changed during the tests. Previously this
@@ -425,11 +427,21 @@ INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca
select count(*) from t1 where sca_code = 'PD';
select count(*) from t1 where sca_code <= 'PD';
select count(*) from t1 where sca_pic is null;
+# this should be fixed by MySQL (see Bug #51451)
+# now that http://bugs.mysql.com/49838 is fixed the following ALTER does
+# copy the table instead of failing
+# --error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
+alter table t1 drop index sca_pic;
+alter table t1 add index sca_pic (cat_code, sca_pic);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where cat_code='E';
+# this should be fixed by MySQL (see Bug #51451)
+--error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
+alter table t1 drop index sca_pic;
+alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where sca_pic >= 'n';
select sca_pic from t1 where sca_pic is null;
@@ -1375,7 +1387,10 @@ show variables like "innodb_thread_sleep_delay";
let $default=`select @@storage_engine`;
set storage_engine=INNODB;
+# this should be fixed by MySQL (see Bug #51451)
+set session old_alter_table=1;
source include/varchar.inc;
+set session old_alter_table=0;
#
# Some errors/warnings on create
@@ -1700,7 +1715,7 @@ set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
# Embedded server doesn't chdir to data directory
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLD_DATADIR ./ master-data/ ''
-- error 1025
rename table t3 to t1;
set foreign_key_checks=1;
@@ -2264,7 +2279,7 @@ disconnect j;
drop table t1, t2, t3, t5, t6, t8, t9;
# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
---error 1005
+--error ER_WRONG_COLUMN_NAME
CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
#
@@ -2340,7 +2355,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLD_DATADIR ./ master-data/ ''
--error 1025
ALTER TABLE t2 MODIFY a INT NOT NULL;
DELETE FROM t1;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug21704.test b/mysql-test/suite/innodb_plugin/t/innodb_bug21704.test
index c649b61034c..9adf3239dcd 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug21704.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug21704.test
@@ -1,4 +1,4 @@
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
--echo #
--echo # Bug#21704: Renaming column does not update FK definition.
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug34053.test b/mysql-test/suite/innodb_plugin/t/innodb_bug34053.test
new file mode 100644
index 00000000000..78ec9afa688
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug34053.test
@@ -0,0 +1,50 @@
+#
+# Make sure http://bugs.mysql.com/34053 remains fixed.
+#
+
+-- source include/not_embedded.inc
+-- source include/have_innodb_plugin.inc
+
+SET storage_engine=InnoDB;
+
+# we do not really care about what gets printed, we are only
+# interested in getting success or failure according to our
+# expectations
+-- disable_query_log
+-- disable_result_log
+
+GRANT USAGE ON *.* TO 'shane'@'localhost' IDENTIFIED BY '12345';
+FLUSH PRIVILEGES;
+
+-- connect (con1,localhost,shane,12345,)
+
+-- connection con1
+-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
+CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
+-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
+CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
+CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB;
+DROP TABLE innodb_monitorx;
+CREATE TABLE innodb_monito (a INT) ENGINE=INNODB;
+DROP TABLE innodb_monito;
+CREATE TABLE xinnodb_monitor (a INT) ENGINE=INNODB;
+DROP TABLE xinnodb_monitor;
+CREATE TABLE nnodb_monitor (a INT) ENGINE=INNODB;
+DROP TABLE nnodb_monitor;
+
+-- connection default
+CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
+CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
+
+-- connection con1
+-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
+DROP TABLE innodb_monitor;
+-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
+DROP TABLE innodb_mem_validate;
+
+-- connection default
+DROP TABLE innodb_monitor;
+DROP TABLE innodb_mem_validate;
+DROP USER 'shane'@'localhost';
+
+-- disconnect con1
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug34300.test b/mysql-test/suite/innodb_plugin/t/innodb_bug34300.test
index 68c385fd72a..d91ce205042 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug34300.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug34300.test
@@ -3,7 +3,7 @@
# http://bugs.mysql.com/34300
#
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
-- disable_query_log
-- disable_result_log
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug35220.test b/mysql-test/suite/innodb_plugin/t/innodb_bug35220.test
new file mode 100644
index 00000000000..30175097c68
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug35220.test
@@ -0,0 +1,16 @@
+#
+# Bug#35220 ALTER TABLE too picky on reserved word "foreign"
+# http://bugs.mysql.com/35220
+#
+
+-- source include/have_innodb_plugin.inc
+
+SET storage_engine=InnoDB;
+
+# we care only that the following SQL commands do not produce errors
+-- disable_query_log
+-- disable_result_log
+
+CREATE TABLE bug35220 (foreign_col INT, dummy_cant_delete_all_columns INT);
+ALTER TABLE bug35220 DROP foreign_col;
+DROP TABLE bug35220;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug36169.test b/mysql-test/suite/innodb_plugin/t/innodb_bug36169.test
index 5bf55193b5c..bcd44a7c543 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug36169.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug36169.test
@@ -3,7 +3,7 @@
# http://bugs.mysql.com/36169
#
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
let $file_format=`select @@innodb_file_format`;
let $file_per_table=`select @@innodb_file_per_table`;
@@ -24,6 +24,7 @@ SET GLOBAL innodb_file_per_table=ON;
# Generating 10 tables
# Creating a table with 94 columns and 24 indexes
DROP TABLE IF EXISTS `table0`;
+set innodb_strict_mode=on;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE IF NOT EXISTS `table0`
(`col0` BOOL,
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug36172.test b/mysql-test/suite/innodb_plugin/t/innodb_bug36172.test
index c6c4e6fae47..fbd6d5605df 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug36172.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug36172.test
@@ -3,7 +3,7 @@
#
-- source include/not_embedded.inc
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
SET storage_engine=InnoDB;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug38231.test b/mysql-test/suite/innodb_plugin/t/innodb_bug38231.test
new file mode 100644
index 00000000000..be588474bc1
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug38231.test
@@ -0,0 +1,112 @@
+#
+# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK
+# http://bugs.mysql.com/38231
+#
+
+-- source include/have_innodb_plugin.inc
+
+SET storage_engine=InnoDB;
+
+# we care only that the following SQL commands do not crash the server
+-- disable_query_log
+-- disable_result_log
+
+DROP TABLE IF EXISTS bug38231;
+CREATE TABLE bug38231 (a INT);
+
+-- connect (con1,localhost,root,,)
+-- connect (con2,localhost,root,,)
+-- connect (con3,localhost,root,,)
+
+-- connection con1
+SET autocommit=0;
+LOCK TABLE bug38231 WRITE;
+
+-- connection con2
+SET autocommit=0;
+-- send
+LOCK TABLE bug38231 WRITE;
+
+# When con1 does UNLOCK below this will release either con2 or con3 which are
+# both waiting on LOCK. At the end we must first --reap and UNLOCK the
+# connection that has been released, otherwise it will wait forever. We assume
+# that the released connection will be the first one that has gained the LOCK,
+# thus we force the order here - con2 does LOCK first, then con3. In other
+# words we wait for LOCK from con2 above to be exected before doing LOCK in
+# con3.
+-- connection con1
+let $wait_condition =
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE info = 'LOCK TABLE bug38231 WRITE';
+-- source include/wait_condition.inc
+# the above enables query log, re-disable it
+-- disable_query_log
+
+-- connection con3
+SET autocommit=0;
+-- send
+LOCK TABLE bug38231 WRITE;
+
+-- connection default
+-- send
+TRUNCATE TABLE bug38231;
+
+-- connection con1
+# Wait for TRUNCATE and the other two LOCKs to be executed; without this,
+# sometimes UNLOCK executes before them. We assume there are no other
+# sessions executing at the same time with the same SQL commands.
+let $wait_condition =
+ SELECT COUNT(*) = 1 FROM information_schema.processlist
+ WHERE info = 'TRUNCATE TABLE bug38231';
+-- source include/wait_condition.inc
+let $wait_condition =
+ SELECT COUNT(*) = 2 FROM information_schema.processlist
+ WHERE info = 'LOCK TABLE bug38231 WRITE';
+-- source include/wait_condition.inc
+# the above enables query log, re-disable it
+-- disable_query_log
+
+# this crashes the server if the bug is present
+UNLOCK TABLES;
+
+# clean up
+
+-- connection con2
+-- reap
+UNLOCK TABLES;
+
+-- connection con3
+-- reap
+UNLOCK TABLES;
+
+-- connection default
+-- reap
+
+-- disconnect con1
+-- disconnect con2
+-- disconnect con3
+
+# test that TRUNCATE works with with row-level locks
+
+-- enable_query_log
+-- enable_result_log
+
+INSERT INTO bug38231 VALUES (1), (10), (300);
+
+-- connect (con4,localhost,root,,)
+
+-- connection con4
+SET autocommit=0;
+SELECT * FROM bug38231 FOR UPDATE;
+
+-- connection default
+TRUNCATE TABLE bug38231;
+
+-- connection con4
+COMMIT;
+
+-- connection default
+
+-- disconnect con4
+
+DROP TABLE bug38231;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug39438-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_bug39438-master.opt
new file mode 100644
index 00000000000..43fac202fd4
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug39438-master.opt
@@ -0,0 +1 @@
+--innodb-file-per-table=1
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug39438.test b/mysql-test/suite/innodb_plugin/t/innodb_bug39438.test
new file mode 100644
index 00000000000..879059bac0d
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug39438.test
@@ -0,0 +1,51 @@
+#
+# Bug#39438 Testcase for Bug#39436 crashes on 5.1 in fil_space_get_latch
+# http://bugs.mysql.com/39438
+#
+# This test must be run with innodb_file_per_table=1 because the crash
+# only occurs if that option is turned on and DISCARD TABLESPACE only
+# works with innodb_file_per_table.
+#
+
+-- source include/have_innodb_plugin.inc
+
+SET storage_engine=InnoDB;
+
+# we care only that the following SQL commands do not crash the server
+-- disable_query_log
+-- disable_result_log
+
+DROP TABLE IF EXISTS bug39438;
+
+CREATE TABLE bug39438 (id INT) ENGINE=INNODB;
+
+# remove: XXX Uncomment the following ALTER and remove those lines after
+# remove: applying the patch.
+# remove: Obviously this test is useless without this ALTER command,
+# remove: but it causes warnings to be printed by mysqld and the whole
+# remove: mysql-test suite fails at the end (returns non-zero). Please
+# remove: apply this patch to the mysql source tree, remove those lines
+# remove: and uncomment the following ALTER. We do not care about the
+# remove: warnings, this test is to ensure mysqld does not crash.
+# remove: === modified file 'mysql-test/lib/mtr_report.pl'
+# remove: --- mysql-test/lib/mtr_report.pl 2008-08-12 10:26:23 +0000
+# remove: +++ mysql-test/lib/mtr_report.pl 2008-10-01 11:57:41 +0000
+# remove: @@ -412,7 +412,10 @@
+# remove:
+# remove: # When trying to set lower_case_table_names = 2
+# remove: # on a case sensitive file system. Bug#37402.
+# remove: - /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./
+# remove: + /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or
+# remove: +
+# remove: + # this test is expected to print warnings
+# remove: + ($testname eq 'main.innodb_bug39438')
+# remove: )
+# remove: {
+# remove: next; # Skip these lines
+# remove:
+#ALTER TABLE bug39438 DISCARD TABLESPACE;
+
+# this crashes the server if the bug is present
+SHOW TABLE STATUS;
+
+DROP TABLE bug39438;
diff --git a/mysql-test/suite/innodb/t/innodb_bug40360.test b/mysql-test/suite/innodb_plugin/t/innodb_bug40360.test
index e88837aab4f..dbe61489760 100644
--- a/mysql-test/suite/innodb/t/innodb_bug40360.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug40360.test
@@ -3,7 +3,7 @@
#
-- source include/not_embedded.inc
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
SET TX_ISOLATION='READ-COMMITTED';
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug40565.test b/mysql-test/suite/innodb_plugin/t/innodb_bug40565.test
index d7aa0fd514a..bcc61a1f6d2 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug40565.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug40565.test
@@ -1,5 +1,5 @@
# Bug #40565 Update Query Results in "1 Row Affected" But Should Be "Zero Rows"
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
create table bug40565(value decimal(4,2)) engine=innodb;
insert into bug40565 values (1), (null);
diff --git a/mysql-test/suite/innodb/t/innodb_bug41904.test b/mysql-test/suite/innodb_plugin/t/innodb_bug41904.test
index 365c5229adc..867af04c490 100644
--- a/mysql-test/suite/innodb/t/innodb_bug41904.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug41904.test
@@ -3,7 +3,7 @@
#
-- source include/not_embedded.inc
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
CREATE TABLE bug41904 (id INT PRIMARY KEY, uniquecol CHAR(15)) ENGINE=InnoDB;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero-master.opt b/mysql-test/suite/innodb_plugin/t/innodb_bug42101-nonzero-master.opt
index d71dbe17d5b..d71dbe17d5b 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero-master.opt
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug42101-nonzero-master.opt
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.test b/mysql-test/suite/innodb_plugin/t/innodb_bug42101-nonzero.test
index 685fdf20489..1216bf415b8 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug42101-nonzero.test
@@ -3,7 +3,7 @@
# http://bugs.mysql.com/42101
#
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
--error ER_WRONG_ARGUMENTS
set global innodb_commit_concurrency=0;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug42101.test b/mysql-test/suite/innodb_plugin/t/innodb_bug42101.test
index b6536490d48..3bbc1928299 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug42101.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug42101.test
@@ -3,7 +3,7 @@
# http://bugs.mysql.com/42101
#
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44032.test b/mysql-test/suite/innodb_plugin/t/innodb_bug44032.test
index a963cb8b68f..1c0ec2f9d95 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug44032.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug44032.test
@@ -2,7 +2,7 @@
# (btr_cur_update_in_place not invoked when updating from/to NULL;
# the update is performed by delete and insert instead)
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
CREATE TABLE bug44032(c CHAR(3) CHARACTER SET UTF8) ROW_FORMAT=REDUNDANT
ENGINE=InnoDB;
diff --git a/mysql-test/t/innodb_bug44369.test b/mysql-test/suite/innodb_plugin/t/innodb_bug44369.test
index f5d85cd5815..d01694c3797 100644
--- a/mysql-test/t/innodb_bug44369.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug44369.test
@@ -3,7 +3,7 @@
# some innodb internal reserved key words,
# both case sensitively and insensitely.
---source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
# This create table operation should fail.
--error ER_WRONG_COLUMN_NAME
diff --git a/mysql-test/suite/innodb/t/innodb_bug44571.test b/mysql-test/suite/innodb_plugin/t/innodb_bug44571.test
index 58f02dfb5d2..3f02a2206a9 100644
--- a/mysql-test/suite/innodb/t/innodb_bug44571.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug44571.test
@@ -4,8 +4,7 @@
# Please also refer to related fix in
# http://bugs.mysql.com/47621
#
--- source include/have_innodb.inc
--- source suite/innodb/include/have_innodb_plugin.inc
+-- source include/have_innodb_plugin.inc
CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
ALTER TABLE bug44571 CHANGE foo bar INT;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug45357.test b/mysql-test/suite/innodb_plugin/t/innodb_bug45357.test
index 81727f352dd..b5e177c2918 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug45357.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug45357.test
@@ -1,4 +1,4 @@
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
set session transaction isolation level read committed;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug46000.test b/mysql-test/suite/innodb_plugin/t/innodb_bug46000.test
index 80c18c58ef0..acc027c20e7 100644
--- a/storage/innodb_plugin/mysql-test/innodb_bug46000.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug46000.test
@@ -3,28 +3,26 @@
# "GEN_CLUST_INDEX", which is the reserved
# name for innodb default primary index.
---source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
# This 'create table' operation should fail because of
# using the reserve name as its index name.
---error ER_CANT_CREATE_TABLE
+--error ER_WRONG_NAME_FOR_INDEX
create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
# Mixed upper/lower case of the reserved key words
---error ER_CANT_CREATE_TABLE
+--error ER_WRONG_NAME_FOR_INDEX
create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
-show errors;
+show warnings;
create table bug46000(id int) engine=innodb;
# This 'create index' operation should fail.
---replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
+--error ER_WRONG_NAME_FOR_INDEX
create index GEN_CLUST_INDEX on bug46000(id);
---replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/
-show errors;
+show warnings;
# This 'create index' operation should succeed, no
# temp table left from last failed create index
diff --git a/mysql-test/suite/innodb/t/innodb_bug46676.test b/mysql-test/suite/innodb_plugin/t/innodb_bug46676.test
index 440666c4226..7e3ecfe715a 100644
--- a/mysql-test/suite/innodb/t/innodb_bug46676.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug46676.test
@@ -2,7 +2,7 @@
# It is reproducible with InnoDB plugin 1.0.4 + MySQL 5.1.37.
# But no longer reproducible after MySQL 5.1.38 (with plugin 1.0.5).
---source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
SET foreign_key_checks=0;
CREATE TABLE t1 (id int, foreign key (id) references t2(id)) ENGINE=INNODB;
diff --git a/mysql-test/suite/innodb/t/innodb_bug47167.test b/mysql-test/suite/innodb_plugin/t/innodb_bug47167.test
index df056b91ff9..e8499bb14dd 100644
--- a/mysql-test/suite/innodb/t/innodb_bug47167.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug47167.test
@@ -3,8 +3,7 @@
# "innodb_file_format_check" with a
# user-Defined Variable.
---source include/have_innodb.inc
--- source suite/innodb/include/have_innodb_plugin.inc
+-- source include/have_innodb_plugin.inc
# Save the value (Antelope) in 'innodb_file_format_check' to
# 'old_innodb_file_format_check'
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug47621.test b/mysql-test/suite/innodb_plugin/t/innodb_bug47621.test
new file mode 100644
index 00000000000..0305484c351
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug47621.test
@@ -0,0 +1,57 @@
+# This is the test for bug #47621, column rename operation should
+# not result in column definition inconsistency between MySQL and
+# InnoDB
+
+-- source include/have_innodb_plugin.inc
+
+CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB;
+
+# Change the column name
+ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT;
+
+# If there is inconsistency of column name definition
+# in MySQL or InnoDB, following create index would fail
+create index orgs on bug47621(sales_acct_id);
+
+# Change the column name back with the index defined on it.
+ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT;
+
+drop table bug47621;
+
+CREATE TABLE bug47621_sale (
+ salesperson INT,
+ PRIMARY KEY(salesperson)) engine = innodb;
+
+CREATE TABLE bug47621_shirt(
+ id SMALLINT,
+ owner INT,
+ FOREIGN KEY(owner)
+ references bug47621_sale(salesperson) ON DELETE RESTRICT)
+ engine = innodb;
+
+insert into bug47621_sale values(9);
+
+insert into bug47621_shirt values(1, 9);
+
+# Any rename operation on columns involved in a reference constraint will
+# fail, as it will be rejected by InnoDB row_rename_table_for_mysql().
+# In above example, any rename on column "salesperson" for table
+# "bug47621_sale", or on column "owner" for table "bug47621_shirt will
+# be blocked. We do not put such rename in the test since InnoDB error
+# message will be printed in the error log, and result in test failure.
+#
+# ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
+
+# Any rename on columns not involved in the foreign key constraint
+# could still proceed
+ALTER TABLE bug47621_shirt CHANGE id new_id INT;
+
+# Referencing table dropped, the rename operation on related columns
+# could proceed
+drop table bug47621_shirt;
+
+ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
+
+ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id);
+
+drop table bug47621_sale;
diff --git a/mysql-test/suite/innodb/t/innodb_bug47622.test b/mysql-test/suite/innodb_plugin/t/innodb_bug47622.test
index 9cf9d0e531b..ec544bd7962 100644
--- a/mysql-test/suite/innodb/t/innodb_bug47622.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug47622.test
@@ -4,7 +4,7 @@
# We resolve the problem by sync the index sequence
# up when opening the table.
---source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
connect (a,localhost,root,,);
connect (b,localhost,root,,);
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug47777.test b/mysql-test/suite/innodb_plugin/t/innodb_bug47777.test
new file mode 100644
index 00000000000..4ea9841bf28
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug47777.test
@@ -0,0 +1,24 @@
+# This is the test for bug 47777. GEOMETRY
+# data is treated as BLOB data in innodb.
+# Consequently, its key value generation/storing
+# should follow the process for the BLOB
+# datatype as well.
+
+-- source include/have_innodb_plugin.inc
+
+create table bug47777(c2 linestring not null, primary key (c2(1))) engine=innodb;
+
+insert into bug47777 values (geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)'));
+
+# Verify correct row get inserted.
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+
+# Update table bug47777 should be successful.
+update bug47777 set c2=GeomFromText('POINT(1 1)');
+
+# Verify the row get updated successfully. The original
+# c2 value should be changed to GeomFromText('POINT(1 1)').
+select count(*) from bug47777 where c2 =geomfromtext('linestring(1 2,3 4,5 6,7 8,9 10)');
+select count(*) from bug47777 where c2 = GeomFromText('POINT(1 1)');
+
+drop table bug47777;
diff --git a/mysql-test/suite/innodb/t/innodb_bug51378.test b/mysql-test/suite/innodb_plugin/t/innodb_bug51378.test
index 8f7b0b9605a..2d0d84807bb 100644
--- a/mysql-test/suite/innodb/t/innodb_bug51378.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug51378.test
@@ -9,7 +9,7 @@
# will be created as primary index
# Following queries test various scenario, no mismatch
# error message should be printed.
---source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
# Create a table contains a BLOB column
create table bug51378 (
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug51920.test b/mysql-test/suite/innodb_plugin/t/innodb_bug51920.test
new file mode 100644
index 00000000000..7f34bad1aed
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug51920.test
@@ -0,0 +1,43 @@
+#
+# Bug #51920: InnoDB connections in lock wait ignore KILL until timeout
+#
+-- source include/not_embedded.inc
+-- source include/have_innodb_plugin.inc
+
+CREATE TABLE bug51920 (i INT) ENGINE=InnoDB;
+INSERT INTO bug51920 VALUES (1);
+
+BEGIN;
+SELECT * FROM bug51920 FOR UPDATE;
+
+connect (con1,localhost,root,,);
+
+connection con1;
+--send
+UPDATE bug51920 SET i=2;
+
+connection default;
+let $wait_condition =
+ SELECT COUNT(*)=1 FROM information_schema.processlist
+ WHERE INFO="UPDATE bug51920 SET i=2";
+-- source include/wait_condition.inc
+
+SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE INFO="UPDATE bug51920 SET i=2"
+INTO @thread_id;
+
+KILL @thread_id;
+let $wait_condition =
+ SELECT COUNT(*)=0 FROM information_schema.processlist WHERE ID=@thread_id;
+-- source include/wait_condition.inc
+
+#
+# Bug#19723: kill of active connection yields different error code
+# depending on platform.
+#
+connection con1;
+-- error 1317, 2006, 2013
+reap;
+connection default;
+DROP TABLE bug51920;
+-- disconnect con1
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug52663.test b/mysql-test/suite/innodb_plugin/t/innodb_bug52663.test
new file mode 100644
index 00000000000..927044fb2ca
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug52663.test
@@ -0,0 +1,34 @@
+--source include/have_innodb_plugin.inc
+
+set session transaction isolation level read committed;
+
+create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
+(what, id)) engine=innodb;
+insert into innodb_bug52663 values ('total', 0, 0);
+begin;
+
+connect (addconroot, localhost, root,,);
+connection addconroot;
+set session transaction isolation level read committed;
+begin;
+
+connection default;
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+select * from innodb_bug52663;
+
+connection addconroot;
+--error ER_LOCK_WAIT_TIMEOUT
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+select * from innodb_bug52663;
+
+connection default;
+commit;
+
+connection addconroot;
+update innodb_bug52663 set count = count + 1 where what = 'total' and id = 0;
+commit;
+select * from innodb_bug52663;
+
+connection default;
+select * from innodb_bug52663;
+drop table innodb_bug52663;
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test b/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test
new file mode 100644
index 00000000000..b20a993a2d1
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug52745.test
@@ -0,0 +1,109 @@
+-- source include/have_innodb_plugin.inc
+
+let $file_format=`select @@innodb_file_format`;
+let $file_format_check=`select @@innodb_file_format_check`;
+let $file_per_table=`select @@innodb_file_per_table`;
+SET GLOBAL innodb_file_format='Barracuda';
+SET GLOBAL innodb_file_per_table=on;
+
+CREATE TABLE bug52745 (
+ a2 int(10) unsigned DEFAULT NULL,
+ col37 time DEFAULT NULL,
+ col38 char(229) CHARACTER SET utf8 DEFAULT NULL,
+ col39 text,
+ col40 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ col41 int(10) unsigned DEFAULT NULL,
+ col42 varchar(248) CHARACTER SET utf8 DEFAULT NULL,
+ col43 smallint(5) unsigned zerofill DEFAULT NULL,
+ col44 varchar(150) CHARACTER SET utf8 DEFAULT NULL,
+ col45 float unsigned zerofill DEFAULT NULL,
+ col46 binary(1) DEFAULT NULL,
+ col47 tinyint(4) DEFAULT NULL,
+ col48 tinyint(1) DEFAULT NULL,
+ col49 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ col50 binary(1) DEFAULT NULL,
+ col51 double unsigned zerofill DEFAULT NULL,
+ col52 int(10) unsigned DEFAULT NULL,
+ col53 time DEFAULT NULL,
+ col54 double unsigned DEFAULT NULL,
+ col55 time DEFAULT NULL,
+ col56 mediumtext CHARACTER SET latin2,
+ col57 blob,
+ col58 decimal(52,16) unsigned zerofill NOT NULL DEFAULT '000000000000000000000000000000000000.0000000000000000',
+ col59 binary(1) DEFAULT NULL,
+ col60 longblob,
+ col61 time DEFAULT NULL,
+ col62 longtext CHARACTER SET utf8 COLLATE utf8_persian_ci,
+ col63 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ col64 int(10) unsigned DEFAULT NULL,
+ col65 date DEFAULT NULL,
+ col66 timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ col67 binary(1) DEFAULT NULL,
+ col68 tinyblob,
+ col69 date DEFAULT NULL,
+ col70 tinyint(3) unsigned zerofill DEFAULT NULL,
+ col71 varchar(44) CHARACTER SET utf8 DEFAULT NULL,
+ col72 datetime DEFAULT NULL,
+ col73 smallint(5) unsigned zerofill DEFAULT NULL,
+ col74 longblob,
+ col75 bit(34) DEFAULT NULL,
+ col76 float unsigned zerofill DEFAULT NULL,
+ col77 year(2) DEFAULT NULL,
+ col78 tinyint(3) unsigned DEFAULT NULL,
+ col79 set('msfheowh','tbpxbgf','by','wahnrjw','myqfasxz','rsokyumrt') CHARACTER SET latin2 DEFAULT NULL,
+ col80 datetime DEFAULT NULL,
+ col81 smallint(6) DEFAULT NULL,
+ col82 enum('xtaurnqfqz','rifrse','kuzwpbvb','niisabk','zxavro','rbvasv','','uulrfaove','','') DEFAULT NULL,
+ col83 bigint(20) unsigned zerofill DEFAULT NULL,
+ col84 float unsigned zerofill DEFAULT NULL,
+ col85 double DEFAULT NULL,
+ col86 enum('ylannv','','vlkhycqc','snke','cxifustp','xiaxaswzp','oxl') CHARACTER SET latin1 COLLATE latin1_german2_ci DEFAULT NULL,
+ col87 varbinary(221) DEFAULT NULL,
+ col88 double unsigned DEFAULT NULL,
+ col89 float unsigned zerofill DEFAULT NULL,
+ col90 tinyblob
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+
+INSERT INTO bug52745 SET
+col40='0000-00-00 00:00:00',
+col51=16547,
+col53='7711484',
+col54=-28604,
+col55='7112612',
+col56='wakefulness\'',
+col57=repeat('absorbefacient\'',106),
+col58=11027,
+col59='AM09gW7',
+col60=repeat('Noelani\'',16),
+col61='2520576',
+col62='substitutiv',
+col63='19950106155112',
+col64=-12038,
+col65='86238806',
+col66='19600719080256',
+col68=repeat('Sagittarius\'',54),
+col69='38943902',
+col70=1232,
+col71='Elora\'',
+col74=repeat('zipp',11),
+col75='0',
+col76=23254,
+col78=13247,
+col79='56219',
+col80='20500609035724',
+col81=11632,
+col82=7,
+col84=-23863,
+col85=6341,
+col87='HZdkf.4 s7t,5Rmq 8so fmr,ruGLUG25TrtI.yQ 2SuHq0ML7rw7.4 b2yf2E5TJxOtBBZImezDnzpj,uPYfznnEUDN1e9aQoO 2DsplB7TFWy oQJ br HLF :F,eQ p4i1oWsr lL3PG,hjCz6hYqN h1QTjLCjrv:QCdSzpYBibJAtZCxLOk3l6Blsh.W',
+col88=16894,
+col89=6161,
+col90=repeat('gale',48);
+
+SHOW WARNINGS;
+
+DROP TABLE bug52745;
+
+EVAL SET GLOBAL innodb_file_format=$file_format;
+EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
+EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
diff --git a/storage/innodb_plugin/mysql-test/innodb_file_format.test b/mysql-test/suite/innodb_plugin/t/innodb_file_format.test
index d63c9b0228f..484a176c58b 100644
--- a/storage/innodb_plugin/mysql-test/innodb_file_format.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_file_format.test
@@ -1,4 +1,4 @@
--- source include/have_innodb.inc
+-- source include/have_innodb_plugin.inc
select @@innodb_file_format;
select @@innodb_file_format_check;
diff --git a/mysql-test/suite/innodb/t/innodb_information_schema.test b/mysql-test/suite/innodb_plugin/t/innodb_information_schema.test
index 599215e9ca4..25255e0b2a9 100644
--- a/mysql-test/suite/innodb/t/innodb_information_schema.test
+++ b/mysql-test/suite/innodb_plugin/t/innodb_information_schema.test
@@ -3,8 +3,7 @@
# INFORMATION_SCHEMA.innodb_locks.lock_data
#
--- source include/have_innodb.inc
--- source suite/innodb/include/have_innodb_plugin.inc
+-- source include/have_innodb_plugin.inc
-- disable_query_log
-- disable_result_log
diff --git a/mysql-test/suite/innodb_plugin/t/innodb_trx_weight.test b/mysql-test/suite/innodb_plugin/t/innodb_trx_weight.test
new file mode 100644
index 00000000000..3d08959b2ea
--- /dev/null
+++ b/mysql-test/suite/innodb_plugin/t/innodb_trx_weight.test
@@ -0,0 +1,108 @@
+#
+# Ensure that the number of locks (SELECT FOR UPDATE for example) is
+# added to the number of altered rows when choosing the smallest
+# transaction to kill as a victim when a deadlock is detected.
+# Also transactions what had edited non-transactional tables should
+# be heavier than ones that had not.
+#
+
+-- source include/have_innodb_plugin.inc
+
+SET storage_engine=InnoDB;
+
+# we do not really care about what gets printed, we are only
+# interested in getting the deadlock resolved according to our
+# expectations
+-- disable_query_log
+-- disable_result_log
+
+# we want to use "-- eval statement1; statement2" which does not work with
+# prepared statements. Because this test should not behave differently with
+# or without prepared statements we disable them so the test does not fail
+# if someone runs ./mysql-test-run.pl --ps-protocol
+-- disable_ps_protocol
+
+-- disable_warnings
+DROP TABLE IF EXISTS t1, t2, t3, t4, t5_nontrans;
+-- enable_warnings
+
+# we will create a simple deadlock with t1, t2 and two connections
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+
+# auxiliary table with a bulk of rows which will be locked by a
+# transaction to increase its weight
+CREATE TABLE t3 (a INT);
+
+# auxiliary empty table which will be inserted by a
+# transaction to increase its weight
+CREATE TABLE t4 (a INT);
+
+# auxiliary non-transactional table which will be edited by a
+# transaction to tremendously increase its weight
+CREATE TABLE t5_nontrans (a INT) ENGINE=MyISAM;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+# insert a lot of rows in t3
+INSERT INTO t3 VALUES (1);
+INSERT INTO t3 SELECT * FROM t3;
+INSERT INTO t3 SELECT * FROM t3;
+INSERT INTO t3 SELECT * FROM t3;
+INSERT INTO t3 SELECT * FROM t3;
+INSERT INTO t3 SELECT * FROM t3;
+INSERT INTO t3 SELECT * FROM t3;
+INSERT INTO t3 SELECT * FROM t3;
+INSERT INTO t3 SELECT * FROM t3;
+INSERT INTO t3 SELECT * FROM t3;
+INSERT INTO t3 SELECT * FROM t3;
+INSERT INTO t3 SELECT * FROM t3;
+
+# test locking weight
+
+-- let $con1_extra_sql =
+-- let $con1_extra_sql_present = 0
+-- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
+-- let $con2_extra_sql_present = 1
+-- let $con1_should_be_rolledback = 1
+-- source suite/innodb_plugin/include/innodb_trx_weight.inc
+
+-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1)
+-- let $con1_extra_sql_present = 1
+-- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
+-- let $con2_extra_sql_present = 1
+-- let $con1_should_be_rolledback = 1
+-- source suite/innodb_plugin/include/innodb_trx_weight.inc
+
+-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1), (1), (1), (1)
+-- let $con1_extra_sql_present = 1
+-- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE
+-- let $con2_extra_sql_present = 1
+-- let $con1_should_be_rolledback = 0
+-- source suite/innodb_plugin/include/innodb_trx_weight.inc
+
+# test weight when non-transactional tables are edited
+
+-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
+-- let $con1_extra_sql_present = 1
+-- let $con2_extra_sql =
+-- let $con2_extra_sql_present = 0
+-- let $con1_should_be_rolledback = 0
+-- source suite/innodb_plugin/include/innodb_trx_weight.inc
+
+-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
+-- let $con1_extra_sql_present = 1
+-- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1)
+-- let $con2_extra_sql_present = 1
+-- let $con1_should_be_rolledback = 1
+-- source suite/innodb_plugin/include/innodb_trx_weight.inc
+
+-- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1)
+-- let $con1_extra_sql = $con1_extra_sql; INSERT INTO t5_nontrans VALUES (1)
+-- let $con1_extra_sql_present = 1
+-- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1)
+-- let $con2_extra_sql_present = 1
+-- let $con1_should_be_rolledback = 0
+-- source suite/innodb_plugin/include/innodb_trx_weight.inc
+
+DROP TABLE t1, t2, t3, t4, t5_nontrans;
diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result
index d26a81cb396..cb339f0a212 100644
--- a/mysql-test/suite/rpl/r/rpl_do_grant.result
+++ b/mysql-test/suite/rpl/r/rpl_do_grant.result
@@ -241,4 +241,18 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
DROP TABLE t1;
DROP PROCEDURE p1;
DROP USER 'user49119'@'localhost';
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+grant all on *.* to foo@"1.2.3.4";
+revoke all privileges, grant option from "foo";
+ERROR HY000: Can't revoke all privileges for one or more of the requested users
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; grant all on *.* to foo@"1.2.3.4"
+master-bin.000001 # Query # # use `test`; revoke all privileges, grant option from "foo"
+DROP USER foo@"1.2.3.4";
"End of test"
diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test
index 8403e108b19..29e1eb5e1c6 100644
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test
@@ -322,4 +322,33 @@ DROP USER 'user49119'@'localhost';
-- sync_slave_with_master
+#
+# Bug #51987 revoke privileges logs wrong error code
+#
+
+-- connection master
+-- source include/master-slave-reset.inc
+-- connection master
+
+grant all on *.* to foo@"1.2.3.4";
+-- error ER_REVOKE_GRANTS
+revoke all privileges, grant option from "foo";
+
+## assertion: revoke is logged
+-- source include/show_binlog_events.inc
+
+-- sync_slave_with_master
+
+## assertion: slave replicates revoke and does not fail because master
+## logged revoke with correct expected error code
+-- let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1)
+ if ($err)
+{
+ -- die UNEXPECTED ERROR AT SLAVE: $err
+}
+
+-- connection master
+DROP USER foo@"1.2.3.4";
+-- sync_slave_with_master
+
--echo "End of test"
diff --git a/mysql-test/suite/sys_vars/r/secure_file_priv.result b/mysql-test/suite/sys_vars/r/secure_file_priv.result
new file mode 100644
index 00000000000..eeeb9a58c0f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/secure_file_priv.result
@@ -0,0 +1,22 @@
+#
+# Bug50373 --secure-file-priv=""
+#
+CREATE TABLE t1 (c1 VARCHAR(50));
+INSERT INTO t1 VALUES ("one"),("two"),("three"),("four"),("five");
+SHOW VARIABLES LIKE 'secure_file_priv';
+Variable_name Value
+secure_file_priv
+c1
+one
+two
+three
+four
+five
+loaded_file
+one
+two
+three
+four
+five
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv-master.opt b/mysql-test/suite/sys_vars/t/secure_file_priv-master.opt
new file mode 100644
index 00000000000..b41d9b04b96
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_file_priv-master.opt
@@ -0,0 +1 @@
+--secure_file_priv=''
diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv.test b/mysql-test/suite/sys_vars/t/secure_file_priv.test
new file mode 100644
index 00000000000..7a534e7d6e4
--- /dev/null
+++ b/mysql-test/suite/sys_vars/t/secure_file_priv.test
@@ -0,0 +1,21 @@
+--echo #
+--echo # Bug50373 --secure-file-priv=""
+--echo #
+CREATE TABLE t1 (c1 VARCHAR(50));
+INSERT INTO t1 VALUES ("one"),("two"),("three"),("four"),("five");
+SHOW VARIABLES LIKE 'secure_file_priv';
+--disable_query_log
+# Atempt to create a file where we normally aren't allowed to create one.
+# Doing this in a portable manner is difficult but we should be able to
+# count on the depth of the directory hierarchy used. Three steps up from
+# the datadir is the 'mysql_test' directory.
+--let $PROTECTED_FILE=`SELECT concat(@@datadir,'/../../../bug50373.txt')`;
+--eval SELECT * FROM t1 INTO OUTFILE '$PROTECTED_FILE';
+DELETE FROM t1;
+--eval LOAD DATA INFILE '$PROTECTED_FILE' INTO TABLE t1;
+SELECT * FROM t1;
+--eval SELECT load_file('$PROTECTED_FILE') AS loaded_file;
+--enable_query_log
+remove_file $PROTECTED_FILE;
+DROP TABLE t1;
+
diff --git a/mysql-test/t/bug46261-master.opt b/mysql-test/t/bug46261-master.opt
new file mode 100644
index 00000000000..6be4269e809
--- /dev/null
+++ b/mysql-test/t/bug46261-master.opt
@@ -0,0 +1 @@
+--skip-grant-tables $EXAMPLE_PLUGIN_OPT
diff --git a/mysql-test/t/bug46261.test b/mysql-test/t/bug46261.test
new file mode 100644
index 00000000000..67bdc995850
--- /dev/null
+++ b/mysql-test/t/bug46261.test
@@ -0,0 +1,16 @@
+--source include/not_embedded.inc
+--source include/have_example_plugin.inc
+
+--echo #
+--echo # Bug#46261 Plugins can be installed with --skip-grant-tables
+--echo #
+
+--replace_regex /\.dll/.so/
+--error ER_OPTION_PREVENTS_STATEMENT
+eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO;
+
+--replace_regex /\.dll/.so/
+--error ER_OPTION_PREVENTS_STATEMENT
+eval UNINSTALL PLUGIN example;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 6f1a3cafecd..583334b0c04 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -732,6 +732,15 @@ SELECT HEX(MONTHNAME(19700101));
SELECT HEX(DAYNAME(19700101));
SET character_set_connection=latin1;
+--echo #
+--echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
+--echo #
+CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1);
+CREATE VIEW v1 AS SELECT 1 from t1
+WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 07462e91696..c1a22adf091 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -11,3 +11,5 @@
##############################################################################
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
+# partition_innodb_plugin : Bug#53307 2010-04-30 VasilDimov valgrind warnings
+# ps_3innodb : Bug#53309 2010-04-30 VasilDimov valgrind warnings
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
index f730c95208e..7cd16a6bc5a 100644
--- a/mysql-test/t/error_simulation.test
+++ b/mysql-test/t/error_simulation.test
@@ -33,3 +33,19 @@ set tmp_table_size=default;
DROP TABLE t1;
+--echo #
+--echo # Bug #50946: fast index creation still seems to copy the table
+--echo #
+CREATE TABLE t1 (a INT(100) NOT NULL);
+INSERT INTO t1 VALUES (1), (0), (2);
+SET SESSION debug='+d,alter_table_only_index_change';
+ALTER TABLE t1 ADD INDEX a(a);
+SET SESSION debug=DEFAULT;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 5.1 tests
+--echo #
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index 3c2f7bbbe96..ba6be72dbdc 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -198,4 +198,19 @@ INSERT INTO t2 VALUES (NULL), (0);
EXPLAIN EXTENDED SELECT (SELECT 1 FROM t2 WHERE d = c) FROM t1;
DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug #48419: another explain crash..
+--echo #
+
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b BLOB, KEY b(b(100)));
+INSERT INTO t2 VALUES ('1'), ('2'), ('3');
+
+FLUSH TABLES;
+
+EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND t.a);
+
+DROP TABLE t1, t2;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/innodb-use-sys-malloc.test b/mysql-test/t/innodb-use-sys-malloc.test
deleted file mode 100644
index 07ccf261713..00000000000
--- a/mysql-test/t/innodb-use-sys-malloc.test
+++ /dev/null
@@ -1,51 +0,0 @@
---source include/have_innodb.inc
-# XtraDB has lots of "still reachable" memory leak warnings at shutdown when
-# --innodb-use-sys-malloc
---source include/not_valgrind.inc
-
-#display current value of innodb_use_sys_malloc
-SELECT @@GLOBAL.innodb_use_sys_malloc;
---echo 1 Expected
-
-#try changing it. Should fail.
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@GLOBAL.innodb_use_sys_malloc=0;
---echo Expected error 'Read only variable'
-
-SELECT @@GLOBAL.innodb_use_sys_malloc;
---echo 1 Expected
-
-
-#do some stuff to see if it works.
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-select * from t1;
-drop table t1;
---source include/have_innodb.inc
-
-#display current value of innodb_use_sys_malloc
-SELECT @@GLOBAL.innodb_use_sys_malloc;
---echo 1 Expected
-
-#try changing it. Should fail.
---error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@GLOBAL.innodb_use_sys_malloc=0;
---echo Expected error 'Read only variable'
-
-SELECT @@GLOBAL.innodb_use_sys_malloc;
---echo 1 Expected
-
-
-#do some stuff to see if it works.
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-select * from t1;
-drop table t1;
diff --git a/mysql-test/t/innodb_bug44032.test b/mysql-test/t/innodb_bug44032.test
deleted file mode 100644
index a963cb8b68f..00000000000
--- a/mysql-test/t/innodb_bug44032.test
+++ /dev/null
@@ -1,13 +0,0 @@
-# Bug44032 no update-in-place of UTF-8 columns in ROW_FORMAT=REDUNDANT
-# (btr_cur_update_in_place not invoked when updating from/to NULL;
-# the update is performed by delete and insert instead)
-
--- source include/have_innodb.inc
-
-CREATE TABLE bug44032(c CHAR(3) CHARACTER SET UTF8) ROW_FORMAT=REDUNDANT
-ENGINE=InnoDB;
-INSERT INTO bug44032 VALUES('abc'),(0xEFBCA4EFBCA4EFBCA4);
-UPDATE bug44032 SET c='DDD' WHERE c=0xEFBCA4EFBCA4EFBCA4;
-UPDATE bug44032 SET c=NULL WHERE c='DDD';
-UPDATE bug44032 SET c='DDD' WHERE c IS NULL;
-DROP TABLE bug44032;
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index dae708b9e18..ada4323dcee 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -605,4 +605,32 @@ explain select t1.id,t2.id from t2 left join t1 on t1.id>=74 and t1.id<=0
drop table t1,t2;
+--echo #
+--echo # Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
+--echo # JOINed during an UPDATE
+--echo #
+
+CREATE TABLE t1 (d INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, b INT,
+ c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
+
+--echo set up our data elements
+INSERT INTO t1 (d) VALUES (1);
+INSERT INTO t2 (a,b) VALUES (1,1);
+SELECT SECOND(c) INTO @bug47453 FROM t2;
+
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+
+SELECT SLEEP(1);
+
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+
+--echo #should be 0
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+
+DROP TABLE t1, t2;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 09464c4d926..43b373c9703 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -807,6 +807,17 @@ WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 1111.11) AND
ROW(t1.b, 1111.11) <=> ROW('','');
DROP TABLE t1;
+--echo #
+--echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
+--echo #
+
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
+INSERT INTO t1 VALUES (0,0), (1,1);
+
+SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests.
@@ -840,15 +851,4 @@ ENGINE=MERGE UNION=(t1,t2);
SELECT t1.a FROM mm1,t1;
DROP TABLE t1, t2, mm1;
---echo #
---echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
---echo #
-
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
-INSERT INTO t1 VALUES (0,0), (1,1);
-
-SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
-
-DROP TABLE t1;
-
--echo End of 5.1 tests
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index e5f0a1d7eba..126bd5c8838 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -153,10 +153,16 @@ select * from t1;
#
# It should not be possible to load from a file outside of vardir
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show variables like "secure_file_pri%";
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-select @@secure_file_priv;
+## The following lines were disabled because of patch for
+## bug 50373. MYSQLTEST_VARDIR doesn't rewrite symlinks
+## to real paths, but this is done for secure_file_priv.
+## Because of this the result can't be replaced if the
+## test suite runs with the --mem option which creates
+## symlinks to the ramdisk.
+#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+#show variables like "secure_file_pri%";
+#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+#select @@secure_file_priv;
--error 1238
set @@secure_file_priv= 0;
diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test
index fed8c96424a..04c72127394 100644
--- a/mysql-test/t/partition_innodb_plugin.test
+++ b/mysql-test/t/partition_innodb_plugin.test
@@ -1,6 +1,5 @@
--source include/have_partition.inc
--source include/have_innodb.inc
---source suite/innodb/include/have_innodb_plugin.inc
#
# Bug#32430 - show engine innodb status causes errors
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index d5f7eda5032..4390b70e9e9 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3065,4 +3065,18 @@ select @plaintext;
deallocate prepare encode;
deallocate prepare decode;
+--echo #
+--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+--echo #
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (0, 0),(0, 0);
+PREPARE stmt FROM "SELECT 1 FROM t1 WHERE
+ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))";
+--disable_warnings
+EXECUTE stmt;
+EXECUTE stmt;
+--enable_warnings
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index fcc4259168b..cec44078279 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -255,3 +255,14 @@ select * from t1,t2 where (a,b) = (c,d);
select host,user from mysql.user where (host,user) = ('localhost','test');
drop table t1,t2;
+
+--echo #
+--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+--echo #
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (0, 0),(0, 0);
+--disable_warnings
+SELECT 1 FROM t1 WHERE ROW(a, b) >=
+ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
+--enable_warnings
+DROP TABLE t1;
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index c1ff9b58e14..a968e146d20 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -2377,4 +2377,35 @@ UPDATE t1 SET id=NULL;
DROP TRIGGER t1_bu;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug#50755: Crash if stored routine def contains version comments
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+DROP TRIGGER IF EXISTS trg1;
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE DATABASE db1;
+USE db1;
+
+CREATE TABLE t1 (b INT);
+CREATE TABLE t2 (a INT);
+
+CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1);
+--echo # Used to crash
+SHOW TRIGGERS IN db1;
+--error ER_PARSE_ERROR
+INSERT INTO t2 VALUES (1);
+SELECT * FROM t1;
+
+--echo # Work around Bug#45235
+let $MYSQLD_DATADIR = `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/db1/t2.TRG
+--remove_file $MYSQLD_DATADIR/db1/trg1.TRN
+
+DROP DATABASE db1;
+USE test;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/variables_debug.test b/mysql-test/t/variables_debug.test
index 7dcaf246803..8f2bde7ae42 100644
--- a/mysql-test/t/variables_debug.test
+++ b/mysql-test/t/variables_debug.test
@@ -10,3 +10,16 @@ set debug= '+P';
select @@debug;
set debug= '-P';
select @@debug;
+
+--echo #
+--echo # Bug #52629: memory leak from sys_var_thd_dbug in
+--echo # binlog.binlog_write_error
+--echo #
+
+SET GLOBAL debug='d,injecting_fault_writing';
+SELECT @@global.debug;
+SET GLOBAL debug='';
+SELECT @@global.debug;
+
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 45e09a79da0..4fb397fe142 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3916,6 +3916,15 @@ ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' )));
DROP VIEW v1;
DROP TABLE t1;
+--echo #
+--echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
+--echo #
+CREATE TABLE t1 (a CHAR(1) CHARSET latin1, b CHAR(1) CHARSET utf8);
+CREATE VIEW v1 AS SELECT 1 from t1
+WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.1 tests.
--echo # -----------------------------------------------------------------
diff --git a/mysys/mf_loadpath.c b/mysys/mf_loadpath.c
index 48a69207839..510c72ffa38 100644
--- a/mysys/mf_loadpath.c
+++ b/mysys/mf_loadpath.c
@@ -26,7 +26,8 @@
char * my_load_path(char * to, const char *path,
const char *own_path_prefix)
{
- char buff[FN_REFLEN];
+ char buff[FN_REFLEN+1];
+ const char *from= buff;
int is_cur;
DBUG_ENTER("my_load_path");
DBUG_PRINT("enter",("path: %s prefix: %s",path,
@@ -34,7 +35,7 @@ char * my_load_path(char * to, const char *path,
if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) ||
test_if_hard_path(path))
- VOID(strmov(buff,path));
+ from= path;
else if ((is_cur=(path[0] == FN_CURLIB && path[1] == FN_LIBCHAR)) ||
(is_prefix(path,FN_PARENTDIR)) ||
! own_path_prefix)
@@ -42,13 +43,16 @@ char * my_load_path(char * to, const char *path,
if (is_cur)
is_cur=2; /* Remove current dir */
if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0)))
- VOID(strcat(buff,path+is_cur));
+ {
+ size_t length= strlen(buff);
+ (void) strmake(buff + length, path+is_cur, FN_REFLEN - length);
+ }
else
- VOID(strmov(buff,path)); /* Return org file name */
+ from= path; /* Return org file name */
}
else
- VOID(strxmov(buff,own_path_prefix,path,NullS));
- strmov(to,buff);
+ (void) strxnmov(buff, FN_REFLEN, own_path_prefix, path, NullS);
+ strmake(to, from, FN_REFLEN-1);
DBUG_PRINT("exit",("to: %s",to));
DBUG_RETURN(to);
} /* my_load_path */
diff --git a/mysys/my_file.c b/mysys/my_file.c
index 64dc4745703..594f361437f 100644
--- a/mysys/my_file.c
+++ b/mysys/my_file.c
@@ -72,7 +72,7 @@ static uint set_max_open_files(uint max_file_limit)
}
#else
-static int set_max_open_files(uint max_file_limit)
+static uint set_max_open_files(uint max_file_limit)
{
/* We don't know the limit. Return best guess */
return min(max_file_limit, OS_FILE_LIMIT);
diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c
index e0c5b94b53e..e6b867e2753 100644
--- a/mysys/my_getwd.c
+++ b/mysys/my_getwd.c
@@ -50,11 +50,16 @@ int my_getwd(char * buf, size_t size, myf MyFlags)
DBUG_PRINT("my",("buf: 0x%lx size: %u MyFlags %d",
(long) buf, (uint) size, MyFlags));
+ if (size < 1)
+ return(-1);
+
if (curr_dir[0]) /* Current pos is saved here */
VOID(strmake(buf,&curr_dir[0],size-1));
else
{
#if defined(HAVE_GETCWD)
+ if (size < 2)
+ return(-1);
if (!getcwd(buf,(uint) (size-2)) && MyFlags & MY_WME)
{
my_errno=errno;
@@ -68,6 +73,8 @@ int my_getwd(char * buf, size_t size, myf MyFlags)
strmake(buf,pathname,size-1);
}
#elif defined(VMS)
+ if (size < 2)
+ return(-1);
if (!getcwd(buf,size-2,1) && MyFlags & MY_WME)
{
my_errno=errno;
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c
index 258e227bb7b..33f45a882e1 100644
--- a/mysys/my_symlink.c
+++ b/mysys/my_symlink.c
@@ -117,6 +117,9 @@ int my_is_symlink(const char *filename __attribute__((unused)))
/*
Resolve all symbolic links in path
'to' may be equal to 'filename'
+
+ to is guaranteed to never set to a string longer than FN_REFLEN
+ (including the end \0)
*/
int my_realpath(char *to, const char *filename,
@@ -130,7 +133,7 @@ int my_realpath(char *to, const char *filename,
DBUG_PRINT("info",("executing realpath"));
if ((ptr=realpath(filename,buff)))
- strmake(to,ptr,FN_REFLEN-1);
+ strmake(to, ptr, FN_REFLEN-1);
else
{
/*
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 23b5efcaf2b..e4e5f1a1510 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -183,6 +183,7 @@ parse_arguments() {
;;
--nice=*) niceness="$val" ;;
--open-files-limit=*) open_files="$val" ;;
+ --open_files_limit=*) open_files="$val" ;;
--skip-kill-mysqld*) KILL_MYSQLD=0 ;;
--syslog) want_syslog=1 ;;
--skip-syslog) want_syslog=0 ;;
@@ -397,10 +398,14 @@ then
if test -n "$open_files"
then
ulimit -n $open_files
- append_arg_to_args "--open-files-limit=$open_files"
fi
fi
+if test -n "$open_files"
+then
+ append_arg_to_args "--open-files-limit=$open_files"
+fi
+
safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
# Make sure that directory for $safe_mysql_unix_port exists
mysql_unix_port_dir=`dirname $safe_mysql_unix_port`
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index 21fca0c0848..398573875d9 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -267,6 +267,14 @@ foreach my $rdb ( @db_desc ) {
my $db = $rdb->{src};
my @dbh_tables = get_list_of_tables( $db );
+ ## filter out certain system non-lockable tables.
+ ## keep in sync with mysqldump.
+ if ($db =~ m/^mysql$/i)
+ {
+ @dbh_tables = grep
+ { !/^(apply_status|schema|general_log|slow_log)$/ } @dbh_tables
+ }
+
## generate regex for tables/files
my $t_regex;
my $negated;
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index e8bc72f15d7..fab538dbee4 100755
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -50,7 +50,7 @@ SET (SQL_SOURCE
hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
item_create.cc item_func.cc item_geofunc.cc item_row.cc
item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc
- key.cc log.cc lock.cc message.rc
+ key.cc log.cc lock.cc
log_event.cc rpl_record.cc rpl_reporting.cc
log_event_old.cc rpl_record_old.cc
message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c
@@ -90,7 +90,7 @@ ADD_LIBRARY(sql ${SQL_SOURCE})
IF (NOT EXISTS cmake_dummy.cc)
FILE (WRITE cmake_dummy.cc "")
ENDIF (NOT EXISTS cmake_dummy.cc)
-ADD_EXECUTABLE(mysqld cmake_dummy.cc)
+ADD_EXECUTABLE(mysqld cmake_dummy.cc message.rc)
SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX})
SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE)
diff --git a/sql/field.cc b/sql/field.cc
index bc6da99166c..94863225bb3 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -8883,14 +8883,20 @@ bool Field_num::eq_def(Field *field)
}
+/**
+ Check whether two numeric fields can be considered 'equal' for table
+ alteration purposes. Fields are equal if they are of the same type
+ and retain the same pack length.
+*/
+
uint Field_num::is_equal(Create_field *new_field)
{
return ((new_field->sql_type == real_type()) &&
- ((new_field->flags & UNSIGNED_FLAG) == (uint) (flags &
- UNSIGNED_FLAG)) &&
+ ((new_field->flags & UNSIGNED_FLAG) ==
+ (uint) (flags & UNSIGNED_FLAG)) &&
((new_field->flags & AUTO_INCREMENT_FLAG) ==
(uint) (flags & AUTO_INCREMENT_FLAG)) &&
- (new_field->length <= max_display_length()));
+ (new_field->pack_length == pack_length()));
}
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 35ca65683d6..68faef750c7 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -7319,13 +7319,6 @@ static int ndbcluster_init(void *p)
if (ndbcluster_inited)
DBUG_RETURN(FALSE);
- /*
- Below we create new THD's. They'll need LOCK_plugin, but it's taken now by
- plugin initialization code. Release it to avoid deadlocks. It's safe, as
- there're no threads that may concurrently access plugin control structures.
- */
- pthread_mutex_unlock(&LOCK_plugin);
-
pthread_mutex_init(&ndbcluster_mutex,MY_MUTEX_INIT_FAST);
pthread_mutex_init(&LOCK_ndb_util_thread, MY_MUTEX_INIT_FAST);
pthread_cond_init(&COND_ndb_util_thread, NULL);
@@ -7466,8 +7459,6 @@ static int ndbcluster_init(void *p)
goto ndbcluster_init_error;
}
- pthread_mutex_lock(&LOCK_plugin);
-
ndbcluster_inited= 1;
DBUG_RETURN(FALSE);
@@ -7480,8 +7471,6 @@ ndbcluster_init_error:
g_ndb_cluster_connection= NULL;
ndbcluster_hton->state= SHOW_OPTION_DISABLED; // If we couldn't use handler
- pthread_mutex_lock(&LOCK_plugin);
-
DBUG_RETURN(TRUE);
}
diff --git a/sql/handler.cc b/sql/handler.cc
index b817673ed23..b7903468b69 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -159,7 +159,7 @@ redo:
}
-plugin_ref ha_lock_engine(THD *thd, handlerton *hton)
+plugin_ref ha_lock_engine(THD *thd, const handlerton *hton)
{
if (hton)
{
@@ -601,9 +601,13 @@ static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
there's no need to rollback here as all transactions must
be rolled back already
*/
- if (hton->state == SHOW_OPTION_YES && hton->close_connection &&
- thd_get_ha_data(thd, hton))
- hton->close_connection(hton, thd);
+ if (hton->state == SHOW_OPTION_YES && thd_get_ha_data(thd, hton))
+ {
+ if (hton->close_connection)
+ hton->close_connection(hton, thd);
+ /* make sure ha_data is reset and ha_data_lock is released */
+ thd_set_ha_data(thd, hton, NULL);
+ }
return FALSE;
}
diff --git a/sql/handler.h b/sql/handler.h
index d03264a23db..2077353959c 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1976,7 +1976,7 @@ extern ulong total_ha, total_ha_2pc;
/* lookups */
handlerton *ha_default_handlerton(THD *thd);
plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name);
-plugin_ref ha_lock_engine(THD *thd, handlerton *hton);
+plugin_ref ha_lock_engine(THD *thd, const handlerton *hton);
handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type);
handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
handlerton *db_type);
diff --git a/sql/item.cc b/sql/item.cc
index 5e8a941185a..fc6da45d1b5 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1713,7 +1713,16 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
if (!(conv= (*arg)->safe_charset_converter(coll.collation)) &&
((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII))
- conv= new Item_func_conv_charset(*arg, coll.collation, 1);
+ {
+ /*
+ We should disable const subselect item evaluation because
+ subselect transformation does not happen in view_prepare_mode
+ and thus val_...() methods can not be called for const items.
+ */
+ bool resolve_const= ((*arg)->type() == Item::SUBSELECT_ITEM &&
+ thd->lex->view_prepare_mode) ? FALSE : TRUE;
+ conv= new Item_func_conv_charset(*arg, coll.collation, resolve_const);
+ }
if (!conv)
{
@@ -5353,13 +5362,25 @@ 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)
+{
max_length=(str_length+1)/2;
char *ptr=(char*) sql_alloc(max_length+1);
if (!ptr)
+ {
+ str_value.set("", 0, &my_charset_bin);
return;
+ }
str_value.set(ptr,max_length,&my_charset_bin);
char *end=ptr+max_length;
if (max_length*2 != str_length)
diff --git a/sql/item.h b/sql/item.h
index a99c97a44ac..45cfb4881dd 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -2155,7 +2155,7 @@ public:
class Item_hex_string: public Item_basic_constant
{
public:
- Item_hex_string() {}
+ Item_hex_string();
Item_hex_string(const char *str,uint str_length);
enum Type type() const { return VARBIN_ITEM; }
double val_real()
@@ -2175,6 +2175,8 @@ public:
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;}
+private:
+ void hex_string_init(const char *str, uint str_length);
};
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 44da45a11e2..22c4fb9d438 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -54,9 +54,9 @@ public:
/* Allow owner function to use string buffers. */
String value1, value2;
- Arg_comparator(): thd(0), a_cache(0), b_cache(0), set_null(TRUE),
+ Arg_comparator(): comparators(0), thd(0), a_cache(0), b_cache(0), set_null(TRUE),
get_value_a_func(0), get_value_b_func(0) {};
- Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), thd(0),
+ Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), comparators(0), thd(0),
a_cache(0), b_cache(0), set_null(TRUE),
get_value_a_func(0), get_value_b_func(0) {};
@@ -112,6 +112,11 @@ public:
return (owner->type() == Item::FUNC_ITEM &&
((Item_func*)owner)->functype() == Item_func::EQUAL_FUNC);
}
+ void cleanup()
+ {
+ delete [] comparators;
+ comparators= 0;
+ }
friend class Item_func;
};
@@ -365,6 +370,11 @@ public:
CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; }
uint decimal_precision() const { return 1; }
void top_level_item() { abort_on_null= TRUE; }
+ void cleanup()
+ {
+ Item_int_func::cleanup();
+ cmp.cleanup();
+ }
friend class Arg_comparator;
};
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 810c4993379..4c90eceec99 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2960,8 +2960,7 @@ String *Item_load_file::val_str(String *str)
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
/* Read only allowed from within dir specified by secure_file_priv */
- if (opt_secure_file_priv &&
- strncmp(opt_secure_file_priv, path, strlen(opt_secure_file_priv)))
+ if (!is_secure_file_path(path))
goto err;
if (!my_stat(path, &stat_info, MYF(0)))
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index f8e9bde282a..24d982b3c8d 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -123,6 +123,21 @@ void Item_subselect::cleanup()
DBUG_VOID_RETURN;
}
+
+/*
+ We cannot use generic Item::safe_charset_converter() because
+ Subselect transformation does not happen in view_prepare_mode
+ and thus we can not evaluate val_...() for const items.
+*/
+
+Item *Item_subselect::safe_charset_converter(CHARSET_INFO *tocs)
+{
+ Item_func_conv_charset *conv=
+ new Item_func_conv_charset(this, tocs, thd->lex->view_prepare_mode ? 0 : 1);
+ return conv->safe ? conv : NULL;
+}
+
+
void Item_singlerow_subselect::cleanup()
{
DBUG_ENTER("Item_singlerow_subselect::cleanup");
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 8d43f2bd383..cea02f2acb6 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -137,6 +137,7 @@ public:
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
bool mark_as_eliminated_processor(uchar *arg);
bool enumerate_field_refs_processor(uchar *arg);
+ Item *safe_charset_converter(CHARSET_INFO *tocs);
/**
Get the SELECT_LEX structure associated with this Item.
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 6629374187a..d6d7e6288de 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1852,6 +1852,12 @@ void sql_perror(const char *message);
bool fn_format_relative_to_data_home(char * to, const char *name,
const char *dir, const char *extension);
+/**
+ Test a file path to determine if the path is compatible with the secure file
+ path restriction.
+*/
+bool is_secure_file_path(char *path);
+
#ifdef MYSQL_SERVER
File open_binlog(IO_CACHE *log, const char *log_file_name,
const char **errmsg);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 3b99b06a8d1..65c2057686d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -9136,6 +9136,45 @@ fn_format_relative_to_data_home(char * to, const char *name,
}
+/**
+ Test a file path to determine if the path is compatible with the secure file
+ path restriction.
+
+ @param path null terminated character string
+
+ @return
+ @retval TRUE The path is secure
+ @retval FALSE The path isn't secure
+*/
+
+bool is_secure_file_path(char *path)
+{
+ char buff1[FN_REFLEN], buff2[FN_REFLEN];
+ /*
+ All paths are secure if opt_secure_file_path is 0
+ */
+ if (!opt_secure_file_priv)
+ return TRUE;
+
+ if (strlen(path) >= FN_REFLEN)
+ return FALSE;
+
+ if (my_realpath(buff1, path, 0))
+ {
+ /*
+ The supplied file path might have been a file and not a directory.
+ */
+ size_t length= dirname_length(path); // Guaranteed to be < FN_REFLEN
+ memcpy(buff2, path, length);
+ buff2[length]= '\0';
+ if (length == 0 || my_realpath(buff1, buff2, 0))
+ return FALSE;
+ }
+ convert_dirname(buff2, buff1, NullS);
+ return is_prefix(buff2, opt_secure_file_priv) ? TRUE : FALSE;
+}
+
+
static int fix_paths(void)
{
char buff[FN_REFLEN],*pos;
@@ -9195,11 +9234,27 @@ static int fix_paths(void)
Convert the secure-file-priv option to system format, allowing
a quick strcmp to check if read or write is in an allowed dir
*/
- if (opt_secure_file_priv && opt_secure_file_priv[0])
+ if (opt_secure_file_priv)
{
- convert_dirname(buff, opt_secure_file_priv, NullS);
- my_free(opt_secure_file_priv, MYF(0));
- opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE));
+ if (*opt_secure_file_priv == 0)
+ {
+ /* For easy check later */
+ my_free(opt_secure_file_priv, MYF(0));
+ opt_secure_file_priv= 0;
+ }
+ else
+ {
+ char *secure_file_real_path;
+ if (my_realpath(buff, opt_secure_file_priv, 0))
+ {
+ sql_print_warning("Failed to normalize the argument for --secure-file-priv.");
+ return 1;
+ }
+ secure_file_real_path= (char *)my_malloc(FN_REFLEN, MYF(MY_FAE));
+ convert_dirname(secure_file_real_path, buff, NullS);
+ my_free(opt_secure_file_priv, MYF(0));
+ opt_secure_file_priv= secure_file_real_path;
+ }
}
return 0;
}
diff --git a/sql/slave.cc b/sql/slave.cc
index 57cd8d0c7da..63c1c9e2c09 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2844,6 +2844,11 @@ pthread_handler_t handle_slave_sql(void *arg)
{
THD *thd; /* needs to be first for thread_stack */
char llbuff[22],llbuff1[22];
+ char saved_log_name[FN_REFLEN];
+ char saved_master_log_name[FN_REFLEN];
+ my_off_t saved_log_pos;
+ my_off_t saved_master_log_pos;
+ my_off_t saved_skip= 0;
Relay_log_info* rli = &((Master_info*)arg)->rli;
const char *errmsg;
@@ -2989,6 +2994,14 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
do not want to wait for next event in this case.
*/
pthread_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);
+ saved_log_pos= rli->group_relay_log_pos;
+ saved_master_log_pos= rli->group_master_log_pos;
+ saved_skip= rli->slave_skip_counter;
+ }
if (rli->until_condition != Relay_log_info::UNTIL_NONE &&
rli->is_until_satisfied(thd, NULL))
{
@@ -3007,6 +3020,21 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
thd_proc_info(thd, "Reading event from the relay log");
DBUG_ASSERT(rli->sql_thd == thd);
THD_CHECK_SENTRY(thd);
+
+ if (saved_skip && rli->slave_skip_counter == 0)
+ {
+ sql_print_information("'SQL_SLAVE_SKIP_COUNTER=%ld' executed at "
+ "relay_log_file='%s', relay_log_pos='%ld', master_log_name='%s', "
+ "master_log_pos='%ld' and new position at "
+ "relay_log_file='%s', relay_log_pos='%ld', master_log_name='%s', "
+ "master_log_pos='%ld' ",
+ (ulong) saved_skip, saved_log_name, (ulong) saved_log_pos,
+ saved_master_log_name, (ulong) saved_master_log_pos,
+ rli->group_relay_log_name, (ulong) rli->group_relay_log_pos,
+ rli->group_master_log_name, (ulong) rli->group_master_log_pos);
+ saved_skip= 0;
+ }
+
if (exec_relay_log_event(thd,rli))
{
DBUG_PRINT("info", ("exec_relay_log_event() failed"));
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index fd9ef7464b0..966aa675362 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -745,21 +745,12 @@ sp_head::create(THD *thd)
sp_head::~sp_head()
{
+ LEX *lex;
+ sp_instr *i;
DBUG_ENTER("sp_head::~sp_head");
- destroy();
- delete m_next_cached_sp;
- if (m_thd)
- restore_thd_mem_root(m_thd);
- DBUG_VOID_RETURN;
-}
-void
-sp_head::destroy()
-{
- sp_instr *i;
- LEX *lex;
- DBUG_ENTER("sp_head::destroy");
- DBUG_PRINT("info", ("name: %s", m_name.str));
+ /* sp_head::restore_thd_mem_root() must already have been called. */
+ DBUG_ASSERT(m_thd == NULL);
for (uint ip = 0 ; (i = get_instr(ip)) ; ip++)
delete i;
@@ -770,21 +761,22 @@ sp_head::destroy()
/*
If we have non-empty LEX stack then we just came out of parser with
error. Now we should delete all auxilary LEXes and restore original
- THD::lex (In this case sp_head::restore_thd_mem_root() was not called
- too, so m_thd points to the current thread context).
- It is safe to not update LEX::ptr because further query string parsing
- and execution will be stopped anyway.
+ THD::lex. It is safe to not update LEX::ptr because further query
+ string parsing and execution will be stopped anyway.
*/
- DBUG_ASSERT(m_lex.is_empty() || m_thd);
while ((lex= (LEX *)m_lex.pop()))
{
- lex_end(m_thd->lex);
- delete m_thd->lex;
- m_thd->lex= lex;
+ THD *thd= lex->thd;
+ lex_end(thd->lex);
+ delete thd->lex;
+ thd->lex= lex;
}
hash_free(&m_sptabs);
hash_free(&m_sroutines);
+
+ delete m_next_cached_sp;
+
DBUG_VOID_RETURN;
}
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 00c96d44f70..d422adc8927 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -289,10 +289,6 @@ public:
virtual ~sp_head();
- /// Free memory
- void
- destroy();
-
bool
execute_trigger(THD *thd,
const LEX_STRING *db_name,
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index e285ff55556..6e9ec902577 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -6118,19 +6118,19 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
VOID(pthread_mutex_unlock(&acl_cache->lock));
- int binlog_error=
+ if (result)
+ my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
+
+ result= result |
write_bin_log(thd, FALSE, thd->query(), thd->query_length());
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
- /* error for writing binary log has already been reported */
- if (result && !binlog_error)
- my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
/* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based;
- DBUG_RETURN(result || binlog_error);
+ DBUG_RETURN(result);
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 51299d4f7e7..eccd85f947c 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -287,6 +287,37 @@ void **thd_ha_data(const THD *thd, const struct handlerton *hton)
return (void **) &thd->ha_data[hton->slot].ha_ptr;
}
+
+/**
+ Provide a handler data getter to simplify coding
+*/
+extern "C"
+void *thd_get_ha_data(const THD *thd, const struct handlerton *hton)
+{
+ return *thd_ha_data(thd, hton);
+}
+
+
+/**
+ Provide a handler data setter to simplify coding
+ @see thd_set_ha_data() definition in plugin.h
+*/
+extern "C"
+void thd_set_ha_data(THD *thd, const struct handlerton *hton,
+ const void *ha_data)
+{
+ plugin_ref *lock= &thd->ha_data[hton->slot].lock;
+ if (ha_data && !*lock)
+ *lock= ha_lock_engine(NULL, (handlerton*) hton);
+ else if (!ha_data && *lock)
+ {
+ plugin_unlock(NULL, *lock);
+ *lock= NULL;
+ }
+ *thd_ha_data(thd, hton)= (void*) ha_data;
+}
+
+
extern "C"
long long thd_test_options(const THD *thd, long long test_options)
{
@@ -1867,8 +1898,7 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
else
(void) fn_format(path, exchange->file_name, mysql_real_data_home, "", option);
- if (opt_secure_file_priv &&
- strncmp(opt_secure_file_priv, path, strlen(opt_secure_file_priv)))
+ if (!is_secure_file_path(path))
{
/* Write only allowed to dir or subdir specified by secure_file_priv */
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 8c4c60c02bb..fd6e4380fca 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1277,7 +1277,11 @@ struct Ha_data
@sa trans_register_ha()
*/
Ha_trx_info ha_info[2];
-
+ /**
+ NULL: engine is not bound to this thread
+ non-NULL: engine is bound to this thread, engine shutdown forbidden
+ */
+ plugin_ref lock;
Ha_data() :ha_ptr(NULL) {}
};
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 5a3907d0f7f..e03269ef6b6 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2125,6 +2125,7 @@ void st_lex::cleanup_lex_after_parse_error(THD *thd)
*/
if (thd->lex->sphead)
{
+ thd->lex->sphead->restore_thd_mem_root(thd);
delete thd->lex->sphead;
thd->lex->sphead= NULL;
}
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 03606c11521..7399b442573 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -348,16 +348,11 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
DBUG_ASSERT(FALSE);
#endif
}
- else if (opt_secure_file_priv)
+ else if (!is_secure_file_path(name))
{
- char secure_file_real_path[FN_REFLEN];
- (void) my_realpath(secure_file_real_path, opt_secure_file_priv, 0);
- if (strncmp(secure_file_real_path, name, strlen(secure_file_real_path)))
- {
- /* Read only allowed from within dir specified by secure_file_priv */
- my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
- DBUG_RETURN(TRUE);
- }
+ /* Read only allowed from within dir specified by secure_file_priv */
+ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
+ DBUG_RETURN(TRUE);
}
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index a93c7467c8c..8256842e456 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1309,7 +1309,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
TABLE_LIST table_list;
char db_buff[NAME_LEN+1];
uint32 db_length;
- uint dummy_errors;
+ uint dummy_errors, query_length;
/* used as fields initializator */
lex_start(thd);
@@ -1320,11 +1320,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
/*
We have name + wildcard in packet, separated by endzero
+ (The packet is guaranteed to end with an end zero)
*/
wildcard= strend(packet);
db_length= wildcard - packet;
wildcard++;
- uint query_length= (uint) (packet_end - wildcard); // Don't count end \0
+ query_length= (uint) (packet_end - wildcard); // Don't count end \0
if (db_length > NAME_LEN || query_length > NAME_LEN)
{
my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 151197be1d3..d908f13d372 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1025,9 +1025,15 @@ void plugin_unlock_list(THD *thd, plugin_ref *list, uint count)
static int plugin_initialize(struct st_plugin_int *plugin)
{
+ int ret= 1;
+ uint state;
DBUG_ENTER("plugin_initialize");
safe_mutex_assert_owner(&LOCK_plugin);
+ state= plugin->state;
+ DBUG_ASSERT(state == PLUGIN_IS_UNINITIALIZED);
+
+ pthread_mutex_unlock(&LOCK_plugin);
if (plugin_type_initialize[plugin->plugin->type])
{
if ((*plugin_type_initialize[plugin->plugin->type])(plugin))
@@ -1046,8 +1052,7 @@ static int plugin_initialize(struct st_plugin_int *plugin)
goto err;
}
}
-
- plugin->state= PLUGIN_IS_READY;
+ state= PLUGIN_IS_READY; // plugin->init() succeeded
if (plugin->plugin->status_vars)
{
@@ -1066,7 +1071,8 @@ static int plugin_initialize(struct st_plugin_int *plugin)
if (add_status_vars(array)) // add_status_vars makes a copy
goto err;
#else
- add_status_vars(plugin->plugin->status_vars); // add_status_vars makes a copy
+ if (add_status_vars(plugin->plugin->status_vars))
+ goto err;
#endif /* FIX_LATER */
}
@@ -1086,9 +1092,12 @@ static int plugin_initialize(struct st_plugin_int *plugin)
}
}
- DBUG_RETURN(0);
+ ret= 0;
+
err:
- DBUG_RETURN(1);
+ pthread_mutex_lock(&LOCK_plugin);
+ plugin->state= state;
+ DBUG_RETURN(ret);
}
@@ -1677,6 +1686,12 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl
struct st_plugin_int *tmp;
DBUG_ENTER("mysql_install_plugin");
+ if (opt_noacl)
+ {
+ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
+ DBUG_RETURN(TRUE);
+ }
+
bzero(&tables, sizeof(tables));
tables.db= (char *)"mysql";
tables.table_name= tables.alias= (char *)"plugin";
@@ -1754,6 +1769,12 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
struct st_plugin_int *plugin;
DBUG_ENTER("mysql_uninstall_plugin");
+ if (opt_noacl)
+ {
+ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
+ DBUG_RETURN(TRUE);
+ }
+
bzero(&tables, sizeof(tables));
tables.db= (char *)"mysql";
tables.table_name= tables.alias= (char *)"plugin";
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 3aa9e9ba56f..7772b4d1ed2 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1134,6 +1134,10 @@ bool change_master(THD* thd, Master_info* mi)
int thread_mask;
const char* errmsg= 0;
bool need_relay_log_purge= 1;
+ char saved_host[HOSTNAME_LENGTH + 1];
+ uint saved_port;
+ char saved_log_name[FN_REFLEN];
+ my_off_t saved_log_pos;
DBUG_ENTER("change_master");
lock_slave_threads(mi);
@@ -1163,6 +1167,14 @@ bool change_master(THD* thd, Master_info* mi)
*/
/*
+ Before processing the command, save the previous state.
+ */
+ strmake(saved_host, mi->host, HOSTNAME_LENGTH);
+ saved_port= mi->port;
+ strmake(saved_log_name, mi->master_log_name, FN_REFLEN - 1);
+ saved_log_pos= mi->master_log_pos;
+
+ /*
If the user specified host or port without binlog or position,
reset binlog's name to FIRST and position to 4.
*/
@@ -1325,6 +1337,15 @@ bool change_master(THD* thd, Master_info* mi)
/* Clear the errors, for a clean start */
mi->rli.clear_error();
mi->rli.clear_until_condition();
+
+ sql_print_information("'CHANGE MASTER TO executed'. "
+ "Previous state master_host='%s', master_port='%u', master_log_file='%s', "
+ "master_log_pos='%ld'. "
+ "New state master_host='%s', master_port='%u', master_log_file='%s', "
+ "master_log_pos='%ld'.", saved_host, saved_port, saved_log_name,
+ (ulong) saved_log_pos, mi->host, mi->port, mi->master_log_name,
+ (ulong) mi->master_log_pos);
+
/*
If we don't write new coordinates to disk now, then old will remain in
relay-log.info until START SLAVE is issued; but if mysqld is shutdown
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 5245063f513..167babe9658 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1116,8 +1116,7 @@ JOIN::optimize()
}
if (conds && const_table_map != found_const_table_map &&
- (select_options & SELECT_DESCRIBE) &&
- select_lex->master_unit() == &thd->lex->unit) // upper level SELECT
+ (select_options & SELECT_DESCRIBE))
{
conds=new Item_int((longlong) 0,1); // Always false
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 014d82f0e91..85fc7ee724d 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -6969,6 +6969,13 @@ view_err:
&candidate_key_count))
goto err;
+ DBUG_EXECUTE_IF("alter_table_only_metadata_change", {
+ if (need_copy_table_res != ALTER_TABLE_METADATA_ONLY)
+ goto err; });
+ DBUG_EXECUTE_IF("alter_table_only_index_change", {
+ if (need_copy_table_res != ALTER_TABLE_INDEX_CHANGED)
+ goto err; });
+
if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
need_copy_table= need_copy_table_res;
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index c71060d4066..cb72534856a 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -273,8 +273,7 @@ int mysql_update(THD *thd,
table->timestamp_field_type= TIMESTAMP_NO_AUTO_SET;
else
{
- if (table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_UPDATE ||
- table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH)
+ if (((uint) table->timestamp_field_type) & TIMESTAMP_AUTO_SET_ON_UPDATE)
bitmap_set_bit(table->write_set,
table->timestamp_field->field_index);
}
@@ -308,10 +307,8 @@ int mysql_update(THD *thd,
update force the table handler to retrieve write-only fields to be able
to compare records and detect data change.
*/
- if (table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ &&
- table->timestamp_field &&
- (table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_UPDATE ||
- table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH))
+ if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) &&
+ (((uint) table->timestamp_field_type) & TIMESTAMP_AUTO_SET_ON_UPDATE))
bitmap_union(table->read_set, table->write_set);
// Don't count on usage of 'only index' when calculating which key to use
table->covering_keys.clear_all();
@@ -1380,6 +1377,15 @@ int multi_update::prepare(List<Item> &not_used_values,
{
table->read_set= &table->def_read_set;
bitmap_union(table->read_set, &table->tmp_set);
+ /*
+ If a timestamp field settable on UPDATE is present then to avoid wrong
+ update force the table handler to retrieve write-only fields to be able
+ to compare records and detect data change.
+ */
+ if ((table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ) &&
+ (((uint) table->timestamp_field_type) &
+ TIMESTAMP_AUTO_SET_ON_UPDATE))
+ bitmap_union(table->read_set, table->write_set);
}
}
diff --git a/sql/table.cc b/sql/table.cc
index 0c3b863786a..5d2b72f9316 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -498,11 +498,19 @@ inline bool is_system_table_name(const char *name, uint length)
Check if a string contains path elements
*/
-static inline bool has_disabled_path_chars(const char *str)
+static bool has_disabled_path_chars(const char *str)
{
for (; *str; str++)
- if (*str == FN_EXTCHAR || *str == '/' || *str == '\\' || *str == '~' || *str == '@')
- return TRUE;
+ {
+ switch (*str) {
+ case FN_EXTCHAR:
+ case '/':
+ case '\\':
+ case '~':
+ case '@':
+ return TRUE;
+ }
+ }
return FALSE;
}
@@ -2761,7 +2769,7 @@ bool check_table_name(const char *name, uint length, bool check_for_path_chars)
int len=my_ismbchar(system_charset_info, name, end);
if (len)
{
- name += len;
+ name+= len;
name_length++;
continue;
}
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index 5cc62c63507..5918db7ab11 100755..100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -63,5 +63,5 @@ SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
usr/usr0sess.c
ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c ut/ut0list.c ut/ut0wqueue.c)
- ## psergey: MYSQL_STORAGE_ENGINE(INNOBASE)
+MYSQL_STORAGE_ENGINE(INNOBASE)
diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
index 7d43532ea3d..45867388a61 100644
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
@@ -759,7 +759,7 @@ buf_pool_init(
/* Wipe contents of frame to eliminate a Purify
warning */
-#ifdef HAVE_valgrind
+#ifdef HAVE_purify
memset(block->frame, '\0', UNIV_PAGE_SIZE);
#endif
if (srv_use_awe) {
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 7927d003546..ebf01fbc296 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -238,7 +238,7 @@ static MYSQL_THDVAR_BOOL(table_locks, PLUGIN_VAR_OPCMDARG,
/* default */ TRUE);
static handler *innobase_create_handler(handlerton *hton,
- TABLE_SHARE *table,
+ TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_innobase(hton, table);
@@ -350,7 +350,7 @@ int
innobase_start_trx_and_assign_read_view(
/*====================================*/
/* out: 0 */
- handlerton* hton, /* in: Innodb handlerton */
+ handlerton* hton, /* in: Innodb handlerton */
THD* thd); /* in: MySQL thread handle of the user for whom
the transaction should be committed */
/********************************************************************
@@ -1714,9 +1714,6 @@ innobase_init(
int err;
bool ret;
char *default_path;
-#ifdef SAFE_MUTEX
- my_bool old_safe_mutex_deadlock_detector;
-#endif
DBUG_ENTER("innobase_init");
handlerton *innobase_hton= (handlerton *)p;
@@ -1971,15 +1968,8 @@ innobase_init(
srv_sizeof_trx_t_in_ha_innodb_cc = sizeof(trx_t);
-#ifdef SAFE_MUTEX
- /* Disable deadlock detection as it's very slow for the buffer pool */
- old_safe_mutex_deadlock_detector= safe_mutex_deadlock_detector;
- safe_mutex_deadlock_detector= 0;
-#endif
err = innobase_start_or_create_for_mysql();
-#ifdef SAFE_MUTEX
- safe_mutex_deadlock_detector= old_safe_mutex_deadlock_detector;
-#endif
+
if (err != DB_SUCCESS) {
my_free(internal_innobase_data_file_path,
MYF(MY_ALLOW_ZERO_PTR));
@@ -4445,7 +4435,7 @@ ha_innobase::unlock_row(void)
case ROW_READ_WITH_LOCKS:
if (!srv_locks_unsafe_for_binlog
&& prebuilt->trx->isolation_level
- != TRX_ISO_READ_COMMITTED) {
+ > TRX_ISO_READ_COMMITTED) {
break;
}
/* fall through */
@@ -4482,7 +4472,7 @@ ha_innobase::try_semi_consistent_read(bool yes)
if (yes
&& (srv_locks_unsafe_for_binlog
- || prebuilt->trx->isolation_level == TRX_ISO_READ_COMMITTED)) {
+ || prebuilt->trx->isolation_level <= TRX_ISO_READ_COMMITTED)) {
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
} else {
prebuilt->row_read_type = ROW_READ_WITH_LOCKS;
@@ -7778,7 +7768,7 @@ ha_innobase::store_lock(
isolation_level = trx->isolation_level;
if ((srv_locks_unsafe_for_binlog
- || isolation_level == TRX_ISO_READ_COMMITTED)
+ || isolation_level <= TRX_ISO_READ_COMMITTED)
&& isolation_level != TRX_ISO_SERIALIZABLE
&& (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT)
&& (sql_command == SQLCOM_INSERT_SELECT
diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h
index 2d5fd1db6c3..ce99a680418 100644
--- a/storage/innobase/include/mem0mem.h
+++ b/storage/innobase/include/mem0mem.h
@@ -138,6 +138,17 @@ mem_heap_free_func(
mem_heap_t* heap, /* in, own: heap to be freed */
const char* file_name, /* in: file name where freed */
ulint line); /* in: line where freed */
+/***************************************************************//**
+Allocates and zero-fills n bytes of memory from a memory heap.
+@return allocated, zero-filled storage */
+UNIV_INLINE
+void*
+mem_heap_zalloc(
+/*============*/
+ mem_heap_t* heap, /*!< in: memory heap */
+ ulint n); /*!< in: number of bytes; if the heap is allowed
+ to grow into the buffer pool, this must be
+ <= MEM_MAX_ALLOC_IN_BUF */
/*******************************************************************
Allocates n bytes of memory from a memory heap. */
UNIV_INLINE
diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
index 6227a27f277..782672dbc18 100644
--- a/storage/innobase/include/mem0mem.ic
+++ b/storage/innobase/include/mem0mem.ic
@@ -122,6 +122,23 @@ mem_block_get_start(mem_block_t* block)
return(block->start);
}
+/***************************************************************//**
+Allocates and zero-fills n bytes of memory from a memory heap.
+@return allocated, zero-filled storage */
+UNIV_INLINE
+void*
+mem_heap_zalloc(
+/*============*/
+ mem_heap_t* heap, /*!< in: memory heap */
+ ulint n) /*!< in: number of bytes; if the heap is allowed
+ to grow into the buffer pool, this must be
+ <= MEM_MAX_ALLOC_IN_BUF */
+{
+ ut_ad(heap);
+ ut_ad(!(heap->type & MEM_HEAP_BTR_SEARCH));
+ return(memset(mem_heap_alloc(heap, n), 0, n));
+}
+
/*******************************************************************
Allocates n bytes of memory from a memory heap. */
UNIV_INLINE
diff --git a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0sys.ic
index 55bcc12a414..1142fb60398 100644
--- a/storage/innobase/include/trx0sys.ic
+++ b/storage/innobase/include/trx0sys.ic
@@ -19,7 +19,7 @@ typedef byte trx_sysf_rseg_t;
#define TRX_SYS_RSEG_SPACE 0 /* space where the the segment
header is placed; starting with
MySQL/InnoDB 5.1.7, this is
- UNIV_UNDEFINED if the slot is unused */
+ ULINT_UNDEFINED for unused slots */
#define TRX_SYS_RSEG_PAGE_NO 4 /* page number where the the segment
header is placed; this is FIL_NULL
if the slot is unused */
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index e5e3577b4e6..ee3a0b27b20 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -55,10 +55,10 @@ of the 32-bit x86 assembler in mutex operations. */
# define UNIV_CAN_USE_X86_ASSEMBLER
# endif
-/* Enable explicit inlining of functions only for compilers known to
-support it. */
+/* We only try to do explicit inlining of functions with gcc and
+Microsoft Visual C++ */
-# if !defined(__GNUC__) && !defined(__SUNPRO_C)
+# if !defined(__GNUC__)
# undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
# define UNIV_MUST_NOT_INLINE
# endif
@@ -82,6 +82,9 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */
+#ifdef HAVE_purify
+# define UNIV_DEBUG_VALGRIND
+#endif /* HAVE_purify */
#if 0
#define UNIV_DEBUG_VALGRIND /* Enable extra
Valgrind instrumentation */
@@ -107,7 +110,7 @@ operations (very slow); also UNIV_DEBUG must be defined */
#define UNIV_BTR_DEBUG /* check B-tree links */
#define UNIV_LIGHT_MEM_DEBUG /* light memory debugging */
-#ifdef HAVE_valgrind
+#ifdef HAVE_purify
/* The following sets all new allocated memory to zero before use:
this can be used to eliminate unnecessary Purify warnings, but note that
it also masks many bugs Purify could detect. For detailed Purify analysis it
diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
index 8f4b64cda96..7df8ea50887 100644
--- a/storage/innobase/lock/lock0lock.c
+++ b/storage/innobase/lock/lock0lock.c
@@ -2362,7 +2362,7 @@ lock_rec_inherit_to_gap(
if (!lock_rec_get_insert_intention(lock)
&& !((srv_locks_unsafe_for_binlog
|| lock->trx->isolation_level
- == TRX_ISO_READ_COMMITTED)
+ <= TRX_ISO_READ_COMMITTED)
&& lock_get_mode(lock) == LOCK_X)) {
lock_rec_add_to_queue(LOCK_REC | lock_get_mode(lock)
@@ -4538,13 +4538,34 @@ lock_rec_queue_validate(
rec, impl_trx));
}
}
-
+#if 0
if (index && !(index->type & DICT_CLUSTERED)) {
/* The kernel mutex may get released temporarily in the
next function call: we have to release lock table mutex
to obey the latching order */
+ /* NOTE: This is a bogus check that would fail in the
+ following case: Our transaction is updating a
+ row. After it has updated the clustered index record,
+ it goes to a secondary index record and finds someone
+ else holding an explicit S- or X-lock on that
+ secondary index record, presumably from a locking
+ read. Our transaction cannot update the secondary
+ index immediately, but places a waiting X-lock request
+ on the secondary index record. There is nothing
+ illegal in this. The assertion is simply too strong. */
+
+ /* From the locking point of view, each secondary
+ index is a separate table. A lock that is held on
+ secondary index rec does not give any rights to modify
+ or read the clustered index rec. Therefore, we can
+ think of the sec index as a separate 'table' from the
+ clust index 'table'. Conversely, a transaction that
+ has acquired a lock on and modified a clustered index
+ record may need to wait for a lock on the
+ corresponding record in a secondary index. */
+
impl_trx = lock_sec_rec_some_has_impl_off_kernel(
rec, index, offsets);
@@ -4555,7 +4576,7 @@ lock_rec_queue_validate(
rec, impl_trx));
}
}
-
+#endif
lock = lock_rec_get_first(rec);
while (lock) {
diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c
index 5d309768064..e6524eeefbf 100644
--- a/storage/innobase/log/log0recv.c
+++ b/storage/innobase/log/log0recv.c
@@ -167,7 +167,7 @@ recv_sys_init(
recv_sys->len = 0;
recv_sys->recovered_offset = 0;
- recv_sys->addr_hash = hash_create(available_memory / 64);
+ recv_sys->addr_hash = hash_create(available_memory / 512);
recv_sys->n_addrs = 0;
recv_sys->apply_log_recs = FALSE;
@@ -207,7 +207,7 @@ recv_sys_empty_hash(void)
hash_table_free(recv_sys->addr_hash);
mem_heap_empty(recv_sys->heap);
- recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256);
+ recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 512);
}
#ifndef UNIV_LOG_DEBUG
diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
index ad14b927170..51c295b5098 100644
--- a/storage/innobase/row/row0ins.c
+++ b/storage/innobase/row/row0ins.c
@@ -140,7 +140,7 @@ row_ins_alloc_sys_fields(
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
- ptr = mem_heap_alloc(heap, DATA_ROW_ID_LEN);
+ ptr = mem_heap_zalloc(heap, DATA_ROW_ID_LEN);
dfield_set_data(dfield, ptr, DATA_ROW_ID_LEN);
@@ -151,7 +151,7 @@ row_ins_alloc_sys_fields(
col = dict_table_get_sys_col(table, DATA_TRX_ID);
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
- ptr = mem_heap_alloc(heap, DATA_TRX_ID_LEN);
+ ptr = mem_heap_zalloc(heap, DATA_TRX_ID_LEN);
dfield_set_data(dfield, ptr, DATA_TRX_ID_LEN);
@@ -162,7 +162,7 @@ row_ins_alloc_sys_fields(
col = dict_table_get_sys_col(table, DATA_ROLL_PTR);
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
- ptr = mem_heap_alloc(heap, DATA_ROLL_PTR_LEN);
+ ptr = mem_heap_zalloc(heap, DATA_ROLL_PTR_LEN);
dfield_set_data(dfield, ptr, DATA_ROLL_PTR_LEN);
}
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
index f7156403247..a0e0ee99775 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -1485,7 +1485,7 @@ row_unlock_for_mysql(
if (UNIV_UNLIKELY
(!srv_locks_unsafe_for_binlog
- && trx->isolation_level != TRX_ISO_READ_COMMITTED)) {
+ && trx->isolation_level > TRX_ISO_READ_COMMITTED)) {
fprintf(stderr,
"InnoDB: Error: calling row_unlock_for_mysql though\n"
diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
index eee74f280af..1d30249c53e 100644
--- a/storage/innobase/row/row0sel.c
+++ b/storage/innobase/row/row0sel.c
@@ -744,7 +744,7 @@ row_sel_get_clust_rec(
trx = thr_get_trx(thr);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
lock_type = LOCK_REC_NOT_GAP;
} else {
lock_type = LOCK_ORDINARY;
@@ -1358,7 +1358,7 @@ rec_loop:
if (srv_locks_unsafe_for_binlog
|| trx->isolation_level
- == TRX_ISO_READ_COMMITTED) {
+ <= TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(next_rec)) {
@@ -1414,7 +1414,7 @@ skip_lock:
trx = thr_get_trx(thr);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(rec)) {
@@ -3596,7 +3596,7 @@ shortcut_fails_too_big_rec:
&& !page_rec_is_supremum(rec)
&& set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the next index record
@@ -3692,7 +3692,7 @@ rec_loop:
if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a lock on the index record */
@@ -3827,7 +3827,7 @@ wrong_offs:
if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
|| trx->isolation_level
- == TRX_ISO_READ_COMMITTED)
+ <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the index
@@ -3862,7 +3862,7 @@ wrong_offs:
if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
|| trx->isolation_level
- == TRX_ISO_READ_COMMITTED)
+ <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the index
@@ -3909,7 +3909,7 @@ wrong_offs:
if (!set_also_gap_locks
|| srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED
|| (unique_search
&& !UNIV_UNLIKELY(rec_get_deleted_flag(rec, comp)))) {
@@ -3947,7 +3947,7 @@ no_gap_lock:
rec_t* old_vers;
case DB_SUCCESS:
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
/* Note that a record of
prebuilt->index was locked. */
prebuilt->new_rec_locks = 1;
@@ -3956,6 +3956,7 @@ no_gap_lock:
case DB_LOCK_WAIT:
if (UNIV_LIKELY(prebuilt->row_read_type
!= ROW_READ_TRY_SEMI_CONSISTENT)
+ || unique_search
|| index != clust_index) {
goto lock_wait_or_error;
@@ -4080,7 +4081,7 @@ no_gap_lock:
/* The record is delete-marked: we can skip it */
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE
&& !did_semi_consistent_read) {
@@ -4147,7 +4148,7 @@ requires_clust_rec:
}
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Note that both the secondary index record
and the clustered index record were locked. */
@@ -4160,7 +4161,7 @@ requires_clust_rec:
/* The record is delete marked: we can skip it */
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* No need to keep a lock on a delete-marked
@@ -4367,7 +4368,7 @@ lock_wait_or_error:
moves_up, &mtr);
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& !same_user_rec) {
/* Since we were not able to restore the cursor
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index 26ea7958d0d..a2eed3f171c 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -1554,8 +1554,9 @@ srv_suspend_mysql_thread(
mutex_exit(&kernel_mutex);
- if (srv_lock_wait_timeout < 100000000
- && wait_time > (double)srv_lock_wait_timeout) {
+ if (trx_is_interrupted(trx)
+ || (srv_lock_wait_timeout < 100000000
+ && wait_time > (double)srv_lock_wait_timeout)) {
trx->error_state = DB_LOCK_WAIT_TIMEOUT;
}
@@ -2104,9 +2105,10 @@ loop:
wait_time = ut_difftime(ut_time(), slot->suspend_time);
- if (srv_lock_wait_timeout < 100000000
- && (wait_time > (double) srv_lock_wait_timeout
- || wait_time < 0)) {
+ if (trx_is_interrupted(thr_get_trx(slot->thr))
+ || (srv_lock_wait_timeout < 100000000
+ && (wait_time > (double) srv_lock_wait_timeout
+ || wait_time < 0))) {
/* Timeout exceeded or a wrap-around in system
time counter: cancel the lock request queued
diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
index d117ff16608..a7950473a17 100644
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
@@ -104,7 +104,7 @@ static char* srv_monitor_file_name;
/* Avoid warnings when using purify */
-#ifdef HAVE_valgrind
+#ifdef HAVE_purify
static int inno_bcmp(register const char *s1, register const char *s2,
register uint len)
{
diff --git a/storage/innodb_plugin/CMakeLists.txt b/storage/innodb_plugin/CMakeLists.txt
index 16d86d0b378..87318ceec78 100644
--- a/storage/innodb_plugin/CMakeLists.txt
+++ b/storage/innodb_plugin/CMakeLists.txt
@@ -85,5 +85,4 @@ SET(INNODB_PLUGIN_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea
#ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DINNODB_RW_LOCKS_USE_ATOMICS -DHAVE_IB_PAUSE_INSTRUCTION)
ADD_DEFINITIONS(-DHAVE_IB_PAUSE_INSTRUCTION)
-#Disable storage engine, as we are using XtraDB
-#MYSQL_STORAGE_ENGINE(INNODB_PLUGIN)
+MYSQL_STORAGE_ENGINE(INNODB_PLUGIN)
diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog
index 58e476716d8..bc69aaca96a 100644
--- a/storage/innodb_plugin/ChangeLog
+++ b/storage/innodb_plugin/ChangeLog
@@ -1,3 +1,77 @@
+2010-05-03 The InnoDB Team
+
+ * buf0buf.c:
+ Fix Bug#53248 compressed tables page checksum mismatch after
+ re-enabling innodb_checksums
+
+2010-04-28 The InnoDB Team
+
+ * log/log0recv.h, log/log0recv.c:
+ Fix Bug#53122 InnoDB recovery uses too big a hash table for redo
+ log records
+
+2010-04-27 The InnoDB Team
+
+ * handler/ha_innodb.cc, lock/lock0lock.c, row/row0mysql.c,
+ row/row0sel.c:
+ Fix Bug#48607 READ UNCOMMITTED uses more locks than READ COMMITTED
+ in InnoDB 5.1+
+
+2010-04-26 The InnoDB Team
+
+ * row/row0sel.c:
+ Fix Bug#52663 Lost update incrementing column value under
+ READ COMMITTED isolation level
+
+2010-04-22 The InnoDB Team
+
+ * include/dict0boot.h, dict/dict0boot.c:
+ Fix a bug that prevented the crash recovery of fast CREATE INDEX
+ from dropping partially created indexes.
+
+2010-04-21 The InnoDB Team
+
+ * btr/btr0btr.c:
+ Fix Bug#52964 Infinite loop in btr_page_split_and_insert()
+ in ROW_FORMAT=COMPRESSED
+
+2010-04-21 The InnoDB Team
+
+ * data/data0data.c:
+ Fix Bug#52745 Failing assertion: blob_no < page_zip->n_blobs
+
+2010-04-20 The InnoDB Team
+
+ * dict/dict0crea.c, handler/ha_innodb.cc, include/trx0trx.h:
+ Fix Bug#50495 'Row size too large' for plugin, but works for
+ built-in InnoDB
+ Only check the record size at index creation time when
+ innodb_strict_mode is set or when ROW_FORMAT is DYNAMIC or COMPRESSED.
+
+2010-04-20 The InnoDB Team
+
+ * btr/btr0btr.c, include/univ.i:
+ Implement UNIV_BTR_AVOID_COPY, for avoiding writes when a B-tree
+ node is split at the first or last record.
+
+2010-04-15 The InnoDB Team
+
+ * trx/trx0rec.c:
+ Fix Bug#52746 InnoDB purge thread crashed with table containing
+ prefix indexed blobs
+
+2010-03-31 The InnoDB Team
+
+ * mysql-test/innodb_bug51920.test, mysql-test/innodb_bug51920.result,
+ srv/srv0srv.c:
+ Fix Bug#51920 InnoDB connections in row lock wait ignore KILL
+ until lock wait timeout
+
+2010-03-31 The InnoDB Team
+
+ * mysql-test/innodb_bug38231.test:
+ Remove non-determinism in the test case.
+
2010-03-18 The InnoDB Team
* CMakeLists.txt:
diff --git a/storage/innodb_plugin/btr/btr0btr.c b/storage/innodb_plugin/btr/btr0btr.c
index fa4fc05d96b..96fcc2ed821 100644
--- a/storage/innodb_plugin/btr/btr0btr.c
+++ b/storage/innodb_plugin/btr/btr0btr.c
@@ -1451,11 +1451,11 @@ Calculates a split record such that the tuple will certainly fit on
its half-page when the split is performed. We assume in this function
only that the cursor page has at least one user record.
@return split record, or NULL if tuple will be the first record on
-upper half-page */
+the lower or upper half-page (determined by btr_page_tuple_smaller()) */
static
rec_t*
-btr_page_get_sure_split_rec(
-/*========================*/
+btr_page_get_split_rec(
+/*===================*/
btr_cur_t* cursor, /*!< in: cursor at which insert should be made */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext) /*!< in: number of externally stored columns */
@@ -1832,6 +1832,37 @@ btr_attach_half_pages(
}
/*************************************************************//**
+Determine if a tuple is smaller than any record on the page.
+@return TRUE if smaller */
+static
+ibool
+btr_page_tuple_smaller(
+/*===================*/
+ btr_cur_t* cursor, /*!< in: b-tree cursor */
+ const dtuple_t* tuple, /*!< in: tuple to consider */
+ ulint* offsets,/*!< in/out: temporary storage */
+ ulint n_uniq, /*!< in: number of unique fields
+ in the index page records */
+ mem_heap_t** heap) /*!< in/out: heap for offsets */
+{
+ buf_block_t* block;
+ const rec_t* first_rec;
+ page_cur_t pcur;
+
+ /* Read the first user record in the page. */
+ block = btr_cur_get_block(cursor);
+ page_cur_set_before_first(block, &pcur);
+ page_cur_move_to_next(&pcur);
+ first_rec = page_cur_get_rec(&pcur);
+
+ offsets = rec_get_offsets(
+ first_rec, cursor->index, offsets,
+ n_uniq, heap);
+
+ return(cmp_dtuple_rec(tuple, first_rec, offsets) < 0);
+}
+
+/*************************************************************//**
Splits an index page to halves and inserts the tuple. It is assumed
that mtr holds an x-latch to the index tree. NOTE: the tree x-latch is
released within this function! NOTE that the operation of this
@@ -1901,12 +1932,17 @@ func_start:
/* 1. Decide the split record; split_rec == NULL means that the
tuple to be inserted should be the first record on the upper
half-page */
+ insert_left = FALSE;
if (n_iterations > 0) {
direction = FSP_UP;
hint_page_no = page_no + 1;
- split_rec = btr_page_get_sure_split_rec(cursor, tuple, n_ext);
+ split_rec = btr_page_get_split_rec(cursor, tuple, n_ext);
+ if (UNIV_UNLIKELY(split_rec == NULL)) {
+ insert_left = btr_page_tuple_smaller(
+ cursor, tuple, offsets, n_uniq, &heap);
+ }
} else if (btr_page_get_split_rec_to_right(cursor, &split_rec)) {
direction = FSP_UP;
hint_page_no = page_no + 1;
@@ -1914,37 +1950,24 @@ func_start:
} else if (btr_page_get_split_rec_to_left(cursor, &split_rec)) {
direction = FSP_DOWN;
hint_page_no = page_no - 1;
+ ut_ad(split_rec);
} else {
direction = FSP_UP;
hint_page_no = page_no + 1;
- if (page_get_n_recs(page) == 1) {
- page_cur_t pcur;
-
- /* There is only one record in the index page
- therefore we can't split the node in the middle
- by default. We need to determine whether the
- new record will be inserted to the left or right. */
-
- /* Read the first (and only) record in the page. */
- page_cur_set_before_first(block, &pcur);
- page_cur_move_to_next(&pcur);
- first_rec = page_cur_get_rec(&pcur);
+ /* If there is only one record in the index page, we
+ can't split the node in the middle by default. We need
+ to determine whether the new record will be inserted
+ to the left or right. */
- offsets = rec_get_offsets(
- first_rec, cursor->index, offsets,
- n_uniq, &heap);
-
- /* If the new record is less than the existing record
- the split in the middle will copy the existing
- record to the new node. */
- if (cmp_dtuple_rec(tuple, first_rec, offsets) < 0) {
- split_rec = page_get_middle_rec(page);
- } else {
- split_rec = NULL;
- }
- } else {
+ if (page_get_n_recs(page) > 1) {
split_rec = page_get_middle_rec(page);
+ } else if (btr_page_tuple_smaller(cursor, tuple,
+ offsets, n_uniq, &heap)) {
+ split_rec = page_rec_get_next(
+ page_get_infimum_rec(page));
+ } else {
+ split_rec = NULL;
}
}
@@ -1974,11 +1997,15 @@ func_start:
avoid further splits by inserting the record
to an empty page. */
split_rec = NULL;
- goto insert_right;
+ goto insert_empty;
}
+ } else if (UNIV_UNLIKELY(insert_left)) {
+ first_rec = page_rec_get_next(page_get_infimum_rec(page));
+ move_limit = page_rec_get_next(btr_cur_get_rec(cursor));
} else {
-insert_right:
- insert_left = FALSE;
+insert_empty:
+ ut_ad(!split_rec);
+ ut_ad(!insert_left);
buf = mem_alloc(rec_get_converted_size(cursor->index,
tuple, n_ext));
@@ -2002,7 +2029,11 @@ insert_right:
&& btr_page_insert_fits(cursor, split_rec,
offsets, tuple, n_ext, heap);
} else {
- mem_free(buf);
+ if (!insert_left) {
+ mem_free(buf);
+ buf = NULL;
+ }
+
insert_will_fit = !new_page_zip
&& btr_page_insert_fits(cursor, NULL,
NULL, tuple, n_ext, heap);
@@ -2015,7 +2046,17 @@ insert_right:
}
/* 5. Move then the records to the new page */
- if (direction == FSP_DOWN) {
+ if (direction == FSP_DOWN
+#ifdef UNIV_BTR_AVOID_COPY
+ && page_rec_is_supremum(move_limit)) {
+ /* Instead of moving all records, make the new page
+ the empty page. */
+
+ left_block = block;
+ right_block = new_block;
+ } else if (direction == FSP_DOWN
+#endif /* UNIV_BTR_AVOID_COPY */
+ ) {
/* fputs("Split left\n", stderr); */
if (0
@@ -2058,6 +2099,14 @@ insert_right:
right_block = block;
lock_update_split_left(right_block, left_block);
+#ifdef UNIV_BTR_AVOID_COPY
+ } else if (!split_rec) {
+ /* Instead of moving all records, make the new page
+ the empty page. */
+
+ left_block = new_block;
+ right_block = block;
+#endif /* UNIV_BTR_AVOID_COPY */
} else {
/* fputs("Split right\n", stderr); */
diff --git a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c
index 504bd162f32..0e603fdca8f 100644
--- a/storage/innodb_plugin/btr/btr0cur.c
+++ b/storage/innodb_plugin/btr/btr0cur.c
@@ -1064,7 +1064,6 @@ btr_cur_optimistic_insert(
ibool inherit;
ulint zip_size;
ulint rec_size;
- mem_heap_t* heap = NULL;
ulint err;
*big_rec = NULL;
@@ -1144,10 +1143,6 @@ btr_cur_optimistic_insert(
index, entry, big_rec_vec);
}
- if (heap) {
- mem_heap_free(heap);
- }
-
return(DB_TOO_BIG_RECORD);
}
}
@@ -1170,15 +1165,11 @@ fail_err:
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
}
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
-
return(err);
}
if (UNIV_UNLIKELY(max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT
- || max_size < rec_size)
+ || max_size < rec_size)
&& UNIV_LIKELY(page_get_n_recs(page) > 1)
&& page_get_max_insert_size(page, 1) < rec_size) {
@@ -1244,10 +1235,6 @@ fail_err:
}
}
- if (UNIV_LIKELY_NULL(heap)) {
- mem_heap_free(heap);
- }
-
#ifdef BTR_CUR_HASH_ADAPT
if (!reorg && leaf && (cursor->flag == BTR_CUR_HASH)) {
btr_search_update_hash_node_on_insert(cursor);
@@ -3369,6 +3356,8 @@ btr_estimate_number_of_different_key_vals(
also the pages used for external storage of fields (those pages are
included in index->stat_n_leaf_pages) */
+ dict_index_stat_mutex_enter(index);
+
for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j]
= ((n_diff[j]
@@ -3398,6 +3387,8 @@ btr_estimate_number_of_different_key_vals(
index->stat_n_diff_key_vals[j] += add_on;
}
+ dict_index_stat_mutex_exit(index);
+
mem_free(n_diff);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
diff --git a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c
index d4a88565570..f299c2df969 100644
--- a/storage/innodb_plugin/buf/buf0buf.c
+++ b/storage/innodb_plugin/buf/buf0buf.c
@@ -1820,14 +1820,14 @@ buf_zip_decompress(
buf_block_t* block, /*!< in/out: block */
ibool check) /*!< in: TRUE=verify the page checksum */
{
- const byte* frame = block->page.zip.data;
+ const byte* frame = block->page.zip.data;
+ ulint stamp_checksum = mach_read_from_4(
+ frame + FIL_PAGE_SPACE_OR_CHKSUM);
ut_ad(buf_block_get_zip_size(block));
ut_a(buf_block_get_space(block) != 0);
- if (UNIV_LIKELY(check)) {
- ulint stamp_checksum = mach_read_from_4(
- frame + FIL_PAGE_SPACE_OR_CHKSUM);
+ if (UNIV_LIKELY(check && stamp_checksum != BUF_NO_CHECKSUM_MAGIC)) {
ulint calc_checksum = page_zip_calc_checksum(
frame, page_zip_get_size(&block->page.zip));
@@ -2251,8 +2251,9 @@ wait_until_unfixed:
/* Decompress the page and apply buffered operations
while not holding buf_pool_mutex or block->mutex. */
success = buf_zip_decompress(block, srv_use_checksums);
+ ut_a(success);
- if (UNIV_LIKELY(success && !recv_no_ibuf_operations)) {
+ if (UNIV_LIKELY(!recv_no_ibuf_operations)) {
ibuf_merge_or_delete_for_page(block, space, offset,
zip_size, TRUE);
}
@@ -2265,13 +2266,6 @@ wait_until_unfixed:
mutex_exit(&block->mutex);
buf_pool->n_pend_unzip--;
rw_lock_x_unlock(&block->lock);
-
- if (UNIV_UNLIKELY(!success)) {
-
- buf_pool_mutex_exit();
- return(NULL);
- }
-
break;
case BUF_BLOCK_ZIP_FREE:
diff --git a/storage/innodb_plugin/buf/buf0flu.c b/storage/innodb_plugin/buf/buf0flu.c
index ac62a7e9537..f2b07492470 100644
--- a/storage/innodb_plugin/buf/buf0flu.c
+++ b/storage/innodb_plugin/buf/buf0flu.c
@@ -153,12 +153,14 @@ buf_flush_block_cmp(
const void* p2) /*!< in: block2 */
{
int ret;
+ const buf_page_t* b1;
+ const buf_page_t* b2;
ut_ad(p1 != NULL);
ut_ad(p2 != NULL);
- const buf_page_t* b1 = *(const buf_page_t**) p1;
- const buf_page_t* b2 = *(const buf_page_t**) p2;
+ b1 = *(const buf_page_t**) p1;
+ b2 = *(const buf_page_t**) p2;
ut_ad(b1 != NULL);
ut_ad(b2 != NULL);
diff --git a/storage/innodb_plugin/data/data0data.c b/storage/innodb_plugin/data/data0data.c
index e3c1f1b4f23..0715b49bf9c 100644
--- a/storage/innodb_plugin/data/data0data.c
+++ b/storage/innodb_plugin/data/data0data.c
@@ -666,6 +666,21 @@ dtuple_convert_big_rec(
goto skip_field;
}
+ /* In DYNAMIC and COMPRESSED format, store
+ locally any non-BLOB columns whose maximum
+ length does not exceed 256 bytes. This is
+ because there is no room for the "external
+ storage" flag when the maximum length is 255
+ bytes or less. This restriction trivially
+ holds in REDUNDANT and COMPACT format, because
+ there we always store locally columns whose
+ length is up to local_len == 788 bytes.
+ @see rec_init_offsets_comp_ordinary */
+ if (ifield->col->mtype != DATA_BLOB
+ && ifield->col->len < 256) {
+ goto skip_field;
+ }
+
longest_i = i;
longest = savings;
diff --git a/storage/innodb_plugin/dict/dict0boot.c b/storage/innodb_plugin/dict/dict0boot.c
index 70b5bfa99f7..45d57b8c619 100644
--- a/storage/innodb_plugin/dict/dict0boot.c
+++ b/storage/innodb_plugin/dict/dict0boot.c
@@ -368,8 +368,8 @@ dict_boot(void)
#if DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2
#error "DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2"
#endif
-#if DICT_SYS_INDEXES_NAME_FIELD != 1 + 2
-#error "DICT_SYS_INDEXES_NAME_FIELD != 1 + 2"
+#if DICT_SYS_INDEXES_NAME_FIELD != 2 + 2
+#error "DICT_SYS_INDEXES_NAME_FIELD != 2 + 2"
#endif
table->id = DICT_INDEXES_ID;
diff --git a/storage/innodb_plugin/dict/dict0crea.c b/storage/innodb_plugin/dict/dict0crea.c
index 4ba7cd8a48c..653bff4bef6 100644
--- a/storage/innodb_plugin/dict/dict0crea.c
+++ b/storage/innodb_plugin/dict/dict0crea.c
@@ -1105,8 +1105,11 @@ dict_create_index_step(
dulint index_id = node->index->id;
- err = dict_index_add_to_cache(node->table, node->index,
- FIL_NULL, TRUE);
+ err = dict_index_add_to_cache(
+ node->table, node->index, FIL_NULL,
+ trx_is_strict(trx)
+ || dict_table_get_format(node->table)
+ >= DICT_TF_FORMAT_ZIP);
node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(!node->index == (err != DB_SUCCESS));
diff --git a/storage/innodb_plugin/dict/dict0dict.c b/storage/innodb_plugin/dict/dict0dict.c
index 8a03151d062..83438231689 100644
--- a/storage/innodb_plugin/dict/dict0dict.c
+++ b/storage/innodb_plugin/dict/dict0dict.c
@@ -80,6 +80,10 @@ UNIV_INTERN rw_lock_t dict_operation_lock;
/** Identifies generated InnoDB foreign key names */
static char dict_ibfk[] = "_ibfk_";
+/** array of mutexes protecting dict_index_t::stat_n_diff_key_vals[] */
+#define DICT_INDEX_STAT_MUTEX_SIZE 32
+mutex_t dict_index_stat_mutex[DICT_INDEX_STAT_MUTEX_SIZE];
+
/*******************************************************************//**
Tries to find column names for the index and sets the col field of the
index.
@@ -239,6 +243,45 @@ dict_mutex_exit_for_mysql(void)
mutex_exit(&(dict_sys->mutex));
}
+/** Get the mutex that protects index->stat_n_diff_key_vals[] */
+#define GET_INDEX_STAT_MUTEX(index) \
+ (&dict_index_stat_mutex[ut_fold_dulint(index->id) \
+ % DICT_INDEX_STAT_MUTEX_SIZE])
+
+/**********************************************************************//**
+Lock the appropriate mutex to protect index->stat_n_diff_key_vals[].
+index->id is used to pick the right mutex and it should not change
+before dict_index_stat_mutex_exit() is called on this index. */
+UNIV_INTERN
+void
+dict_index_stat_mutex_enter(
+/*========================*/
+ const dict_index_t* index) /*!< in: index */
+{
+ ut_ad(index != NULL);
+ ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
+ ut_ad(index->cached);
+ ut_ad(!index->to_be_dropped);
+
+ mutex_enter(GET_INDEX_STAT_MUTEX(index));
+}
+
+/**********************************************************************//**
+Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */
+UNIV_INTERN
+void
+dict_index_stat_mutex_exit(
+/*=======================*/
+ const dict_index_t* index) /*!< in: index */
+{
+ ut_ad(index != NULL);
+ ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
+ ut_ad(index->cached);
+ ut_ad(!index->to_be_dropped);
+
+ mutex_exit(GET_INDEX_STAT_MUTEX(index));
+}
+
/********************************************************************//**
Decrements the count of open MySQL handles to a table. */
UNIV_INTERN
@@ -605,6 +648,8 @@ void
dict_init(void)
/*===========*/
{
+ int i;
+
dict_sys = mem_alloc(sizeof(dict_sys_t));
mutex_create(&dict_sys->mutex, SYNC_DICT);
@@ -625,6 +670,10 @@ dict_init(void)
ut_a(dict_foreign_err_file);
mutex_create(&dict_foreign_err_mutex, SYNC_ANY_LATCH);
+
+ for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) {
+ mutex_create(&dict_index_stat_mutex[i], SYNC_INDEX_TREE);
+ }
}
/**********************************************************************//**
@@ -4171,9 +4220,13 @@ dict_update_statistics_low(
index = dict_table_get_first_index(table);
+ dict_index_stat_mutex_enter(index);
+
table->stat_n_rows = index->stat_n_diff_key_vals[
dict_index_get_n_unique(index)];
+ dict_index_stat_mutex_exit(index);
+
table->stat_clustered_index_size = index->stat_index_size;
table->stat_sum_of_other_index_sizes = sum_of_index_sizes
@@ -4351,6 +4404,8 @@ dict_index_print_low(
ut_ad(mutex_own(&(dict_sys->mutex)));
+ dict_index_stat_mutex_enter(index);
+
if (index->n_user_defined_cols > 0) {
n_vals = index->stat_n_diff_key_vals[
index->n_user_defined_cols];
@@ -4358,6 +4413,8 @@ dict_index_print_low(
n_vals = index->stat_n_diff_key_vals[1];
}
+ dict_index_stat_mutex_exit(index);
+
if (dict_index_is_clust(index)) {
type_string = "clustered index";
} else if (dict_index_is_unique(index)) {
@@ -4767,8 +4824,10 @@ UNIV_INTERN
void
dict_table_check_for_dup_indexes(
/*=============================*/
- const dict_table_t* table) /*!< in: Check for dup indexes
+ const dict_table_t* table, /*!< in: Check for dup indexes
in this table */
+ ibool tmp_ok) /*!< in: TRUE=allow temporary
+ index names */
{
/* Check for duplicates, ignoring indexes that are marked
as to be dropped */
@@ -4782,9 +4841,11 @@ dict_table_check_for_dup_indexes(
ut_a(UT_LIST_GET_LEN(table->indexes) > 0);
index1 = UT_LIST_GET_FIRST(table->indexes);
- index2 = UT_LIST_GET_NEXT(indexes, index1);
- while (index1 && index2) {
+ do {
+ ut_ad(tmp_ok || *index1->name != TEMP_INDEX_PREFIX);
+
+ index2 = UT_LIST_GET_NEXT(indexes, index1);
while (index2) {
@@ -4796,8 +4857,7 @@ dict_table_check_for_dup_indexes(
}
index1 = UT_LIST_GET_NEXT(indexes, index1);
- index2 = UT_LIST_GET_NEXT(indexes, index1);
- }
+ } while (index1);
}
#endif /* UNIV_DEBUG */
@@ -4850,5 +4910,9 @@ dict_close(void)
mem_free(dict_sys);
dict_sys = NULL;
+
+ for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) {
+ mutex_free(&dict_index_stat_mutex[i]);
+ }
}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/innodb_plugin/ha/ha0ha.c b/storage/innodb_plugin/ha/ha0ha.c
index db85288298d..9d9d341ad39 100644
--- a/storage/innodb_plugin/ha/ha0ha.c
+++ b/storage/innodb_plugin/ha/ha0ha.c
@@ -403,8 +403,6 @@ ha_print_info(
FILE* file, /*!< in: file where to print */
hash_table_t* table) /*!< in: hash table */
{
- ut_ad(table);
- ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
#ifdef UNIV_DEBUG
/* Some of the code here is disabled for performance reasons in production
builds, see http://bugs.mysql.com/36941 */
@@ -418,6 +416,8 @@ builds, see http://bugs.mysql.com/36941 */
#endif /* PRINT_USED_CELLS */
ulint n_bufs;
+ ut_ad(table);
+ ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
#ifdef PRINT_USED_CELLS
for (i = 0; i < hash_get_n_cells(table); i++) {
diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
index fbbebbce8fd..0fc6e786f4c 100644
--- a/storage/innodb_plugin/handler/ha_innodb.cc
+++ b/storage/innodb_plugin/handler/ha_innodb.cc
@@ -108,7 +108,6 @@ static ulong commit_threads = 0;
static pthread_mutex_t commit_threads_m;
static pthread_cond_t commit_cond;
static pthread_mutex_t commit_cond_m;
-static pthread_mutex_t analyze_mutex;
static bool innodb_inited = 0;
#define INSIDE_HA_INNOBASE_CC
@@ -316,7 +315,7 @@ static MYSQL_THDVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG,
static handler *innobase_create_handler(handlerton *hton,
- TABLE_SHARE *table,
+ TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_innobase(hton, table);
@@ -429,8 +428,9 @@ static
int
innobase_start_trx_and_assign_read_view(
/*====================================*/
- handlerton* hton, /*!< in: Innodb handlerton */
- THD* thd); /*!< in: MySQL thread handle of the user for whom
+ /* out: 0 */
+ handlerton* hton, /* in: Innodb handlerton */
+ THD* thd); /* in: MySQL thread handle of the user for whom
the transaction should be committed */
/****************************************************************//**
Flushes InnoDB logs to disk and makes a checkpoint. Really, a commit flushes
@@ -1815,6 +1815,19 @@ trx_is_interrupted(
return(trx && trx->mysql_thd && thd_killed((THD*) trx->mysql_thd));
}
+/**********************************************************************//**
+Determines if the currently running transaction is in strict mode.
+@return TRUE if strict */
+extern "C" UNIV_INTERN
+ibool
+trx_is_strict(
+/*==========*/
+ trx_t* trx) /*!< in: transaction */
+{
+ return(trx && trx->mysql_thd
+ && THDVAR((THD*) trx->mysql_thd, strict_mode));
+}
+
/**************************************************************//**
Resets some fields of a prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */
@@ -2134,7 +2147,7 @@ mem_free_and_error:
}
sql_print_error("InnoDB: invalid value "
- "innodb_file_format_check=%s",
+ "innodb_change_buffering=%s",
innobase_change_buffering);
goto mem_free_and_error;
}
@@ -2223,7 +2236,6 @@ innobase_change_buffering_inited_ok:
pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST);
- pthread_mutex_init(&analyze_mutex, MY_MUTEX_INIT_FAST);
pthread_cond_init(&commit_cond, NULL);
innodb_inited= 1;
#ifdef MYSQL_DYNAMIC_PLUGIN
@@ -2278,7 +2290,6 @@ innobase_end(
pthread_mutex_destroy(&prepare_commit_mutex);
pthread_mutex_destroy(&commit_threads_m);
pthread_mutex_destroy(&commit_cond_m);
- pthread_mutex_destroy(&analyze_mutex);
pthread_cond_destroy(&commit_cond);
}
@@ -5126,7 +5137,7 @@ ha_innobase::unlock_row(void)
case ROW_READ_WITH_LOCKS:
if (!srv_locks_unsafe_for_binlog
&& prebuilt->trx->isolation_level
- != TRX_ISO_READ_COMMITTED) {
+ > TRX_ISO_READ_COMMITTED) {
break;
}
/* fall through */
@@ -5165,7 +5176,7 @@ ha_innobase::try_semi_consistent_read(bool yes)
if (yes
&& (srv_locks_unsafe_for_binlog
- || prebuilt->trx->isolation_level == TRX_ISO_READ_COMMITTED)) {
+ || prebuilt->trx->isolation_level <= TRX_ISO_READ_COMMITTED)) {
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
} else {
prebuilt->row_read_type = ROW_READ_WITH_LOCKS;
@@ -7583,6 +7594,8 @@ ha_innobase::info(
break;
}
+ dict_index_stat_mutex_enter(index);
+
if (index->stat_n_diff_key_vals[j + 1] == 0) {
rec_per_key = stats.records;
@@ -7591,6 +7604,8 @@ ha_innobase::info(
index->stat_n_diff_key_vals[j + 1]);
}
+ dict_index_stat_mutex_exit(index);
+
/* Since MySQL seems to favor table scans
too much over index searches, we pretend
index selectivity is 2 times better than
@@ -7645,15 +7660,9 @@ ha_innobase::analyze(
THD* thd, /*!< in: connection thread handle */
HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
{
- /* Serialize ANALYZE TABLE inside InnoDB, see
- Bug#38996 Race condition in ANALYZE TABLE */
- pthread_mutex_lock(&analyze_mutex);
-
/* Simply call ::info() with all the flags */
info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);
- pthread_mutex_unlock(&analyze_mutex);
-
return(0);
}
@@ -9086,7 +9095,7 @@ ha_innobase::store_lock(
isolation_level = trx->isolation_level;
if ((srv_locks_unsafe_for_binlog
- || isolation_level == TRX_ISO_READ_COMMITTED)
+ || isolation_level <= TRX_ISO_READ_COMMITTED)
&& isolation_level != TRX_ISO_SERIALIZABLE
&& (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT)
&& (sql_command == SQLCOM_INSERT_SELECT
diff --git a/storage/innodb_plugin/handler/handler0alter.cc b/storage/innodb_plugin/handler/handler0alter.cc
index 071253d2dae..e474c318c58 100644
--- a/storage/innodb_plugin/handler/handler0alter.cc
+++ b/storage/innodb_plugin/handler/handler0alter.cc
@@ -722,6 +722,8 @@ err_exit:
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
+ ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE));
+
/* If a new primary key is defined for the table we need
to drop the original table and rebuild all indexes. */
@@ -754,6 +756,8 @@ err_exit:
user_thd);
}
+ ut_d(dict_table_check_for_dup_indexes(innodb_table,
+ FALSE));
row_mysql_unlock_data_dictionary(trx);
goto err_exit;
}
@@ -828,7 +832,7 @@ error_handling:
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table));
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE));
if (!new_primary) {
error = row_merge_rename_indexes(trx, indexed_table);
@@ -917,6 +921,7 @@ convert_error:
}
if (dict_locked) {
+ ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE));
row_mysql_unlock_data_dictionary(trx);
}
@@ -959,6 +964,7 @@ ha_innobase::prepare_drop_index(
/* Test and mark all the indexes to be dropped */
row_mysql_lock_data_dictionary(trx);
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
/* Check that none of the indexes have previously been flagged
for deletion. */
@@ -1124,6 +1130,7 @@ func_exit:
} while (index);
}
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
row_mysql_unlock_data_dictionary(trx);
DBUG_RETURN(err);
@@ -1170,6 +1177,7 @@ ha_innobase::final_drop_index(
prebuilt->table->flags, user_thd);
row_mysql_lock_data_dictionary(trx);
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
if (UNIV_UNLIKELY(err)) {
@@ -1210,9 +1218,8 @@ ha_innobase::final_drop_index(
valid index entry count in the translation table to zero */
share->idx_trans_tbl.index_count = 0;
- ut_d(dict_table_check_for_dup_indexes(prebuilt->table));
-
func_exit:
+ ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE));
trx_commit_for_mysql(trx);
trx_commit_for_mysql(prebuilt->trx);
row_mysql_unlock_data_dictionary(trx);
diff --git a/storage/innodb_plugin/include/dict0boot.h b/storage/innodb_plugin/include/dict0boot.h
index e01fafe652d..1a13bd1503a 100644
--- a/storage/innodb_plugin/include/dict0boot.h
+++ b/storage/innodb_plugin/include/dict0boot.h
@@ -137,7 +137,7 @@ clustered index */
#define DICT_SYS_INDEXES_PAGE_NO_FIELD 8
#define DICT_SYS_INDEXES_SPACE_NO_FIELD 7
#define DICT_SYS_INDEXES_TYPE_FIELD 6
-#define DICT_SYS_INDEXES_NAME_FIELD 3
+#define DICT_SYS_INDEXES_NAME_FIELD 4
/* When a row id which is zero modulo this number (which must be a power of
two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is
diff --git a/storage/innodb_plugin/include/dict0dict.h b/storage/innodb_plugin/include/dict0dict.h
index 12396556c2d..79dcbb30de2 100644
--- a/storage/innodb_plugin/include/dict0dict.h
+++ b/storage/innodb_plugin/include/dict0dict.h
@@ -928,9 +928,10 @@ UNIV_INTERN
void
dict_table_check_for_dup_indexes(
/*=============================*/
- const dict_table_t* table); /*!< in: Check for dup indexes
+ const dict_table_t* table, /*!< in: Check for dup indexes
in this table */
-
+ ibool tmp_ok);/*!< in: TRUE=allow temporary
+ index names */
#endif /* UNIV_DEBUG */
/**********************************************************************//**
Builds a node pointer out of a physical record and a page number.
@@ -1060,6 +1061,22 @@ UNIV_INTERN
void
dict_mutex_exit_for_mysql(void);
/*===========================*/
+/**********************************************************************//**
+Lock the appropriate mutex to protect index->stat_n_diff_key_vals[].
+index->id is used to pick the right mutex and it should not change
+before dict_index_stat_mutex_exit() is called on this index. */
+UNIV_INTERN
+void
+dict_index_stat_mutex_enter(
+/*========================*/
+ const dict_index_t* index); /*!< in: index */
+/**********************************************************************//**
+Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */
+UNIV_INTERN
+void
+dict_index_stat_mutex_exit(
+/*=======================*/
+ const dict_index_t* index); /*!< in: index */
/********************************************************************//**
Checks if the database name in two table names is the same.
@return TRUE if same db name */
diff --git a/storage/innodb_plugin/include/log0recv.h b/storage/innodb_plugin/include/log0recv.h
index 3209799e140..9f334a34b44 100644
--- a/storage/innodb_plugin/include/log0recv.h
+++ b/storage/innodb_plugin/include/log0recv.h
@@ -368,8 +368,8 @@ typedef struct recv_addr_struct recv_addr_t;
struct recv_addr_struct{
enum recv_addr_state state;
/*!< recovery state of the page */
- ulint space; /*!< space id */
- ulint page_no;/*!< page number */
+ unsigned space:32;/*!< space id */
+ unsigned page_no:32;/*!< page number */
UT_LIST_BASE_NODE_T(recv_t)
rec_list;/*!< list of log records for this page */
hash_node_t addr_hash;/*!< hash node in the hash bucket chain */
diff --git a/storage/innodb_plugin/include/trx0trx.h b/storage/innodb_plugin/include/trx0trx.h
index 480f265a138..6872fb463c0 100644
--- a/storage/innodb_plugin/include/trx0trx.h
+++ b/storage/innodb_plugin/include/trx0trx.h
@@ -391,6 +391,14 @@ ibool
trx_is_interrupted(
/*===============*/
trx_t* trx); /*!< in: transaction */
+/**********************************************************************//**
+Determines if the currently running transaction is in strict mode.
+@return TRUE if strict */
+UNIV_INTERN
+ibool
+trx_is_strict(
+/*==========*/
+ trx_t* trx); /*!< in: transaction */
#else /* !UNIV_HOTBACKUP */
#define trx_is_interrupted(trx) FALSE
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/innodb_plugin/include/univ.i b/storage/innodb_plugin/include/univ.i
index 0df05999845..49717760456 100644
--- a/storage/innodb_plugin/include/univ.i
+++ b/storage/innodb_plugin/include/univ.i
@@ -46,7 +46,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 1
#define INNODB_VERSION_MINOR 0
-#define INNODB_VERSION_BUGFIX 7
+#define INNODB_VERSION_BUGFIX 8
/* The following is the InnoDB version as shown in
SELECT plugin_version FROM information_schema.plugins;
@@ -115,7 +115,7 @@ if we are compiling on Windows. */
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
# include <sys/stat.h>
-# if !defined(__NETWARE__) && !defined(__WIN__)
+# if !defined(__NETWARE__) && !defined(__WIN__)
# include <sys/mman.h> /* mmap() for os0proc.c */
# endif
@@ -165,6 +165,9 @@ command. Not tested on Windows. */
#define UNIV_COMPILE_TEST_FUNCS
*/
+#ifdef HAVE_purify
+# define UNIV_DEBUG_VALGRIND
+#endif /* HAVE_purify */
#if 0
#define UNIV_DEBUG_VALGRIND /* Enable extra
Valgrind instrumentation */
@@ -202,6 +205,10 @@ operations (very slow); also UNIV_DEBUG must be defined */
adaptive hash index */
#define UNIV_SRV_PRINT_LATCH_WAITS /* enable diagnostic output
in sync0sync.c */
+#define UNIV_BTR_AVOID_COPY /* when splitting B-tree nodes,
+ do not move any records when
+ all the records would
+ be moved */
#define UNIV_BTR_PRINT /* enable functions for
printing B-trees */
#define UNIV_ZIP_DEBUG /* extensive consistency checks
diff --git a/storage/innodb_plugin/lock/lock0lock.c b/storage/innodb_plugin/lock/lock0lock.c
index d5fff572aee..04e5fe1a65a 100644
--- a/storage/innodb_plugin/lock/lock0lock.c
+++ b/storage/innodb_plugin/lock/lock0lock.c
@@ -2400,7 +2400,7 @@ lock_rec_inherit_to_gap(
if (!lock_rec_get_insert_intention(lock)
&& !((srv_locks_unsafe_for_binlog
|| lock->trx->isolation_level
- == TRX_ISO_READ_COMMITTED)
+ <= TRX_ISO_READ_COMMITTED)
&& lock_get_mode(lock) == LOCK_X)) {
lock_rec_add_to_queue(LOCK_REC | LOCK_GAP
@@ -4710,6 +4710,7 @@ lock_rec_queue_validate(
ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
block, heap_no, impl_trx));
}
+#if 0
} else {
/* The kernel mutex may get released temporarily in the
@@ -4720,6 +4721,27 @@ lock_rec_queue_validate(
(fil_space_t::latch), the following check WILL break
latching order and may cause a deadlock of threads. */
+ /* NOTE: This is a bogus check that would fail in the
+ following case: Our transaction is updating a
+ row. After it has updated the clustered index record,
+ it goes to a secondary index record and finds someone
+ else holding an explicit S- or X-lock on that
+ secondary index record, presumably from a locking
+ read. Our transaction cannot update the secondary
+ index immediately, but places a waiting X-lock request
+ on the secondary index record. There is nothing
+ illegal in this. The assertion is simply too strong. */
+
+ /* From the locking point of view, each secondary
+ index is a separate table. A lock that is held on
+ secondary index rec does not give any rights to modify
+ or read the clustered index rec. Therefore, we can
+ think of the sec index as a separate 'table' from the
+ clust index 'table'. Conversely, a transaction that
+ has acquired a lock on and modified a clustered index
+ record may need to wait for a lock on the
+ corresponding record in a secondary index. */
+
impl_trx = lock_sec_rec_some_has_impl_off_kernel(
rec, index, offsets);
@@ -4730,6 +4752,7 @@ lock_rec_queue_validate(
ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
block, heap_no, impl_trx));
}
+#endif
}
lock = lock_rec_get_first(block, heap_no);
diff --git a/storage/innodb_plugin/log/log0recv.c b/storage/innodb_plugin/log/log0recv.c
index 7f5b2df7882..a727d6be768 100644
--- a/storage/innodb_plugin/log/log0recv.c
+++ b/storage/innodb_plugin/log/log0recv.c
@@ -300,11 +300,11 @@ recv_sys_init(
flush_list during recovery process.
As this initialization is done while holding the buffer pool
mutex we perform it before acquiring recv_sys->mutex. */
+#ifndef UNIV_HOTBACKUP
buf_flush_init_flush_rbt();
mutex_enter(&(recv_sys->mutex));
-#ifndef UNIV_HOTBACKUP
recv_sys->heap = mem_heap_create_in_buffer(256);
#else /* !UNIV_HOTBACKUP */
recv_sys->heap = mem_heap_create(256);
@@ -321,7 +321,7 @@ recv_sys_init(
recv_sys->len = 0;
recv_sys->recovered_offset = 0;
- recv_sys->addr_hash = hash_create(available_memory / 64);
+ recv_sys->addr_hash = hash_create(available_memory / 512);
recv_sys->n_addrs = 0;
recv_sys->apply_log_recs = FALSE;
@@ -361,7 +361,7 @@ recv_sys_empty_hash(void)
hash_table_free(recv_sys->addr_hash);
mem_heap_empty(recv_sys->heap);
- recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256);
+ recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 512);
}
#ifndef UNIV_HOTBACKUP
diff --git a/storage/innodb_plugin/mysql-test/have_innodb.inc b/storage/innodb_plugin/mysql-test/have_innodb.inc
deleted file mode 100644
index 8944cc46f3e..00000000000
--- a/storage/innodb_plugin/mysql-test/have_innodb.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-disable_query_log;
---require r/true.require
-select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` from information_schema.engines where engine = 'innodb';
-enable_query_log;
diff --git a/storage/innodb_plugin/mysql-test/innodb-analyze.result b/storage/innodb_plugin/mysql-test/innodb-analyze.result
deleted file mode 100644
index 2aee004a2d6..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-analyze.result
+++ /dev/null
@@ -1,2 +0,0 @@
-Variable_name Value
-innodb_stats_sample_pages 1
diff --git a/storage/innodb_plugin/mysql-test/innodb-consistent.result b/storage/innodb_plugin/mysql-test/innodb-consistent.result
deleted file mode 100644
index 9115791b99c..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-consistent.result
+++ /dev/null
@@ -1,35 +0,0 @@
-drop table if exists t1;
-set session transaction isolation level read committed;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-create table t2 like t1;
-insert into t2 values (1),(2),(3),(4),(5),(6),(7);
-set autocommit=0;
-begin;
-replace into t1 select * from t2;
-set session transaction isolation level read committed;
-set autocommit=0;
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-commit;
-begin;
-insert into t1 select * from t2;
-set session transaction isolation level read committed;
-set autocommit=0;
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-commit;
-select * from t1;
-a
-1
-2
-3
-4
-5
-6
-7
-drop table t1;
-drop table t2;
diff --git a/storage/innodb_plugin/mysql-test/innodb-consistent.test b/storage/innodb_plugin/mysql-test/innodb-consistent.test
deleted file mode 100644
index 791600fc8a7..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-consistent.test
+++ /dev/null
@@ -1,58 +0,0 @@
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
-# a consistent read of the source table.
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-connection a;
-set session transaction isolation level read committed;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-create table t2 like t1;
-insert into t2 values (1),(2),(3),(4),(5),(6),(7);
-set autocommit=0;
-
-# REPLACE INTO ... SELECT case
-begin;
-# this should not result in any locks on t2.
-replace into t1 select * from t2;
-
-connection b;
-set session transaction isolation level read committed;
-set autocommit=0;
-# should not cuase a lock wait.
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-connection a;
-commit;
-
-# INSERT INTO ... SELECT case
-begin;
-# this should not result in any locks on t2.
-insert into t1 select * from t2;
-
-connection b;
-set session transaction isolation level read committed;
-set autocommit=0;
-# should not cuase a lock wait.
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-connection a;
-commit;
-
-select * from t1;
-drop table t1;
-drop table t2;
-
-connection default;
-disconnect a;
-disconnect b;
diff --git a/storage/innodb_plugin/mysql-test/innodb-index.inc b/storage/innodb_plugin/mysql-test/innodb-index.inc
deleted file mode 100644
index 37de3162abe..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-index.inc
+++ /dev/null
@@ -1,26 +0,0 @@
---eval create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=$charset
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
-commit;
---error ER_DUP_ENTRY
-alter table t1 add unique index (b);
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-show create table t1;
-alter table t1 add index (b);
-insert into t1 values(10,10,'kkk','iii');
-select * from t1;
-select * from t1 force index(b) order by b;
-explain select * from t1 force index(b) order by b;
-show create table t1;
-alter table t1 add unique index (c), add index (d);
-insert into t1 values(11,11,'aaa','mmm');
-select * from t1;
-select * from t1 force index(b) order by b;
-select * from t1 force index(c) order by c;
-select * from t1 force index(d) order by d;
-explain select * from t1 force index(b) order by b;
-explain select * from t1 force index(c) order by c;
-explain select * from t1 force index(d) order by d;
-show create table t1;
-check table t1;
-drop table t1;
diff --git a/storage/innodb_plugin/mysql-test/innodb-index.result b/storage/innodb_plugin/mysql-test/innodb-index.result
deleted file mode 100644
index a7d66b15300..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-index.result
+++ /dev/null
@@ -1,1170 +0,0 @@
-create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
-insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak');
-commit;
-alter table t1 add index b (b), add index b (b);
-ERROR 42000: Duplicate key name 'b'
-alter table t1 add index (b,b);
-ERROR 42S21: Duplicate column name 'b'
-alter table t1 add index d2 (d);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- KEY `d2` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-explain select * from t1 force index(d2) order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL d2 23 NULL 4
-select * from t1 force index (d2) order by d;
-a b c d
-3 4 ad ad
-2 3 ak ak
-5 5 oo oo
-4 4 tr tr
-alter table t1 add unique index (b);
-ERROR 23000: Duplicate entry '4' for key 'b'
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- KEY `d2` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 add index (b);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- KEY `d2` (`d`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB;
-alter table t1 add unique index (c), add index (d);
-ERROR HY000: Table 'test.t1#1' already exists
-rename table `t1#1` to `t1#2`;
-alter table t1 add unique index (c), add index (d);
-ERROR HY000: Table 'test.t1#2' already exists
-drop table `t1#2`;
-alter table t1 add unique index (c), add index (d);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- UNIQUE KEY `c` (`c`),
- KEY `d2` (`d`),
- KEY `b` (`b`),
- KEY `d` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 10 NULL 4
-alter table t1 add primary key (a), drop index c;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `d2` (`d`),
- KEY `b` (`b`),
- KEY `d` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 add primary key (c);
-ERROR 42000: Multiple primary key defined
-alter table t1 drop primary key, add primary key (b);
-ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
-create unique index c on t1 (c);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `c` (`c`),
- KEY `d2` (`d`),
- KEY `b` (`b`),
- KEY `d` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 10 NULL 4
-select * from t1 force index(c) order by c;
-a b c d
-3 4 ad ad
-2 3 ak ak
-5 5 oo oo
-4 4 tr tr
-alter table t1 drop index b, add index (b);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `c` (`c`),
- KEY `d2` (`d`),
- KEY `d` (`d`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-insert into t1 values(6,1,'ggg','ggg');
-select * from t1;
-a b c d
-2 3 ak ak
-3 4 ad ad
-4 4 tr tr
-5 5 oo oo
-6 1 ggg ggg
-select * from t1 force index(b) order by b;
-a b c d
-6 1 ggg ggg
-2 3 ak ak
-3 4 ad ad
-4 4 tr tr
-5 5 oo oo
-select * from t1 force index(c) order by c;
-a b c d
-3 4 ad ad
-2 3 ak ak
-6 1 ggg ggg
-5 5 oo oo
-4 4 tr tr
-select * from t1 force index(d) order by d;
-a b c d
-3 4 ad ad
-2 3 ak ak
-6 1 ggg ggg
-5 5 oo oo
-4 4 tr tr
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 5 NULL 5
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 10 NULL 5
-explain select * from t1 force index(d) order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL d 23 NULL 5
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `c` (`c`),
- KEY `d2` (`d`),
- KEY `d` (`d`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add index (c(2));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `c` (`c`(2))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 add unique index (d(10));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `d` (`d`(10)),
- KEY `c` (`c`(2))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-insert into t1 values(5,1,'ggg','ggg');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 3 ad ad
-4 4 afe afe
-5 1 ggg ggg
-select * from t1 force index(c) order by c;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 3 ad ad
-4 4 afe afe
-5 1 ggg ggg
-select * from t1 force index(d) order by d;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 3 ad ad
-4 4 afe afe
-5 1 ggg ggg
-explain select * from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
-explain select * from t1 force index(d) order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `d` (`d`(10)),
- KEY `c` (`c`(2))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 drop index d;
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 3 ad ad
-4 4 afe afe
-5 1 ggg ggg
-8 9 fff fff
-select * from t1 force index(c) order by c;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 3 ad ad
-4 4 afe afe
-8 9 fff fff
-5 1 ggg ggg
-explain select * from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
-explain select * from t1 order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `c` (`c`(2))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add unique index (b,c);
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 16 NULL 5
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `b` (`b`,`c`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 add index (b,c);
-insert into t1 values(11,11,'kkk','kkk');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-11 11 kkk kkk
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-11 11 kkk kkk
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 16 NULL 6
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `b` (`b`,`c`),
- KEY `b_2` (`b`,`c`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t1 add unique index (c,d);
-insert into t1 values(13,13,'yyy','aaa');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-11 11 kkk kkk
-13 13 yyy aaa
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-11 11 kkk kkk
-13 13 yyy aaa
-select * from t1 force index(c) order by c;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-11 11 kkk kkk
-13 13 yyy aaa
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 16 NULL 7
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 34 NULL 7
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `b` (`b`,`c`),
- UNIQUE KEY `c` (`c`,`d`),
- KEY `b_2` (`b`,`c`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int not null, c int, primary key (a), key (b)) engine = innodb;
-create table t3(a int not null, c int not null, d int, primary key (a), key (c)) engine = innodb;
-create table t4(a int not null, d int not null, e int, primary key (a), key (d)) engine = innodb;
-create table t2(a int not null, b int not null, c int not null, d int not null, e int,
-foreign key (b) references t1(b) on delete cascade,
-foreign key (c) references t3(c), foreign key (d) references t4(d))
-engine = innodb;
-alter table t1 drop index b;
-ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint
-alter table t3 drop index c;
-ERROR HY000: Cannot drop index 'c': needed in a foreign key constraint
-alter table t4 drop index d;
-ERROR HY000: Cannot drop index 'd': needed in a foreign key constraint
-alter table t2 drop index b;
-ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint
-alter table t2 drop index b, drop index c, drop index d;
-ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint
-create unique index dc on t2 (d,c);
-create index dc on t1 (b,c);
-alter table t2 add primary key (a);
-insert into t1 values (1,1,1);
-insert into t3 values (1,1,1);
-insert into t4 values (1,1,1);
-insert into t2 values (1,1,1,1,1);
-commit;
-alter table t4 add constraint dc foreign key (a) references t1(a);
-show create table t4;
-Table Create Table
-t4 CREATE TABLE `t4` (
- `a` int(11) NOT NULL,
- `d` int(11) NOT NULL,
- `e` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `d` (`d`),
- CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t3 add constraint dc foreign key (a) references t1(a);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 121)
-show create table t3;
-Table Create Table
-t3 CREATE TABLE `t3` (
- `a` int(11) NOT NULL,
- `c` int(11) NOT NULL,
- `d` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `c` (`c`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-alter table t2 drop index b, add index (b);
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `a` int(11) NOT NULL,
- `b` int(11) NOT NULL,
- `c` int(11) NOT NULL,
- `d` int(11) NOT NULL,
- `e` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `dc` (`d`,`c`),
- KEY `c` (`c`),
- KEY `b` (`b`),
- CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`b`) ON DELETE CASCADE,
- CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t3` (`c`),
- CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`d`) REFERENCES `t4` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-delete from t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
-drop index dc on t4;
-ERROR 42000: Can't DROP 'dc'; check that column/key exists
-alter table t3 drop foreign key dc;
-ERROR HY000: Error on rename of './test/t3' to '#sql2-temporary' (errno: 152)
-alter table t4 drop foreign key dc;
-select * from t2;
-a b c d e
-1 1 1 1 1
-delete from t1;
-select * from t2;
-a b c d e
-drop table t2,t4,t3,t1;
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=utf8;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add unique index (b);
-ERROR 23000: Duplicate entry '2' for key 'b'
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-alter table t1 add index (b);
-insert into t1 values(10,10,'kkk','iii');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 5 NULL 6
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-alter table t1 add unique index (c), add index (d);
-insert into t1 values(11,11,'aaa','mmm');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-select * from t1 force index(c) order by c;
-a b c d
-11 11 aaa mmm
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-select * from t1 force index(d) order by d;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 5 NULL 7
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 31 NULL 7
-explain select * from t1 force index(d) order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL d 63 NULL 7
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `c` (`c`),
- KEY `b` (`b`),
- KEY `d` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-drop table t1;
-create table t1(a int not null, b int) engine = innodb;
-insert into t1 values (1,1),(1,1),(1,1),(1,1);
-alter table t1 add unique index (a);
-ERROR 23000: Duplicate entry '1' for key 'a'
-alter table t1 add unique index (b);
-ERROR 23000: Duplicate entry '1' for key 'b'
-alter table t1 add unique index (a), add unique index(b);
-ERROR 23000: Duplicate entry '1' for key 'a'
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, c int not null,b int, primary key(a), unique key(c), key(b)) engine = innodb;
-alter table t1 drop index c, drop index b;
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `c` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int, primary key(a)) engine = innodb;
-alter table t1 add index (b);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
-alter table t1 add unique index (b), add unique index (c), add unique index (d);
-ERROR 23000: Duplicate entry '4' for key 'b'
-alter table t1 add unique index (c), add unique index (b), add index (d);
-ERROR 23000: Duplicate entry 'ac' for key 'c'
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-drop table t1;
-create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb;
-insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1);
-alter table t1 add unique index (b);
-insert into t1 values (10,20,20),(11,19,19),(12,18,18),(13,17,17);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) NOT NULL,
- `c` int(11) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `b` (`b`),
- KEY `c` (`c`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 5 NULL 9
-explain select * from t1 order by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL 9
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 4 NULL 9
-select * from t1 order by a;
-a b c
-1 5 1
-2 4 2
-3 3 3
-4 2 4
-5 1 5
-10 20 20
-11 19 19
-12 18 18
-13 17 17
-select * from t1 force index(b) order by b;
-a b c
-5 1 5
-4 2 4
-3 3 3
-2 4 2
-1 5 1
-13 17 17
-12 18 18
-11 19 19
-10 20 20
-select * from t1 force index(c) order by c;
-a b c
-1 5 1
-2 4 2
-3 3 3
-4 2 4
-5 1 5
-13 17 17
-12 18 18
-11 19 19
-10 20 20
-drop table t1;
-create table t1(a int not null, b int not null) engine=innodb;
-insert into t1 values (1,1);
-alter table t1 add primary key(b);
-insert into t1 values (2,2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) NOT NULL,
- PRIMARY KEY (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-select * from t1;
-a b
-1 1
-2 2
-explain select * from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2
-explain select * from t1 order by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using filesort
-explain select * from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL 2
-checksum table t1;
-Table Checksum
-test.t1 582702641
-drop table t1;
-create table t1(a int not null) engine=innodb;
-insert into t1 values (1);
-alter table t1 add primary key(a);
-insert into t1 values (2);
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-commit;
-select * from t1;
-a
-1
-2
-explain select * from t1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index
-explain select * from t1 order by a;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index
-drop table t1;
-create table t2(d varchar(17) primary key) engine=innodb default charset=utf8;
-create table t3(a int primary key) engine=innodb;
-insert into t3 values(22),(44),(33),(55),(66);
-insert into t2 values ('jejdkrun87'),('adfd72nh9k'),
-('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik');
-create table t1(a int, b blob, c text, d text not null)
-engine=innodb default charset = utf8;
-insert into t1
-select a,left(repeat(d,100*a),65535),repeat(d,20*a),d from t2,t3;
-drop table t2, t3;
-select count(*) from t1 where a=44;
-count(*)
-5
-select a,
-length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
-a length(b) b=left(repeat(d,100*a),65535) length(c) c=repeat(d,20*a) d
-22 22000 1 4400 1 adfd72nh9k
-22 35200 1 7040 1 adfdijn0loKNHJik
-22 28600 1 5720 1 adfdijnmnb78k
-22 26400 1 5280 1 adfdpplkeock
-22 22000 1 4400 1 jejdkrun87
-33 33000 1 6600 1 adfd72nh9k
-33 52800 1 10560 1 adfdijn0loKNHJik
-33 42900 1 8580 1 adfdijnmnb78k
-33 39600 1 7920 1 adfdpplkeock
-33 33000 1 6600 1 jejdkrun87
-44 44000 1 8800 1 adfd72nh9k
-44 65535 1 14080 1 adfdijn0loKNHJik
-44 57200 1 11440 1 adfdijnmnb78k
-44 52800 1 10560 1 adfdpplkeock
-44 44000 1 8800 1 jejdkrun87
-55 55000 1 11000 1 adfd72nh9k
-55 65535 1 17600 1 adfdijn0loKNHJik
-55 65535 1 14300 1 adfdijnmnb78k
-55 65535 1 13200 1 adfdpplkeock
-55 55000 1 11000 1 jejdkrun87
-66 65535 1 13200 1 adfd72nh9k
-66 65535 1 21120 1 adfdijn0loKNHJik
-66 65535 1 17160 1 adfdijnmnb78k
-66 65535 1 15840 1 adfdpplkeock
-66 65535 1 13200 1 jejdkrun87
-alter table t1 add primary key (a), add key (b(20));
-ERROR 23000: Duplicate entry '22' for key 'PRIMARY'
-delete from t1 where a%2;
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-alter table t1 add primary key (a,b(255),c(255)), add key (b(767));
-select count(*) from t1 where a=44;
-count(*)
-5
-select a,
-length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
-a length(b) b=left(repeat(d,100*a),65535) length(c) c=repeat(d,20*a) d
-22 22000 1 4400 1 adfd72nh9k
-22 35200 1 7040 1 adfdijn0loKNHJik
-22 28600 1 5720 1 adfdijnmnb78k
-22 26400 1 5280 1 adfdpplkeock
-22 22000 1 4400 1 jejdkrun87
-44 44000 1 8800 1 adfd72nh9k
-44 65535 1 14080 1 adfdijn0loKNHJik
-44 57200 1 11440 1 adfdijnmnb78k
-44 52800 1 10560 1 adfdpplkeock
-44 44000 1 8800 1 jejdkrun87
-66 65535 1 13200 1 adfd72nh9k
-66 65535 1 21120 1 adfdijn0loKNHJik
-66 65535 1 17160 1 adfdijnmnb78k
-66 65535 1 15840 1 adfdpplkeock
-66 65535 1 13200 1 jejdkrun87
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` blob NOT NULL,
- `c` text NOT NULL,
- `d` text NOT NULL,
- PRIMARY KEY (`a`,`b`(255),`c`(255)),
- KEY `b` (`b`(767))
-) ENGINE=InnoDB DEFAULT CHARSET=utf8
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-explain select * from t1 where b like 'adfd%';
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where
-create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
-insert into t2 select a,left(b,255) from t1;
-drop table t1;
-rename table t2 to t1;
-set innodb_lock_wait_timeout=1;
-begin;
-select a from t1 limit 1 for update;
-a
-22
-set innodb_lock_wait_timeout=1;
-create index t1ba on t1 (b,a);
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-commit;
-begin;
-select a from t1 limit 1 lock in share mode;
-a
-22
-create index t1ba on t1 (b,a);
-drop index t1ba on t1;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-commit;
-explain select a from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL t1ba 261 NULL 15 Using index
-select a,sleep(2+a/100) from t1 order by b limit 3;
-select sleep(1);
-sleep(1)
-0
-drop index t1ba on t1;
-a sleep(2+a/100)
-22 0
-44 0
-66 0
-explain select a from t1 order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL PRIMARY 261 NULL 15 Using index; Using filesort
-select a from t1 order by b limit 3;
-a
-22
-66
-44
-commit;
-drop table t1;
-set global innodb_file_per_table=on;
-set global innodb_file_format='Barracuda';
-create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
-i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob,
-q blob,r blob,s blob,t blob,u blob)
-engine=innodb row_format=dynamic;
-create index t1a on t1 (a(1));
-create index t1b on t1 (b(1));
-create index t1c on t1 (c(1));
-create index t1d on t1 (d(1));
-create index t1e on t1 (e(1));
-create index t1f on t1 (f(1));
-create index t1g on t1 (g(1));
-create index t1h on t1 (h(1));
-create index t1i on t1 (i(1));
-create index t1j on t1 (j(1));
-create index t1k on t1 (k(1));
-create index t1l on t1 (l(1));
-create index t1m on t1 (m(1));
-create index t1n on t1 (n(1));
-create index t1o on t1 (o(1));
-create index t1p on t1 (p(1));
-create index t1q on t1 (q(1));
-create index t1r on t1 (r(1));
-create index t1s on t1 (s(1));
-create index t1t on t1 (t(1));
-create index t1u on t1 (u(1));
-ERROR HY000: Too big row
-create index t1ut on t1 (u(1), t(1));
-ERROR HY000: Too big row
-create index t1st on t1 (s(1), t(1));
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` blob,
- `b` blob,
- `c` blob,
- `d` blob,
- `e` blob,
- `f` blob,
- `g` blob,
- `h` blob,
- `i` blob,
- `j` blob,
- `k` blob,
- `l` blob,
- `m` blob,
- `n` blob,
- `o` blob,
- `p` blob,
- `q` blob,
- `r` blob,
- `s` blob,
- `t` blob,
- `u` blob,
- KEY `t1a` (`a`(1)),
- KEY `t1b` (`b`(1)),
- KEY `t1c` (`c`(1)),
- KEY `t1d` (`d`(1)),
- KEY `t1e` (`e`(1)),
- KEY `t1f` (`f`(1)),
- KEY `t1g` (`g`(1)),
- KEY `t1h` (`h`(1)),
- KEY `t1i` (`i`(1)),
- KEY `t1j` (`j`(1)),
- KEY `t1k` (`k`(1)),
- KEY `t1l` (`l`(1)),
- KEY `t1m` (`m`(1)),
- KEY `t1n` (`n`(1)),
- KEY `t1o` (`o`(1)),
- KEY `t1p` (`p`(1)),
- KEY `t1q` (`q`(1)),
- KEY `t1r` (`r`(1)),
- KEY `t1s` (`s`(1)),
- KEY `t1t` (`t`(1)),
- KEY `t1st` (`s`(1),`t`(1))
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
-create index t1u on t1 (u(1));
-ERROR HY000: Too big row
-alter table t1 row_format=compact;
-create index t1u on t1 (u(1));
-drop table t1;
-set global innodb_file_per_table=0;
-set global innodb_file_format=Antelope;
-SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
-SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
-CREATE TABLE t1(
-c1 BIGINT(12) NOT NULL,
-PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-CREATE TABLE t2(
-c1 BIGINT(16) NOT NULL,
-c2 BIGINT(12) NOT NULL,
-c3 BIGINT(12) NOT NULL,
-PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3) REFERENCES t1(c1);
-SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
-SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `fk_t2_ca` (`c3`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `i_t2_c3_c2` (`c3`,`c2`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
-SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-INSERT INTO t2 VALUES(0,0,0);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`))
-INSERT INTO t1 VALUES(0);
-INSERT INTO t2 VALUES(0,0,0);
-DROP TABLE t2;
-CREATE TABLE t2(
-c1 BIGINT(16) NOT NULL,
-c2 BIGINT(12) NOT NULL,
-c3 BIGINT(12) NOT NULL,
-PRIMARY KEY (c1,c2,c3)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3) REFERENCES t1(c1);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`,`c2`,`c3`),
- KEY `fk_t2_ca` (`c3`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`,`c2`,`c3`),
- KEY `i_t2_c3_c2` (`c3`,`c2`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-INSERT INTO t2 VALUES(0,0,1);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`))
-INSERT INTO t2 VALUES(0,0,0);
-DELETE FROM t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`))
-DELETE FROM t2;
-DROP TABLE t2;
-DROP TABLE t1;
-CREATE TABLE t1(
-c1 BIGINT(12) NOT NULL,
-c2 INT(4) NOT NULL,
-PRIMARY KEY (c2,c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-CREATE TABLE t2(
-c1 BIGINT(16) NOT NULL,
-c2 BIGINT(12) NOT NULL,
-c3 BIGINT(12) NOT NULL,
-PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
-ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL;
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
-ERROR HY000: Can't create table '#sql-temporary' (errno: 150)
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
-FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `c1` bigint(12) NOT NULL,
- `c2` bigint(12) NOT NULL,
- PRIMARY KEY (`c2`,`c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `fk_t2_ca` (`c3`,`c2`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE INDEX i_t2_c2_c1 ON t2(c2, c1);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `fk_t2_ca` (`c3`,`c2`),
- KEY `i_t2_c2_c1` (`c2`,`c1`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE INDEX i_t2_c3_c1_c2 ON t2(c3, c1, c2);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `fk_t2_ca` (`c3`,`c2`),
- KEY `i_t2_c2_c1` (`c2`,`c1`),
- KEY `i_t2_c3_c1_c2` (`c3`,`c1`,`c2`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-SHOW CREATE TABLE t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `c1` bigint(16) NOT NULL,
- `c2` bigint(12) NOT NULL,
- `c3` bigint(12) NOT NULL,
- PRIMARY KEY (`c1`),
- KEY `i_t2_c2_c1` (`c2`,`c1`),
- KEY `i_t2_c3_c1_c2` (`c3`,`c1`,`c2`),
- KEY `i_t2_c3_c2` (`c3`,`c2`),
- CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-DROP TABLE t2;
-DROP TABLE t1;
-CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
-BEGIN;
-SELECT * FROM t1;
-a b
-3 a
-3 b
-1 c
-0 d
-1 e
-CREATE INDEX t1a ON t1(a);
-SELECT * FROM t1;
-a b
-3 a
-3 b
-1 c
-0 d
-1 e
-SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
-ERROR HY000: Table definition has changed, please retry transaction
-SELECT * FROM t1;
-a b
-3 a
-3 b
-1 c
-0 d
-1 e
-COMMIT;
-SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
-a b
-0 d
-1 c
-1 e
-3 a
-3 b
-DROP TABLE t1;
diff --git a/storage/innodb_plugin/mysql-test/innodb-index.test b/storage/innodb_plugin/mysql-test/innodb-index.test
deleted file mode 100644
index 42888ff3686..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-index.test
+++ /dev/null
@@ -1,534 +0,0 @@
--- source include/have_innodb.inc
-
-create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
-insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak');
-commit;
---error ER_DUP_KEYNAME
-alter table t1 add index b (b), add index b (b);
---error ER_DUP_FIELDNAME
-alter table t1 add index (b,b);
-alter table t1 add index d2 (d);
-show create table t1;
-explain select * from t1 force index(d2) order by d;
-select * from t1 force index (d2) order by d;
---error ER_DUP_ENTRY
-alter table t1 add unique index (b);
-show create table t1;
-alter table t1 add index (b);
-show create table t1;
-
-# Check how existing tables interfere with temporary tables.
-CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB;
-
---error 156
-alter table t1 add unique index (c), add index (d);
-rename table `t1#1` to `t1#2`;
---error 156
-alter table t1 add unique index (c), add index (d);
-drop table `t1#2`;
-
-alter table t1 add unique index (c), add index (d);
-show create table t1;
-explain select * from t1 force index(c) order by c;
-alter table t1 add primary key (a), drop index c;
-show create table t1;
---error ER_MULTIPLE_PRI_KEY
-alter table t1 add primary key (c);
---error ER_DUP_ENTRY
-alter table t1 drop primary key, add primary key (b);
-create unique index c on t1 (c);
-show create table t1;
-explain select * from t1 force index(c) order by c;
-select * from t1 force index(c) order by c;
-alter table t1 drop index b, add index (b);
-show create table t1;
-insert into t1 values(6,1,'ggg','ggg');
-select * from t1;
-select * from t1 force index(b) order by b;
-select * from t1 force index(c) order by c;
-select * from t1 force index(d) order by d;
-explain select * from t1 force index(b) order by b;
-explain select * from t1 force index(c) order by c;
-explain select * from t1 force index(d) order by d;
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add index (c(2));
-show create table t1;
-alter table t1 add unique index (d(10));
-show create table t1;
-insert into t1 values(5,1,'ggg','ggg');
-select * from t1;
-select * from t1 force index(c) order by c;
-select * from t1 force index(d) order by d;
-explain select * from t1 order by b;
-explain select * from t1 force index(c) order by c;
-explain select * from t1 force index(d) order by d;
-show create table t1;
-alter table t1 drop index d;
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-select * from t1 force index(c) order by c;
-explain select * from t1 order by b;
-explain select * from t1 force index(c) order by c;
-explain select * from t1 order by d;
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add unique index (b,c);
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-select * from t1 force index(b) order by b;
-explain select * from t1 force index(b) order by b;
-show create table t1;
-alter table t1 add index (b,c);
-insert into t1 values(11,11,'kkk','kkk');
-select * from t1;
-select * from t1 force index(b) order by b;
-explain select * from t1 force index(b) order by b;
-show create table t1;
-alter table t1 add unique index (c,d);
-insert into t1 values(13,13,'yyy','aaa');
-select * from t1;
-select * from t1 force index(b) order by b;
-select * from t1 force index(c) order by c;
-explain select * from t1 force index(b) order by b;
-explain select * from t1 force index(c) order by c;
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int not null, c int, primary key (a), key (b)) engine = innodb;
-create table t3(a int not null, c int not null, d int, primary key (a), key (c)) engine = innodb;
-create table t4(a int not null, d int not null, e int, primary key (a), key (d)) engine = innodb;
-create table t2(a int not null, b int not null, c int not null, d int not null, e int,
-foreign key (b) references t1(b) on delete cascade,
-foreign key (c) references t3(c), foreign key (d) references t4(d))
-engine = innodb;
---error ER_DROP_INDEX_FK
-alter table t1 drop index b;
---error ER_DROP_INDEX_FK
-alter table t3 drop index c;
---error ER_DROP_INDEX_FK
-alter table t4 drop index d;
---error ER_DROP_INDEX_FK
-alter table t2 drop index b;
---error ER_DROP_INDEX_FK
-alter table t2 drop index b, drop index c, drop index d;
-# Apparently, the following makes mysql_alter_table() drop index d.
-create unique index dc on t2 (d,c);
-create index dc on t1 (b,c);
-# This should preserve the foreign key constraints.
-alter table t2 add primary key (a);
-insert into t1 values (1,1,1);
-insert into t3 values (1,1,1);
-insert into t4 values (1,1,1);
-insert into t2 values (1,1,1,1,1);
-commit;
-alter table t4 add constraint dc foreign key (a) references t1(a);
-show create table t4;
---replace_regex /'test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
-# a foreign key 'test/dc' already exists
---error ER_CANT_CREATE_TABLE
-alter table t3 add constraint dc foreign key (a) references t1(a);
-show create table t3;
-alter table t2 drop index b, add index (b);
-show create table t2;
---error ER_ROW_IS_REFERENCED_2
-delete from t1;
---error ER_CANT_DROP_FIELD_OR_KEY
-drop index dc on t4;
-# there is no foreign key dc on t3
---replace_regex /'\.\/test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/
---error ER_ERROR_ON_RENAME
-alter table t3 drop foreign key dc;
-alter table t4 drop foreign key dc;
-select * from t2;
-delete from t1;
-select * from t2;
-
-drop table t2,t4,t3,t1;
-
--- let charset = utf8
--- source include/innodb-index.inc
-
-create table t1(a int not null, b int) engine = innodb;
-insert into t1 values (1,1),(1,1),(1,1),(1,1);
---error ER_DUP_ENTRY
-alter table t1 add unique index (a);
---error ER_DUP_ENTRY
-alter table t1 add unique index (b);
---error ER_DUP_ENTRY
-alter table t1 add unique index (a), add unique index(b);
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, c int not null,b int, primary key(a), unique key(c), key(b)) engine = innodb;
-alter table t1 drop index c, drop index b;
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int, primary key(a)) engine = innodb;
-alter table t1 add index (b);
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe');
---error ER_DUP_ENTRY
-alter table t1 add unique index (b), add unique index (c), add unique index (d);
---error ER_DUP_ENTRY
-alter table t1 add unique index (c), add unique index (b), add index (d);
-show create table t1;
-drop table t1;
-
-create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb;
-insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1);
-alter table t1 add unique index (b);
-insert into t1 values (10,20,20),(11,19,19),(12,18,18),(13,17,17);
-show create table t1;
-check table t1;
-explain select * from t1 force index(c) order by c;
-explain select * from t1 order by a;
-explain select * from t1 force index(b) order by b;
-select * from t1 order by a;
-select * from t1 force index(b) order by b;
-select * from t1 force index(c) order by c;
-drop table t1;
-
-create table t1(a int not null, b int not null) engine=innodb;
-insert into t1 values (1,1);
-alter table t1 add primary key(b);
-insert into t1 values (2,2);
-show create table t1;
-check table t1;
-select * from t1;
-explain select * from t1;
-explain select * from t1 order by a;
-explain select * from t1 order by b;
-checksum table t1;
-drop table t1;
-
-create table t1(a int not null) engine=innodb;
-insert into t1 values (1);
-alter table t1 add primary key(a);
-insert into t1 values (2);
-show create table t1;
-check table t1;
-commit;
-select * from t1;
-explain select * from t1;
-explain select * from t1 order by a;
-drop table t1;
-
-create table t2(d varchar(17) primary key) engine=innodb default charset=utf8;
-create table t3(a int primary key) engine=innodb;
-
-insert into t3 values(22),(44),(33),(55),(66);
-
-insert into t2 values ('jejdkrun87'),('adfd72nh9k'),
-('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik');
-
-create table t1(a int, b blob, c text, d text not null)
-engine=innodb default charset = utf8;
-
-# r2667 The following test is disabled because MySQL behavior changed.
-# r2667 The test was added with this comment:
-# r2667
-# r2667 ------------------------------------------------------------------------
-# r2667 r1699 | marko | 2007-08-10 19:53:19 +0300 (Fri, 10 Aug 2007) | 5 lines
-# r2667
-# r2667 branches/zip: Add changes that accidentally omitted from r1698:
-# r2667
-# r2667 innodb-index.test, innodb-index.result: Add a test for creating
-# r2667 a PRIMARY KEY on a column that contains a NULL value.
-# r2667 ------------------------------------------------------------------------
-# r2667
-# r2667 but in BZR-r2667:
-# r2667 http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1/revision/davi%40mysql.com-20080617141221-8yre8ys9j4uw3xx5?start_revid=joerg%40mysql.com-20080630105418-7qoe5ehomgrcdb89
-# r2667 MySQL changed the behavior to do full table copy when creating PRIMARY INDEX
-# r2667 on a non-NULL column instead of calling ::add_index() which would fail (and
-# r2667 this is what we were testing here). Before r2667 the code execution path was
-# r2667 like this (when adding PRIMARY INDEX on a non-NULL column with ALTER TABLE):
-# r2667
-# r2667 mysql_alter_table()
-# r2667 compare_tables() // would return ALTER_TABLE_INDEX_CHANGED
-# r2667 ::add_index() // would fail with "primary index cannot contain NULL"
-# r2667
-# r2667 after r2667 the code execution path is the following:
-# r2667
-# r2667 mysql_alter_table()
-# r2667 compare_tables() // returns ALTER_TABLE_DATA_CHANGED
-# r2667 full copy is done, without calling ::add_index()
-# r2667
-# r2667 To enable, remove "# r2667: " below.
-# r2667
-# r2667: insert into t1 values (null,null,null,'null');
-insert into t1
-select a,left(repeat(d,100*a),65535),repeat(d,20*a),d from t2,t3;
-drop table t2, t3;
-select count(*) from t1 where a=44;
-select a,
-length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
-# r2667: --error ER_PRIMARY_CANT_HAVE_NULL
-# r2667: alter table t1 add primary key (a), add key (b(20));
-# r2667: delete from t1 where d='null';
---error ER_DUP_ENTRY
-alter table t1 add primary key (a), add key (b(20));
-delete from t1 where a%2;
-check table t1;
-alter table t1 add primary key (a,b(255),c(255)), add key (b(767));
-select count(*) from t1 where a=44;
-select a,
-length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1;
-show create table t1;
-check table t1;
-explain select * from t1 where b like 'adfd%';
-
-#
-# Test locking
-#
-
-create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb;
-insert into t2 select a,left(b,255) from t1;
-drop table t1;
-rename table t2 to t1;
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-connection a;
-set innodb_lock_wait_timeout=1;
-begin;
-# Obtain an IX lock on the table
-select a from t1 limit 1 for update;
-connection b;
-set innodb_lock_wait_timeout=1;
-# This would require an S lock on the table, conflicting with the IX lock.
---error ER_LOCK_WAIT_TIMEOUT
-create index t1ba on t1 (b,a);
-connection a;
-commit;
-begin;
-# Obtain an IS lock on the table
-select a from t1 limit 1 lock in share mode;
-connection b;
-# This will require an S lock on the table. No conflict with the IS lock.
-create index t1ba on t1 (b,a);
-# This would require an X lock on the table, conflicting with the IS lock.
---error ER_LOCK_WAIT_TIMEOUT
-drop index t1ba on t1;
-connection a;
-commit;
-explain select a from t1 order by b;
---send
-select a,sleep(2+a/100) from t1 order by b limit 3;
-
-# The following DROP INDEX will succeed, altough the SELECT above has
-# opened a read view. However, during the execution of the SELECT,
-# MySQL should hold a table lock that should block the execution
-# of the DROP INDEX below.
-
-connection b;
-select sleep(1);
-drop index t1ba on t1;
-
-# After the index was dropped, subsequent SELECTs will use the same
-# read view, but they should not be accessing the dropped index any more.
-
-connection a;
-reap;
-explain select a from t1 order by b;
-select a from t1 order by b limit 3;
-commit;
-
-connection default;
-disconnect a;
-disconnect b;
-
-drop table t1;
-
-let $per_table=`select @@innodb_file_per_table`;
-let $format=`select @@innodb_file_format`;
-set global innodb_file_per_table=on;
-set global innodb_file_format='Barracuda';
-# Test creating a table that could lead to undo log overflow.
-# In the undo log, we write a 768-byte prefix (REC_MAX_INDEX_COL_LEN)
-# of each externally stored column that appears as a column prefix in an index.
-# For this test case, it would suffice to write 1 byte, though.
-create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob,
- i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob,
- q blob,r blob,s blob,t blob,u blob)
- engine=innodb row_format=dynamic;
-create index t1a on t1 (a(1));
-create index t1b on t1 (b(1));
-create index t1c on t1 (c(1));
-create index t1d on t1 (d(1));
-create index t1e on t1 (e(1));
-create index t1f on t1 (f(1));
-create index t1g on t1 (g(1));
-create index t1h on t1 (h(1));
-create index t1i on t1 (i(1));
-create index t1j on t1 (j(1));
-create index t1k on t1 (k(1));
-create index t1l on t1 (l(1));
-create index t1m on t1 (m(1));
-create index t1n on t1 (n(1));
-create index t1o on t1 (o(1));
-create index t1p on t1 (p(1));
-create index t1q on t1 (q(1));
-create index t1r on t1 (r(1));
-create index t1s on t1 (s(1));
-create index t1t on t1 (t(1));
---error 139
-create index t1u on t1 (u(1));
---error 139
-create index t1ut on t1 (u(1), t(1));
-create index t1st on t1 (s(1), t(1));
-show create table t1;
---error 139
-create index t1u on t1 (u(1));
-alter table t1 row_format=compact;
-create index t1u on t1 (u(1));
-
-drop table t1;
-eval set global innodb_file_per_table=$per_table;
-eval set global innodb_file_format=$format;
-
-#
-# Test to check whether CREATE INDEX handles implicit foreign key
-# constraint modifications (Issue #70, Bug #38786)
-#
-SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
-SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
-
-CREATE TABLE t1(
- c1 BIGINT(12) NOT NULL,
- PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-CREATE TABLE t2(
- c1 BIGINT(16) NOT NULL,
- c2 BIGINT(12) NOT NULL,
- c3 BIGINT(12) NOT NULL,
- PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3) REFERENCES t1(c1);
-
-SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
-SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-
-SHOW CREATE TABLE t2;
-
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-
-SHOW CREATE TABLE t2;
-
-SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
-SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
-
---error ER_NO_REFERENCED_ROW_2
-INSERT INTO t2 VALUES(0,0,0);
-INSERT INTO t1 VALUES(0);
-INSERT INTO t2 VALUES(0,0,0);
-
-DROP TABLE t2;
-
-CREATE TABLE t2(
- c1 BIGINT(16) NOT NULL,
- c2 BIGINT(12) NOT NULL,
- c3 BIGINT(12) NOT NULL,
- PRIMARY KEY (c1,c2,c3)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3) REFERENCES t1(c1);
-
-SHOW CREATE TABLE t2;
-
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-
-SHOW CREATE TABLE t2;
---error ER_NO_REFERENCED_ROW_2
-INSERT INTO t2 VALUES(0,0,1);
-INSERT INTO t2 VALUES(0,0,0);
---error ER_ROW_IS_REFERENCED_2
-DELETE FROM t1;
-DELETE FROM t2;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
-CREATE TABLE t1(
- c1 BIGINT(12) NOT NULL,
- c2 INT(4) NOT NULL,
- PRIMARY KEY (c2,c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-CREATE TABLE t2(
- c1 BIGINT(16) NOT NULL,
- c2 BIGINT(12) NOT NULL,
- c3 BIGINT(12) NOT NULL,
- PRIMARY KEY (c1)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1);
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
-ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL;
---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
-
-ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
- FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1);
-SHOW CREATE TABLE t1;
-SHOW CREATE TABLE t2;
-CREATE INDEX i_t2_c2_c1 ON t2(c2, c1);
-SHOW CREATE TABLE t2;
-CREATE INDEX i_t2_c3_c1_c2 ON t2(c3, c1, c2);
-SHOW CREATE TABLE t2;
-CREATE INDEX i_t2_c3_c2 ON t2(c3, c2);
-SHOW CREATE TABLE t2;
-
-DROP TABLE t2;
-DROP TABLE t1;
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-connection a;
-CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB;
-INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e');
-connection b;
-BEGIN;
-SELECT * FROM t1;
-connection a;
-CREATE INDEX t1a ON t1(a);
-connection b;
-SELECT * FROM t1;
---error ER_TABLE_DEF_CHANGED
-SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
-SELECT * FROM t1;
-COMMIT;
-SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a;
-connection default;
-disconnect a;
-disconnect b;
-
-DROP TABLE t1;
diff --git a/storage/innodb_plugin/mysql-test/innodb-index_ucs2.result b/storage/innodb_plugin/mysql-test/innodb-index_ucs2.result
deleted file mode 100644
index c8a1e8c7da1..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-index_ucs2.result
+++ /dev/null
@@ -1,116 +0,0 @@
-create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=ucs2;
-insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe');
-commit;
-alter table t1 add unique index (b);
-ERROR 23000: Duplicate entry '2' for key 'b'
-insert into t1 values(8,9,'fff','fff');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2
-alter table t1 add index (b);
-insert into t1 values(10,10,'kkk','iii');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 5 NULL 6
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2
-alter table t1 add unique index (c), add index (d);
-insert into t1 values(11,11,'aaa','mmm');
-select * from t1;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-select * from t1 force index(b) order by b;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-select * from t1 force index(c) order by c;
-a b c d
-11 11 aaa mmm
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-select * from t1 force index(d) order by d;
-a b c d
-1 1 ab ab
-2 2 ac ac
-3 2 ad ad
-4 4 afe afe
-8 9 fff fff
-10 10 kkk iii
-11 11 aaa mmm
-explain select * from t1 force index(b) order by b;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL b 5 NULL 7
-explain select * from t1 force index(c) order by c;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL c 21 NULL 7
-explain select * from t1 force index(d) order by d;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index NULL d 43 NULL 7
-show create table t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
- `c` char(10) DEFAULT NULL,
- `d` varchar(20) DEFAULT NULL,
- PRIMARY KEY (`a`),
- UNIQUE KEY `c` (`c`),
- KEY `b` (`b`),
- KEY `d` (`d`)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2
-check table t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-drop table t1;
diff --git a/storage/innodb_plugin/mysql-test/innodb-index_ucs2.test b/storage/innodb_plugin/mysql-test/innodb-index_ucs2.test
deleted file mode 100644
index fff9a4da1a8..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-index_ucs2.test
+++ /dev/null
@@ -1,5 +0,0 @@
--- source include/have_innodb.inc
--- source include/have_ucs2.inc
-
--- let charset = ucs2
--- source include/innodb-index.inc
diff --git a/storage/innodb_plugin/mysql-test/innodb-timeout.result b/storage/innodb_plugin/mysql-test/innodb-timeout.result
deleted file mode 100644
index be9a688cd72..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-timeout.result
+++ /dev/null
@@ -1,38 +0,0 @@
-set global innodb_lock_wait_timeout=42;
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-42
-set innodb_lock_wait_timeout=1;
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-1
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-42
-set global innodb_lock_wait_timeout=347;
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-42
-set innodb_lock_wait_timeout=1;
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-1
-select @@innodb_lock_wait_timeout;
-@@innodb_lock_wait_timeout
-347
-create table t1(a int primary key)engine=innodb;
-begin;
-insert into t1 values(1),(2),(3);
-select * from t1 for update;
-commit;
-a
-1
-2
-3
-begin;
-insert into t1 values(4);
-select * from t1 for update;
-commit;
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-drop table t1;
-set global innodb_lock_wait_timeout=50;
diff --git a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.result b/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.result
deleted file mode 100644
index 2ec4c7c8130..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.result
+++ /dev/null
@@ -1,48 +0,0 @@
-SELECT @@GLOBAL.innodb_use_sys_malloc;
-@@GLOBAL.innodb_use_sys_malloc
-1
-1 Expected
-SET @@GLOBAL.innodb_use_sys_malloc=0;
-ERROR HY000: Variable 'innodb_use_sys_malloc' is a read only variable
-Expected error 'Read only variable'
-SELECT @@GLOBAL.innodb_use_sys_malloc;
-@@GLOBAL.innodb_use_sys_malloc
-1
-1 Expected
-drop table if exists t1;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-select * from t1;
-a
-1
-2
-3
-4
-5
-6
-7
-drop table t1;
-SELECT @@GLOBAL.innodb_use_sys_malloc;
-@@GLOBAL.innodb_use_sys_malloc
-1
-1 Expected
-SET @@GLOBAL.innodb_use_sys_malloc=0;
-ERROR HY000: Variable 'innodb_use_sys_malloc' is a read only variable
-Expected error 'Read only variable'
-SELECT @@GLOBAL.innodb_use_sys_malloc;
-@@GLOBAL.innodb_use_sys_malloc
-1
-1 Expected
-drop table if exists t1;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-insert into t1 values (1),(2),(3),(4),(5),(6),(7);
-select * from t1;
-a
-1
-2
-3
-4
-5
-6
-7
-drop table t1;
diff --git a/storage/innodb_plugin/mysql-test/innodb-zip.result b/storage/innodb_plugin/mysql-test/innodb-zip.result
deleted file mode 100644
index b26c4112826..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-zip.result
+++ /dev/null
@@ -1,421 +0,0 @@
-set global innodb_file_per_table=off;
-set global innodb_file_format=`0`;
-create table t0(a int primary key) engine=innodb row_format=compressed;
-Warnings:
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
-create table t00(a int primary key) engine=innodb
-key_block_size=4 row_format=compressed;
-Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
-Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
-create table t1(a int primary key) engine=innodb row_format=dynamic;
-Warnings:
-Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
-create table t2(a int primary key) engine=innodb row_format=redundant;
-create table t3(a int primary key) engine=innodb row_format=compact;
-create table t4(a int primary key) engine=innodb key_block_size=9;
-Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9.
-create table t5(a int primary key) engine=innodb
-key_block_size=1 row_format=redundant;
-Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
-set global innodb_file_per_table=on;
-create table t6(a int primary key) engine=innodb
-key_block_size=1 row_format=redundant;
-Warnings:
-Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
-set global innodb_file_format=`1`;
-create table t7(a int primary key) engine=innodb
-key_block_size=1 row_format=redundant;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-create table t8(a int primary key) engine=innodb
-key_block_size=1 row_format=fixed;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
-create table t9(a int primary key) engine=innodb
-key_block_size=1 row_format=compact;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-create table t10(a int primary key) engine=innodb
-key_block_size=1 row_format=dynamic;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED.
-create table t11(a int primary key) engine=innodb
-key_block_size=1 row_format=compressed;
-create table t12(a int primary key) engine=innodb
-key_block_size=1;
-create table t13(a int primary key) engine=innodb
-row_format=compressed;
-create table t14(a int primary key) engine=innodb key_block_size=9;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9.
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t0 Compact
-test t00 Compact
-test t1 Compact
-test t10 Dynamic
-test t11 Compressed
-test t12 Compressed
-test t13 Compressed
-test t14 Compact
-test t2 Redundant
-test t3 Compact
-test t4 Compact
-test t5 Redundant
-test t6 Redundant
-test t7 Redundant
-test t8 Compact
-test t9 Compact
-drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
-alter table t1 key_block_size=0;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0.
-alter table t1 row_format=dynamic;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Dynamic
-alter table t1 row_format=compact;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Compact
-alter table t1 row_format=redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Redundant
-drop table t1;
-create table t1(a int not null, b text, index(b(10))) engine=innodb
-key_block_size=1;
-create table t2(b text)engine=innodb;
-insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000)));
-insert into t1 select 1, b from t2;
-commit;
-begin;
-update t1 set b=repeat('B',100);
-select a,left(b,40) from t1 natural join t2;
-a left(b,40)
-1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
-rollback;
-select a,left(b,40) from t1 natural join t2;
-a left(b,40)
-1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Compressed
-test t2 Compact
-drop table t1,t2;
-SET SESSION innodb_strict_mode = off;
-CREATE TABLE t1(
-c TEXT NOT NULL, d TEXT NOT NULL,
-PRIMARY KEY (c(767),d(767)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
-CREATE TABLE t1(
-c TEXT NOT NULL, d TEXT NOT NULL,
-PRIMARY KEY (c(767),d(767)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
-CREATE TABLE t1(
-c TEXT NOT NULL, d TEXT NOT NULL,
-PRIMARY KEY (c(767),d(767)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
-drop table t1;
-CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
-CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
-DROP TABLE t1;
-create table t1( c1 int not null, c2 blob, c3 blob, c4 blob,
-primary key(c1, c2(22), c3(22)))
-engine = innodb row_format = dynamic;
-begin;
-insert into t1 values(1, repeat('A', 20000), repeat('B', 20000),
-repeat('C', 20000));
-update t1 set c3 = repeat('D', 20000) where c1 = 1;
-commit;
-select count(*) from t1 where c2 = repeat('A', 20000);
-count(*)
-1
-select count(*) from t1 where c3 = repeat('D', 20000);
-count(*)
-1
-select count(*) from t1 where c4 = repeat('C', 20000);
-count(*)
-1
-update t1 set c3 = repeat('E', 20000) where c1 = 1;
-drop table t1;
-set global innodb_file_format=`0`;
-select @@innodb_file_format;
-@@innodb_file_format
-Antelope
-set global innodb_file_format=`1`;
-select @@innodb_file_format;
-@@innodb_file_format
-Barracuda
-set global innodb_file_format=`2`;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=`-1`;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=`Antelope`;
-set global innodb_file_format=`Barracuda`;
-set global innodb_file_format=`Cheetah`;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=`abc`;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=`1a`;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_format=``;
-ERROR HY000: Incorrect arguments to SET
-set global innodb_file_per_table = on;
-set global innodb_file_format = `1`;
-set innodb_strict_mode = off;
-create table t1 (id int primary key) engine = innodb key_block_size = 0;
-Warnings:
-Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0.
-drop table t1;
-set innodb_strict_mode = on;
-create table t1 (id int primary key) engine = innodb key_block_size = 0;
-ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16]
-Error 1005 Can't create table 'test.t1' (errno: 1478)
-create table t2 (id int primary key) engine = innodb key_block_size = 9;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-create table t3 (id int primary key) engine = innodb key_block_size = 1;
-create table t4 (id int primary key) engine = innodb key_block_size = 2;
-create table t5 (id int primary key) engine = innodb key_block_size = 4;
-create table t6 (id int primary key) engine = innodb key_block_size = 8;
-create table t7 (id int primary key) engine = innodb key_block_size = 16;
-create table t8 (id int primary key) engine = innodb row_format = compressed;
-create table t9 (id int primary key) engine = innodb row_format = dynamic;
-create table t10(id int primary key) engine = innodb row_format = compact;
-create table t11(id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t10 Compact
-test t11 Redundant
-test t3 Compressed
-test t4 Compressed
-test t5 Compressed
-test t6 Compressed
-test t7 Compressed
-test t8 Compressed
-test t9 Dynamic
-drop table t3, t4, t5, t6, t7, t8, t9, t10, t11;
-create table t1 (id int primary key) engine = innodb
-key_block_size = 8 row_format = compressed;
-create table t2 (id int primary key) engine = innodb
-key_block_size = 8 row_format = redundant;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-create table t3 (id int primary key) engine = innodb
-key_block_size = 8 row_format = compact;
-ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t3' (errno: 1478)
-create table t4 (id int primary key) engine = innodb
-key_block_size = 8 row_format = dynamic;
-ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t4' (errno: 1478)
-create table t5 (id int primary key) engine = innodb
-key_block_size = 8 row_format = default;
-ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t5' (errno: 1478)
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t1 Compressed
-drop table t1;
-create table t1 (id int primary key) engine = innodb
-key_block_size = 9 row_format = redundant;
-ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t1' (errno: 1478)
-create table t2 (id int primary key) engine = innodb
-key_block_size = 9 row_format = compact;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-create table t2 (id int primary key) engine = innodb
-key_block_size = 9 row_format = dynamic;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16]
-Error 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE.
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-set global innodb_file_per_table = off;
-create table t1 (id int primary key) engine = innodb key_block_size = 1;
-ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t1' (errno: 1478)
-create table t2 (id int primary key) engine = innodb key_block_size = 2;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-create table t3 (id int primary key) engine = innodb key_block_size = 4;
-ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t3' (errno: 1478)
-create table t4 (id int primary key) engine = innodb key_block_size = 8;
-ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t4' (errno: 1478)
-create table t5 (id int primary key) engine = innodb key_block_size = 16;
-ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t5' (errno: 1478)
-create table t6 (id int primary key) engine = innodb row_format = compressed;
-ERROR HY000: Can't create table 'test.t6' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t6' (errno: 1478)
-create table t7 (id int primary key) engine = innodb row_format = dynamic;
-ERROR HY000: Can't create table 'test.t7' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
-Error 1005 Can't create table 'test.t7' (errno: 1478)
-create table t8 (id int primary key) engine = innodb row_format = compact;
-create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t8 Compact
-test t9 Redundant
-drop table t8, t9;
-set global innodb_file_per_table = on;
-set global innodb_file_format = `0`;
-create table t1 (id int primary key) engine = innodb key_block_size = 1;
-ERROR HY000: Can't create table 'test.t1' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t1' (errno: 1478)
-create table t2 (id int primary key) engine = innodb key_block_size = 2;
-ERROR HY000: Can't create table 'test.t2' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t2' (errno: 1478)
-create table t3 (id int primary key) engine = innodb key_block_size = 4;
-ERROR HY000: Can't create table 'test.t3' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t3' (errno: 1478)
-create table t4 (id int primary key) engine = innodb key_block_size = 8;
-ERROR HY000: Can't create table 'test.t4' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t4' (errno: 1478)
-create table t5 (id int primary key) engine = innodb key_block_size = 16;
-ERROR HY000: Can't create table 'test.t5' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t5' (errno: 1478)
-create table t6 (id int primary key) engine = innodb row_format = compressed;
-ERROR HY000: Can't create table 'test.t6' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t6' (errno: 1478)
-create table t7 (id int primary key) engine = innodb row_format = dynamic;
-ERROR HY000: Can't create table 'test.t7' (errno: 1478)
-show errors;
-Level Code Message
-Error 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
-Error 1005 Can't create table 'test.t7' (errno: 1478)
-create table t8 (id int primary key) engine = innodb row_format = compact;
-create table t9 (id int primary key) engine = innodb row_format = redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-table_schema table_name row_format
-test t8 Compact
-test t9 Redundant
-drop table t8, t9;
-set global innodb_file_per_table=0;
-set global innodb_file_format=Antelope;
-set global innodb_file_per_table=on;
-set global innodb_file_format=`Barracuda`;
-set global innodb_file_format_check=`Antelope`;
-create table normal_table (
-c1 int
-) engine = innodb;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Antelope
-create table zip_table (
-c1 int
-) engine = innodb key_block_size = 8;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Barracuda
-set global innodb_file_format_check=`Antelope`;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Antelope
-show table status;
-select @@innodb_file_format_check;
-@@innodb_file_format_check
-Barracuda
-drop table normal_table, zip_table;
diff --git a/storage/innodb_plugin/mysql-test/innodb-zip.test b/storage/innodb_plugin/mysql-test/innodb-zip.test
deleted file mode 100644
index 5bcd0e3c824..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb-zip.test
+++ /dev/null
@@ -1,343 +0,0 @@
--- source include/have_innodb.inc
-
-let $per_table=`select @@innodb_file_per_table`;
-let $format=`select @@innodb_file_format`;
-let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
-set global innodb_file_per_table=off;
-set global innodb_file_format=`0`;
-
-create table t0(a int primary key) engine=innodb row_format=compressed;
-create table t00(a int primary key) engine=innodb
-key_block_size=4 row_format=compressed;
-create table t1(a int primary key) engine=innodb row_format=dynamic;
-create table t2(a int primary key) engine=innodb row_format=redundant;
-create table t3(a int primary key) engine=innodb row_format=compact;
-create table t4(a int primary key) engine=innodb key_block_size=9;
-create table t5(a int primary key) engine=innodb
-key_block_size=1 row_format=redundant;
-
-set global innodb_file_per_table=on;
-create table t6(a int primary key) engine=innodb
-key_block_size=1 row_format=redundant;
-set global innodb_file_format=`1`;
-create table t7(a int primary key) engine=innodb
-key_block_size=1 row_format=redundant;
-create table t8(a int primary key) engine=innodb
-key_block_size=1 row_format=fixed;
-create table t9(a int primary key) engine=innodb
-key_block_size=1 row_format=compact;
-create table t10(a int primary key) engine=innodb
-key_block_size=1 row_format=dynamic;
-create table t11(a int primary key) engine=innodb
-key_block_size=1 row_format=compressed;
-create table t12(a int primary key) engine=innodb
-key_block_size=1;
-create table t13(a int primary key) engine=innodb
-row_format=compressed;
-create table t14(a int primary key) engine=innodb key_block_size=9;
-
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-
-drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14;
-alter table t1 key_block_size=0;
-alter table t1 row_format=dynamic;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-alter table t1 row_format=compact;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-alter table t1 row_format=redundant;
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-drop table t1;
-
-create table t1(a int not null, b text, index(b(10))) engine=innodb
-key_block_size=1;
-
-create table t2(b text)engine=innodb;
-insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000)));
-
-insert into t1 select 1, b from t2;
-commit;
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-
-connection a;
-begin;
-update t1 set b=repeat('B',100);
-
-connection b;
-select a,left(b,40) from t1 natural join t2;
-
-connection a;
-rollback;
-
-connection b;
-select a,left(b,40) from t1 natural join t2;
-
-connection default;
-disconnect a;
-disconnect b;
-
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-drop table t1,t2;
-
-# The following should fail even in non-strict mode.
-SET SESSION innodb_strict_mode = off;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE t1(
- c TEXT NOT NULL, d TEXT NOT NULL,
- PRIMARY KEY (c(767),d(767)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE t1(
- c TEXT NOT NULL, d TEXT NOT NULL,
- PRIMARY KEY (c(767),d(767)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII;
-CREATE TABLE t1(
- c TEXT NOT NULL, d TEXT NOT NULL,
- PRIMARY KEY (c(767),d(767)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII;
-drop table t1;
---error ER_TOO_BIG_ROWSIZE
-CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438)))
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII;
-INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512));
-DROP TABLE t1;
-
-#
-# Test blob column inheritance (mantis issue#36)
-#
-
-create table t1( c1 int not null, c2 blob, c3 blob, c4 blob,
- primary key(c1, c2(22), c3(22)))
- engine = innodb row_format = dynamic;
-begin;
-insert into t1 values(1, repeat('A', 20000), repeat('B', 20000),
- repeat('C', 20000));
-
-update t1 set c3 = repeat('D', 20000) where c1 = 1;
-commit;
-
-# one blob column which is unchanged in update and part of PK
-# one blob column which is changed and part of of PK
-# one blob column which is not part of PK and is unchanged
-select count(*) from t1 where c2 = repeat('A', 20000);
-select count(*) from t1 where c3 = repeat('D', 20000);
-select count(*) from t1 where c4 = repeat('C', 20000);
-
-update t1 set c3 = repeat('E', 20000) where c1 = 1;
-drop table t1;
-
-#
-#
-# Test innodb_file_format
-#
-set global innodb_file_format=`0`;
-select @@innodb_file_format;
-set global innodb_file_format=`1`;
-select @@innodb_file_format;
--- error ER_WRONG_ARGUMENTS
-set global innodb_file_format=`2`;
--- error ER_WRONG_ARGUMENTS
-set global innodb_file_format=`-1`;
-set global innodb_file_format=`Antelope`;
-set global innodb_file_format=`Barracuda`;
--- error ER_WRONG_ARGUMENTS
-set global innodb_file_format=`Cheetah`;
--- error ER_WRONG_ARGUMENTS
-set global innodb_file_format=`abc`;
--- error ER_WRONG_ARGUMENTS
-set global innodb_file_format=`1a`;
--- error ER_WRONG_ARGUMENTS
-set global innodb_file_format=``;
-
-#test strict mode.
-# this does not work anymore, has been removed from mysqltest
-# -- enable_errors
-set global innodb_file_per_table = on;
-set global innodb_file_format = `1`;
-
-set innodb_strict_mode = off;
-create table t1 (id int primary key) engine = innodb key_block_size = 0;
-drop table t1;
-
-#set strict_mode
-set innodb_strict_mode = on;
-
-#Test different values of KEY_BLOCK_SIZE
-
---error ER_CANT_CREATE_TABLE
-create table t1 (id int primary key) engine = innodb key_block_size = 0;
-show errors;
-
---error ER_CANT_CREATE_TABLE
-create table t2 (id int primary key) engine = innodb key_block_size = 9;
-show errors;
-
-
-create table t3 (id int primary key) engine = innodb key_block_size = 1;
-create table t4 (id int primary key) engine = innodb key_block_size = 2;
-create table t5 (id int primary key) engine = innodb key_block_size = 4;
-create table t6 (id int primary key) engine = innodb key_block_size = 8;
-create table t7 (id int primary key) engine = innodb key_block_size = 16;
-
-#check various ROW_FORMAT values.
-create table t8 (id int primary key) engine = innodb row_format = compressed;
-create table t9 (id int primary key) engine = innodb row_format = dynamic;
-create table t10(id int primary key) engine = innodb row_format = compact;
-create table t11(id int primary key) engine = innodb row_format = redundant;
-
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-drop table t3, t4, t5, t6, t7, t8, t9, t10, t11;
-
-#test different values of ROW_FORMAT with KEY_BLOCK_SIZE
-create table t1 (id int primary key) engine = innodb
-key_block_size = 8 row_format = compressed;
-
---error ER_CANT_CREATE_TABLE
-create table t2 (id int primary key) engine = innodb
-key_block_size = 8 row_format = redundant;
-show errors;
-
---error ER_CANT_CREATE_TABLE
-create table t3 (id int primary key) engine = innodb
-key_block_size = 8 row_format = compact;
-show errors;
-
---error ER_CANT_CREATE_TABLE
-create table t4 (id int primary key) engine = innodb
-key_block_size = 8 row_format = dynamic;
-show errors;
-
---error ER_CANT_CREATE_TABLE
-create table t5 (id int primary key) engine = innodb
-key_block_size = 8 row_format = default;
-show errors;
-
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-drop table t1;
-
-#test multiple errors
---error ER_CANT_CREATE_TABLE
-create table t1 (id int primary key) engine = innodb
-key_block_size = 9 row_format = redundant;
-show errors;
-
---error ER_CANT_CREATE_TABLE
-create table t2 (id int primary key) engine = innodb
-key_block_size = 9 row_format = compact;
-show errors;
-
---error ER_CANT_CREATE_TABLE
-create table t2 (id int primary key) engine = innodb
-key_block_size = 9 row_format = dynamic;
-show errors;
-
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-
-#test valid values with innodb_file_per_table unset
-set global innodb_file_per_table = off;
-
---error ER_CANT_CREATE_TABLE
-create table t1 (id int primary key) engine = innodb key_block_size = 1;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t2 (id int primary key) engine = innodb key_block_size = 2;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t3 (id int primary key) engine = innodb key_block_size = 4;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t4 (id int primary key) engine = innodb key_block_size = 8;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t5 (id int primary key) engine = innodb key_block_size = 16;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t6 (id int primary key) engine = innodb row_format = compressed;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t7 (id int primary key) engine = innodb row_format = dynamic;
-show errors;
-create table t8 (id int primary key) engine = innodb row_format = compact;
-create table t9 (id int primary key) engine = innodb row_format = redundant;
-
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-drop table t8, t9;
-
-#test valid values with innodb_file_format unset
-set global innodb_file_per_table = on;
-set global innodb_file_format = `0`;
-
---error ER_CANT_CREATE_TABLE
-create table t1 (id int primary key) engine = innodb key_block_size = 1;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t2 (id int primary key) engine = innodb key_block_size = 2;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t3 (id int primary key) engine = innodb key_block_size = 4;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t4 (id int primary key) engine = innodb key_block_size = 8;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t5 (id int primary key) engine = innodb key_block_size = 16;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t6 (id int primary key) engine = innodb row_format = compressed;
-show errors;
---error ER_CANT_CREATE_TABLE
-create table t7 (id int primary key) engine = innodb row_format = dynamic;
-show errors;
-create table t8 (id int primary key) engine = innodb row_format = compact;
-create table t9 (id int primary key) engine = innodb row_format = redundant;
-
-SELECT table_schema, table_name, row_format
-FROM information_schema.tables WHERE engine='innodb';
-drop table t8, t9;
-
-eval set global innodb_file_per_table=$per_table;
-eval set global innodb_file_format=$format;
-#
-# Testing of tablespace tagging
-#
--- disable_info
-set global innodb_file_per_table=on;
-set global innodb_file_format=`Barracuda`;
-set global innodb_file_format_check=`Antelope`;
-create table normal_table (
- c1 int
-) engine = innodb;
-select @@innodb_file_format_check;
-create table zip_table (
- c1 int
-) engine = innodb key_block_size = 8;
-select @@innodb_file_format_check;
-set global innodb_file_format_check=`Antelope`;
-select @@innodb_file_format_check;
--- disable_result_log
-show table status;
--- enable_result_log
-select @@innodb_file_format_check;
-drop table normal_table, zip_table;
--- disable_result_log
-
-#
-# restore environment to the state it was before this test execution
-#
-
--- disable_query_log
-eval set global innodb_file_format=$format;
-eval set global innodb_file_per_table=$per_table;
-eval set global innodb_file_format_check=$innodb_file_format_check_orig;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug36169.result b/storage/innodb_plugin/mysql-test/innodb_bug36169.result
deleted file mode 100644
index aa80e4d7aa4..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_bug36169.result
+++ /dev/null
@@ -1,2 +0,0 @@
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug40360.result b/storage/innodb_plugin/mysql-test/innodb_bug40360.result
deleted file mode 100644
index ef4cf463903..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_bug40360.result
+++ /dev/null
@@ -1,4 +0,0 @@
-SET TX_ISOLATION='READ-COMMITTED';
-CREATE TABLE bug40360 (a INT) engine=innodb;
-INSERT INTO bug40360 VALUES (1);
-DROP TABLE bug40360;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug40360.test b/storage/innodb_plugin/mysql-test/innodb_bug40360.test
deleted file mode 100644
index e88837aab4f..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_bug40360.test
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Make sure http://bugs.mysql.com/40360 remains fixed.
-#
-
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
-SET TX_ISOLATION='READ-COMMITTED';
-
-# This is the default since MySQL 5.1.29 SET BINLOG_FORMAT='STATEMENT';
-
-CREATE TABLE bug40360 (a INT) engine=innodb;
-
-INSERT INTO bug40360 VALUES (1);
-
-DROP TABLE bug40360;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug41904.result b/storage/innodb_plugin/mysql-test/innodb_bug41904.result
deleted file mode 100644
index 6070d32d181..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_bug41904.result
+++ /dev/null
@@ -1,4 +0,0 @@
-CREATE TABLE bug41904 (id INT PRIMARY KEY, uniquecol CHAR(15)) ENGINE=InnoDB;
-INSERT INTO bug41904 VALUES (1,NULL), (2,NULL);
-CREATE UNIQUE INDEX ui ON bug41904 (uniquecol);
-DROP TABLE bug41904;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug41904.test b/storage/innodb_plugin/mysql-test/innodb_bug41904.test
deleted file mode 100644
index 365c5229adc..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_bug41904.test
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Make sure http://bugs.mysql.com/41904 remains fixed.
-#
-
--- source include/not_embedded.inc
--- source include/have_innodb.inc
-
-CREATE TABLE bug41904 (id INT PRIMARY KEY, uniquecol CHAR(15)) ENGINE=InnoDB;
-
-INSERT INTO bug41904 VALUES (1,NULL), (2,NULL);
-
-CREATE UNIQUE INDEX ui ON bug41904 (uniquecol);
-
-DROP TABLE bug41904;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44032.result b/storage/innodb_plugin/mysql-test/innodb_bug44032.result
deleted file mode 100644
index da2a000b06e..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_bug44032.result
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE bug44032(c CHAR(3) CHARACTER SET UTF8) ROW_FORMAT=REDUNDANT
-ENGINE=InnoDB;
-INSERT INTO bug44032 VALUES('abc'),(0xEFBCA4EFBCA4EFBCA4);
-UPDATE bug44032 SET c='DDD' WHERE c=0xEFBCA4EFBCA4EFBCA4;
-UPDATE bug44032 SET c=NULL WHERE c='DDD';
-UPDATE bug44032 SET c='DDD' WHERE c IS NULL;
-DROP TABLE bug44032;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44369.result b/storage/innodb_plugin/mysql-test/innodb_bug44369.result
deleted file mode 100644
index e4b84ecac19..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_bug44369.result
+++ /dev/null
@@ -1,14 +0,0 @@
-create table bug44369 (DB_ROW_ID int) engine=innodb;
-ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
-create table bug44369 (db_row_id int) engine=innodb;
-ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
-show errors;
-Level Code Message
-Error 1005 Error creating table 'test/bug44369' with column name 'db_row_id'. 'db_row_id' is a reserved name. Please try to re-create the table with a different column name.
-Error 1005 Can't create table 'test.bug44369' (errno: -1)
-create table bug44369 (db_TRX_Id int) engine=innodb;
-ERROR HY000: Can't create table 'test.bug44369' (errno: -1)
-show errors;
-Level Code Message
-Error 1005 Error creating table 'test/bug44369' with column name 'db_TRX_Id'. 'db_TRX_Id' is a reserved name. Please try to re-create the table with a different column name.
-Error 1005 Can't create table 'test.bug44369' (errno: -1)
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44571.result b/storage/innodb_plugin/mysql-test/innodb_bug44571.result
deleted file mode 100644
index 36374edcb3e..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_bug44571.result
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
-ALTER TABLE bug44571 CHANGE foo bar INT;
-ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
-ERROR 42000: Key column 'foo' doesn't exist in table
-ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
-ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
-CREATE INDEX bug44571b ON bug44571 (bar);
-ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it
-DROP TABLE bug44571;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44571.test b/storage/innodb_plugin/mysql-test/innodb_bug44571.test
deleted file mode 100644
index 685463ceff9..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_bug44571.test
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Bug#44571 InnoDB Plugin crashes on ADD INDEX
-# http://bugs.mysql.com/44571
-#
--- source include/have_innodb.inc
-
-CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB;
-ALTER TABLE bug44571 CHANGE foo bar INT;
--- error ER_KEY_COLUMN_DOES_NOT_EXITS
-ALTER TABLE bug44571 ADD INDEX bug44571b (foo);
-# The following will fail, because the CHANGE foo bar was
-# not communicated to InnoDB.
---error ER_NOT_KEYFILE
-ALTER TABLE bug44571 ADD INDEX bug44571b (bar);
---error ER_NOT_KEYFILE
-CREATE INDEX bug44571b ON bug44571 (bar);
-DROP TABLE bug44571;
diff --git a/storage/innodb_plugin/mysql-test/innodb_bug46000.result b/storage/innodb_plugin/mysql-test/innodb_bug46000.result
deleted file mode 100644
index ccff888a48d..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_bug46000.result
+++ /dev/null
@@ -1,17 +0,0 @@
-create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb;
-ERROR HY000: Can't create table 'test.bug46000' (errno: -1)
-create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb;
-ERROR HY000: Can't create table 'test.bug46000' (errno: -1)
-show errors;
-Level Code Message
-Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
-Error 1005 Can't create table 'test.bug46000' (errno: -1)
-create table bug46000(id int) engine=innodb;
-create index GEN_CLUST_INDEX on bug46000(id);
-ERROR HY000: Can't create table '#sql-temporary' (errno: -1)
-show errors;
-Level Code Message
-Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index.
-Error 1005 Can't create table '#sql-temporary' (errno: -1)
-create index idx on bug46000(id);
-drop table bug46000;
diff --git a/storage/innodb_plugin/mysql-test/innodb_information_schema.result b/storage/innodb_plugin/mysql-test/innodb_information_schema.result
deleted file mode 100644
index 396cae579ce..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_information_schema.result
+++ /dev/null
@@ -1,23 +0,0 @@
-lock_mode lock_type lock_table lock_index lock_rec lock_data
-X RECORD `test`.```t'\"_str` `PRIMARY` 2 '1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc'''''
-X RECORD `test`.```t'\"_str` `PRIMARY` 2 '1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc'''''
-X RECORD `test`.```t'\"_str` `PRIMARY` 3 '2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""'
-X RECORD `test`.```t'\"_str` `PRIMARY` 3 '2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""'
-X RECORD `test`.```t'\"_str` `PRIMARY` 4 '3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\'
-X RECORD `test`.```t'\"_str` `PRIMARY` 4 '3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\'
-X RECORD `test`.```t'\"_str` `PRIMARY` 5 '4', 'abc', '\0abc', 'abc\0', 'a\0bc', 'a\0bc\0', 'a\0bc\0\0'
-X RECORD `test`.```t'\"_str` `PRIMARY` 5 '4', 'abc', '\0abc', 'abc\0', 'a\0bc', 'a\0bc\0', 'a\0bc\0\0'
-X RECORD `test`.`t_min` `PRIMARY` 2 -128, 0, -32768, 0, -8388608, 0, -2147483648, 0, -9223372036854775808, 0
-X RECORD `test`.`t_min` `PRIMARY` 2 -128, 0, -32768, 0, -8388608, 0, -2147483648, 0, -9223372036854775808, 0
-X RECORD `test`.`t_max` `PRIMARY` 2 127, 255, 32767, 65535, 8388607, 16777215, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615
-X RECORD `test`.`t_max` `PRIMARY` 2 127, 255, 32767, 65535, 8388607, 16777215, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615
-X RECORD `test`.```t'\"_str` `PRIMARY` 1 supremum pseudo-record
-X RECORD `test`.```t'\"_str` `PRIMARY` 1 supremum pseudo-record
-lock_table COUNT(*)
-`test`.`t_max` 2
-`test`.`t_min` 2
-`test`.```t'\"_str` 10
-lock_table COUNT(*)
-"test"."t_max" 2
-"test"."t_min" 2
-"test"."`t'\""_str" 10
diff --git a/storage/innodb_plugin/mysql-test/innodb_information_schema.test b/storage/innodb_plugin/mysql-test/innodb_information_schema.test
deleted file mode 100644
index eaed653854a..00000000000
--- a/storage/innodb_plugin/mysql-test/innodb_information_schema.test
+++ /dev/null
@@ -1,145 +0,0 @@
-#
-# Test that user data is correctly "visualized" in
-# INFORMATION_SCHEMA.innodb_locks.lock_data
-#
-
--- source include/have_innodb.inc
-
--- disable_query_log
--- disable_result_log
-
-SET storage_engine=InnoDB;
-
--- disable_warnings
-DROP TABLE IF EXISTS t_min, t_max;
--- enable_warnings
-
-let $table_def =
-(
- c01 TINYINT,
- c02 TINYINT UNSIGNED,
- c03 SMALLINT,
- c04 SMALLINT UNSIGNED,
- c05 MEDIUMINT,
- c06 MEDIUMINT UNSIGNED,
- c07 INT,
- c08 INT UNSIGNED,
- c09 BIGINT,
- c10 BIGINT UNSIGNED,
- PRIMARY KEY(c01, c02, c03, c04, c05, c06, c07, c08, c09, c10)
-);
-
--- eval CREATE TABLE t_min $table_def;
-INSERT INTO t_min VALUES
-(-128, 0,
- -32768, 0,
- -8388608, 0,
- -2147483648, 0,
- -9223372036854775808, 0);
-
--- eval CREATE TABLE t_max $table_def;
-INSERT INTO t_max VALUES
-(127, 255,
- 32767, 65535,
- 8388607, 16777215,
- 2147483647, 4294967295,
- 9223372036854775807, 18446744073709551615);
-
-CREATE TABLE ```t'\"_str` (
- c1 VARCHAR(32),
- c2 VARCHAR(32),
- c3 VARCHAR(32),
- c4 VARCHAR(32),
- c5 VARCHAR(32),
- c6 VARCHAR(32),
- c7 VARCHAR(32),
- PRIMARY KEY(c1, c2, c3, c4, c5, c6, c7)
-);
-INSERT INTO ```t'\"_str` VALUES
-('1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc''''');
-INSERT INTO ```t'\"_str` VALUES
-('2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""');
-INSERT INTO ```t'\"_str` VALUES
-('3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\');
-INSERT INTO ```t'\"_str` VALUES
-('4', 'abc', 0x00616263, 0x61626300, 0x61006263, 0x6100626300, 0x610062630000);
-
--- connect (con_lock,localhost,root,,)
--- connect (con_min_trylock,localhost,root,,)
--- connect (con_max_trylock,localhost,root,,)
--- connect (con_str_insert_supremum,localhost,root,,)
--- connect (con_str_lock_row1,localhost,root,,)
--- connect (con_str_lock_row2,localhost,root,,)
--- connect (con_str_lock_row3,localhost,root,,)
--- connect (con_str_lock_row4,localhost,root,,)
--- connect (con_verify_innodb_locks,localhost,root,,)
-
--- connection con_lock
-SET autocommit=0;
-SELECT * FROM t_min FOR UPDATE;
-SELECT * FROM t_max FOR UPDATE;
-SELECT * FROM ```t'\"_str` FOR UPDATE;
-
--- connection con_min_trylock
--- send
-SELECT * FROM t_min FOR UPDATE;
-
--- connection con_max_trylock
--- send
-SELECT * FROM t_max FOR UPDATE;
-
--- connection con_str_insert_supremum
--- send
-INSERT INTO ```t'\"_str` VALUES
-('z', 'z', 'z', 'z', 'z', 'z', 'z');
-
--- connection con_str_lock_row1
--- send
-SELECT * FROM ```t'\"_str` WHERE c1 = '1' FOR UPDATE;
-
--- connection con_str_lock_row2
--- send
-SELECT * FROM ```t'\"_str` WHERE c1 = '2' FOR UPDATE;
-
--- connection con_str_lock_row3
--- send
-SELECT * FROM ```t'\"_str` WHERE c1 = '3' FOR UPDATE;
-
--- connection con_str_lock_row4
--- send
-SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE;
-
-# Give time to the above 2 queries to execute before continuing.
-# Without this sleep it sometimes happens that the SELECT from innodb_locks
-# executes before some of them, resulting in less than expected number
-# of rows being selected from innodb_locks.
--- sleep 0.1
-
--- enable_result_log
--- connection con_verify_innodb_locks
-SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data
-FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data;
-
-SELECT lock_table,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
-GROUP BY lock_table;
-
-set @save_sql_mode = @@sql_mode;
-SET SQL_MODE='ANSI_QUOTES';
-SELECT lock_table,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS
-GROUP BY lock_table;
-SET @@sql_mode=@save_sql_mode;
--- disable_result_log
-
--- connection default
-
--- disconnect con_lock
--- disconnect con_min_trylock
--- disconnect con_max_trylock
--- disconnect con_str_insert_supremum
--- disconnect con_str_lock_row1
--- disconnect con_str_lock_row2
--- disconnect con_str_lock_row3
--- disconnect con_str_lock_row4
--- disconnect con_verify_innodb_locks
-
-DROP TABLE t_min, t_max, ```t'\"_str`;
diff --git a/storage/innodb_plugin/mysql-test/patches/innodb-index.diff b/storage/innodb_plugin/mysql-test/patches/innodb-index.diff
deleted file mode 100644
index 0b008c96f25..00000000000
--- a/storage/innodb_plugin/mysql-test/patches/innodb-index.diff
+++ /dev/null
@@ -1,62 +0,0 @@
-This part of the innodb-index test causes mysqld to print some warnings
-and subsequently the whole mysql-test suite to fail.
-
-A permanent solution is probably to remove the printouts from the source
-code or to somehow tell the mysql-test suite that warnings are expected.
-Currently we simply do not execute the problematic tests. Please
-coordinate a permanent solution with Marko, who added those tests.
-
-This cannot be proposed to MySQL because it touches files that are not
-in the MySQL source repository.
-
-Index: storage/innobase/mysql-test/innodb-index.result
-===================================================================
---- storage/innobase/mysql-test/innodb-index.result (revision 2870)
-+++ storage/innobase/mysql-test/innodb-index.result (working copy)
-@@ -43,19 +43,12 @@ t1 CREATE TABLE `t1` (
- `b` int(11) DEFAULT NULL,
- `c` char(10) NOT NULL,
- `d` varchar(20) DEFAULT NULL,
- KEY `d2` (`d`),
- KEY `b` (`b`)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1
--CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB;
--alter table t1 add unique index (c), add index (d);
--ERROR HY000: Table 'test.t1#1' already exists
--rename table `t1#1` to `t1#2`;
--alter table t1 add unique index (c), add index (d);
--ERROR HY000: Table 'test.t1#2' already exists
--drop table `t1#2`;
- alter table t1 add unique index (c), add index (d);
- show create table t1;
- Table Create Table
- t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` int(11) DEFAULT NULL,
-Index: storage/innobase/mysql-test/innodb-index.test
-===================================================================
---- storage/innobase/mysql-test/innodb-index.test (revision 2870)
-+++ storage/innobase/mysql-test/innodb-index.test (working copy)
-@@ -14,22 +14,12 @@ select * from t1 force index (d2) order
- --error ER_DUP_ENTRY
- alter table t1 add unique index (b);
- show create table t1;
- alter table t1 add index (b);
- show create table t1;
-
--# Check how existing tables interfere with temporary tables.
--CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB;
--
----error 156
--alter table t1 add unique index (c), add index (d);
--rename table `t1#1` to `t1#2`;
----error 156
--alter table t1 add unique index (c), add index (d);
--drop table `t1#2`;
--
- alter table t1 add unique index (c), add index (d);
- show create table t1;
- explain select * from t1 force index(c) order by c;
- alter table t1 add primary key (a), drop index c;
- show create table t1;
- --error ER_MULTIPLE_PRI_KEY
diff --git a/storage/innodb_plugin/plug.in.disabled b/storage/innodb_plugin/plug.in.disabled
index 9aed029cfc2..e638332d74a 100644
--- a/storage/innodb_plugin/plug.in.disabled
+++ b/storage/innodb_plugin/plug.in.disabled
@@ -15,7 +15,7 @@
#
MYSQL_STORAGE_ENGINE(innodb_plugin,, [InnoDB Storage Engine],
- [Transactional Tables using InnoDB],)
+ [Transactional Tables using InnoDB], [max,max-no-ndb])
MYSQL_PLUGIN_DIRECTORY(innodb_plugin, [storage/innodb_plugin])
MYSQL_PLUGIN_DYNAMIC(innodb_plugin, [ha_innodb_plugin.la])
MYSQL_PLUGIN_ACTIONS(innodb_plugin, [
diff --git a/storage/innodb_plugin/rem/rem0rec.c b/storage/innodb_plugin/rem/rem0rec.c
index 27c11dacc8c..37ba8ca2ffe 100644
--- a/storage/innodb_plugin/rem/rem0rec.c
+++ b/storage/innodb_plugin/rem/rem0rec.c
@@ -212,6 +212,13 @@ rec_get_n_extern_new(
const dict_col_t* col
= dict_field_get_col(field);
len = *lens--;
+ /* If the maximum length of the field is up
+ to 255 bytes, the actual length is always
+ stored in one byte. If the maximum length is
+ more than 255 bytes, the actual length is
+ stored in one byte for 0..127. The length
+ will be encoded in two bytes when it is 128 or
+ more, or when the field is stored externally. */
if (UNIV_UNLIKELY(col->len > 255)
|| UNIV_UNLIKELY(col->mtype == DATA_BLOB)) {
if (len & 0x80) {
@@ -294,6 +301,13 @@ rec_init_offsets_comp_ordinary(
const dict_col_t* col
= dict_field_get_col(field);
len = *lens--;
+ /* If the maximum length of the field is up
+ to 255 bytes, the actual length is always
+ stored in one byte. If the maximum length is
+ more than 255 bytes, the actual length is
+ stored in one byte for 0..127. The length
+ will be encoded in two bytes when it is 128 or
+ more, or when the field is stored externally. */
if (UNIV_UNLIKELY(col->len > 255)
|| UNIV_UNLIKELY(col->mtype
== DATA_BLOB)) {
@@ -425,6 +439,15 @@ rec_init_offsets(
const dict_col_t* col
= dict_field_get_col(field);
len = *lens--;
+ /* If the maximum length of the field
+ is up to 255 bytes, the actual length
+ is always stored in one byte. If the
+ maximum length is more than 255 bytes,
+ the actual length is stored in one
+ byte for 0..127. The length will be
+ encoded in two bytes when it is 128 or
+ more, or when the field is stored
+ externally. */
if (UNIV_UNLIKELY(col->len > 255)
|| UNIV_UNLIKELY(col->mtype
== DATA_BLOB)) {
@@ -647,6 +670,13 @@ rec_get_offsets_reverse(
const dict_col_t* col
= dict_field_get_col(field);
len = *lens++;
+ /* If the maximum length of the field is up
+ to 255 bytes, the actual length is always
+ stored in one byte. If the maximum length is
+ more than 255 bytes, the actual length is
+ stored in one byte for 0..127. The length
+ will be encoded in two bytes when it is 128 or
+ more, or when the field is stored externally. */
if (UNIV_UNLIKELY(col->len > 255)
|| UNIV_UNLIKELY(col->mtype == DATA_BLOB)) {
if (len & 0x80) {
@@ -781,12 +811,20 @@ rec_get_converted_size_comp_prefix(
ut_ad(len <= col->len || col->mtype == DATA_BLOB);
+ /* If the maximum length of a variable-length field
+ is up to 255 bytes, the actual length is always stored
+ in one byte. If the maximum length is more than 255
+ bytes, the actual length is stored in one byte for
+ 0..127. The length will be encoded in two bytes when
+ it is 128 or more, or when the field is stored externally. */
+
if (field->fixed_len) {
ut_ad(len == field->fixed_len);
/* dict_index_add_col() should guarantee this */
ut_ad(!field->prefix_len
|| field->fixed_len == field->prefix_len);
} else if (dfield_is_ext(&fields[i])) {
+ ut_ad(col->len >= 256 || col->mtype == DATA_BLOB);
extra_size += 2;
} else if (len < 128
|| (col->len < 256 && col->mtype != DATA_BLOB)) {
@@ -1086,6 +1124,8 @@ rec_convert_dtuple_to_rec_comp(
/* Store the data and the offsets */
for (i = 0, field = fields; i < n_fields; i++, field++) {
+ const dict_field_t* ifield;
+
type = dfield_get_type(field);
len = dfield_get_len(field);
@@ -1120,12 +1160,20 @@ rec_convert_dtuple_to_rec_comp(
/* only nullable fields can be null */
ut_ad(!dfield_is_null(field));
- fixed_len = dict_index_get_nth_field(index, i)->fixed_len;
-
+ ifield = dict_index_get_nth_field(index, i);
+ fixed_len = ifield->fixed_len;
+ /* If the maximum length of a variable-length field
+ is up to 255 bytes, the actual length is always stored
+ in one byte. If the maximum length is more than 255
+ bytes, the actual length is stored in one byte for
+ 0..127. The length will be encoded in two bytes when
+ it is 128 or more, or when the field is stored externally. */
if (fixed_len) {
ut_ad(len == fixed_len);
ut_ad(!dfield_is_ext(field));
} else if (dfield_is_ext(field)) {
+ ut_ad(ifield->col->len >= 256
+ || ifield->col->mtype == DATA_BLOB);
ut_ad(len <= REC_MAX_INDEX_COL_LEN
+ BTR_EXTERN_FIELD_REF_SIZE);
*lens-- = (byte) (len >> 8) | 0xc0;
@@ -1215,11 +1263,20 @@ rec_convert_dtuple_to_rec(
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
const ulint* offsets;
+ ulint i;
rec_offs_init(offsets_);
offsets = rec_get_offsets(rec, index,
offsets_, ULINT_UNDEFINED, &heap);
ut_ad(rec_validate(rec, offsets));
+ ut_ad(dtuple_get_n_fields(dtuple)
+ == rec_offs_n_fields(offsets));
+
+ for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+ ut_ad(!dfield_is_ext(dtuple_get_nth_field(dtuple, i))
+ == !rec_offs_nth_extern(offsets, i));
+ }
+
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1402,6 +1459,13 @@ rec_copy_prefix_to_buf(
prefix_len += field->fixed_len;
} else {
ulint len = *lens--;
+ /* If the maximum length of the column is up
+ to 255 bytes, the actual length is always
+ stored in one byte. If the maximum length is
+ more than 255 bytes, the actual length is
+ stored in one byte for 0..127. The length
+ will be encoded in two bytes when it is 128 or
+ more, or when the column is stored externally. */
if (col->len > 255 || col->mtype == DATA_BLOB) {
if (len & 0x80) {
/* 1exxxxxx */
diff --git a/storage/innodb_plugin/row/row0merge.c b/storage/innodb_plugin/row/row0merge.c
index 88a2770032d..d61d626f92e 100644
--- a/storage/innodb_plugin/row/row0merge.c
+++ b/storage/innodb_plugin/row/row0merge.c
@@ -2070,7 +2070,7 @@ row_merge_drop_temp_indexes(void)
field = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_NAME_FIELD,
&len);
if (len == UNIV_SQL_NULL || len == 0
- || mach_read_from_1(field) != (ulint) TEMP_INDEX_PREFIX) {
+ || (char) *field != TEMP_INDEX_PREFIX) {
continue;
}
diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c
index 0d8d298453c..24abf8067f2 100644
--- a/storage/innodb_plugin/row/row0mysql.c
+++ b/storage/innodb_plugin/row/row0mysql.c
@@ -1458,7 +1458,7 @@ row_unlock_for_mysql(
if (UNIV_UNLIKELY
(!srv_locks_unsafe_for_binlog
- && trx->isolation_level != TRX_ISO_READ_COMMITTED)) {
+ && trx->isolation_level > TRX_ISO_READ_COMMITTED)) {
fprintf(stderr,
"InnoDB: Error: calling row_unlock_for_mysql though\n"
diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c
index 78318bf6461..d0702a0cd2f 100644
--- a/storage/innodb_plugin/row/row0sel.c
+++ b/storage/innodb_plugin/row/row0sel.c
@@ -852,7 +852,7 @@ row_sel_get_clust_rec(
trx = thr_get_trx(thr);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
lock_type = LOCK_REC_NOT_GAP;
} else {
lock_type = LOCK_ORDINARY;
@@ -1465,7 +1465,7 @@ rec_loop:
if (srv_locks_unsafe_for_binlog
|| trx->isolation_level
- == TRX_ISO_READ_COMMITTED) {
+ <= TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(next_rec)) {
@@ -1522,7 +1522,7 @@ skip_lock:
trx = thr_get_trx(thr);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(rec)) {
@@ -3665,7 +3665,7 @@ shortcut_fails_too_big_rec:
&& !page_rec_is_supremum(rec)
&& set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the next index record
@@ -3761,7 +3761,7 @@ rec_loop:
if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a lock on the index record */
@@ -3895,7 +3895,7 @@ wrong_offs:
if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
|| trx->isolation_level
- == TRX_ISO_READ_COMMITTED)
+ <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the index
@@ -3931,7 +3931,7 @@ wrong_offs:
if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
|| trx->isolation_level
- == TRX_ISO_READ_COMMITTED)
+ <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the index
@@ -3979,7 +3979,7 @@ wrong_offs:
if (!set_also_gap_locks
|| srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED
|| (unique_search
&& !UNIV_UNLIKELY(rec_get_deleted_flag(rec, comp)))) {
@@ -4018,7 +4018,7 @@ no_gap_lock:
const rec_t* old_vers;
case DB_SUCCESS:
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
/* Note that a record of
prebuilt->index was locked. */
prebuilt->new_rec_locks = 1;
@@ -4027,6 +4027,7 @@ no_gap_lock:
case DB_LOCK_WAIT:
if (UNIV_LIKELY(prebuilt->row_read_type
!= ROW_READ_TRY_SEMI_CONSISTENT)
+ || unique_search
|| index != clust_index) {
goto lock_wait_or_error;
@@ -4150,7 +4151,7 @@ no_gap_lock:
/* The record is delete-marked: we can skip it */
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE
&& !did_semi_consistent_read) {
@@ -4217,7 +4218,7 @@ requires_clust_rec:
}
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* Note that both the secondary index record
and the clustered index record were locked. */
@@ -4230,7 +4231,7 @@ requires_clust_rec:
/* The record is delete marked: we can skip it */
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& prebuilt->select_lock_type != LOCK_NONE) {
/* No need to keep a lock on a delete-marked
@@ -4441,7 +4442,7 @@ lock_wait_or_error:
moves_up, &mtr);
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
&& !same_user_rec) {
/* Since we were not able to restore the cursor
@@ -4613,12 +4614,12 @@ row_search_autoinc_read_column(
case DATA_FLOAT:
ut_a(len == sizeof(float));
- value = mach_float_read(data);
+ value = (ib_uint64_t) mach_float_read(data);
break;
case DATA_DOUBLE:
ut_a(len == sizeof(double));
- value = mach_double_read(data);
+ value = (ib_uint64_t) mach_double_read(data);
break;
default:
diff --git a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
index 78f11cfd2f3..63c355cea32 100644
--- a/storage/innodb_plugin/srv/srv0srv.c
+++ b/storage/innodb_plugin/srv/srv0srv.c
@@ -1609,8 +1609,9 @@ srv_suspend_mysql_thread(
innodb_lock_wait_timeout, because trx->mysql_thd == NULL. */
lock_wait_timeout = thd_lock_wait_timeout(trx->mysql_thd);
- if (lock_wait_timeout < 100000000
- && wait_time > (double) lock_wait_timeout) {
+ if (trx_is_interrupted(trx)
+ || (lock_wait_timeout < 100000000
+ && wait_time > (double) lock_wait_timeout)) {
trx->error_state = DB_LOCK_WAIT_TIMEOUT;
}
@@ -2158,9 +2159,10 @@ loop:
lock_wait_timeout = thd_lock_wait_timeout(
trx->mysql_thd);
- if (lock_wait_timeout < 100000000
- && (wait_time > (double) lock_wait_timeout
- || wait_time < 0)) {
+ if (trx_is_interrupted(trx)
+ || (lock_wait_timeout < 100000000
+ && (wait_time > (double) lock_wait_timeout
+ || wait_time < 0))) {
/* Timeout exceeded or a wrap-around in system
time counter: cancel the lock request queued
diff --git a/storage/innodb_plugin/trx/trx0rec.c b/storage/innodb_plugin/trx/trx0rec.c
index bcc1f81381e..f50e10ed756 100644
--- a/storage/innodb_plugin/trx/trx0rec.c
+++ b/storage/innodb_plugin/trx/trx0rec.c
@@ -350,8 +350,13 @@ trx_undo_rec_get_col_val(
ut_ad(*orig_len >= BTR_EXTERN_FIELD_REF_SIZE);
ut_ad(*len > *orig_len);
- ut_ad(*len >= REC_MAX_INDEX_COL_LEN
+ /* @see dtuple_convert_big_rec() */
+ ut_ad(*len >= BTR_EXTERN_FIELD_REF_SIZE * 2);
+ /* we do not have access to index->table here
+ ut_ad(dict_table_get_format(index->table) >= DICT_TF_FORMAT_ZIP
+ || *len >= REC_MAX_INDEX_COL_LEN
+ BTR_EXTERN_FIELD_REF_SIZE);
+ */
*len += UNIV_EXTERN_STORAGE_FIELD;
break;
@@ -1075,11 +1080,15 @@ trx_undo_rec_get_partial_row(
/* If the prefix of this column is indexed,
ensure that enough prefix is stored in the
undo log record. */
- ut_a(ignore_prefix
- || !col->ord_part
- || dfield_get_len(dfield)
- >= REC_MAX_INDEX_COL_LEN
- + BTR_EXTERN_FIELD_REF_SIZE);
+ if (!ignore_prefix && col->ord_part) {
+ ut_a(dfield_get_len(dfield)
+ >= 2 * BTR_EXTERN_FIELD_REF_SIZE);
+ ut_a(dict_table_get_format(index->table)
+ >= DICT_TF_FORMAT_ZIP
+ || dfield_get_len(dfield)
+ >= REC_MAX_INDEX_COL_LEN
+ + BTR_EXTERN_FIELD_REF_SIZE);
+ }
}
}
diff --git a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c
index e8c98e22918..6ef7e62e6ae 100644
--- a/storage/innodb_plugin/trx/trx0trx.c
+++ b/storage/innodb_plugin/trx/trx0trx.c
@@ -843,7 +843,7 @@ trx_commit_off_kernel(
recovery i.e.: back ground rollback thread is still active
then there is a chance that the rollback thread may see
this trx as COMMITTED_IN_MEMORY and goes adhead to clean it
- up calling trx_cleanup_at_db_startup(). This can happen
+ up calling trx_cleanup_at_db_startup(). This can happen
in the case we are committing a trx here that is left in
PREPARED state during the crash. Note that commit of the
rollback of a PREPARED trx happens in the recovery thread
diff --git a/storage/pbxt/src/ha_pbxt.cc b/storage/pbxt/src/ha_pbxt.cc
index f9ebbc9c903..0a76239b177 100644
--- a/storage/pbxt/src/ha_pbxt.cc
+++ b/storage/pbxt/src/ha_pbxt.cc
@@ -1250,7 +1250,7 @@ static int pbxt_init(void *p)
* Only real problem, 2 threads try to load the same
* plugin at the same time.
*/
-#if MYSQL_VERSION_ID < 60014
+#if MYSQL_VERSION_ID < 60014 && (!defined(MARIADB_BASE_VERSION) || MYSQL_VERSION_ID < 50146)
myxt_mutex_unlock(&LOCK_plugin);
#endif
#endif
@@ -1287,7 +1287,7 @@ static int pbxt_init(void *p)
if (thd)
myxt_destroy_thread(thd, FALSE);
#ifndef DRIZZLED
-#if MYSQL_VERSION_ID < 60014
+#if MYSQL_VERSION_ID < 60014 && (!defined(MARIADB_BASE_VERSION) || MYSQL_VERSION_ID < 50146)
myxt_mutex_lock(&LOCK_plugin);
#endif
#endif