summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-06-19 17:28:08 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-06-19 17:28:08 +0300
commit1e3886ae80c44a39ec3e4061b4ea3131cdcef213 (patch)
treece95518792d1432b669ba13a248928e74e81a9bb /mysql-test
parent0fe7d8a2a221196d977e5efe3f3dedb22806bb53 (diff)
parent3a7201ea922f6d3373924c413fdb4b108f6208c5 (diff)
downloadmariadb-git-1e3886ae80c44a39ec3e4061b4ea3131cdcef213.tar.gz
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/innodb_page_size.combinations16
-rw-r--r--mysql-test/include/innodb_page_size.inc4
-rw-r--r--mysql-test/include/innodb_page_size_small.combinations8
-rw-r--r--mysql-test/include/innodb_page_size_small.inc4
-rw-r--r--mysql-test/include/varchar.inc1
-rw-r--r--mysql-test/lib/mtr_report.pm4
-rwxr-xr-xmysql-test/mysql-test-run.pl42
-rw-r--r--mysql-test/r/alter_table_online.result35
-rw-r--r--mysql-test/r/analyze_format_json.result33
-rw-r--r--mysql-test/r/create.result4
-rw-r--r--mysql-test/r/cte_nonrecursive.result2
-rw-r--r--mysql-test/r/derived_view.result59
-rw-r--r--mysql-test/r/flush-innodb.result2
-rw-r--r--mysql-test/r/flush.result10
-rw-r--r--mysql-test/r/func_group.result9
-rw-r--r--mysql-test/r/func_hybrid_type.result147
-rw-r--r--mysql-test/r/func_regexp_pcre.result14
-rw-r--r--mysql-test/r/grant.result4
-rw-r--r--mysql-test/r/innodb_ext_key.result77
-rw-r--r--mysql-test/r/insert_notembedded.result2
-rw-r--r--mysql-test/r/join_outer.result95
-rw-r--r--mysql-test/r/join_outer_jcl6.result95
-rw-r--r--mysql-test/r/limit_rows_examined.result5
-rw-r--r--mysql-test/r/log_tables-big.result8
-rw-r--r--mysql-test/r/mdl_sync.result18
-rw-r--r--mysql-test/r/merge.result16
-rw-r--r--mysql-test/r/mix2_myisam.result3
-rw-r--r--mysql-test/r/mrr_icp_extra.result3
-rw-r--r--mysql-test/r/myisam.result3
-rw-r--r--mysql-test/r/myisam_debug.result12
-rw-r--r--mysql-test/r/mysqld--help.result2
-rw-r--r--mysql-test/r/partition_alter.result47
-rw-r--r--mysql-test/r/rename.result2
-rw-r--r--mysql-test/r/sp.result18
-rw-r--r--mysql-test/r/subselect_innodb.result39
-rw-r--r--mysql-test/r/subselect_mat_cost_bugs.result43
-rw-r--r--mysql-test/r/subselect_sj.result95
-rw-r--r--mysql-test/r/subselect_sj2_mat.result23
-rw-r--r--mysql-test/r/subselect_sj_jcl6.result95
-rw-r--r--mysql-test/r/trigger.result12
-rw-r--r--mysql-test/r/union.result29
-rw-r--r--mysql-test/r/view.result28
-rw-r--r--mysql-test/suite/binlog/r/mysqladmin.result12
-rw-r--r--mysql-test/suite/binlog/t/mysqladmin.test12
-rw-r--r--mysql-test/suite/csv/read_only.result30
-rw-r--r--mysql-test/suite/csv/read_only.test19
-rw-r--r--mysql-test/suite/encryption/r/innodb-checksum-algorithm,32k.rdiff38
-rw-r--r--mysql-test/suite/encryption/r/innodb-checksum-algorithm,64k.rdiff38
-rw-r--r--mysql-test/suite/encryption/r/innodb-checksum-algorithm.result643
-rw-r--r--mysql-test/suite/encryption/r/innodb-compressed-blob.result1
-rw-r--r--mysql-test/suite/encryption/r/innodb-first-page-read.result87
-rw-r--r--mysql-test/suite/encryption/r/innodb-key-rotation-disable.result1
-rw-r--r--mysql-test/suite/encryption/t/innodb-checksum-algorithm.test120
-rw-r--r--mysql-test/suite/encryption/t/innodb-compressed-blob.combinations12
-rw-r--r--mysql-test/suite/encryption/t/innodb-compressed-blob.opt4
-rw-r--r--mysql-test/suite/encryption/t/innodb-compressed-blob.test3
-rw-r--r--mysql-test/suite/encryption/t/innodb-first-page-read.opt5
-rw-r--r--mysql-test/suite/encryption/t/innodb-first-page-read.test92
-rw-r--r--mysql-test/suite/encryption/t/innodb-key-rotation-disable.test1
-rw-r--r--mysql-test/suite/federated/assisted_discovery.result34
-rw-r--r--mysql-test/suite/federated/assisted_discovery.test24
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_trig_0407.result2
-rw-r--r--mysql-test/suite/funcs_1/r/innodb_views.result12
-rw-r--r--mysql-test/suite/funcs_1/r/memory_trig_0407.result2
-rw-r--r--mysql-test/suite/funcs_1/r/memory_views.result12
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_trig_0407.result2
-rw-r--r--mysql-test/suite/funcs_1/r/myisam_views-big.result18
-rw-r--r--mysql-test/suite/galera/galera_2nodes.cnf2
-rw-r--r--mysql-test/suite/galera/r/MW-309.result22
-rw-r--r--mysql-test/suite/galera/t/MW-309.test32
-rw-r--r--mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf5
-rw-r--r--mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test2
-rw-r--r--mysql-test/suite/galera/t/galera_var_cluster_address.test1
-rw-r--r--mysql-test/suite/galera_3nodes/disabled.def1
-rw-r--r--mysql-test/suite/galera_3nodes/galera_3nodes.cnf9
-rw-r--r--mysql-test/suite/innodb/include/innodb-page-compression.inc126
-rw-r--r--mysql-test/suite/innodb/include/wait_all_purged.inc19
-rw-r--r--mysql-test/suite/innodb/r/doublewrite.result12
-rw-r--r--mysql-test/suite/innodb/r/drop_table_background.result9
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_compression_default.result115
-rw-r--r--mysql-test/suite/innodb/r/innodb-page_compression_snappy.result489
-rw-r--r--mysql-test/suite/innodb/r/innodb.result3
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_del_mark.result91
-rw-r--r--mysql-test/suite/innodb/r/innodb_stats_persistent.result116
-rw-r--r--mysql-test/suite/innodb/r/row_format_redundant.result79
-rw-r--r--mysql-test/suite/innodb/r/table_flags,32k.rdiff105
-rw-r--r--mysql-test/suite/innodb/r/table_flags,4k.rdiff92
-rw-r--r--mysql-test/suite/innodb/r/table_flags,64k.rdiff105
-rw-r--r--mysql-test/suite/innodb/r/table_flags,8k.rdiff92
-rw-r--r--mysql-test/suite/innodb/r/table_flags.result188
-rw-r--r--mysql-test/suite/innodb/r/temporary_table.result4
-rw-r--r--mysql-test/suite/innodb/t/101_compatibility.test2
-rw-r--r--mysql-test/suite/innodb/t/alter_missing_tablespace.test2
-rw-r--r--mysql-test/suite/innodb/t/doublewrite.test50
-rw-r--r--mysql-test/suite/innodb/t/drop_table_background.test30
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-debug.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-nullable.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-table.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter-tempfile.test3
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_default.test42
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_snappy.test243
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_del_mark-master.opt1
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_del_mark.test113
-rw-r--r--mysql-test/suite/innodb/t/innodb_stats_persistent.test95
-rw-r--r--mysql-test/suite/innodb/t/log_data_file_size.test2
-rw-r--r--mysql-test/suite/innodb/t/log_file_size.test8
-rw-r--r--mysql-test/suite/innodb/t/row_format_redundant.test157
-rw-r--r--mysql-test/suite/innodb/t/table_flags.test206
-rw-r--r--mysql-test/suite/innodb/t/temporary_table.test7
-rw-r--r--mysql-test/suite/innodb/t/truncate_purge_debug.test19
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result12
-rw-r--r--mysql-test/suite/innodb_zip/include/have_innodb_zip.inc4
-rw-r--r--mysql-test/suite/innodb_zip/r/wl6344_compress_level.result60
-rw-r--r--mysql-test/suite/innodb_zip/t/bug36169.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/bug52745.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/bug53591.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/bug56680.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/create_options.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/innochecksum.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/innochecksum_2.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/innochecksum_3.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb-zip.test2
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_bug36169.test2
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_bug36172.test2
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_bug52745.test2
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_bug53591.test2
-rw-r--r--mysql-test/suite/innodb_zip/t/innodb_bug56680.test2
-rw-r--r--mysql-test/suite/innodb_zip/t/recover.test7
-rw-r--r--mysql-test/suite/innodb_zip/t/restart.test4
-rw-r--r--mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/wl5522_zip.test3
-rw-r--r--mysql-test/suite/innodb_zip/t/wl6344_compress_level.test63
-rw-r--r--mysql-test/suite/maria/maria.result3
-rw-r--r--mysql-test/suite/mariabackup/full_backup.test1
-rw-r--r--mysql-test/suite/mariabackup/include/restart_and_restore.inc2
-rw-r--r--mysql-test/suite/mariabackup/incremental_encrypted.test5
-rw-r--r--mysql-test/suite/mariabackup/suite.pm5
-rw-r--r--mysql-test/suite/mariabackup/tar.result12
-rw-r--r--mysql-test/suite/mariabackup/tar.test30
-rw-r--r--mysql-test/suite/mariabackup/xb_file_key_management.test1
-rw-r--r--mysql-test/suite/mariabackup/xbstream.test2
-rw-r--r--mysql-test/suite/multi_source/mdev-9544.cnf22
-rw-r--r--mysql-test/suite/multi_source/mdev-9544.result90
-rw-r--r--mysql-test/suite/multi_source/mdev-9544.test116
-rw-r--r--mysql-test/suite/perfschema/r/start_server_1_digest.result7
-rw-r--r--mysql-test/suite/perfschema/r/view_table_io.result2
-rw-r--r--mysql-test/suite/perfschema/t/start_server_1_digest-master.opt1
-rw-r--r--mysql-test/suite/perfschema/t/start_server_1_digest.test15
-rw-r--r--mysql-test/suite/plugins/r/show_all_plugins.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev-11092.result21
-rw-r--r--mysql-test/suite/rpl/r/sequence.result20
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev-11092.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev-11092.test53
-rw-r--r--mysql-test/suite/sql_sequence/alter.result30
-rw-r--r--mysql-test/suite/sql_sequence/alter.test2
-rw-r--r--mysql-test/suite/sql_sequence/aria.result2
-rw-r--r--mysql-test/suite/sql_sequence/binlog.result20
-rw-r--r--mysql-test/suite/sql_sequence/binlog.test8
-rw-r--r--mysql-test/suite/sql_sequence/create.result293
-rw-r--r--mysql-test/suite/sql_sequence/create.test115
-rw-r--r--mysql-test/suite/sql_sequence/gtid.result68
-rw-r--r--mysql-test/suite/sql_sequence/gtid.test4
-rw-r--r--mysql-test/suite/sql_sequence/mysqldump.result28
-rw-r--r--mysql-test/suite/sql_sequence/next.result172
-rw-r--r--mysql-test/suite/sql_sequence/next.test66
-rw-r--r--mysql-test/suite/sql_sequence/other.result40
-rw-r--r--mysql-test/suite/sql_sequence/other.test22
-rw-r--r--mysql-test/suite/sql_sequence/read_only.result13
-rw-r--r--mysql-test/suite/sql_sequence/read_only.test16
-rw-r--r--mysql-test/suite/sql_sequence/replication.result243
-rw-r--r--mysql-test/suite/sql_sequence/replication.test105
-rw-r--r--mysql-test/suite/sql_sequence/setval.result96
-rw-r--r--mysql-test/suite/sql_sequence/setval.test48
-rw-r--r--mysql-test/suite/sql_sequence/temporary.result12
-rw-r--r--mysql-test/suite/sql_sequence/temporary.test16
-rw-r--r--mysql-test/suite/storage_engine/alter_table.result2
-rw-r--r--mysql-test/suite/storage_engine/alter_tablespace.result2
-rw-r--r--mysql-test/suite/storage_engine/create_table.result2
-rw-r--r--mysql-test/suite/storage_engine/disabled.def12
-rw-r--r--mysql-test/suite/storage_engine/insert_delayed.test2
-rw-r--r--mysql-test/suite/storage_engine/repair_table.inc3
-rw-r--r--mysql-test/suite/storage_engine/repair_table.result3
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_data_dir.result (renamed from mysql-test/suite/storage_engine/tbl_opt_data_index_dir.result)9
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_data_dir.test52
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_data_index_dir.test52
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_index_dir.result19
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_index_dir.test52
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_row_format.result20
-rw-r--r--mysql-test/suite/storage_engine/tbl_opt_row_format.test28
-rw-r--r--mysql-test/suite/storage_engine/type_char_indexes.result2
-rw-r--r--mysql-test/suite/storage_engine/type_date_time.result2
-rw-r--r--mysql-test/suite/storage_engine/vcol.result24
-rw-r--r--mysql-test/suite/sys_vars/r/delay_key_write_func.result42
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_sched_priority_cleaner_basic.result2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result6
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_embedded.result4
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result4
-rw-r--r--mysql-test/suite/sys_vars/t/delay_key_write_func.test42
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_sched_priority_cleaner_basic.test10
-rw-r--r--mysql-test/suite/wsrep/include/check_galera_version.inc26
-rw-r--r--mysql-test/t/alter_table_online.test24
-rw-r--r--mysql-test/t/derived_view.test50
-rw-r--r--mysql-test/t/func_group.test11
-rw-r--r--mysql-test/t/func_hybrid_type.test36
-rw-r--r--mysql-test/t/func_regexp_pcre.test11
-rw-r--r--mysql-test/t/innodb_ext_key.test45
-rw-r--r--mysql-test/t/join_outer.test82
-rw-r--r--mysql-test/t/log_tables-big-master.opt2
-rw-r--r--mysql-test/t/mdl_sync.test24
-rw-r--r--mysql-test/t/myisam_debug.test13
-rw-r--r--mysql-test/t/mysqld--help.test1
-rw-r--r--mysql-test/t/partition_alter.test39
-rw-r--r--mysql-test/t/subselect_innodb.test35
-rw-r--r--mysql-test/t/subselect_mat_cost_bugs.test44
-rw-r--r--mysql-test/t/subselect_sj.test72
-rw-r--r--mysql-test/t/subselect_sj2_mat.test20
-rw-r--r--mysql-test/t/trigger.test24
-rw-r--r--mysql-test/t/truncate.test2
-rw-r--r--mysql-test/t/union.test25
221 files changed, 5988 insertions, 2121 deletions
diff --git a/mysql-test/include/innodb_page_size.combinations b/mysql-test/include/innodb_page_size.combinations
new file mode 100644
index 00000000000..b9b1e1b106f
--- /dev/null
+++ b/mysql-test/include/innodb_page_size.combinations
@@ -0,0 +1,16 @@
+[64k]
+innodb-page-size=64K
+innodb-buffer-pool-size=24M
+
+[32k]
+innodb-page-size=32K
+innodb-buffer-pool-size=24M
+
+[16k]
+innodb-page-size=16K
+
+[8k]
+innodb-page-size=8K
+
+[4k]
+innodb-page-size=4K
diff --git a/mysql-test/include/innodb_page_size.inc b/mysql-test/include/innodb_page_size.inc
new file mode 100644
index 00000000000..754b640da86
--- /dev/null
+++ b/mysql-test/include/innodb_page_size.inc
@@ -0,0 +1,4 @@
+# The goal of including this file is to enable innodb_page_size combinations
+# (see include/innodb_page_size.combinations)
+
+--source include/have_innodb.inc
diff --git a/mysql-test/include/innodb_page_size_small.combinations b/mysql-test/include/innodb_page_size_small.combinations
new file mode 100644
index 00000000000..a9b7c7ce14d
--- /dev/null
+++ b/mysql-test/include/innodb_page_size_small.combinations
@@ -0,0 +1,8 @@
+[16k]
+innodb-page-size=16K
+
+[8k]
+innodb-page-size=8K
+
+[4k]
+innodb-page-size=4K
diff --git a/mysql-test/include/innodb_page_size_small.inc b/mysql-test/include/innodb_page_size_small.inc
new file mode 100644
index 00000000000..754b640da86
--- /dev/null
+++ b/mysql-test/include/innodb_page_size_small.inc
@@ -0,0 +1,4 @@
+# The goal of including this file is to enable innodb_page_size combinations
+# (see include/innodb_page_size.combinations)
+
+--source include/have_innodb.inc
diff --git a/mysql-test/include/varchar.inc b/mysql-test/include/varchar.inc
index 50741130895..7add7113b8d 100644
--- a/mysql-test/include/varchar.inc
+++ b/mysql-test/include/varchar.inc
@@ -90,6 +90,7 @@ explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a '
--replace_regex /Duplicate entry '[^']+' for key/Duplicate entry '{ ' for key/
--error ER_DUP_ENTRY
alter table t1 add unique(v);
+show warnings;
alter table t1 add key(v);
select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
--replace_column 6 # 9 # 10 #
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
index 97ace54f0fb..d93d8adf34c 100644
--- a/mysql-test/lib/mtr_report.pm
+++ b/mysql-test/lib/mtr_report.pm
@@ -208,6 +208,10 @@ sub mtr_report_test ($) {
{
mtr_report("[ skipped ]");
}
+ if ( $tinfo->{'warnings'} )
+ {
+ mtr_report($tinfo->{'warnings'});
+ }
}
elsif ($result eq 'MTR_RES_PASSED')
{
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 1d41067bb1e..4fc0c90c07d 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2794,15 +2794,26 @@ sub mysql_server_start($) {
}
my $mysqld_basedir= $mysqld->value('basedir');
+ my $extra_opts= get_extra_opts($mysqld, $tinfo);
+
if ( $basedir eq $mysqld_basedir )
{
if (! $opt_start_dirty) # If dirty, keep possibly grown system db
{
- # Copy datadir from installed system db
- my $path= ($opt_parallel == 1) ? "$opt_vardir" : "$opt_vardir/..";
- my $install_db= "$path/install.db";
- copytree($install_db, $datadir) if -d $install_db;
- mtr_error("Failed to copy system db to '$datadir'") unless -d $datadir;
+ # Some InnoDB options are incompatible with the default bootstrap.
+ # If they are used, re-bootstrap
+ if ( $extra_opts and
+ "@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)/ )
+ {
+ mysql_install_db($mysqld, undef, $extra_opts);
+ }
+ else {
+ # Copy datadir from installed system db
+ my $path= ($opt_parallel == 1) ? "$opt_vardir" : "$opt_vardir/..";
+ my $install_db= "$path/install.db";
+ copytree($install_db, $datadir) if -d $install_db;
+ mtr_error("Failed to copy system db to '$datadir'") unless -d $datadir;
+ }
}
}
else
@@ -2841,7 +2852,6 @@ sub mysql_server_start($) {
if (!$opt_embedded_server)
{
- my $extra_opts= get_extra_opts($mysqld, $tinfo);
mysqld_start($mysqld,$extra_opts);
# Save this test case information, so next can examine it
@@ -3065,7 +3075,7 @@ sub default_mysqld {
sub mysql_install_db {
- my ($mysqld, $datadir)= @_;
+ my ($mysqld, $datadir, $extra_opts)= @_;
my $install_datadir= $datadir || $mysqld->value('datadir');
my $install_basedir= $mysqld->value('basedir');
@@ -3106,6 +3116,13 @@ sub mysql_install_db {
mtr_add_arg($args, $extra_opt);
}
}
+ # InnoDB options can come not only from the command line, but also
+ # from option files or combinations
+ foreach my $extra_opt ( @$extra_opts ) {
+ if ($extra_opt =~ /--innodb/) {
+ mtr_add_arg($args, $extra_opt);
+ }
+ }
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
# configure --disable-grant-options), mysqld will not recognize the
@@ -3990,12 +4007,13 @@ sub run_testcase ($$) {
{
my $res= $test->exit_status();
- if ($res == 0 and $opt_warnings and check_warnings($tinfo) )
+ if (($res == 0 or $res == 62) and $opt_warnings and check_warnings($tinfo) )
{
- # Test case suceeded, but it has produced unexpected
- # warnings, continue in $res == 1
- $res= 1;
- resfile_output($tinfo->{'warnings'}) if $opt_resfile;
+ # If test case suceeded, but it has produced unexpected
+ # warnings, continue with $res == 1;
+ # but if the test was skipped, it should remain skipped
+ $res= 1 if $res == 0;
+ resfile_output($tinfo->{'warnings'}) if $opt_resfile;
}
if ( $res == 0 )
diff --git a/mysql-test/r/alter_table_online.result b/mysql-test/r/alter_table_online.result
index b3ef9c354f7..54df4e0c96c 100644
--- a/mysql-test/r/alter_table_online.result
+++ b/mysql-test/r/alter_table_online.result
@@ -184,6 +184,35 @@ CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
-#
-# End of MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
-#
+select @@global.delay_key_write;
+@@global.delay_key_write
+ON
+create table t1 (a int, b int, key(b));
+flush tables;
+flush status;
+show status like 'Feature_delay_key_write';
+Variable_name Value
+Feature_delay_key_write 0
+insert t1 values (1,2),(2,3),(3,4);
+show status like 'Feature_delay_key_write';
+Variable_name Value
+Feature_delay_key_write 0
+alter online table t1 delay_key_write=1;
+show status like 'Feature_delay_key_write';
+Variable_name Value
+Feature_delay_key_write 1
+flush tables;
+insert t1 values (1,2),(2,3),(3,4);
+show status like 'Feature_delay_key_write';
+Variable_name Value
+Feature_delay_key_write 2
+alter online table t1 delay_key_write=0;
+show status like 'Feature_delay_key_write';
+Variable_name Value
+Feature_delay_key_write 2
+flush tables;
+insert t1 values (1,2),(2,3),(3,4);
+show status like 'Feature_delay_key_write';
+Variable_name Value
+Feature_delay_key_write 2
+drop table t1;
diff --git a/mysql-test/r/analyze_format_json.result b/mysql-test/r/analyze_format_json.result
index e5edc1e344b..e077f919aa0 100644
--- a/mysql-test/r/analyze_format_json.result
+++ b/mysql-test/r/analyze_format_json.result
@@ -614,22 +614,24 @@ ANALYZE
},
"block-nl-join": {
"table": {
- "table_name": "<subquery2>",
+ "table_name": "t2",
"access_type": "ALL",
- "possible_keys": ["distinct_key"],
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_total_time_ms": "REPLACED",
"filtered": 100,
- "r_filtered": 100
+ "r_filtered": 0,
+ "attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
- "r_filtered": 100,
- "materialized": {
- "unique": 1,
+ "attached_condition": "<in_optimizer>(t2.b,t2.b in (subquery#2))",
+ "r_filtered": null
+ },
+ "subqueries": [
+ {
"query_block": {
"select_id": 2,
"r_loops": 1,
@@ -646,24 +648,7 @@ ANALYZE
}
}
}
- },
- "block-nl-join": {
- "table": {
- "table_name": "t2",
- "access_type": "ALL",
- "r_loops": 1,
- "rows": 2,
- "r_rows": 2,
- "r_total_time_ms": "REPLACED",
- "filtered": 100,
- "r_filtered": 100
- },
- "buffer_type": "incremental",
- "buffer_size": "256Kb",
- "join_type": "BNL",
- "attached_condition": "t2.b = `<subquery2>`.a",
- "r_filtered": 0
- }
+ ]
}
}
drop table t1,t2;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 798faaa1198..dca48c07fe9 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -667,7 +667,7 @@ create table t1 (a int);
create table t1 select * from t1;
ERROR 42S01: Table 't1' already exists
create table t2 union = (t1) select * from t1;
-ERROR HY000: 'test.t2' is not BASE TABLE
+ERROR HY000: 'test.t2' is not of type 'BASE TABLE'
flush tables with read lock;
unlock tables;
drop table t1;
@@ -701,7 +701,7 @@ create database mysqltest;
use mysqltest;
create view v1 as select 'foo' from dual;
create table t1 like v1;
-ERROR HY000: 'mysqltest.v1' is not BASE TABLE
+ERROR HY000: 'mysqltest.v1' is not of type 'BASE TABLE'
drop view v1;
drop database mysqltest;
create database mysqltest;
diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result
index 317d8bd05df..262b49e9a60 100644
--- a/mysql-test/r/cte_nonrecursive.result
+++ b/mysql-test/r/cte_nonrecursive.result
@@ -507,6 +507,7 @@ select t.a, count(*) from t1,t where t1.a=t.a group by t.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 35 func 1
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
explain
@@ -522,6 +523,7 @@ where t1.a=t.a group by t.a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary; Using filesort
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 35 func 1
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 8 Using where; Using join buffer (flat, BNL join)
# with clause in the specification of a derived table
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result
index e986b486bf2..deba9b1f09a 100644
--- a/mysql-test/r/derived_view.result
+++ b/mysql-test/r/derived_view.result
@@ -2916,5 +2916,64 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 27
deallocate prepare stmt1;
drop table t1,t2;
+#
+# Bug mdev-12670: mergeable derived / view with subqueries
+# subject to semi-join optimizations
+# (actually this is a 5.3 bug.)
+#
+create table t1 (a int) engine=myisam;
+insert into t1 values (5),(3),(2),(7),(2),(5),(1);
+create table t2 (b int, index idx(b)) engine=myisam;
+insert into t2 values (2),(3),(2),(1),(3),(4);
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+explain select a from t1 where a in (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
+1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1)
+explain select * from (select a from t1 where a in (select b from t2)) t;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
+1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1)
+create view v1 as select a from t1 where a in (select b from t2);
+explain select * from v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
+1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1)
+drop view v1;
+drop table t1,t2;
+#
+# Bug mdev-12812: mergeable derived / view with subqueries
+# NOT subject to semi-join optimizations
+#
+CREATE TABLE t1 (c1 varchar(3)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('foo');
+CREATE TABLE t2 (c2 varchar(3)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('bar'),('qux'),('foo');
+SELECT STRAIGHT_JOIN *
+FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq;
+c1
+foo
+foo
+EXPLAIN EXTENDED SELECT STRAIGHT_JOIN *
+FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
+3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+Warnings:
+Note 1003 /* select#1 */ select straight_join `test`.`t1`.`c1` AS `c1` from `test`.`t1` where <in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#3 */ select `test`.`t2`.`c2` from `test`.`t2` where <cache>(`test`.`t1`.`c1`) = `test`.`t2`.`c2`))
+DROP TABLE t1, t2;
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
diff --git a/mysql-test/r/flush-innodb.result b/mysql-test/r/flush-innodb.result
index bd09f0d62dc..21e5bda7785 100644
--- a/mysql-test/r/flush-innodb.result
+++ b/mysql-test/r/flush-innodb.result
@@ -60,7 +60,7 @@ DROP TABLE export;
CREATE VIEW v1 AS SELECT 1;
CREATE TEMPORARY TABLE t1 (a INT);
FLUSH TABLES v1 FOR EXPORT;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
FLUSH TABLES t1 FOR EXPORT;
ERROR 42S02: Table 'test.t1' doesn't exist
FLUSH TABLES non_existent FOR EXPORT;
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index 2c651b71a66..5cd4fde477d 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -295,16 +295,16 @@ create view v1 as select 1;
create view v2 as select * from t1;
create view v3 as select * from v2;
flush table v1, v2, v3 with read lock;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
flush table v1 with read lock;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
flush table v2 with read lock;
-ERROR HY000: 'test.v2' is not BASE TABLE
+ERROR HY000: 'test.v2' is not of type 'BASE TABLE'
flush table v3 with read lock;
-ERROR HY000: 'test.v3' is not BASE TABLE
+ERROR HY000: 'test.v3' is not of type 'BASE TABLE'
create temporary table v1 (a int);
flush table v1 with read lock;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
drop view v1;
create table v1 (a int);
flush table v1 with read lock;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index df953630a8b..3340328cad6 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -2448,6 +2448,15 @@ DROP TABLE t1;
# End of 10.1 tests
#
#
+# MDEV-13064: assertion `n < m_size' fails in Item::split_sum_func2()
+#
+create table t1 (i int) engine=MyISAM;
+insert into t1 value (1),(2);
+select count(*)+sleep(0) from t1;
+count(*)+sleep(0)
+2
+drop table t1;
+#
# Start of 10.3 tests
#
#
diff --git a/mysql-test/r/func_hybrid_type.result b/mysql-test/r/func_hybrid_type.result
index ee108c165df..fe45338b36f 100644
--- a/mysql-test/r/func_hybrid_type.result
+++ b/mysql-test/r/func_hybrid_type.result
@@ -3570,6 +3570,153 @@ t1 CREATE TABLE `t1` (
`c2` bigint(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1 AS SELECT
+9 AS i1, COALESCE(9) AS c1,
+99 AS i2, COALESCE(99) AS c2,
+999 AS i3, COALESCE(999) AS c3,
+9999 AS i4, COALESCE(9999) AS c4,
+99999 AS i5, COALESCE(99999) AS c5,
+999999 AS i6, COALESCE(999999) AS c6,
+9999999 AS i7, COALESCE(9999999) AS c7,
+99999999 AS i8, COALESCE(99999999) AS c8,
+999999999 AS i9, COALESCE(999999999) AS c9,
+2147483647, COALESCE(2147483647),
+2147483648, COALESCE(2147483648),
+9999999999 AS i10, COALESCE(9999999999) AS c10,
+99999999999 AS i11, COALESCE(99999999999) AS c11,
+999999999999 AS i12, COALESCE(999999999999) AS c12,
+9999999999999 AS i13, COALESCE(9999999999999) AS c13,
+99999999999999 AS i14, COALESCE(99999999999999) AS c14,
+999999999999999 AS i15, COALESCE(999999999999999) AS c15,
+9999999999999999 AS i16, COALESCE(9999999999999999) AS c16,
+99999999999999999 AS i17, COALESCE(99999999999999999) AS c17,
+999999999999999999 AS i18, COALESCE(999999999999999999) AS c18,
+9223372036854775807, COALESCE(9223372036854775807),
+9223372036854775808, COALESCE(9223372036854775808),
+9999999999999999999 AS i19, COALESCE(9999999999999999999) AS c19,
+18446744073709551615, COALESCE(18446744073709551615),
+18446744073709551616, COALESCE(18446744073709551616),
+99999999999999999999 AS i20, COALESCE(99999999999999999999) AS c20,
+999999999999999999999 AS i21, COALESCE(999999999999999999999) AS c21,
+9999999999999999999999 AS i22, COALESCE(9999999999999999999999) AS c22;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i1` int(1) NOT NULL,
+ `c1` int(1) NOT NULL,
+ `i2` int(2) NOT NULL,
+ `c2` int(2) NOT NULL,
+ `i3` int(3) NOT NULL,
+ `c3` int(3) NOT NULL,
+ `i4` int(4) NOT NULL,
+ `c4` int(4) NOT NULL,
+ `i5` int(5) NOT NULL,
+ `c5` int(5) NOT NULL,
+ `i6` int(6) NOT NULL,
+ `c6` int(6) NOT NULL,
+ `i7` int(7) NOT NULL,
+ `c7` int(7) NOT NULL,
+ `i8` int(8) NOT NULL,
+ `c8` int(8) NOT NULL,
+ `i9` int(9) NOT NULL,
+ `c9` int(9) NOT NULL,
+ `2147483647` bigint(10) NOT NULL,
+ `COALESCE(2147483647)` bigint(10) NOT NULL,
+ `2147483648` bigint(10) NOT NULL,
+ `COALESCE(2147483648)` bigint(10) NOT NULL,
+ `i10` bigint(10) NOT NULL,
+ `c10` bigint(10) NOT NULL,
+ `i11` bigint(11) NOT NULL,
+ `c11` bigint(11) NOT NULL,
+ `i12` bigint(12) NOT NULL,
+ `c12` bigint(12) NOT NULL,
+ `i13` bigint(13) NOT NULL,
+ `c13` bigint(13) NOT NULL,
+ `i14` bigint(14) NOT NULL,
+ `c14` bigint(14) NOT NULL,
+ `i15` bigint(15) NOT NULL,
+ `c15` bigint(15) NOT NULL,
+ `i16` bigint(16) NOT NULL,
+ `c16` bigint(16) NOT NULL,
+ `i17` bigint(17) NOT NULL,
+ `c17` bigint(17) NOT NULL,
+ `i18` bigint(18) NOT NULL,
+ `c18` bigint(18) NOT NULL,
+ `9223372036854775807` bigint(19) NOT NULL,
+ `COALESCE(9223372036854775807)` bigint(19) NOT NULL,
+ `9223372036854775808` bigint(19) unsigned NOT NULL,
+ `COALESCE(9223372036854775808)` bigint(19) unsigned NOT NULL,
+ `i19` bigint(19) unsigned NOT NULL,
+ `c19` bigint(19) unsigned NOT NULL,
+ `18446744073709551615` bigint(20) unsigned NOT NULL,
+ `COALESCE(18446744073709551615)` bigint(20) unsigned NOT NULL,
+ `18446744073709551616` decimal(20,0) NOT NULL,
+ `COALESCE(18446744073709551616)` decimal(20,0) NOT NULL,
+ `i20` decimal(20,0) NOT NULL,
+ `c20` decimal(20,0) NOT NULL,
+ `i21` decimal(21,0) NOT NULL,
+ `c21` decimal(21,0) NOT NULL,
+ `i22` decimal(22,0) NOT NULL,
+ `c22` decimal(22,0) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+i1 9
+c1 9
+i2 99
+c2 99
+i3 999
+c3 999
+i4 9999
+c4 9999
+i5 99999
+c5 99999
+i6 999999
+c6 999999
+i7 9999999
+c7 9999999
+i8 99999999
+c8 99999999
+i9 999999999
+c9 999999999
+2147483647 2147483647
+COALESCE(2147483647) 2147483647
+2147483648 2147483648
+COALESCE(2147483648) 2147483648
+i10 9999999999
+c10 9999999999
+i11 99999999999
+c11 99999999999
+i12 999999999999
+c12 999999999999
+i13 9999999999999
+c13 9999999999999
+i14 99999999999999
+c14 99999999999999
+i15 999999999999999
+c15 999999999999999
+i16 9999999999999999
+c16 9999999999999999
+i17 99999999999999999
+c17 99999999999999999
+i18 999999999999999999
+c18 999999999999999999
+9223372036854775807 9223372036854775807
+COALESCE(9223372036854775807) 9223372036854775807
+9223372036854775808 9223372036854775808
+COALESCE(9223372036854775808) 9223372036854775808
+i19 9999999999999999999
+c19 9999999999999999999
+18446744073709551615 18446744073709551615
+COALESCE(18446744073709551615) 18446744073709551615
+18446744073709551616 18446744073709551616
+COALESCE(18446744073709551616) 18446744073709551616
+i20 99999999999999999999
+c20 99999999999999999999
+i21 999999999999999999999
+c21 999999999999999999999
+i22 9999999999999999999999
+c22 9999999999999999999999
+DROP TABLE t1;
#
# MDEV-9406 CREATE TABLE..SELECT creates different columns for IFNULL() and equivalent COALESCE,CASE,IF
#
diff --git a/mysql-test/r/func_regexp_pcre.result b/mysql-test/r/func_regexp_pcre.result
index 18aa7ed8379..266ea6c5eef 100644
--- a/mysql-test/r/func_regexp_pcre.result
+++ b/mysql-test/r/func_regexp_pcre.result
@@ -880,3 +880,17 @@ SET @regCheck= '\\xE0\\x01';
SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;
CAST(0xE001 AS BINARY) REGEXP @regCheck
1
+# MDEV-12420: Testing recursion overflow
+SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp' REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$');
+1
+Warnings:
+Warning 1139 Got error 'pcre_exec: recursion limit of NUM exceeded' from regexp
+SELECT REGEXP_INSTR('a_kollision', 'oll');
+REGEXP_INSTR('a_kollision', 'oll')
+4
+SELECT REGEXP_INSTR('a_kollision', '(oll)');
+REGEXP_INSTR('a_kollision', '(oll)')
+4
+SELECT REGEXP_INSTR('a_kollision', 'o([lm])\\1');
+REGEXP_INSTR('a_kollision', 'o([lm])\\1')
+4
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 3e3c84d4300..9e16cf370d8 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1090,7 +1090,7 @@ t_nn CREATE TABLE `t_nn` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE VIEW mysqltest2.t_nn;
-ERROR HY000: 'mysqltest2.t_nn' is not VIEW
+ERROR HY000: 'mysqltest2.t_nn' is not of type 'VIEW'
SHOW CREATE VIEW mysqltest2.v_yy;
View Create View character_set_client collation_connection
v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where `mysqltest2`.`t_nn`.`c1` = 55 latin1 latin1_swedish_ci
@@ -1110,7 +1110,7 @@ t_nn CREATE TABLE `t_nn` (
`c1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE VIEW mysqltest2.t_nn;
-ERROR HY000: 'mysqltest2.t_nn' is not VIEW
+ERROR HY000: 'mysqltest2.t_nn' is not of type 'VIEW'
DROP VIEW mysqltest2.v_nn;
DROP VIEW mysqltest2.v_yn;
DROP VIEW mysqltest2.v_ny;
diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result
index 1305be86e5a..c55e8d138f8 100644
--- a/mysql-test/r/innodb_ext_key.result
+++ b/mysql-test/r/innodb_ext_key.result
@@ -1133,5 +1133,78 @@ where index_date_updated= 10 and index_id < 800;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range index_date_updated index_date_updated 13 NULL # Using index condition
drop table t0,t1,t2;
-set optimizer_switch=@save_ext_key_optimizer_switch;
-SET SESSION STORAGE_ENGINE=DEFAULT;
+#
+# MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff'
+# was corrupted, server crashes in opt_sum_query
+CREATE TABLE t1 (
+pk INT,
+f1 VARCHAR(3),
+f2 VARCHAR(1024),
+PRIMARY KEY (pk),
+KEY(f2)
+) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
+INSERT INTO t1 VALUES (1,'foo','abc'),(2,'bar','def');
+SELECT MAX(t2.pk) FROM t1 t2 INNER JOIN t1 t3 ON t2.f1 = t3.f1 WHERE t2.pk <= 4;
+MAX(t2.pk)
+2
+drop table t1;
+CREATE TABLE t1 (
+pk1 INT,
+pk2 INT,
+f1 VARCHAR(3),
+f2 VARCHAR(1021),
+PRIMARY KEY (pk1,pk2),
+KEY(f2)
+) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
+INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
+explain format= json
+select * from t1 force index(f2) where pk1 <= 5 and pk2 <=5 and f2 = 'abc' and f1 <= '3';
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["f2"],
+ "key": "f2",
+ "key_length": "3070",
+ "used_key_parts": ["f2", "pk1"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
+ "attached_condition": "t1.f1 <= '3'"
+ }
+ }
+}
+drop table t1;
+CREATE TABLE t1 (
+f2 INT,
+pk2 INT,
+f1 VARCHAR(3),
+pk1 VARCHAR(1000),
+PRIMARY KEY (pk1,pk2),
+KEY k1(pk1,f2)
+) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
+INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
+explain format= json
+select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3';
+EXPLAIN
+{
+ "query_block": {
+ "select_id": 1,
+ "table": {
+ "table_name": "t1",
+ "access_type": "range",
+ "possible_keys": ["k1"],
+ "key": "k1",
+ "key_length": "3011",
+ "used_key_parts": ["pk1", "f2", "pk2"],
+ "rows": 1,
+ "filtered": 100,
+ "index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",
+ "attached_condition": "t1.f1 <= '3'"
+ }
+ }
+}
+drop table t1;
diff --git a/mysql-test/r/insert_notembedded.result b/mysql-test/r/insert_notembedded.result
index d2733eac061..8dd4aa7d71e 100644
--- a/mysql-test/r/insert_notembedded.result
+++ b/mysql-test/r/insert_notembedded.result
@@ -4,7 +4,7 @@ drop table if exists t1;
create table t1 (n int);
create view v1 as select * from t1;
insert delayed into v1 values (1);
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
drop table t1;
drop view v1;
CREATE DATABASE meow;
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index d7b4e107a8d..46e542910a1 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -2337,4 +2337,99 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3`
drop table t1,t2,t3;
+#
+# MDEV-11958: LEFT JOIN with stored routine produces incorrect result
+#
+CREATE TABLE t (x INT);
+INSERT INTO t VALUES(1),(NULL);
+CREATE FUNCTION f (val INT, ret INT) RETURNS INT DETERMINISTIC RETURN IFNULL(val, ret);
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+FROM t t1 LEFT JOIN t t2
+ON t1.x = t2.x
+WHERE IFNULL(t2.x,0)=0;
+x x IFNULL(t2.x,0) f(t2.x,0)
+NULL NULL 0 0
+explain extended
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+FROM t t1 LEFT JOIN t t2
+ON t1.x = t2.x
+WHERE IFNULL(t2.x,0)=0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where ifnull(`test`.`t2`.`x`,0) = 0
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+FROM t t1 LEFT JOIN t t2
+ON t1.x = t2.x
+WHERE f(t2.x,0)=0;
+x x IFNULL(t2.x,0) f(t2.x,0)
+NULL NULL 0 0
+explain extended
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+FROM t t1 LEFT JOIN t t2
+ON t1.x = t2.x
+WHERE f(t2.x,0)=0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where `f`(`test`.`t2`.`x`,0) = 0
+drop function f;
+drop table t;
+CREATE TABLE t1 (
+col1 DECIMAL(33,5) NULL DEFAULT NULL,
+col2 DECIMAL(33,5) NULL DEFAULT NULL
+);
+CREATE TABLE t2 (
+col1 DECIMAL(33,5) NULL DEFAULT NULL,
+col2 DECIMAL(33,5) NULL DEFAULT NULL,
+col3 DECIMAL(33,5) NULL DEFAULT NULL
+);
+INSERT INTO t1 VALUES (2, 1.1), (2, 2.1);
+INSERT INTO t2 VALUES (3, 3.1, 4), (1, 1, NULL);
+CREATE FUNCTION f1 ( p_num DECIMAL(45,15), p_return DECIMAL(45,15))
+RETURNS decimal(33,5)
+LANGUAGE SQL
+DETERMINISTIC
+CONTAINS SQL
+SQL SECURITY INVOKER
+BEGIN
+IF p_num IS NULL THEN
+RETURN p_return;
+ELSE
+RETURN p_num;
+END IF;
+END |
+SELECT t1.col1, t2.col1, t2.col3
+FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
+WHERE IFNULL(t2.col3,0) = 0;
+col1 col1 col3
+2.00000 NULL NULL
+2.00000 NULL NULL
+EXPLAIN EXTENDED SELECT t1.col1, t2.col1, t2.col3
+FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
+WHERE IFNULL(t2.col3,0) = 0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where ifnull(`test`.`t2`.`col3`,0) = 0
+SELECT t1.col1, t2.col1, t2.col3
+FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
+WHERE f1(t2.col3,0) = 0;
+col1 col1 col3
+2.00000 NULL NULL
+2.00000 NULL NULL
+EXPLAIN EXTENDED SELECT t1.col1, t2.col1, t2.col3
+FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
+WHERE f1(t2.col3,0) = 0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0
+DROP FUNCTION f1;
+DROP TABLE t1,t2;
+# end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result
index cab4c78eb3a..65e2dde409e 100644
--- a/mysql-test/r/join_outer_jcl6.result
+++ b/mysql-test/r/join_outer_jcl6.result
@@ -2348,6 +2348,101 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t1`.`i1` AS `i1`,`test`.`t1`.`v1` AS `v1`,`test`.`t2`.`i2` AS `i2`,`test`.`t2`.`v2` AS `v2`,`test`.`t3`.`i3` AS `i3`,`test`.`t3`.`v3` AS `v3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t3`.`v3` = 4 and `test`.`t1`.`i1` = `test`.`t3`.`i3` and `test`.`t2`.`i2` = `test`.`t3`.`i3`
drop table t1,t2,t3;
+#
+# MDEV-11958: LEFT JOIN with stored routine produces incorrect result
+#
+CREATE TABLE t (x INT);
+INSERT INTO t VALUES(1),(NULL);
+CREATE FUNCTION f (val INT, ret INT) RETURNS INT DETERMINISTIC RETURN IFNULL(val, ret);
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+FROM t t1 LEFT JOIN t t2
+ON t1.x = t2.x
+WHERE IFNULL(t2.x,0)=0;
+x x IFNULL(t2.x,0) f(t2.x,0)
+NULL NULL 0 0
+explain extended
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+FROM t t1 LEFT JOIN t t2
+ON t1.x = t2.x
+WHERE IFNULL(t2.x,0)=0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where ifnull(`test`.`t2`.`x`,0) = 0
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+FROM t t1 LEFT JOIN t t2
+ON t1.x = t2.x
+WHERE f(t2.x,0)=0;
+x x IFNULL(t2.x,0) f(t2.x,0)
+NULL NULL 0 0
+explain extended
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+FROM t t1 LEFT JOIN t t2
+ON t1.x = t2.x
+WHERE f(t2.x,0)=0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`x` AS `x`,`test`.`t2`.`x` AS `x`,ifnull(`test`.`t2`.`x`,0) AS `IFNULL(t2.x,0)`,`f`(`test`.`t2`.`x`,0) AS `f(t2.x,0)` from `test`.`t` `t1` left join `test`.`t` `t2` on(`test`.`t2`.`x` = `test`.`t1`.`x`) where `f`(`test`.`t2`.`x`,0) = 0
+drop function f;
+drop table t;
+CREATE TABLE t1 (
+col1 DECIMAL(33,5) NULL DEFAULT NULL,
+col2 DECIMAL(33,5) NULL DEFAULT NULL
+);
+CREATE TABLE t2 (
+col1 DECIMAL(33,5) NULL DEFAULT NULL,
+col2 DECIMAL(33,5) NULL DEFAULT NULL,
+col3 DECIMAL(33,5) NULL DEFAULT NULL
+);
+INSERT INTO t1 VALUES (2, 1.1), (2, 2.1);
+INSERT INTO t2 VALUES (3, 3.1, 4), (1, 1, NULL);
+CREATE FUNCTION f1 ( p_num DECIMAL(45,15), p_return DECIMAL(45,15))
+RETURNS decimal(33,5)
+LANGUAGE SQL
+DETERMINISTIC
+CONTAINS SQL
+SQL SECURITY INVOKER
+BEGIN
+IF p_num IS NULL THEN
+RETURN p_return;
+ELSE
+RETURN p_num;
+END IF;
+END |
+SELECT t1.col1, t2.col1, t2.col3
+FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
+WHERE IFNULL(t2.col3,0) = 0;
+col1 col1 col3
+2.00000 NULL NULL
+2.00000 NULL NULL
+EXPLAIN EXTENDED SELECT t1.col1, t2.col1, t2.col3
+FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
+WHERE IFNULL(t2.col3,0) = 0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where ifnull(`test`.`t2`.`col3`,0) = 0
+SELECT t1.col1, t2.col1, t2.col3
+FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
+WHERE f1(t2.col3,0) = 0;
+col1 col1 col3
+2.00000 NULL NULL
+2.00000 NULL NULL
+EXPLAIN EXTENDED SELECT t1.col1, t2.col1, t2.col3
+FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
+WHERE f1(t2.col3,0) = 0;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
+1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0
+DROP FUNCTION f1;
+DROP TABLE t1,t2;
+# end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;
set join_cache_level=default;
show variables like 'join_cache_level';
diff --git a/mysql-test/r/limit_rows_examined.result b/mysql-test/r/limit_rows_examined.result
index 3bc97859303..c94599235b1 100644
--- a/mysql-test/r/limit_rows_examined.result
+++ b/mysql-test/r/limit_rows_examined.result
@@ -425,7 +425,7 @@ c1
bb
cc
Warnings:
-Warning 1931 Query execution was interrupted. The query examined at least 18 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete
+Warning 1931 Query execution was interrupted. The query examined at least 17 rows, which exceeds LIMIT ROWS EXAMINED (16). The query result may be incomplete
select * from v1 LIMIT ROWS EXAMINED 11;
c1
bb
@@ -438,7 +438,8 @@ from (select * from t1
where c1 IN (select * from t2 where c2 > ' ' LIMIT ROWS EXAMINED 0)) as tmp
LIMIT ROWS EXAMINED 11;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 2 func 1
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 4 Using where
select *
from (select * from t1
diff --git a/mysql-test/r/log_tables-big.result b/mysql-test/r/log_tables-big.result
index 1e189a7726f..0a33510fe77 100644
--- a/mysql-test/r/log_tables-big.result
+++ b/mysql-test/r/log_tables-big.result
@@ -1,8 +1,12 @@
set @@global.log_output = 'TABLE';
+connect con1,localhost,root,,;
+connect con2,localhost,root,,;
+connection con1;
set session long_query_time=10;
select get_lock('bug27638', 1);
get_lock('bug27638', 1)
1
+connection con2;
set session long_query_time=1;
select get_lock('bug27638', 2);
get_lock('bug27638', 2)
@@ -25,7 +29,11 @@ select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.s
where sql_text = 'select get_lock(\'bug27638\', 101)';
qt sql_text
OK select get_lock('bug27638', 101)
+connection con1;
select release_lock('bug27638');
release_lock('bug27638')
1
+connection default;
+disconnect con1;
+disconnect con2;
set @@global.log_output=default;
diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result
index 1e285650c77..3880fc5ef91 100644
--- a/mysql-test/r/mdl_sync.result
+++ b/mysql-test/r/mdl_sync.result
@@ -3049,3 +3049,21 @@ SET DEBUG_SYNC= 'RESET';
disconnect con1;
disconnect con2;
disconnect con3;
+#
+# MDEV-12620 - set lock_wait_timeout = 1;flush tables with read lock;
+# lock not released after timeout
+#
+CREATE TABLE t1(a INT) ENGINE=InnoDB;
+SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go';
+SELECT * FROM t1;
+connect con1,localhost,root,,;
+SET debug_sync='now WAIT_FOR ready';
+SET lock_wait_timeout=1;
+FLUSH TABLES WITH READ LOCK;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SET debug_sync='now SIGNAL go';
+connection default;
+a
+SET debug_sync='RESET';
+DROP TABLE t1;
+disconnect con1;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index da194c7e11c..f468f47c4c9 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -629,7 +629,7 @@ INSERT INTO t3 VALUES (3), (33);
LOCK TABLES t3 READ;
CREATE TEMPORARY TABLE t4 (c1 INT NOT NULL) ENGINE=MERGE UNION=(t1,t2)
INSERT_METHOD=LAST SELECT * FROM t3;
-ERROR HY000: 'test.t4' is not BASE TABLE
+ERROR HY000: 'test.t4' is not of type 'BASE TABLE'
SELECT * FROM t4;
ERROR HY000: Table 't4' was not locked with LOCK TABLES
UNLOCK TABLES;
@@ -702,11 +702,11 @@ create table t2 (a int);
insert into t1 values (0);
insert into t2 values (1);
create table t3 engine=merge union=(t1, t2) select * from t1;
-ERROR HY000: 'test.t3' is not BASE TABLE
+ERROR HY000: 'test.t3' is not of type 'BASE TABLE'
create table t3 engine=merge union=(t1, t2) select * from t2;
-ERROR HY000: 'test.t3' is not BASE TABLE
+ERROR HY000: 'test.t3' is not of type 'BASE TABLE'
create table t3 engine=merge union=(t1, t2) select (select max(a) from t2);
-ERROR HY000: 'test.t3' is not BASE TABLE
+ERROR HY000: 'test.t3' is not of type 'BASE TABLE'
drop table t1, t2;
create table t1 (
a double(14,4),
@@ -1176,7 +1176,7 @@ SHOW CREATE TABLE t3;
ERROR 42S02: Table 'test.t3' doesn't exist
CREATE TABLE t3 ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST
SELECT * FROM t2;
-ERROR HY000: 'test.t3' is not BASE TABLE
+ERROR HY000: 'test.t3' is not of type 'BASE TABLE'
SHOW CREATE TABLE t3;
ERROR 42S02: Table 'test.t3' doesn't exist
DROP TABLE t1, t2;
@@ -3115,11 +3115,11 @@ DROP TABLE m2;
#
CREATE TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST SELECT * FROM m1;
-ERROR HY000: 'test.m2' is not BASE TABLE
+ERROR HY000: 'test.m2' is not of type 'BASE TABLE'
#
CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST SELECT * FROM m1;
-ERROR HY000: 'test.m2' is not BASE TABLE
+ERROR HY000: 'test.m2' is not of type 'BASE TABLE'
#
CREATE TABLE m2 LIKE m1;
SHOW CREATE TABLE m2;
@@ -3519,7 +3519,7 @@ Got one of the listed errors
#
CREATE TEMPORARY TABLE m2 (c1 INT, c2 INT) ENGINE=MRG_MyISAM UNION=(t3,t4)
INSERT_METHOD=LAST SELECT * FROM m1;
-ERROR HY000: 'test.m2' is not BASE TABLE
+ERROR HY000: 'test.m2' is not of type 'BASE TABLE'
#
CREATE TEMPORARY TABLE m2 LIKE m1;
SHOW CREATE TABLE m2;
diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result
index b282be15a56..34764466d2a 100644
--- a/mysql-test/r/mix2_myisam.result
+++ b/mysql-test/r/mix2_myisam.result
@@ -1549,6 +1549,9 @@ 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 '{ ' for key 'v_2'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry 'a' for key 'v_2'
alter table t1 add key(v);
Warnings:
Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release
diff --git a/mysql-test/r/mrr_icp_extra.result b/mysql-test/r/mrr_icp_extra.result
index 5706bf21895..95788b393dd 100644
--- a/mysql-test/r/mrr_icp_extra.result
+++ b/mysql-test/r/mrr_icp_extra.result
@@ -350,6 +350,9 @@ 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 '{ ' for key 'v_2'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry 'a' for key 'v_2'
alter table t1 add key(v);
Warnings:
Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index f7eb5db6468..5b41b35c1ba 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -1255,6 +1255,9 @@ 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 '{ ' for key 'v_2'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry 'a' for key 'v_2'
alter table t1 add key(v);
Warnings:
Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release
diff --git a/mysql-test/r/myisam_debug.result b/mysql-test/r/myisam_debug.result
index 39cbd69cdb0..6232e3eac0e 100644
--- a/mysql-test/r/myisam_debug.result
+++ b/mysql-test/r/myisam_debug.result
@@ -29,3 +29,15 @@ Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1,t2;
disconnect insertConn;
+call mtr.add_suppression("Index for table '.*test.t1\\.MYI' is corrupt; try to repair it");
+create table t1 (a int, index(a));
+lock tables t1 write;
+insert t1 values (1),(2),(1);
+set @old_dbug=@@debug_dbug;
+set debug_dbug='+d,mi_lock_database_failure';
+unlock tables;
+Warnings:
+Error 126 Index for table './test/t1.MYI' is corrupt; try to repair it
+Error 1030 Got error 22 "Invalid argument" from storage engine MyISAM
+set debug_dbug=@old_dbug;
+drop table t1;
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 564269319cb..1fd365e3029 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -1404,7 +1404,7 @@ performance-schema-max-rwlock-instances -1
performance-schema-max-socket-classes 10
performance-schema-max-socket-instances -1
performance-schema-max-stage-classes 150
-performance-schema-max-statement-classes 190
+performance-schema-max-statement-classes 191
performance-schema-max-table-handles -1
performance-schema-max-table-instances -1
performance-schema-max-thread-classes 50
diff --git a/mysql-test/r/partition_alter.result b/mysql-test/r/partition_alter.result
index cbd90b5ba7c..76b55cefb07 100644
--- a/mysql-test/r/partition_alter.result
+++ b/mysql-test/r/partition_alter.result
@@ -51,3 +51,50 @@ execute stmt;
execute stmt;
deallocate prepare stmt;
drop table test_data;
+create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
+engine=innodb
+partition by range columns (d) (
+partition p1 values less than ('2016-10-18'),
+partition p2 values less than ('2020-10-19'));
+insert t1 values (0, '2000-01-02', 0);
+insert t1 values (1, '2020-01-02', 10);
+alter table t1 add check (b in (0, 1));
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`#sql-temporary`
+alter table t1 add check (b in (0, 10));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `d` date NOT NULL,
+ `b` tinyint(1) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`,`d`),
+ CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,10))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY RANGE COLUMNS(d)
+(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = InnoDB,
+ PARTITION p2 VALUES LESS THAN ('2020-10-19') ENGINE = InnoDB)
+insert t1 values (2, '2020-01-03', 20);
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
+drop table t1;
+create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
+partition by range columns (d) (
+partition p1 values less than ('2016-10-18'),
+partition p2 values less than ('2020-10-19'));
+insert t1 values (0, '2000-01-02', 0);
+insert t1 values (1, '2020-01-02', 10);
+alter table t1 add check (b in (0, 1));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL,
+ `d` date NOT NULL,
+ `b` tinyint(1) NOT NULL DEFAULT 0,
+ PRIMARY KEY (`id`,`d`),
+ CONSTRAINT `CONSTRAINT_1` CHECK (`b` in (0,1))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ PARTITION BY RANGE COLUMNS(d)
+(PARTITION p1 VALUES LESS THAN ('2016-10-18') ENGINE = MyISAM,
+ PARTITION p2 VALUES LESS THAN ('2020-10-19') ENGINE = MyISAM)
+insert t1 values (2, '2020-01-03', 20);
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
+drop table t1;
diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result
index 2b8c925b309..ff8566abe02 100644
--- a/mysql-test/r/rename.result
+++ b/mysql-test/r/rename.result
@@ -74,7 +74,7 @@ End of 4.1 tests
create table t1(f1 int);
create view v1 as select * from t1;
alter table v1 rename to v2;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
drop view v1;
drop table t1;
End of 5.0 tests
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 641c756691e..71ca5de2990 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -4329,57 +4329,57 @@ Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
-test.v1 repair Error 'test.v1' is not BASE TABLE
+test.v1 repair Error 'test.v1' is not of type 'BASE TABLE'
test.v1 repair status Operation failed
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t2 optimize status OK
test.t3 optimize status OK
-test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE'
test.v1 optimize status Operation failed
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
test.t3 analyze status Table is already up to date
-test.v1 analyze Error 'test.v1' is not BASE TABLE
+test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE'
test.v1 analyze status Operation failed
call bug13012()|
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
-test.v1 repair Error 'test.v1' is not BASE TABLE
+test.v1 repair Error 'test.v1' is not of type 'BASE TABLE'
test.v1 repair status Operation failed
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t2 optimize status OK
test.t3 optimize status OK
-test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE'
test.v1 optimize status Operation failed
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
test.t3 analyze status Table is already up to date
-test.v1 analyze Error 'test.v1' is not BASE TABLE
+test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE'
test.v1 analyze status Operation failed
call bug13012()|
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
-test.v1 repair Error 'test.v1' is not BASE TABLE
+test.v1 repair Error 'test.v1' is not of type 'BASE TABLE'
test.v1 repair status Operation failed
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t2 optimize status OK
test.t3 optimize status OK
-test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE'
test.v1 optimize status Operation failed
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
test.t3 analyze status Table is already up to date
-test.v1 analyze Error 'test.v1' is not BASE TABLE
+test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE'
test.v1 analyze status Operation failed
drop procedure bug13012|
drop view v1|
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index 01257c33361..ec7f2c0a3d5 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -576,3 +576,42 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL #
2 DEPENDENT SUBQUERY t2 ref key1 key1 5 test.t1.a # Using where; Using filesort
drop table t1,t2;
+#
+# mdev-12931: semi-join in ON expression of STRAIGHT_JOIN
+# joining a base table and a mergeable derived table
+#
+CREATE TABLE t1 (f1 int) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (3),(2);
+CREATE TABLE t2 (f2 int) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(4);
+CREATE TABLE t3 (f3 int) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (5),(6);
+CREATE TABLE t4 (f4 int) ENGINE=InnoDB;
+INSERT INTO t4 VALUES (1),(8);
+SELECT *
+FROM t1
+INNER JOIN
+( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq
+ON ( 1 IN ( SELECT f4 FROM t4 ) ) )
+ON ( f1 >= f2 );
+f1 f2 f3
+3 1 5
+2 1 5
+3 1 6
+2 1 6
+EXPLAIN EXTENDED
+SELECT *
+FROM t1
+INNER JOIN
+( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq
+ON ( 1 IN ( SELECT f4 FROM t4 ) ) )
+ON ( f1 >= f2 );
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 100.00
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
+1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join)
+3 MATERIALIZED t4 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` join `test`.`t2` semi join (`test`.`t4`) join `test`.`t3` where `test`.`t4`.`f4` = 1 and `test`.`t1`.`f1` >= `test`.`t2`.`f2`
+DROP TABLE t1,t2,t3,t4;
diff --git a/mysql-test/r/subselect_mat_cost_bugs.result b/mysql-test/r/subselect_mat_cost_bugs.result
index b4ddd5e5849..f5d5be8f726 100644
--- a/mysql-test/r/subselect_mat_cost_bugs.result
+++ b/mysql-test/r/subselect_mat_cost_bugs.result
@@ -379,6 +379,7 @@ drop table t3, t4, t5;
#
# LP BUG#858038 The result of a query with NOT IN subquery depends on the state of the optimizer switch
#
+set @optimizer_switch_save= @@optimizer_switch;
create table t1 (c1 char(2) not null, c2 char(2));
create table t2 (c3 char(2), c4 char(2));
insert into t1 values ('a1', 'b1');
@@ -400,6 +401,7 @@ id select_type table type possible_keys key key_len ref rows Extra
select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2);
c1 c2
drop table t1, t2;
+set optimizer_switch= @optimizer_switch_save;
#
# MDEV-12673: cost-based choice between materialization and in-to-exists
#
@@ -442,3 +444,44 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t3 const PRIMARY PRIMARY 4 const 1
2 DEPENDENT SUBQUERY t2 index NULL i2 11 NULL 2 Using where; Using index
DROP TABLE t1,t2,t3;
+#
+# MDEV-7599: in-to-exists chosen after min/max optimization
+#
+set @optimizer_switch_save= @@optimizer_switch;
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT, c INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,6),(2,4), (8,9);
+SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
+b c
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 MATERIALIZED t1 index NULL a 5 NULL 2 100.00 Using index
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,`test`.`t2`.`b` in ( <materialize> (/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t2`.`b` ), <primary_index_lookup>(`test`.`t2`.`b` in <temporary table> on distinct_key where `test`.`t2`.`b` = `<subquery2>`.`MIN(a)`))))
+set optimizer_switch= 'materialization=off';
+SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
+b c
+EXPLAIN EXTENDED SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
+2 DEPENDENT SUBQUERY t1 index NULL a 5 NULL 2 100.00 Using index
+2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`b`>(<in_optimizer>(`test`.`t2`.`b`,<exists>(/* select#2 */ select min(`test`.`t1`.`a`) from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c` = `test`.`t2`.`b` having trigcond(<cache>(`test`.`t2`.`b`) = <ref_null_helper>(min(`test`.`t1`.`a`))))))
+set optimizer_switch= @optimizer_switch_save;
+DROP TABLE t1,t2;
+CREATE TABLE t1 (f1 varchar(10)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('bar');
+CREATE TABLE t2 (f2 varchar(10), key(f2)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('baz'),('qux');
+CREATE TABLE t3 (f3 varchar(10)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES ('abc'),('def');
+SELECT * FROM t1
+WHERE f1 = ALL( SELECT MAX(t2a.f2)
+FROM t2 AS t2a INNER JOIN t2 t2b INNER JOIN t3
+ON (f3 = t2b.f2) );
+f1
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/r/subselect_sj.result b/mysql-test/r/subselect_sj.result
index 861360ddf9a..a601dac5337 100644
--- a/mysql-test/r/subselect_sj.result
+++ b/mysql-test/r/subselect_sj.result
@@ -1652,9 +1652,9 @@ CREATE VIEW v1 AS SELECT 1;
EXPLAIN
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived3> system NULL NULL NULL NULL 1
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
-2 MATERIALIZED <derived3> system NULL NULL NULL NULL 1
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
a a
@@ -3072,4 +3072,97 @@ project_number
aaa
drop table t1, t2, t3;
set optimizer_switch= @tmp_mdev6859;
+#
+# MDEV-12675: subquery subject to semi-join optimizations
+# in ON expression of INNER JOIN
+#
+set @tmp_mdev12675=@@optimizer_switch;
+set optimizer_switch=default;
+create table t1 (a int) engine=myisam;
+insert into t1 values (5),(3),(2),(7),(2),(5),(1);
+create table t2 (b int, index idx(b)) engine=myisam;
+insert into t2 values (2),(3),(2),(1),(3),(4);
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+explain
+select a from t1, t2 where b between 1 and 2 and a in (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
+1 PRIMARY t2 ref idx idx 5 test.t1.a 256 Using index; FirstMatch(t1)
+1 PRIMARY t2 range idx idx 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
+explain
+select a from t1 join t2 on b between 1 and 2 and a in (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
+1 PRIMARY t2 ref idx idx 5 test.t1.a 256 Using index; FirstMatch(t1)
+1 PRIMARY t2 range idx idx 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
+drop table t1,t2;
+set optimizer_switch= @tmp_mdev12675;
+#
+# MDEV-12817: subquery NOT subject to semi-join optimizations
+# in ON expression of INNER JOIN
+#
+CREATE TABLE t1 (c1 int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (c2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (c3 int) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6);
+CREATE TABLE t4 (c4 int) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (7),(8);
+SELECT c1
+FROM t1
+LEFT JOIN
+( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
+ON (c1 = c3);
+c1
+1
+2
+EXPLAIN EXTENDED SELECT c1
+FROM t1
+LEFT JOIN
+( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
+ON (c1 = c3);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t3`.`c3` = `test`.`t1`.`c1` and <cache>(<in_optimizer>(1,<exists>(/* select#2 */ select `test`.`t4`.`c4` from `test`.`t4` where 1 = `test`.`t4`.`c4`)))) where 1
+# mdev-12820
+SELECT *
+FROM t1
+LEFT JOIN
+( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
+ON (c1 = c2);
+c1 c2 c4
+1 NULL NULL
+2 NULL NULL
+EXPLAIN EXTENDED SELECT *
+FROM t1
+LEFT JOIN
+( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
+ON (c1 = c2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
+1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00
+3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(`test`.`t2`.`c2` = `test`.`t1`.`c1` and <in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#3 */ select `test`.`t3`.`c3` from `test`.`t3` where <cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))) where 1
+DROP TABLE t1,t2,t3,t4;
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/r/subselect_sj2_mat.result b/mysql-test/r/subselect_sj2_mat.result
index 07c9e74b4d7..8466f9fba4e 100644
--- a/mysql-test/r/subselect_sj2_mat.result
+++ b/mysql-test/r/subselect_sj2_mat.result
@@ -1625,3 +1625,26 @@ i1
DROP TABLE t1,t2,t3;
set join_cache_level= @save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
+#
+# mdev-7791: materialization of a semi-join subquery +
+# RAND() in WHERE
+# (materialized table is accessed last)
+#
+set @save_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='materialization=on';
+create table t1(i int);
+insert into t1 values (1), (2), (3), (7), (9), (10);
+create table t2(i int);
+insert into t2 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+select * from t1 where (rand() < 0) and i in (select i from t2);
+i
+explain extended
+select * from t1 where (rand() < 0) and i in (select i from t2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 6 100.00 Using where
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 10 100.00
+Warnings:
+Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` semi join (`test`.`t2`) where rand() < 0
+drop table t1,t2;
+set optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/r/subselect_sj_jcl6.result b/mysql-test/r/subselect_sj_jcl6.result
index bcfa1b14be9..77a073ea2d3 100644
--- a/mysql-test/r/subselect_sj_jcl6.result
+++ b/mysql-test/r/subselect_sj_jcl6.result
@@ -1665,9 +1665,9 @@ CREATE VIEW v1 AS SELECT 1;
EXPLAIN
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived3> system NULL NULL NULL NULL 1
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
-2 MATERIALIZED <derived3> system NULL NULL NULL NULL 1
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
SELECT * FROM t1 INNER JOIN t2 ON t2.a != 0 AND t2.a IN (SELECT * FROM v1);
a a
@@ -3086,6 +3086,99 @@ project_number
aaa
drop table t1, t2, t3;
set optimizer_switch= @tmp_mdev6859;
+#
+# MDEV-12675: subquery subject to semi-join optimizations
+# in ON expression of INNER JOIN
+#
+set @tmp_mdev12675=@@optimizer_switch;
+set optimizer_switch=default;
+create table t1 (a int) engine=myisam;
+insert into t1 values (5),(3),(2),(7),(2),(5),(1);
+create table t2 (b int, index idx(b)) engine=myisam;
+insert into t2 values (2),(3),(2),(1),(3),(4);
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+analyze table t1,t2;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+test.t2 analyze status OK
+explain
+select a from t1, t2 where b between 1 and 2 and a in (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
+1 PRIMARY t2 ref idx idx 5 test.t1.a 256 Using index; FirstMatch(t1)
+1 PRIMARY t2 range idx idx 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
+explain
+select a from t1 join t2 on b between 1 and 2 and a in (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where
+1 PRIMARY t2 ref idx idx 5 test.t1.a 256 Using index; FirstMatch(t1)
+1 PRIMARY t2 range idx idx 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
+drop table t1,t2;
+set optimizer_switch= @tmp_mdev12675;
+#
+# MDEV-12817: subquery NOT subject to semi-join optimizations
+# in ON expression of INNER JOIN
+#
+CREATE TABLE t1 (c1 int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (c2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (c3 int) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6);
+CREATE TABLE t4 (c4 int) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (7),(8);
+SELECT c1
+FROM t1
+LEFT JOIN
+( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
+ON (c1 = c3);
+c1
+1
+2
+EXPLAIN EXTENDED SELECT c1
+FROM t1
+LEFT JOIN
+( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
+ON (c1 = c3);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
+2 SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1` from `test`.`t1` left join (`test`.`t2` join `test`.`t3`) on(`test`.`t3`.`c3` = `test`.`t1`.`c1` and <cache>(<in_optimizer>(1,<exists>(/* select#2 */ select `test`.`t4`.`c4` from `test`.`t4` where 1 = `test`.`t4`.`c4`)))) where 1
+# mdev-12820
+SELECT *
+FROM t1
+LEFT JOIN
+( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
+ON (c1 = c2);
+c1 c2 c4
+1 NULL NULL
+2 NULL NULL
+EXPLAIN EXTENDED SELECT *
+FROM t1
+LEFT JOIN
+( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
+ON (c1 = c2);
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join)
+1 PRIMARY t4 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join)
+3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2`,`test`.`t4`.`c4` AS `c4` from `test`.`t1` left join (`test`.`t2` join `test`.`t4`) on(`test`.`t2`.`c2` = `test`.`t1`.`c1` and <in_optimizer>(`test`.`t1`.`c1`,<exists>(/* select#3 */ select `test`.`t3`.`c3` from `test`.`t3` where <cache>(`test`.`t2`.`c2`) = `test`.`t3`.`c3`))) where 1
+DROP TABLE t1,t2,t3,t4;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 77590d8508b..b751632307a 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -313,7 +313,7 @@ drop trigger trg;
ERROR HY000: Trigger does not exist
create view v1 as select * from t1;
create trigger trg before insert on v1 for each row set @a:=1;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
drop view v1;
drop table t1;
drop table t3;
@@ -2368,6 +2368,16 @@ tr1 1 2016-01-01 10:10:10.33
tr2 2 2016-01-01 10:10:10.99
drop table t1;
set time_zone= @@global.time_zone;
+# MDEV-12992: Increasing memory consumption
+with each invocation of trigger
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (b INT);
+CREATE TRIGGER tr
+AFTER UPDATE ON t1 FOR EACH ROW SELECT (SELECT b FROM t2) INTO @x;
+# Running 20000 queries
+DROP TABLE t1,t2;
#
# Start of 10.3 tests
#
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index e0aa93d5c97..956703237a1 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -2178,6 +2178,35 @@ WHERE t1_2.b NOT IN ( SELECT 4 UNION ALL SELECT 5 );
a b a b
1 1 1 1
DROP TABLE t1;
+# Bug mdev-12788: UNION ALL + impossible having for derived
+# with IN subquery in WHERE
+#
+CREATE TABLE t1 (i int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (pk int PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2);
+SELECT 1, 2
+UNION ALL
+SELECT i, COUNT(*) FROM (
+SELECT * FROM t1 WHERE i IN ( SELECT pk FROM t2 )
+) AS sq
+GROUP BY i
+HAVING i = 10;
+1 2
+1 2
+EXPLAIN EXTENDED SELECT 1, 2
+UNION ALL
+SELECT i, COUNT(*) FROM (
+SELECT * FROM t1 WHERE i IN ( SELECT pk FROM t2 )
+) AS sq
+GROUP BY i
+HAVING i = 10;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL NULL No tables used
+2 UNION NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
+Warnings:
+Note 1003 /* select#1 */ select 1 AS `1`,2 AS `2` union all /* select#2 */ select 1 AS `i`,count(0) AS `COUNT(*)` from `test`.`t2` where 1 group by 1 having 0
+DROP TABLE t1,t2;
#
# Start of 10.3 tests
#
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index e200af46b87..37c3fe55a52 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -41,7 +41,7 @@ show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`b` + 1 AS `c` from `t1` latin1 latin1_swedish_ci
show create view t1;
-ERROR HY000: 'test.t1' is not VIEW
+ERROR HY000: 'test.t1' is not of type 'VIEW'
drop table t1;
select a from v1;
ERROR 42S22: Unknown column 'a' in 'field list'
@@ -199,7 +199,7 @@ c d
drop view v100;
ERROR 42S02: Unknown VIEW: 'test.v100'
drop view t1;
-ERROR HY000: 'test.t1' is not VIEW
+ERROR HY000: 'test.t1' is not of type 'VIEW'
drop table v1;
ERROR 42S02: 'test.v1' is a view
drop view v1,v2;
@@ -675,7 +675,7 @@ drop view v1;
create table t1 (col1 int,col2 char(22));
create view v1 as select * from t1;
create index i1 on v1 (col1);
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
drop view v1;
drop table t1;
CREATE VIEW v1 (f1,f2,f3,f4) AS SELECT connection_id(), pi(), current_user(), version();
@@ -1061,7 +1061,7 @@ drop table t1,t2,t3;
create table t1 (s1 int);
create view v1 as select * from t1;
handler v1 open as xx;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
drop view v1;
drop table t1;
create table t1(a int);
@@ -2445,28 +2445,28 @@ CREATE TABLE t1(id INT);
CREATE VIEW v1 AS SELECT id FROM t1;
OPTIMIZE TABLE v1;
Table Op Msg_type Msg_text
-test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE'
test.v1 optimize status Operation failed
ANALYZE TABLE v1;
Table Op Msg_type Msg_text
-test.v1 analyze Error 'test.v1' is not BASE TABLE
+test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE'
test.v1 analyze status Operation failed
REPAIR TABLE v1;
Table Op Msg_type Msg_text
-test.v1 repair Error 'test.v1' is not BASE TABLE
+test.v1 repair Error 'test.v1' is not of type 'BASE TABLE'
test.v1 repair status Operation failed
DROP TABLE t1;
OPTIMIZE TABLE v1;
Table Op Msg_type Msg_text
-test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE'
test.v1 optimize status Operation failed
ANALYZE TABLE v1;
Table Op Msg_type Msg_text
-test.v1 analyze Error 'test.v1' is not BASE TABLE
+test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE'
test.v1 analyze status Operation failed
REPAIR TABLE v1;
Table Op Msg_type Msg_text
-test.v1 repair Error 'test.v1' is not BASE TABLE
+test.v1 repair Error 'test.v1' is not of type 'BASE TABLE'
test.v1 repair status Operation failed
DROP VIEW v1;
create definer = current_user() sql security invoker view v1 as select 1;
@@ -2920,7 +2920,7 @@ Tables_in_test
t1
CREATE VIEW v1 AS SELECT id FROM t1;
DROP VIEW t1,v1;
-ERROR HY000: 'test.t1' is not VIEW
+ERROR HY000: 'test.t1' is not of type 'VIEW'
SHOW TABLES;
Tables_in_test
t1
@@ -3706,7 +3706,7 @@ CREATE TABLE t1(c1 INT);
SELECT * FROM t1;
c1
ALTER ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW t1 (c2) AS SELECT (1);
-ERROR HY000: 'test.t1' is not VIEW
+ERROR HY000: 'test.t1' is not of type 'VIEW'
DROP TABLE t1;
@@ -4011,7 +4011,7 @@ drop procedure p;
CREATE TABLE t1 (a INT);
CREATE VIEW v1 AS SELECT a FROM t1;
ALTER TABLE v1;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
DROP VIEW v1;
DROP TABLE t1;
#
@@ -5584,7 +5584,7 @@ create table t1 (a int, b int);
create view v1 as select a+b from t1;
alter table v1 check partition p1;
Table Op Msg_type Msg_text
-test.v1 check Error 'test.v1' is not BASE TABLE
+test.v1 check Error 'test.v1' is not of type 'BASE TABLE'
test.v1 check status Operation failed
drop view v1;
drop table t1;
diff --git a/mysql-test/suite/binlog/r/mysqladmin.result b/mysql-test/suite/binlog/r/mysqladmin.result
new file mode 100644
index 00000000000..4be6c96d55b
--- /dev/null
+++ b/mysql-test/suite/binlog/r/mysqladmin.result
@@ -0,0 +1,12 @@
+create user adm@localhost identified by 'foobar';
+grant reload on *.* to adm@localhost;
+reset master;
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # flush status
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # GTID #-#-#
+master-bin.000001 # Query # # flush status
+drop user adm@localhost;
diff --git a/mysql-test/suite/binlog/t/mysqladmin.test b/mysql-test/suite/binlog/t/mysqladmin.test
new file mode 100644
index 00000000000..3c2fbc0a708
--- /dev/null
+++ b/mysql-test/suite/binlog/t/mysqladmin.test
@@ -0,0 +1,12 @@
+source include/have_binlog_format_statement.inc;
+#
+# MDEV-12612 mysqladmin --local flush... to use FLUSH LOCAL
+#
+create user adm@localhost identified by 'foobar';
+grant reload on *.* to adm@localhost;
+reset master;
+exec $MYSQLADMIN -uadm -pfoobar flush-status;
+source include/show_binlog_events.inc;
+exec $MYSQLADMIN --local -uadm -pfoobar flush-status;
+source include/show_binlog_events.inc;
+drop user adm@localhost;
diff --git a/mysql-test/suite/csv/read_only.result b/mysql-test/suite/csv/read_only.result
new file mode 100644
index 00000000000..d6936681f65
--- /dev/null
+++ b/mysql-test/suite/csv/read_only.result
@@ -0,0 +1,30 @@
+create table t1 (a int not null) engine=csv;
+insert t1 values (1),(2);
+flush tables;
+select * from information_schema.tables where table_schema='test';
+TABLE_CATALOG def
+TABLE_SCHEMA test
+TABLE_NAME t1
+TABLE_TYPE BASE TABLE
+ENGINE NULL
+VERSION NULL
+ROW_FORMAT NULL
+TABLE_ROWS NULL
+AVG_ROW_LENGTH NULL
+DATA_LENGTH NULL
+MAX_DATA_LENGTH NULL
+INDEX_LENGTH NULL
+DATA_FREE NULL
+AUTO_INCREMENT NULL
+CREATE_TIME NULL
+UPDATE_TIME NULL
+CHECK_TIME NULL
+TABLE_COLLATION NULL
+CHECKSUM NULL
+CREATE_OPTIONS NULL
+TABLE_COMMENT File './test/t1.CSM' not found (Errcode: 13 "Permission denied")
+Warnings:
+Level Warning
+Code 29
+Message File './test/t1.CSM' not found (Errcode: 13 "Permission denied")
+drop table t1;
diff --git a/mysql-test/suite/csv/read_only.test b/mysql-test/suite/csv/read_only.test
new file mode 100644
index 00000000000..2af209182d0
--- /dev/null
+++ b/mysql-test/suite/csv/read_only.test
@@ -0,0 +1,19 @@
+#
+# MDEV-11883 MariaDB crashes with out-of-memory when query information_schema
+#
+source include/have_csv.inc;
+
+let datadir=`select @@datadir`;
+
+create table t1 (a int not null) engine=csv;
+insert t1 values (1),(2);
+flush tables;
+
+chmod 0400 $datadir/test/t1.CSM;
+chmod 0400 $datadir/test/t1.CSV;
+
+--replace_result $datadir ./
+query_vertical select * from information_schema.tables where table_schema='test';
+
+drop table t1;
+
diff --git a/mysql-test/suite/encryption/r/innodb-checksum-algorithm,32k.rdiff b/mysql-test/suite/encryption/r/innodb-checksum-algorithm,32k.rdiff
new file mode 100644
index 00000000000..cd66df7440b
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-checksum-algorithm,32k.rdiff
@@ -0,0 +1,38 @@
+--- suite/encryption/r/innodb-checksum-algorithm.result
++++ suite/encryption/r/innodb-checksum-algorithm,32k.reject
+@@ -13,9 +13,9 @@
+ SET GLOBAL innodb_default_encryption_key_id=4;
+ SET GLOBAL innodb_checksum_algorithm=crc32;
+ create table tce_crc32(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=yes;
++ROW_FORMAT=DYNAMIC encrypted=yes;
+ create table tc_crc32(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=no;
++ROW_FORMAT=DYNAMIC encrypted=no;
+ create table te_crc32(a serial, b blob, index(b(10))) engine=innodb
+ encrypted=yes;
+ create table t_crc32(a serial, b blob, index(b(10))) engine=innodb
+@@ -222,9 +222,9 @@
+ t_crc32, tpe_crc32, tp_crc32;
+ SET GLOBAL innodb_checksum_algorithm=innodb;
+ create table tce_innodb(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=yes;
++ROW_FORMAT=DYNAMIC encrypted=yes;
+ create table tc_innodb(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=no;
++ROW_FORMAT=DYNAMIC encrypted=no;
+ create table te_innodb(a serial, b blob, index(b(10))) engine=innodb
+ encrypted=yes;
+ create table t_innodb(a serial, b blob, index(b(10))) engine=innodb
+@@ -431,9 +431,9 @@
+ t_innodb, tpe_innodb, tp_innodb;
+ SET GLOBAL innodb_checksum_algorithm=none;
+ create table tce_none(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=yes;
++ROW_FORMAT=DYNAMIC encrypted=yes;
+ create table tc_none(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=no;
++ROW_FORMAT=DYNAMIC encrypted=no;
+ create table te_none(a serial, b blob, index(b(10))) engine=innodb
+ encrypted=yes;
+ create table t_none(a serial, b blob, index(b(10))) engine=innodb
diff --git a/mysql-test/suite/encryption/r/innodb-checksum-algorithm,64k.rdiff b/mysql-test/suite/encryption/r/innodb-checksum-algorithm,64k.rdiff
new file mode 100644
index 00000000000..523074297da
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-checksum-algorithm,64k.rdiff
@@ -0,0 +1,38 @@
+--- suite/encryption/r/innodb-checksum-algorithm.result
++++ suite/encryption/r/innodb-checksum-algorithm,64k.reject
+@@ -13,9 +13,9 @@
+ SET GLOBAL innodb_default_encryption_key_id=4;
+ SET GLOBAL innodb_checksum_algorithm=crc32;
+ create table tce_crc32(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=yes;
++ROW_FORMAT=DYNAMIC encrypted=yes;
+ create table tc_crc32(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=no;
++ROW_FORMAT=DYNAMIC encrypted=no;
+ create table te_crc32(a serial, b blob, index(b(10))) engine=innodb
+ encrypted=yes;
+ create table t_crc32(a serial, b blob, index(b(10))) engine=innodb
+@@ -222,9 +222,9 @@
+ t_crc32, tpe_crc32, tp_crc32;
+ SET GLOBAL innodb_checksum_algorithm=innodb;
+ create table tce_innodb(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=yes;
++ROW_FORMAT=DYNAMIC encrypted=yes;
+ create table tc_innodb(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=no;
++ROW_FORMAT=DYNAMIC encrypted=no;
+ create table te_innodb(a serial, b blob, index(b(10))) engine=innodb
+ encrypted=yes;
+ create table t_innodb(a serial, b blob, index(b(10))) engine=innodb
+@@ -431,9 +431,9 @@
+ t_innodb, tpe_innodb, tp_innodb;
+ SET GLOBAL innodb_checksum_algorithm=none;
+ create table tce_none(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=yes;
++ROW_FORMAT=DYNAMIC encrypted=yes;
+ create table tc_none(a serial, b blob, index(b(10))) engine=innodb
+-ROW_FORMAT=COMPRESSED encrypted=no;
++ROW_FORMAT=DYNAMIC encrypted=no;
+ create table te_none(a serial, b blob, index(b(10))) engine=innodb
+ encrypted=yes;
+ create table t_none(a serial, b blob, index(b(10))) engine=innodb
diff --git a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result
new file mode 100644
index 00000000000..a12b47ef31d
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result
@@ -0,0 +1,643 @@
+SET @saved_file_per_table = @@global.innodb_file_per_table;
+SET @saved_checksum_algorithm = @@global.innodb_checksum_algorithm;
+SET @saved_encrypt_tables = @@global.innodb_encrypt_tables;
+SET @saved_encryption_threads = @@global.innodb_encryption_threads;
+SET @saved_encryption_key_id = @@global.innodb_default_encryption_key_id;
+SET GLOBAL innodb_file_per_table = ON;
+SET GLOBAL innodb_encrypt_tables = ON;
+SET GLOBAL innodb_encryption_threads = 4;
+call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_(crc32|none|innodb)\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"(innodb|none|crc32)\"");
+SET GLOBAL innodb_checksum_algorithm = innodb;
+SET GLOBAL innodb_default_encryption_key_id=4;
+SET GLOBAL innodb_checksum_algorithm=crc32;
+create table tce_crc32(a serial, b blob, index(b(10))) engine=innodb
+ROW_FORMAT=COMPRESSED encrypted=yes;
+create table tc_crc32(a serial, b blob, index(b(10))) engine=innodb
+ROW_FORMAT=COMPRESSED encrypted=no;
+create table te_crc32(a serial, b blob, index(b(10))) engine=innodb
+encrypted=yes;
+create table t_crc32(a serial, b blob, index(b(10))) engine=innodb
+encrypted=no;
+create table tpe_crc32(a serial, b blob, index(b(10))) engine=innodb
+page_compressed=yes encrypted=yes;
+create table tp_crc32(a serial, b blob, index(b(10))) engine=innodb
+page_compressed=yes encrypted=no;
+begin;
+insert into tce_crc32(b) values (repeat('secret',20));
+insert into tc_crc32(b) values (repeat('secret',20));
+insert into te_crc32(b) values (repeat('secret',20));
+insert into t_crc32(b) values (repeat('secret',20));
+insert into tpe_crc32(b) values (repeat('secret',20));
+insert into tp_crc32(b) values (repeat('secret',20));
+commit;
+FLUSH TABLES tce_crc32, tc_crc32, te_crc32,
+t_crc32, tpe_crc32, tp_crc32 FOR EXPORT;
+backup: tce_crc32
+backup: tc_crc32
+backup: te_crc32
+backup: t_crc32
+backup: tpe_crc32
+backup: tp_crc32
+t_crc32.cfg
+t_crc32.frm
+t_crc32.ibd
+tc_crc32.cfg
+tc_crc32.frm
+tc_crc32.ibd
+tce_crc32.cfg
+tce_crc32.frm
+tce_crc32.ibd
+te_crc32.cfg
+te_crc32.frm
+te_crc32.ibd
+tp_crc32.cfg
+tp_crc32.frm
+tp_crc32.ibd
+tpe_crc32.cfg
+tpe_crc32.frm
+tpe_crc32.ibd
+UNLOCK TABLES;
+SET GLOBAL innodb_checksum_algorithm=strict_crc32;
+ALTER TABLE tce_crc32 DISCARD TABLESPACE;
+ALTER TABLE tc_crc32 DISCARD TABLESPACE;
+ALTER TABLE te_crc32 DISCARD TABLESPACE;
+ALTER TABLE t_crc32 DISCARD TABLESPACE;
+ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
+ALTER TABLE tp_crc32 DISCARD TABLESPACE;
+restore: tce_crc32 .ibd and .cfg files
+restore: tc_crc32 .ibd and .cfg files
+restore: te_crc32 .ibd and .cfg files
+restore: t_crc32 .ibd and .cfg files
+restore: tpe_crc32 .ibd and .cfg files
+restore: tp_crc32 .ibd and .cfg files
+ALTER TABLE tce_crc32 IMPORT TABLESPACE;
+update tce_crc32 set b=substr(b,1);
+ALTER TABLE tc_crc32 IMPORT TABLESPACE;
+update tc_crc32 set b=substr(b,1);
+ALTER TABLE te_crc32 IMPORT TABLESPACE;
+update te_crc32 set b=substr(b,1);
+ALTER TABLE t_crc32 IMPORT TABLESPACE;
+update t_crc32 set b=substr(b,1);
+ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
+update tpe_crc32 set b=substr(b,1);
+ALTER TABLE tp_crc32 IMPORT TABLESPACE;
+update tp_crc32 set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=crc32;
+ALTER TABLE tce_crc32 DISCARD TABLESPACE;
+ALTER TABLE tc_crc32 DISCARD TABLESPACE;
+ALTER TABLE te_crc32 DISCARD TABLESPACE;
+ALTER TABLE t_crc32 DISCARD TABLESPACE;
+ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
+ALTER TABLE tp_crc32 DISCARD TABLESPACE;
+restore: tce_crc32 .ibd and .cfg files
+restore: tc_crc32 .ibd and .cfg files
+restore: te_crc32 .ibd and .cfg files
+restore: t_crc32 .ibd and .cfg files
+restore: tpe_crc32 .ibd and .cfg files
+restore: tp_crc32 .ibd and .cfg files
+ALTER TABLE tce_crc32 IMPORT TABLESPACE;
+update tce_crc32 set b=substr(b,1);
+ALTER TABLE tc_crc32 IMPORT TABLESPACE;
+update tc_crc32 set b=substr(b,1);
+ALTER TABLE te_crc32 IMPORT TABLESPACE;
+update te_crc32 set b=substr(b,1);
+ALTER TABLE t_crc32 IMPORT TABLESPACE;
+update t_crc32 set b=substr(b,1);
+ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
+update tpe_crc32 set b=substr(b,1);
+ALTER TABLE tp_crc32 IMPORT TABLESPACE;
+update tp_crc32 set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=strict_innodb;
+ALTER TABLE tce_crc32 DISCARD TABLESPACE;
+ALTER TABLE tc_crc32 DISCARD TABLESPACE;
+ALTER TABLE te_crc32 DISCARD TABLESPACE;
+ALTER TABLE t_crc32 DISCARD TABLESPACE;
+ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
+ALTER TABLE tp_crc32 DISCARD TABLESPACE;
+restore: tce_crc32 .ibd and .cfg files
+restore: tc_crc32 .ibd and .cfg files
+restore: te_crc32 .ibd and .cfg files
+restore: t_crc32 .ibd and .cfg files
+restore: tpe_crc32 .ibd and .cfg files
+restore: tp_crc32 .ibd and .cfg files
+ALTER TABLE tce_crc32 IMPORT TABLESPACE;
+update tce_crc32 set b=substr(b,1);
+ALTER TABLE tc_crc32 IMPORT TABLESPACE;
+update tc_crc32 set b=substr(b,1);
+ALTER TABLE te_crc32 IMPORT TABLESPACE;
+update te_crc32 set b=substr(b,1);
+ALTER TABLE t_crc32 IMPORT TABLESPACE;
+update t_crc32 set b=substr(b,1);
+ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
+update tpe_crc32 set b=substr(b,1);
+ALTER TABLE tp_crc32 IMPORT TABLESPACE;
+update tp_crc32 set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=innodb;
+ALTER TABLE tce_crc32 DISCARD TABLESPACE;
+ALTER TABLE tc_crc32 DISCARD TABLESPACE;
+ALTER TABLE te_crc32 DISCARD TABLESPACE;
+ALTER TABLE t_crc32 DISCARD TABLESPACE;
+ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
+ALTER TABLE tp_crc32 DISCARD TABLESPACE;
+restore: tce_crc32 .ibd and .cfg files
+restore: tc_crc32 .ibd and .cfg files
+restore: te_crc32 .ibd and .cfg files
+restore: t_crc32 .ibd and .cfg files
+restore: tpe_crc32 .ibd and .cfg files
+restore: tp_crc32 .ibd and .cfg files
+ALTER TABLE tce_crc32 IMPORT TABLESPACE;
+update tce_crc32 set b=substr(b,1);
+ALTER TABLE tc_crc32 IMPORT TABLESPACE;
+update tc_crc32 set b=substr(b,1);
+ALTER TABLE te_crc32 IMPORT TABLESPACE;
+update te_crc32 set b=substr(b,1);
+ALTER TABLE t_crc32 IMPORT TABLESPACE;
+update t_crc32 set b=substr(b,1);
+ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
+update tpe_crc32 set b=substr(b,1);
+ALTER TABLE tp_crc32 IMPORT TABLESPACE;
+update tp_crc32 set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=strict_none;
+ALTER TABLE tce_crc32 DISCARD TABLESPACE;
+ALTER TABLE tc_crc32 DISCARD TABLESPACE;
+ALTER TABLE te_crc32 DISCARD TABLESPACE;
+ALTER TABLE t_crc32 DISCARD TABLESPACE;
+ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
+ALTER TABLE tp_crc32 DISCARD TABLESPACE;
+restore: tce_crc32 .ibd and .cfg files
+restore: tc_crc32 .ibd and .cfg files
+restore: te_crc32 .ibd and .cfg files
+restore: t_crc32 .ibd and .cfg files
+restore: tpe_crc32 .ibd and .cfg files
+restore: tp_crc32 .ibd and .cfg files
+ALTER TABLE tce_crc32 IMPORT TABLESPACE;
+update tce_crc32 set b=substr(b,1);
+ALTER TABLE tc_crc32 IMPORT TABLESPACE;
+update tc_crc32 set b=substr(b,1);
+ALTER TABLE te_crc32 IMPORT TABLESPACE;
+update te_crc32 set b=substr(b,1);
+ALTER TABLE t_crc32 IMPORT TABLESPACE;
+update t_crc32 set b=substr(b,1);
+ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
+update tpe_crc32 set b=substr(b,1);
+ALTER TABLE tp_crc32 IMPORT TABLESPACE;
+update tp_crc32 set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=none;
+ALTER TABLE tce_crc32 DISCARD TABLESPACE;
+ALTER TABLE tc_crc32 DISCARD TABLESPACE;
+ALTER TABLE te_crc32 DISCARD TABLESPACE;
+ALTER TABLE t_crc32 DISCARD TABLESPACE;
+ALTER TABLE tpe_crc32 DISCARD TABLESPACE;
+ALTER TABLE tp_crc32 DISCARD TABLESPACE;
+restore: tce_crc32 .ibd and .cfg files
+restore: tc_crc32 .ibd and .cfg files
+restore: te_crc32 .ibd and .cfg files
+restore: t_crc32 .ibd and .cfg files
+restore: tpe_crc32 .ibd and .cfg files
+restore: tp_crc32 .ibd and .cfg files
+ALTER TABLE tce_crc32 IMPORT TABLESPACE;
+update tce_crc32 set b=substr(b,1);
+ALTER TABLE tc_crc32 IMPORT TABLESPACE;
+update tc_crc32 set b=substr(b,1);
+ALTER TABLE te_crc32 IMPORT TABLESPACE;
+update te_crc32 set b=substr(b,1);
+ALTER TABLE t_crc32 IMPORT TABLESPACE;
+update t_crc32 set b=substr(b,1);
+ALTER TABLE tpe_crc32 IMPORT TABLESPACE;
+update tpe_crc32 set b=substr(b,1);
+ALTER TABLE tp_crc32 IMPORT TABLESPACE;
+update tp_crc32 set b=substr(b,1);
+CHECK TABLE tce_crc32, tc_crc32, te_crc32,
+t_crc32, tpe_crc32, tp_crc32;
+Table Op Msg_type Msg_text
+test.tce_crc32 check status OK
+test.tc_crc32 check status OK
+test.te_crc32 check status OK
+test.t_crc32 check status OK
+test.tpe_crc32 check status OK
+test.tp_crc32 check status OK
+DROP TABLE tce_crc32, tc_crc32, te_crc32,
+t_crc32, tpe_crc32, tp_crc32;
+SET GLOBAL innodb_checksum_algorithm=innodb;
+create table tce_innodb(a serial, b blob, index(b(10))) engine=innodb
+ROW_FORMAT=COMPRESSED encrypted=yes;
+create table tc_innodb(a serial, b blob, index(b(10))) engine=innodb
+ROW_FORMAT=COMPRESSED encrypted=no;
+create table te_innodb(a serial, b blob, index(b(10))) engine=innodb
+encrypted=yes;
+create table t_innodb(a serial, b blob, index(b(10))) engine=innodb
+encrypted=no;
+create table tpe_innodb(a serial, b blob, index(b(10))) engine=innodb
+page_compressed=yes encrypted=yes;
+create table tp_innodb(a serial, b blob, index(b(10))) engine=innodb
+page_compressed=yes encrypted=no;
+begin;
+insert into tce_innodb(b) values (repeat('secret',20));
+insert into tc_innodb(b) values (repeat('secret',20));
+insert into te_innodb(b) values (repeat('secret',20));
+insert into t_innodb(b) values (repeat('secret',20));
+insert into tpe_innodb(b) values (repeat('secret',20));
+insert into tp_innodb(b) values (repeat('secret',20));
+commit;
+FLUSH TABLES tce_innodb, tc_innodb, te_innodb,
+t_innodb, tpe_innodb, tp_innodb FOR EXPORT;
+backup: tce_innodb
+backup: tc_innodb
+backup: te_innodb
+backup: t_innodb
+backup: tpe_innodb
+backup: tp_innodb
+t_innodb.cfg
+t_innodb.frm
+t_innodb.ibd
+tc_innodb.cfg
+tc_innodb.frm
+tc_innodb.ibd
+tce_innodb.cfg
+tce_innodb.frm
+tce_innodb.ibd
+te_innodb.cfg
+te_innodb.frm
+te_innodb.ibd
+tp_innodb.cfg
+tp_innodb.frm
+tp_innodb.ibd
+tpe_innodb.cfg
+tpe_innodb.frm
+tpe_innodb.ibd
+UNLOCK TABLES;
+SET GLOBAL innodb_checksum_algorithm=strict_crc32;
+ALTER TABLE tce_innodb DISCARD TABLESPACE;
+ALTER TABLE tc_innodb DISCARD TABLESPACE;
+ALTER TABLE te_innodb DISCARD TABLESPACE;
+ALTER TABLE t_innodb DISCARD TABLESPACE;
+ALTER TABLE tpe_innodb DISCARD TABLESPACE;
+ALTER TABLE tp_innodb DISCARD TABLESPACE;
+restore: tce_innodb .ibd and .cfg files
+restore: tc_innodb .ibd and .cfg files
+restore: te_innodb .ibd and .cfg files
+restore: t_innodb .ibd and .cfg files
+restore: tpe_innodb .ibd and .cfg files
+restore: tp_innodb .ibd and .cfg files
+ALTER TABLE tce_innodb IMPORT TABLESPACE;
+update tce_innodb set b=substr(b,1);
+ALTER TABLE tc_innodb IMPORT TABLESPACE;
+update tc_innodb set b=substr(b,1);
+ALTER TABLE te_innodb IMPORT TABLESPACE;
+update te_innodb set b=substr(b,1);
+ALTER TABLE t_innodb IMPORT TABLESPACE;
+update t_innodb set b=substr(b,1);
+ALTER TABLE tpe_innodb IMPORT TABLESPACE;
+update tpe_innodb set b=substr(b,1);
+ALTER TABLE tp_innodb IMPORT TABLESPACE;
+update tp_innodb set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=crc32;
+ALTER TABLE tce_innodb DISCARD TABLESPACE;
+ALTER TABLE tc_innodb DISCARD TABLESPACE;
+ALTER TABLE te_innodb DISCARD TABLESPACE;
+ALTER TABLE t_innodb DISCARD TABLESPACE;
+ALTER TABLE tpe_innodb DISCARD TABLESPACE;
+ALTER TABLE tp_innodb DISCARD TABLESPACE;
+restore: tce_innodb .ibd and .cfg files
+restore: tc_innodb .ibd and .cfg files
+restore: te_innodb .ibd and .cfg files
+restore: t_innodb .ibd and .cfg files
+restore: tpe_innodb .ibd and .cfg files
+restore: tp_innodb .ibd and .cfg files
+ALTER TABLE tce_innodb IMPORT TABLESPACE;
+update tce_innodb set b=substr(b,1);
+ALTER TABLE tc_innodb IMPORT TABLESPACE;
+update tc_innodb set b=substr(b,1);
+ALTER TABLE te_innodb IMPORT TABLESPACE;
+update te_innodb set b=substr(b,1);
+ALTER TABLE t_innodb IMPORT TABLESPACE;
+update t_innodb set b=substr(b,1);
+ALTER TABLE tpe_innodb IMPORT TABLESPACE;
+update tpe_innodb set b=substr(b,1);
+ALTER TABLE tp_innodb IMPORT TABLESPACE;
+update tp_innodb set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=strict_innodb;
+ALTER TABLE tce_innodb DISCARD TABLESPACE;
+ALTER TABLE tc_innodb DISCARD TABLESPACE;
+ALTER TABLE te_innodb DISCARD TABLESPACE;
+ALTER TABLE t_innodb DISCARD TABLESPACE;
+ALTER TABLE tpe_innodb DISCARD TABLESPACE;
+ALTER TABLE tp_innodb DISCARD TABLESPACE;
+restore: tce_innodb .ibd and .cfg files
+restore: tc_innodb .ibd and .cfg files
+restore: te_innodb .ibd and .cfg files
+restore: t_innodb .ibd and .cfg files
+restore: tpe_innodb .ibd and .cfg files
+restore: tp_innodb .ibd and .cfg files
+ALTER TABLE tce_innodb IMPORT TABLESPACE;
+update tce_innodb set b=substr(b,1);
+ALTER TABLE tc_innodb IMPORT TABLESPACE;
+update tc_innodb set b=substr(b,1);
+ALTER TABLE te_innodb IMPORT TABLESPACE;
+update te_innodb set b=substr(b,1);
+ALTER TABLE t_innodb IMPORT TABLESPACE;
+update t_innodb set b=substr(b,1);
+ALTER TABLE tpe_innodb IMPORT TABLESPACE;
+update tpe_innodb set b=substr(b,1);
+ALTER TABLE tp_innodb IMPORT TABLESPACE;
+update tp_innodb set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=innodb;
+ALTER TABLE tce_innodb DISCARD TABLESPACE;
+ALTER TABLE tc_innodb DISCARD TABLESPACE;
+ALTER TABLE te_innodb DISCARD TABLESPACE;
+ALTER TABLE t_innodb DISCARD TABLESPACE;
+ALTER TABLE tpe_innodb DISCARD TABLESPACE;
+ALTER TABLE tp_innodb DISCARD TABLESPACE;
+restore: tce_innodb .ibd and .cfg files
+restore: tc_innodb .ibd and .cfg files
+restore: te_innodb .ibd and .cfg files
+restore: t_innodb .ibd and .cfg files
+restore: tpe_innodb .ibd and .cfg files
+restore: tp_innodb .ibd and .cfg files
+ALTER TABLE tce_innodb IMPORT TABLESPACE;
+update tce_innodb set b=substr(b,1);
+ALTER TABLE tc_innodb IMPORT TABLESPACE;
+update tc_innodb set b=substr(b,1);
+ALTER TABLE te_innodb IMPORT TABLESPACE;
+update te_innodb set b=substr(b,1);
+ALTER TABLE t_innodb IMPORT TABLESPACE;
+update t_innodb set b=substr(b,1);
+ALTER TABLE tpe_innodb IMPORT TABLESPACE;
+update tpe_innodb set b=substr(b,1);
+ALTER TABLE tp_innodb IMPORT TABLESPACE;
+update tp_innodb set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=strict_none;
+ALTER TABLE tce_innodb DISCARD TABLESPACE;
+ALTER TABLE tc_innodb DISCARD TABLESPACE;
+ALTER TABLE te_innodb DISCARD TABLESPACE;
+ALTER TABLE t_innodb DISCARD TABLESPACE;
+ALTER TABLE tpe_innodb DISCARD TABLESPACE;
+ALTER TABLE tp_innodb DISCARD TABLESPACE;
+restore: tce_innodb .ibd and .cfg files
+restore: tc_innodb .ibd and .cfg files
+restore: te_innodb .ibd and .cfg files
+restore: t_innodb .ibd and .cfg files
+restore: tpe_innodb .ibd and .cfg files
+restore: tp_innodb .ibd and .cfg files
+ALTER TABLE tce_innodb IMPORT TABLESPACE;
+update tce_innodb set b=substr(b,1);
+ALTER TABLE tc_innodb IMPORT TABLESPACE;
+update tc_innodb set b=substr(b,1);
+ALTER TABLE te_innodb IMPORT TABLESPACE;
+update te_innodb set b=substr(b,1);
+ALTER TABLE t_innodb IMPORT TABLESPACE;
+update t_innodb set b=substr(b,1);
+ALTER TABLE tpe_innodb IMPORT TABLESPACE;
+update tpe_innodb set b=substr(b,1);
+ALTER TABLE tp_innodb IMPORT TABLESPACE;
+update tp_innodb set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=none;
+ALTER TABLE tce_innodb DISCARD TABLESPACE;
+ALTER TABLE tc_innodb DISCARD TABLESPACE;
+ALTER TABLE te_innodb DISCARD TABLESPACE;
+ALTER TABLE t_innodb DISCARD TABLESPACE;
+ALTER TABLE tpe_innodb DISCARD TABLESPACE;
+ALTER TABLE tp_innodb DISCARD TABLESPACE;
+restore: tce_innodb .ibd and .cfg files
+restore: tc_innodb .ibd and .cfg files
+restore: te_innodb .ibd and .cfg files
+restore: t_innodb .ibd and .cfg files
+restore: tpe_innodb .ibd and .cfg files
+restore: tp_innodb .ibd and .cfg files
+ALTER TABLE tce_innodb IMPORT TABLESPACE;
+update tce_innodb set b=substr(b,1);
+ALTER TABLE tc_innodb IMPORT TABLESPACE;
+update tc_innodb set b=substr(b,1);
+ALTER TABLE te_innodb IMPORT TABLESPACE;
+update te_innodb set b=substr(b,1);
+ALTER TABLE t_innodb IMPORT TABLESPACE;
+update t_innodb set b=substr(b,1);
+ALTER TABLE tpe_innodb IMPORT TABLESPACE;
+update tpe_innodb set b=substr(b,1);
+ALTER TABLE tp_innodb IMPORT TABLESPACE;
+update tp_innodb set b=substr(b,1);
+CHECK TABLE tce_innodb, tc_innodb, te_innodb,
+t_innodb, tpe_innodb, tp_innodb;
+Table Op Msg_type Msg_text
+test.tce_innodb check status OK
+test.tc_innodb check status OK
+test.te_innodb check status OK
+test.t_innodb check status OK
+test.tpe_innodb check status OK
+test.tp_innodb check status OK
+DROP TABLE tce_innodb, tc_innodb, te_innodb,
+t_innodb, tpe_innodb, tp_innodb;
+SET GLOBAL innodb_checksum_algorithm=none;
+create table tce_none(a serial, b blob, index(b(10))) engine=innodb
+ROW_FORMAT=COMPRESSED encrypted=yes;
+create table tc_none(a serial, b blob, index(b(10))) engine=innodb
+ROW_FORMAT=COMPRESSED encrypted=no;
+create table te_none(a serial, b blob, index(b(10))) engine=innodb
+encrypted=yes;
+create table t_none(a serial, b blob, index(b(10))) engine=innodb
+encrypted=no;
+create table tpe_none(a serial, b blob, index(b(10))) engine=innodb
+page_compressed=yes encrypted=yes;
+create table tp_none(a serial, b blob, index(b(10))) engine=innodb
+page_compressed=yes encrypted=no;
+begin;
+insert into tce_none(b) values (repeat('secret',20));
+insert into tc_none(b) values (repeat('secret',20));
+insert into te_none(b) values (repeat('secret',20));
+insert into t_none(b) values (repeat('secret',20));
+insert into tpe_none(b) values (repeat('secret',20));
+insert into tp_none(b) values (repeat('secret',20));
+commit;
+FLUSH TABLES tce_none, tc_none, te_none,
+t_none, tpe_none, tp_none FOR EXPORT;
+backup: tce_none
+backup: tc_none
+backup: te_none
+backup: t_none
+backup: tpe_none
+backup: tp_none
+t_none.cfg
+t_none.frm
+t_none.ibd
+tc_none.cfg
+tc_none.frm
+tc_none.ibd
+tce_none.cfg
+tce_none.frm
+tce_none.ibd
+te_none.cfg
+te_none.frm
+te_none.ibd
+tp_none.cfg
+tp_none.frm
+tp_none.ibd
+tpe_none.cfg
+tpe_none.frm
+tpe_none.ibd
+UNLOCK TABLES;
+SET GLOBAL innodb_checksum_algorithm=strict_crc32;
+ALTER TABLE tce_none DISCARD TABLESPACE;
+ALTER TABLE tc_none DISCARD TABLESPACE;
+ALTER TABLE te_none DISCARD TABLESPACE;
+ALTER TABLE t_none DISCARD TABLESPACE;
+ALTER TABLE tpe_none DISCARD TABLESPACE;
+ALTER TABLE tp_none DISCARD TABLESPACE;
+restore: tce_none .ibd and .cfg files
+restore: tc_none .ibd and .cfg files
+restore: te_none .ibd and .cfg files
+restore: t_none .ibd and .cfg files
+restore: tpe_none .ibd and .cfg files
+restore: tp_none .ibd and .cfg files
+ALTER TABLE tce_none IMPORT TABLESPACE;
+update tce_none set b=substr(b,1);
+ALTER TABLE tc_none IMPORT TABLESPACE;
+update tc_none set b=substr(b,1);
+ALTER TABLE te_none IMPORT TABLESPACE;
+update te_none set b=substr(b,1);
+ALTER TABLE t_none IMPORT TABLESPACE;
+update t_none set b=substr(b,1);
+ALTER TABLE tpe_none IMPORT TABLESPACE;
+update tpe_none set b=substr(b,1);
+ALTER TABLE tp_none IMPORT TABLESPACE;
+update tp_none set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=crc32;
+ALTER TABLE tce_none DISCARD TABLESPACE;
+ALTER TABLE tc_none DISCARD TABLESPACE;
+ALTER TABLE te_none DISCARD TABLESPACE;
+ALTER TABLE t_none DISCARD TABLESPACE;
+ALTER TABLE tpe_none DISCARD TABLESPACE;
+ALTER TABLE tp_none DISCARD TABLESPACE;
+restore: tce_none .ibd and .cfg files
+restore: tc_none .ibd and .cfg files
+restore: te_none .ibd and .cfg files
+restore: t_none .ibd and .cfg files
+restore: tpe_none .ibd and .cfg files
+restore: tp_none .ibd and .cfg files
+ALTER TABLE tce_none IMPORT TABLESPACE;
+update tce_none set b=substr(b,1);
+ALTER TABLE tc_none IMPORT TABLESPACE;
+update tc_none set b=substr(b,1);
+ALTER TABLE te_none IMPORT TABLESPACE;
+update te_none set b=substr(b,1);
+ALTER TABLE t_none IMPORT TABLESPACE;
+update t_none set b=substr(b,1);
+ALTER TABLE tpe_none IMPORT TABLESPACE;
+update tpe_none set b=substr(b,1);
+ALTER TABLE tp_none IMPORT TABLESPACE;
+update tp_none set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=strict_innodb;
+ALTER TABLE tce_none DISCARD TABLESPACE;
+ALTER TABLE tc_none DISCARD TABLESPACE;
+ALTER TABLE te_none DISCARD TABLESPACE;
+ALTER TABLE t_none DISCARD TABLESPACE;
+ALTER TABLE tpe_none DISCARD TABLESPACE;
+ALTER TABLE tp_none DISCARD TABLESPACE;
+restore: tce_none .ibd and .cfg files
+restore: tc_none .ibd and .cfg files
+restore: te_none .ibd and .cfg files
+restore: t_none .ibd and .cfg files
+restore: tpe_none .ibd and .cfg files
+restore: tp_none .ibd and .cfg files
+ALTER TABLE tce_none IMPORT TABLESPACE;
+update tce_none set b=substr(b,1);
+ALTER TABLE tc_none IMPORT TABLESPACE;
+update tc_none set b=substr(b,1);
+ALTER TABLE te_none IMPORT TABLESPACE;
+update te_none set b=substr(b,1);
+ALTER TABLE t_none IMPORT TABLESPACE;
+update t_none set b=substr(b,1);
+ALTER TABLE tpe_none IMPORT TABLESPACE;
+update tpe_none set b=substr(b,1);
+ALTER TABLE tp_none IMPORT TABLESPACE;
+update tp_none set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=innodb;
+ALTER TABLE tce_none DISCARD TABLESPACE;
+ALTER TABLE tc_none DISCARD TABLESPACE;
+ALTER TABLE te_none DISCARD TABLESPACE;
+ALTER TABLE t_none DISCARD TABLESPACE;
+ALTER TABLE tpe_none DISCARD TABLESPACE;
+ALTER TABLE tp_none DISCARD TABLESPACE;
+restore: tce_none .ibd and .cfg files
+restore: tc_none .ibd and .cfg files
+restore: te_none .ibd and .cfg files
+restore: t_none .ibd and .cfg files
+restore: tpe_none .ibd and .cfg files
+restore: tp_none .ibd and .cfg files
+ALTER TABLE tce_none IMPORT TABLESPACE;
+update tce_none set b=substr(b,1);
+ALTER TABLE tc_none IMPORT TABLESPACE;
+update tc_none set b=substr(b,1);
+ALTER TABLE te_none IMPORT TABLESPACE;
+update te_none set b=substr(b,1);
+ALTER TABLE t_none IMPORT TABLESPACE;
+update t_none set b=substr(b,1);
+ALTER TABLE tpe_none IMPORT TABLESPACE;
+update tpe_none set b=substr(b,1);
+ALTER TABLE tp_none IMPORT TABLESPACE;
+update tp_none set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=strict_none;
+ALTER TABLE tce_none DISCARD TABLESPACE;
+ALTER TABLE tc_none DISCARD TABLESPACE;
+ALTER TABLE te_none DISCARD TABLESPACE;
+ALTER TABLE t_none DISCARD TABLESPACE;
+ALTER TABLE tpe_none DISCARD TABLESPACE;
+ALTER TABLE tp_none DISCARD TABLESPACE;
+restore: tce_none .ibd and .cfg files
+restore: tc_none .ibd and .cfg files
+restore: te_none .ibd and .cfg files
+restore: t_none .ibd and .cfg files
+restore: tpe_none .ibd and .cfg files
+restore: tp_none .ibd and .cfg files
+ALTER TABLE tce_none IMPORT TABLESPACE;
+update tce_none set b=substr(b,1);
+ALTER TABLE tc_none IMPORT TABLESPACE;
+update tc_none set b=substr(b,1);
+ALTER TABLE te_none IMPORT TABLESPACE;
+update te_none set b=substr(b,1);
+ALTER TABLE t_none IMPORT TABLESPACE;
+update t_none set b=substr(b,1);
+ALTER TABLE tpe_none IMPORT TABLESPACE;
+update tpe_none set b=substr(b,1);
+ALTER TABLE tp_none IMPORT TABLESPACE;
+update tp_none set b=substr(b,1);
+SET GLOBAL innodb_checksum_algorithm=none;
+ALTER TABLE tce_none DISCARD TABLESPACE;
+ALTER TABLE tc_none DISCARD TABLESPACE;
+ALTER TABLE te_none DISCARD TABLESPACE;
+ALTER TABLE t_none DISCARD TABLESPACE;
+ALTER TABLE tpe_none DISCARD TABLESPACE;
+ALTER TABLE tp_none DISCARD TABLESPACE;
+restore: tce_none .ibd and .cfg files
+restore: tc_none .ibd and .cfg files
+restore: te_none .ibd and .cfg files
+restore: t_none .ibd and .cfg files
+restore: tpe_none .ibd and .cfg files
+restore: tp_none .ibd and .cfg files
+ALTER TABLE tce_none IMPORT TABLESPACE;
+update tce_none set b=substr(b,1);
+ALTER TABLE tc_none IMPORT TABLESPACE;
+update tc_none set b=substr(b,1);
+ALTER TABLE te_none IMPORT TABLESPACE;
+update te_none set b=substr(b,1);
+ALTER TABLE t_none IMPORT TABLESPACE;
+update t_none set b=substr(b,1);
+ALTER TABLE tpe_none IMPORT TABLESPACE;
+update tpe_none set b=substr(b,1);
+ALTER TABLE tp_none IMPORT TABLESPACE;
+update tp_none set b=substr(b,1);
+CHECK TABLE tce_none, tc_none, te_none,
+t_none, tpe_none, tp_none;
+Table Op Msg_type Msg_text
+test.tce_none check status OK
+test.tc_none check status OK
+test.te_none check status OK
+test.t_none check status OK
+test.tpe_none check status OK
+test.tp_none check status OK
+DROP TABLE tce_none, tc_none, te_none,
+t_none, tpe_none, tp_none;
+SET GLOBAL innodb_file_per_table = @saved_file_per_table;
+SET GLOBAL innodb_checksum_algorithm = @saved_checksum_algorithm;
+SET GLOBAL innodb_encrypt_tables = @saved_encrypt_tables;
+SET GLOBAL innodb_encryption_threads = @saved_encryption_threads;
+SET GLOBAL innodb_default_encryption_key_id = @saved_encryption_key_id;
diff --git a/mysql-test/suite/encryption/r/innodb-compressed-blob.result b/mysql-test/suite/encryption/r/innodb-compressed-blob.result
index 5753188b168..bf43e1b30d6 100644
--- a/mysql-test/suite/encryption/r/innodb-compressed-blob.result
+++ b/mysql-test/suite/encryption/r/innodb-compressed-blob.result
@@ -1,4 +1,5 @@
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
+call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[1-3]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]");
# Restart mysqld --file-key-management-filename=keys2.txt
SET GLOBAL innodb_file_per_table = ON;
set GLOBAL innodb_default_encryption_key_id=4;
diff --git a/mysql-test/suite/encryption/r/innodb-first-page-read.result b/mysql-test/suite/encryption/r/innodb-first-page-read.result
new file mode 100644
index 00000000000..a630aa3cb09
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb-first-page-read.result
@@ -0,0 +1,87 @@
+create database innodb_test;
+use innodb_test;
+create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
+create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact;
+create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic;
+create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed;
+create table innodb_compressed1(c1 bigint not null, b char(200)) engine=innodb row_format=compressed key_block_size=1;
+create table innodb_compressed2(c1 bigint not null, b char(200)) engine=innodb row_format=compressed key_block_size=2;
+create table innodb_compressed4(c1 bigint not null, b char(200)) engine=innodb row_format=compressed key_block_size=4;
+create table innodb_compressed8(c1 bigint not null, b char(200)) engine=innodb row_format=compressed key_block_size=8;
+create table innodb_compressed16(c1 bigint not null, b char(200)) engine=innodb row_format=compressed key_block_size=16;
+create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant;
+create table innodb_pagecomp(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes;
+create table innodb_pagecomp1(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=1;
+create table innodb_pagecomp2(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=2;
+create table innodb_pagecomp3(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=3;
+create table innodb_pagecomp4(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=4;
+create table innodb_pagecomp5(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=5;
+create table innodb_pagecomp6(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=6;
+create table innodb_pagecomp7(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=7;
+create table innodb_pagecomp8(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=8;
+create table innodb_pagecomp9(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=9;
+create table innodb_datadir1(c1 bigint not null, b char(200)) engine=innodb DATA DIRECTORY='MYSQL_TMP_DIR';
+create table innodb_datadir2(c1 bigint not null, b char(200)) engine=innodb row_format=compressed DATA DIRECTORY='MYSQL_TMP_DIR';
+create table innodb_datadir3(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes DATA DIRECTORY='MYSQL_TMP_DIR';
+begin;
+insert into innodb_normal values (1,'secret');
+insert into innodb_compact select * from innodb_normal;
+insert into innodb_dynamic select * from innodb_normal;
+insert into innodb_compressed select * from innodb_normal;
+insert into innodb_compressed1 select * from innodb_normal;
+insert into innodb_compressed2 select * from innodb_normal;
+insert into innodb_compressed4 select * from innodb_normal;
+insert into innodb_compressed8 select * from innodb_normal;
+insert into innodb_compressed16 select * from innodb_normal;
+insert into innodb_redundant select * from innodb_normal;
+insert into innodb_pagecomp select * from innodb_normal;
+insert into innodb_pagecomp1 select * from innodb_normal;
+insert into innodb_pagecomp2 select * from innodb_normal;
+insert into innodb_pagecomp3 select * from innodb_normal;
+insert into innodb_pagecomp4 select * from innodb_normal;
+insert into innodb_pagecomp5 select * from innodb_normal;
+insert into innodb_pagecomp6 select * from innodb_normal;
+insert into innodb_pagecomp7 select * from innodb_normal;
+insert into innodb_pagecomp8 select * from innodb_normal;
+insert into innodb_pagecomp9 select * from innodb_normal;
+insert into innodb_datadir1 select * from innodb_normal;
+insert into innodb_datadir2 select * from innodb_normal;
+insert into innodb_datadir3 select * from innodb_normal;
+commit;
+# Restart server and see how many page 0's are read
+# result should be less than actual number of tables
+# i.e. < 23 + 3 = 26
+show status like 'innodb_pages0_read%';
+Variable_name Value
+Innodb_pages0_read 26
+use innodb_test;
+show status like 'innodb_pages0_read%';
+Variable_name Value
+Innodb_pages0_read 26
+use test;
+show status like 'innodb_pages0_read%';
+Variable_name Value
+Innodb_pages0_read 26
+set global innodb_encrypt_tables=OFF;
+# wait until tables are decrypted
+show status like 'innodb_pages0_read%';
+Variable_name Value
+Innodb_pages0_read 26
+use innodb_test;
+show status like 'innodb_pages0_read%';
+Variable_name Value
+Innodb_pages0_read 26
+use test;
+# restart and see number read page 0
+show status like 'innodb_pages0_read%';
+Variable_name Value
+Innodb_pages0_read 26
+use innodb_test;
+show status like 'innodb_pages0_read%';
+Variable_name Value
+Innodb_pages0_read 26
+use test;
+drop database innodb_test;
+show status like 'innodb_pages0_read%';
+Variable_name Value
+Innodb_pages0_read 26
diff --git a/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result b/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result
index afd3ac412ef..b39b3d13c97 100644
--- a/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result
+++ b/mysql-test/suite/encryption/r/innodb-key-rotation-disable.result
@@ -64,5 +64,4 @@ FOUND 1 /public/ in t7.ibd
FOUND 1 /public/ in t8.ibd
# t9 page compressed expecting NOT FOUND
NOT FOUND /public/ in t9.ibd
-use test;
drop database enctests;
diff --git a/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test b/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test
new file mode 100644
index 00000000000..7eaa1bd64c6
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test
@@ -0,0 +1,120 @@
+-- source include/innodb_page_size.inc
+-- source include/have_file_key_management_plugin.inc
+
+SET @saved_file_per_table = @@global.innodb_file_per_table;
+SET @saved_checksum_algorithm = @@global.innodb_checksum_algorithm;
+SET @saved_encrypt_tables = @@global.innodb_encrypt_tables;
+SET @saved_encryption_threads = @@global.innodb_encryption_threads;
+SET @saved_encryption_key_id = @@global.innodb_default_encryption_key_id;
+
+SET GLOBAL innodb_file_per_table = ON;
+SET GLOBAL innodb_encrypt_tables = ON;
+SET GLOBAL innodb_encryption_threads = 4;
+
+call mtr.add_suppression("InnoDB: innodb_checksum_algorithm is set to \"strict_(crc32|none|innodb)\" but the page \\[page id: space=[0-9]+, page number=[0-9]+\\] contains a valid checksum \"(innodb|none|crc32)\"");
+
+SET GLOBAL innodb_checksum_algorithm = innodb;
+SET GLOBAL innodb_default_encryption_key_id=4;
+
+let MYSQLD_DATADIR =`SELECT @@datadir`;
+
+# ROW_FORMAT=COMPRESSED is unavailable with innodb_page_size=32k or 64k
+let $row_format_compressed= `select case when @@global.innodb_page_size>16384
+then 'ROW_FORMAT=DYNAMIC' else 'ROW_FORMAT=COMPRESSED' end`;
+
+let $from = 3;
+while ($from)
+{
+dec $from;
+let checksum = `select case $from
+ when 0 then 'none'
+ when 1 then 'innodb'
+ when 2 then 'crc32'
+ end`;
+eval SET GLOBAL innodb_checksum_algorithm=$checksum;
+
+eval create table tce_$checksum(a serial, b blob, index(b(10))) engine=innodb
+$row_format_compressed encrypted=yes;
+eval create table tc_$checksum(a serial, b blob, index(b(10))) engine=innodb
+$row_format_compressed encrypted=no;
+eval create table te_$checksum(a serial, b blob, index(b(10))) engine=innodb
+encrypted=yes;
+eval create table t_$checksum(a serial, b blob, index(b(10))) engine=innodb
+encrypted=no;
+eval create table tpe_$checksum(a serial, b blob, index(b(10))) engine=innodb
+page_compressed=yes encrypted=yes;
+eval create table tp_$checksum(a serial, b blob, index(b(10))) engine=innodb
+page_compressed=yes encrypted=no;
+
+begin;
+eval insert into tce_$checksum(b) values (repeat('secret',20));
+eval insert into tc_$checksum(b) values (repeat('secret',20));
+eval insert into te_$checksum(b) values (repeat('secret',20));
+eval insert into t_$checksum(b) values (repeat('secret',20));
+eval insert into tpe_$checksum(b) values (repeat('secret',20));
+eval insert into tp_$checksum(b) values (repeat('secret',20));
+commit;
+
+eval FLUSH TABLES tce_$checksum, tc_$checksum, te_$checksum,
+t_$checksum, tpe_$checksum, tp_$checksum FOR EXPORT;
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
+my @tables = ("tce_", "tc_", "te_", "t_", "tpe_", "tp_");
+ib_backup_tablespaces("test", map{ $_ . $ENV{checksum} } @tables);
+EOF
+--list_files $MYSQLD_DATADIR/test
+UNLOCK TABLES;
+
+let $to = 6;
+while ($to)
+{
+dec $to;
+let $tocksum = `select case $to
+ when 0 then 'none'
+ when 1 then 'strict_none'
+ when 2 then 'innodb'
+ when 3 then 'strict_innodb'
+ when 4 then 'crc32'
+ when 5 then 'strict_crc32'
+ end`;
+
+eval SET GLOBAL innodb_checksum_algorithm=$tocksum;
+
+eval ALTER TABLE tce_$checksum DISCARD TABLESPACE;
+eval ALTER TABLE tc_$checksum DISCARD TABLESPACE;
+eval ALTER TABLE te_$checksum DISCARD TABLESPACE;
+eval ALTER TABLE t_$checksum DISCARD TABLESPACE;
+eval ALTER TABLE tpe_$checksum DISCARD TABLESPACE;
+eval ALTER TABLE tp_$checksum DISCARD TABLESPACE;
+
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
+my @tables = ("tce_", "tc_", "te_", "t_", "tpe_", "tp_");
+ib_restore_tablespaces("test", map{ $_ . $ENV{checksum} } @tables);
+EOF
+
+eval ALTER TABLE tce_$checksum IMPORT TABLESPACE;
+eval update tce_$checksum set b=substr(b,1);
+eval ALTER TABLE tc_$checksum IMPORT TABLESPACE;
+eval update tc_$checksum set b=substr(b,1);
+eval ALTER TABLE te_$checksum IMPORT TABLESPACE;
+eval update te_$checksum set b=substr(b,1);
+eval ALTER TABLE t_$checksum IMPORT TABLESPACE;
+eval update t_$checksum set b=substr(b,1);
+eval ALTER TABLE tpe_$checksum IMPORT TABLESPACE;
+eval update tpe_$checksum set b=substr(b,1);
+eval ALTER TABLE tp_$checksum IMPORT TABLESPACE;
+eval update tp_$checksum set b=substr(b,1);
+}
+
+eval CHECK TABLE tce_$checksum, tc_$checksum, te_$checksum,
+t_$checksum, tpe_$checksum, tp_$checksum;
+eval DROP TABLE tce_$checksum, tc_$checksum, te_$checksum,
+t_$checksum, tpe_$checksum, tp_$checksum;
+}
+
+SET GLOBAL innodb_file_per_table = @saved_file_per_table;
+SET GLOBAL innodb_checksum_algorithm = @saved_checksum_algorithm;
+SET GLOBAL innodb_encrypt_tables = @saved_encrypt_tables;
+SET GLOBAL innodb_encryption_threads = @saved_encryption_threads;
+SET GLOBAL innodb_default_encryption_key_id = @saved_encryption_key_id;
diff --git a/mysql-test/suite/encryption/t/innodb-compressed-blob.combinations b/mysql-test/suite/encryption/t/innodb-compressed-blob.combinations
new file mode 100644
index 00000000000..e096b023b52
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-compressed-blob.combinations
@@ -0,0 +1,12 @@
+[crc32]
+loose-innodb-tablespaces-encryption
+loose-innodb-encrypt-tables=on
+loose-innodb-encryption-threads=4
+max_allowed_packet=64K
+loose-innodb-checksum-algorithm=crc32
+[none]
+loose-innodb-tablespaces-encryption
+loose-innodb-encrypt-tables=on
+loose-innodb-encryption-threads=4
+max_allowed_packet=64K
+loose-innodb-checksum-algorithm=none
diff --git a/mysql-test/suite/encryption/t/innodb-compressed-blob.opt b/mysql-test/suite/encryption/t/innodb-compressed-blob.opt
deleted file mode 100644
index 36dcb6c6f26..00000000000
--- a/mysql-test/suite/encryption/t/innodb-compressed-blob.opt
+++ /dev/null
@@ -1,4 +0,0 @@
---innodb-tablespaces-encryption
---innodb-encrypt-tables=on
---innodb-encryption-threads=2
---max_allowed_packet=64K
diff --git a/mysql-test/suite/encryption/t/innodb-compressed-blob.test b/mysql-test/suite/encryption/t/innodb-compressed-blob.test
index 6256aaf5c33..4f28f8e183d 100644
--- a/mysql-test/suite/encryption/t/innodb-compressed-blob.test
+++ b/mysql-test/suite/encryption/t/innodb-compressed-blob.test
@@ -1,10 +1,11 @@
--- source include/have_innodb.inc
+-- source include/innodb_page_size_small.inc
-- source include/have_file_key_management_plugin.inc
# embedded does not support restart
-- source include/not_embedded.inc
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\.");
+call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[1-3]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]");
--echo # Restart mysqld --file-key-management-filename=keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
diff --git a/mysql-test/suite/encryption/t/innodb-first-page-read.opt b/mysql-test/suite/encryption/t/innodb-first-page-read.opt
new file mode 100644
index 00000000000..38d69691ed6
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-first-page-read.opt
@@ -0,0 +1,5 @@
+--innodb-encrypt-tables=ON
+--innodb-encrypt-log=ON
+--innodb-encryption-rotate-key-age=15
+--innodb-encryption-threads=4
+--innodb-tablespaces-encryption
diff --git a/mysql-test/suite/encryption/t/innodb-first-page-read.test b/mysql-test/suite/encryption/t/innodb-first-page-read.test
new file mode 100644
index 00000000000..216a864f746
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb-first-page-read.test
@@ -0,0 +1,92 @@
+-- source include/have_innodb.inc
+-- source include/have_file_key_management_plugin.inc
+-- source include/not_embedded.inc
+
+create database innodb_test;
+use innodb_test;
+create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
+create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact;
+create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic;
+create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed;
+create table innodb_compressed1(c1 bigint not null, b char(200)) engine=innodb row_format=compressed key_block_size=1;
+create table innodb_compressed2(c1 bigint not null, b char(200)) engine=innodb row_format=compressed key_block_size=2;
+create table innodb_compressed4(c1 bigint not null, b char(200)) engine=innodb row_format=compressed key_block_size=4;
+create table innodb_compressed8(c1 bigint not null, b char(200)) engine=innodb row_format=compressed key_block_size=8;
+create table innodb_compressed16(c1 bigint not null, b char(200)) engine=innodb row_format=compressed key_block_size=16;
+create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant;
+create table innodb_pagecomp(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes;
+create table innodb_pagecomp1(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=1;
+create table innodb_pagecomp2(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=2;
+create table innodb_pagecomp3(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=3;
+create table innodb_pagecomp4(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=4;
+create table innodb_pagecomp5(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=5;
+create table innodb_pagecomp6(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=6;
+create table innodb_pagecomp7(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=7;
+create table innodb_pagecomp8(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=8;
+create table innodb_pagecomp9(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes page_compression_level=9;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval create table innodb_datadir1(c1 bigint not null, b char(200)) engine=innodb DATA DIRECTORY='$MYSQL_TMP_DIR';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval create table innodb_datadir2(c1 bigint not null, b char(200)) engine=innodb row_format=compressed DATA DIRECTORY='$MYSQL_TMP_DIR';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval create table innodb_datadir3(c1 bigint not null, b char(200)) engine=innodb page_compressed=yes DATA DIRECTORY='$MYSQL_TMP_DIR';
+
+begin;
+insert into innodb_normal values (1,'secret');
+insert into innodb_compact select * from innodb_normal;
+insert into innodb_dynamic select * from innodb_normal;
+insert into innodb_compressed select * from innodb_normal;
+insert into innodb_compressed1 select * from innodb_normal;
+insert into innodb_compressed2 select * from innodb_normal;
+insert into innodb_compressed4 select * from innodb_normal;
+insert into innodb_compressed8 select * from innodb_normal;
+insert into innodb_compressed16 select * from innodb_normal;
+insert into innodb_redundant select * from innodb_normal;
+insert into innodb_pagecomp select * from innodb_normal;
+insert into innodb_pagecomp1 select * from innodb_normal;
+insert into innodb_pagecomp2 select * from innodb_normal;
+insert into innodb_pagecomp3 select * from innodb_normal;
+insert into innodb_pagecomp4 select * from innodb_normal;
+insert into innodb_pagecomp5 select * from innodb_normal;
+insert into innodb_pagecomp6 select * from innodb_normal;
+insert into innodb_pagecomp7 select * from innodb_normal;
+insert into innodb_pagecomp8 select * from innodb_normal;
+insert into innodb_pagecomp9 select * from innodb_normal;
+insert into innodb_datadir1 select * from innodb_normal;
+insert into innodb_datadir2 select * from innodb_normal;
+insert into innodb_datadir3 select * from innodb_normal;
+commit;
+
+--echo # Restart server and see how many page 0's are read
+--source include/restart_mysqld.inc
+
+--echo # result should be less than actual number of tables
+--echo # i.e. < 23 + 3 = 26
+show status like 'innodb_pages0_read%';
+use innodb_test;
+show status like 'innodb_pages0_read%';
+use test;
+show status like 'innodb_pages0_read%';
+
+set global innodb_encrypt_tables=OFF;
+
+--echo # wait until tables are decrypted
+--let $wait_condition=SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
+--source include/wait_condition.inc
+
+show status like 'innodb_pages0_read%';
+use innodb_test;
+show status like 'innodb_pages0_read%';
+use test;
+
+--echo # restart and see number read page 0
+-- source include/restart_mysqld.inc
+
+show status like 'innodb_pages0_read%';
+use innodb_test;
+show status like 'innodb_pages0_read%';
+use test;
+
+drop database innodb_test;
+show status like 'innodb_pages0_read%';
diff --git a/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test b/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test
index c1e3dd4cfb5..3167cee4b4b 100644
--- a/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test
+++ b/mysql-test/suite/encryption/t/innodb-key-rotation-disable.test
@@ -80,5 +80,4 @@ SET GLOBAL innodb_encrypt_tables=ON;
-- source include/start_mysqld.inc
-use test;
drop database enctests;
diff --git a/mysql-test/suite/federated/assisted_discovery.result b/mysql-test/suite/federated/assisted_discovery.result
index f79e47da8b4..4818ff7bb02 100644
--- a/mysql-test/suite/federated/assisted_discovery.result
+++ b/mysql-test/suite/federated/assisted_discovery.result
@@ -38,6 +38,40 @@ id group a\\b a\\ name
1 1 2 NULL foo
2 1 2 NULL fee
DROP TABLE t1;
+create table t1 (
+a bigint(20) not null auto_increment,
+b bigint(20) not null,
+c tinyint(4) not null,
+d varchar(4096) not null,
+primary key (a),
+key (b,c,d(255))
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL AUTO_INCREMENT,
+ `b` bigint(20) NOT NULL,
+ `c` tinyint(4) NOT NULL,
+ `d` varchar(4096) NOT NULL,
+ PRIMARY KEY (`a`),
+ KEY `b` (`b`,`c`,`d`(255))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+connection master;
+create table t1 engine=federated
+connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) NOT NULL AUTO_INCREMENT,
+ `b` bigint(20) NOT NULL,
+ `c` tinyint(4) NOT NULL,
+ `d` varchar(4096) NOT NULL,
+ PRIMARY KEY (`a`),
+ KEY `b` (`b`,`c`,`d`(255))
+) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'
+drop table t1;
+connection slave;
+drop table t1;
connection master;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/suite/federated/assisted_discovery.test b/mysql-test/suite/federated/assisted_discovery.test
index 9f3abe74ecc..fa83a2a8e19 100644
--- a/mysql-test/suite/federated/assisted_discovery.test
+++ b/mysql-test/suite/federated/assisted_discovery.test
@@ -30,5 +30,29 @@ connection slave;
SELECT * FROM t1;
DROP TABLE t1;
+#
+#
+#
+create table t1 (
+ a bigint(20) not null auto_increment,
+ b bigint(20) not null,
+ c tinyint(4) not null,
+ d varchar(4096) not null,
+ primary key (a),
+ key (b,c,d(255))
+);
+show create table t1;
+
+connection master;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+eval create table t1 engine=federated
+ connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+show create table t1;
+drop table t1;
+
+connection slave;
+drop table t1;
+
source include/federated_cleanup.inc;
diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
index b6a3a34207d..4753efd1794 100644
--- a/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/innodb_trig_0407.result
@@ -245,7 +245,7 @@ Testcase 3.5.5.3:
Create view vw3 as select f118 from tb3;
Create trigger trg3 before INSERT
on vw3 for each row set new.f118='s';
-ERROR HY000: 'test.vw3' is not BASE TABLE
+ERROR HY000: 'test.vw3' is not of type 'BASE TABLE'
drop view vw3;
Testcase 3.5.5.4:
diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result
index dfe46bbf645..d81d09353e1 100644
--- a/mysql-test/suite/funcs_1/r/innodb_views.result
+++ b/mysql-test/suite/funcs_1/r/innodb_views.result
@@ -3520,12 +3520,12 @@ f1
DROP TRIGGER tr1 ;
SET @a:=0 ;
CREATE TRIGGER tr1 BEFORE INSERT ON v1 FOR EACH ROW SET @a:=1 ;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
RENAME TABLE v1 TO v2;
RENAME VIEW v2 TO v1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VIEW v2 TO v1' at line 1
ALTER TABLE v2 RENAME AS v1;
-ERROR HY000: 'test.v2' is not BASE TABLE
+ERROR HY000: 'test.v2' is not of type 'BASE TABLE'
ALTER VIEW v1 RENAME AS v2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RENAME AS v2' at line 1
DROP TABLE IF EXISTS t1, t2 ;
@@ -3535,12 +3535,12 @@ CREATE TABLE t1 ( f1 DATE, f2 BLOB, f3 DOUBLE );
CREATE VIEW v1 AS SELECT f1, f2, f3 FROM t1;
ALTER TABLE t1 ADD PRIMARY KEY(f1);
ALTER TABLE v1 ADD PRIMARY KEY(f1);
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
ALTER VIEW v1 ADD PRIMARY KEY(f1);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ADD PRIMARY KEY(f1)' at line 1
CREATE INDEX t1_idx ON t1(f3);
CREATE INDEX v1_idx ON v1(f3);
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
DROP TABLE t1;
DROP VIEW v1;
@@ -4085,9 +4085,9 @@ Drop view test.v1 ;
Testcase 3.3.1.14
--------------------------------------------------------------------------------
CREATE OR REPLACE VIEW test.tb2 AS SELECT * From tb2 LIMIT 2;
-ERROR HY000: 'test.tb2' is not VIEW
+ERROR HY000: 'test.tb2' is not of type 'VIEW'
CREATE OR REPLACE VIEW tb2 AS SELECT * From tb2 LIMIT 2;
-ERROR HY000: 'test.tb2' is not VIEW
+ERROR HY000: 'test.tb2' is not of type 'VIEW'
Testcase 3.3.1.15
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/memory_trig_0407.result b/mysql-test/suite/funcs_1/r/memory_trig_0407.result
index 57b14e49f72..c21c206f118 100644
--- a/mysql-test/suite/funcs_1/r/memory_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/memory_trig_0407.result
@@ -245,7 +245,7 @@ Testcase 3.5.5.3:
Create view vw3 as select f118 from tb3;
Create trigger trg3 before INSERT
on vw3 for each row set new.f118='s';
-ERROR HY000: 'test.vw3' is not BASE TABLE
+ERROR HY000: 'test.vw3' is not of type 'BASE TABLE'
drop view vw3;
Testcase 3.5.5.4:
diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result
index b81ea2f309b..ca24c73d933 100644
--- a/mysql-test/suite/funcs_1/r/memory_views.result
+++ b/mysql-test/suite/funcs_1/r/memory_views.result
@@ -3521,12 +3521,12 @@ f1
DROP TRIGGER tr1 ;
SET @a:=0 ;
CREATE TRIGGER tr1 BEFORE INSERT ON v1 FOR EACH ROW SET @a:=1 ;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
RENAME TABLE v1 TO v2;
RENAME VIEW v2 TO v1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VIEW v2 TO v1' at line 1
ALTER TABLE v2 RENAME AS v1;
-ERROR HY000: 'test.v2' is not BASE TABLE
+ERROR HY000: 'test.v2' is not of type 'BASE TABLE'
ALTER VIEW v1 RENAME AS v2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RENAME AS v2' at line 1
DROP TABLE IF EXISTS t1, t2 ;
@@ -3536,12 +3536,12 @@ CREATE TABLE t1 ( f1 DATE, f2 BLOB, f3 DOUBLE );
CREATE VIEW v1 AS SELECT f1, f2, f3 FROM t1;
ALTER TABLE t1 ADD PRIMARY KEY(f1);
ALTER TABLE v1 ADD PRIMARY KEY(f1);
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
ALTER VIEW v1 ADD PRIMARY KEY(f1);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ADD PRIMARY KEY(f1)' at line 1
CREATE INDEX t1_idx ON t1(f3);
CREATE INDEX v1_idx ON v1(f3);
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
DROP TABLE t1;
DROP VIEW v1;
@@ -4086,9 +4086,9 @@ Drop view test.v1 ;
Testcase 3.3.1.14
--------------------------------------------------------------------------------
CREATE OR REPLACE VIEW test.tb2 AS SELECT * From tb2 LIMIT 2;
-ERROR HY000: 'test.tb2' is not VIEW
+ERROR HY000: 'test.tb2' is not of type 'VIEW'
CREATE OR REPLACE VIEW tb2 AS SELECT * From tb2 LIMIT 2;
-ERROR HY000: 'test.tb2' is not VIEW
+ERROR HY000: 'test.tb2' is not of type 'VIEW'
Testcase 3.3.1.15
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
index 57b14e49f72..c21c206f118 100644
--- a/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
+++ b/mysql-test/suite/funcs_1/r/myisam_trig_0407.result
@@ -245,7 +245,7 @@ Testcase 3.5.5.3:
Create view vw3 as select f118 from tb3;
Create trigger trg3 before INSERT
on vw3 for each row set new.f118='s';
-ERROR HY000: 'test.vw3' is not BASE TABLE
+ERROR HY000: 'test.vw3' is not of type 'BASE TABLE'
drop view vw3;
Testcase 3.5.5.4:
diff --git a/mysql-test/suite/funcs_1/r/myisam_views-big.result b/mysql-test/suite/funcs_1/r/myisam_views-big.result
index 9296b9d98a2..feb67539cb9 100644
--- a/mysql-test/suite/funcs_1/r/myisam_views-big.result
+++ b/mysql-test/suite/funcs_1/r/myisam_views-big.result
@@ -4023,12 +4023,12 @@ f1
DROP TRIGGER tr1 ;
SET @a:=0 ;
CREATE TRIGGER tr1 BEFORE INSERT ON v1 FOR EACH ROW SET @a:=1 ;
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
RENAME TABLE v1 TO v2;
RENAME VIEW v2 TO v1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VIEW v2 TO v1' at line 1
ALTER TABLE v2 RENAME AS v1;
-ERROR HY000: 'test.v2' is not BASE TABLE
+ERROR HY000: 'test.v2' is not of type 'BASE TABLE'
ALTER VIEW v1 RENAME AS v2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'RENAME AS v2' at line 1
DROP TABLE IF EXISTS t1, t2 ;
@@ -4038,12 +4038,12 @@ CREATE TABLE t1 ( f1 DATE, f2 BLOB, f3 DOUBLE );
CREATE VIEW v1 AS SELECT f1, f2, f3 FROM t1;
ALTER TABLE t1 ADD PRIMARY KEY(f1);
ALTER TABLE v1 ADD PRIMARY KEY(f1);
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
ALTER VIEW v1 ADD PRIMARY KEY(f1);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ADD PRIMARY KEY(f1)' at line 1
CREATE INDEX t1_idx ON t1(f3);
CREATE INDEX v1_idx ON v1(f3);
-ERROR HY000: 'test.v1' is not BASE TABLE
+ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
DROP TABLE t1;
DROP VIEW v1;
@@ -4604,9 +4604,9 @@ Drop view test.v1 ;
Testcase 3.3.1.14
--------------------------------------------------------------------------------
CREATE OR REPLACE VIEW test.tb2 AS SELECT * From tb2 LIMIT 2;
-ERROR HY000: 'test.tb2' is not VIEW
+ERROR HY000: 'test.tb2' is not of type 'VIEW'
CREATE OR REPLACE VIEW tb2 AS SELECT * From tb2 LIMIT 2;
-ERROR HY000: 'test.tb2' is not VIEW
+ERROR HY000: 'test.tb2' is not of type 'VIEW'
Testcase 3.3.1.15
--------------------------------------------------------------------------------
@@ -4784,7 +4784,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
-Note 4067 Unknown VIEW: 'test.v2'
+Note 4068 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@@ -8387,7 +8387,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@@ -22989,7 +22989,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
-Note 4067 Unknown VIEW: 'test.v1'
+Note 4068 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------
diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf
index 34bf1fc58fe..f120775d433 100644
--- a/mysql-test/suite/galera/galera_2nodes.cnf
+++ b/mysql-test/suite/galera/galera_2nodes.cnf
@@ -16,7 +16,7 @@ wsrep-sync-wait=7
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep-cluster-address=gcomm://
-wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S'
+wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M'
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
diff --git a/mysql-test/suite/galera/r/MW-309.result b/mysql-test/suite/galera/r/MW-309.result
new file mode 100644
index 00000000000..3dd49a041ee
--- /dev/null
+++ b/mysql-test/suite/galera/r/MW-309.result
@@ -0,0 +1,22 @@
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+SET GLOBAL wsrep_max_ws_rows = 2;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SELECT * FROM t1 GROUP BY f1;
+f1
+1
+SHOW STATUS LIKE '%wsrep%';
+SET GLOBAL wsrep_max_ws_rows = 0;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MW-309.test b/mysql-test/suite/galera/t/MW-309.test
new file mode 100644
index 00000000000..351a508ecec
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-309.test
@@ -0,0 +1,32 @@
+#
+# MW-309 Regression: wsrep_max_ws_rows limit also applies to certain SELECT queries
+#
+
+--source include/galera_cluster.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+INSERT INTO t1 SELECT * FROM t1;
+
+SET GLOBAL wsrep_max_ws_rows = 2;
+
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+SELECT * FROM t1 GROUP BY f1;
+SELECT * FROM t1 GROUP BY f1;
+
+--error 0
+SELECT * FROM t1 GROUP BY f1;
+
+--disable_result_log
+--error 0
+SHOW STATUS LIKE '%wsrep%';
+--enable_result_log
+
+SET GLOBAL wsrep_max_ws_rows = 0;
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf b/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf
index 7d684cef67d..b4bf5f02171 100644
--- a/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf
+++ b/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.cnf
@@ -1,9 +1,8 @@
!include ../galera_2nodes.cnf
[mysqld]
-#wsrep_sst_method=xtrabackup-v2
-#wsrep_sst_auth="root:"
-#wsrep_debug=ON
+wsrep_sst_method=xtrabackup-v2
+wsrep_sst_auth="root:"
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test b/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test
index 251450f7099..30ce9bc4ceb 100644
--- a/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test
+++ b/mysql-test/suite/galera/t/galera_autoinc_sst_xtrabackup.test
@@ -1,6 +1,6 @@
#
# Test that autoincrement works correctly while the cluster membership
-# is changing and IST takes place.
+# is changing and SST takes place.
#
--source include/big_test.inc
diff --git a/mysql-test/suite/galera/t/galera_var_cluster_address.test b/mysql-test/suite/galera/t/galera_var_cluster_address.test
index 0f857eb1aac..03706bbbb12 100644
--- a/mysql-test/suite/galera/t/galera_var_cluster_address.test
+++ b/mysql-test/suite/galera/t/galera_var_cluster_address.test
@@ -76,4 +76,3 @@ CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://192.0.2.1\\) failed: 7
--source include/galera_end.inc
--echo # End of test
-
diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def
index ca55c41ff72..502e7bfba68 100644
--- a/mysql-test/suite/galera_3nodes/disabled.def
+++ b/mysql-test/suite/galera_3nodes/disabled.def
@@ -5,3 +5,4 @@ galera_slave_options_do :MDEV-8798
galera_slave_options_ignore : MDEV-8798
galera_pc_bootstrap : TODO: Investigate: Timeout in wait_condition.inc
galera_pc_weight : Test times out
+galera_safe_to_bootstrap : I Really dont know :(
diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
index 1ed273fdcb5..305bdaaae3a 100644
--- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
@@ -14,11 +14,10 @@ wsrep-causal-reads=ON
wsrep-sync-wait=7
[mysqld.1]
-#galera_port=@OPT.port
-#ist_port=@OPT.port
-#sst_port=@OPT.port
-wsrep-cluster-address=gcomm://
-wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S'
+wsrep-cluster-address='gcomm://'
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
+
+wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
diff --git a/mysql-test/suite/innodb/include/innodb-page-compression.inc b/mysql-test/suite/innodb/include/innodb-page-compression.inc
new file mode 100644
index 00000000000..0e7ae8cf029
--- /dev/null
+++ b/mysql-test/suite/innodb/include/innodb-page-compression.inc
@@ -0,0 +1,126 @@
+create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb;
+create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
+create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
+create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3;
+create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4;
+create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5;
+create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6;
+create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7;
+create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8;
+create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9;
+
+--disable_query_log
+begin;
+let $i = 2000;
+while ($i)
+{
+ insert into innodb_normal(b) values(REPEAT('Aa',50));
+ insert into innodb_normal(b) values(REPEAT('a',100));
+ insert into innodb_normal(b) values(REPEAT('b',100));
+ insert into innodb_normal(b) values(REPEAT('0',100));
+ insert into innodb_normal(b) values(REPEAT('1',100));
+ dec $i;
+}
+
+insert into innodb_page_compressed1 select * from innodb_normal;
+insert into innodb_page_compressed2 select * from innodb_normal;
+insert into innodb_page_compressed3 select * from innodb_normal;
+insert into innodb_page_compressed4 select * from innodb_normal;
+insert into innodb_page_compressed5 select * from innodb_normal;
+insert into innodb_page_compressed6 select * from innodb_normal;
+insert into innodb_page_compressed7 select * from innodb_normal;
+insert into innodb_page_compressed8 select * from innodb_normal;
+insert into innodb_page_compressed9 select * from innodb_normal;
+commit;
+--enable_query_log
+
+select count(*) from innodb_page_compressed1;
+select count(*) from innodb_page_compressed3;
+select count(*) from innodb_page_compressed4;
+select count(*) from innodb_page_compressed5;
+select count(*) from innodb_page_compressed6;
+select count(*) from innodb_page_compressed6;
+select count(*) from innodb_page_compressed7;
+select count(*) from innodb_page_compressed8;
+select count(*) from innodb_page_compressed9;
+
+#
+# Wait until pages are really compressed
+#
+let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
+--source include/wait_condition.inc
+
+--let $MYSQLD_DATADIR=`select @@datadir`
+
+# shutdown before grep
+
+--source include/shutdown_mysqld.inc
+
+--let t1_IBD = $MYSQLD_DATADIR/test/innodb_normal.ibd
+--let SEARCH_RANGE = 10000000
+--let SEARCH_PATTERN=AaAaAaAa
+--echo # innodb_normal expected FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed1.ibd
+--echo # innodb_page_compressed1 page compressed expected NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed2.ibd
+--echo # innodb_page_compressed2 page compressed expected NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed3.ibd
+--echo # innodb_page_compressed3 page compressed expected NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed4.ibd
+--echo # innodb_page_compressed4 page compressed expected NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed5.ibd
+--echo # innodb_page_compressed5 page compressed expected NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed6.ibd
+--echo # innodb_page_compressed6 page compressed expected NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed7.ibd
+--echo # innodb_page_compressed7 page compressed expected NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed8.ibd
+--echo # innodb_page_compressed8 page compressed expected NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+--let t1_IBD = $MYSQLD_DATADIR/test/innodb_page_compressed9.ibd
+--echo # innodb_page_compressed9 page compressed expected NOT FOUND
+-- let SEARCH_FILE=$t1_IBD
+-- source include/search_pattern_in_file.inc
+
+-- source include/start_mysqld.inc
+
+select count(*) from innodb_page_compressed1;
+select count(*) from innodb_page_compressed3;
+select count(*) from innodb_page_compressed4;
+select count(*) from innodb_page_compressed5;
+select count(*) from innodb_page_compressed6;
+select count(*) from innodb_page_compressed6;
+select count(*) from innodb_page_compressed7;
+select count(*) from innodb_page_compressed8;
+select count(*) from innodb_page_compressed9;
+
+let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_DECOMPRESSED';
+--source include/wait_condition.inc
+
+drop table innodb_normal;
+drop table innodb_page_compressed1;
+drop table innodb_page_compressed2;
+drop table innodb_page_compressed3;
+drop table innodb_page_compressed4;
+drop table innodb_page_compressed5;
+drop table innodb_page_compressed6;
+drop table innodb_page_compressed7;
+drop table innodb_page_compressed8;
+drop table innodb_page_compressed9;
diff --git a/mysql-test/suite/innodb/include/wait_all_purged.inc b/mysql-test/suite/innodb/include/wait_all_purged.inc
new file mode 100644
index 00000000000..7dbb59a5d32
--- /dev/null
+++ b/mysql-test/suite/innodb/include/wait_all_purged.inc
@@ -0,0 +1,19 @@
+# Wait for everything to be purged.
+# The user should have set innodb_purge_rseg_truncate_frequency=1.
+
+let $wait_counter= 300;
+while ($wait_counter)
+{
+ --replace_regex /.*History list length ([0-9]+).*/\1/
+ let $remaining= `SHOW ENGINE INNODB STATUS`;
+ if ($remaining == 'InnoDB 0')
+ {
+ let $wait_counter= 0;
+ }
+ if ($wait_counter)
+ {
+ real_sleep 0.1;
+ dec $wait_counter;
+ }
+}
+echo $remaining transactions not purged;
diff --git a/mysql-test/suite/innodb/r/doublewrite.result b/mysql-test/suite/innodb/r/doublewrite.result
index 6b913f49972..61c81ee9dff 100644
--- a/mysql-test/suite/innodb/r/doublewrite.result
+++ b/mysql-test/suite/innodb/r/doublewrite.result
@@ -231,6 +231,7 @@ set global innodb_buf_flush_list_now = 1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
+FOUND 1 /\[ERROR\] InnoDB: .*test.t1\.ibd.*/ in mysqld.1.err
select f1, f2 from t1;
f1 f2
1 ############
@@ -238,6 +239,13 @@ f1 f2
3 ////////////
4 ------------
5 ............
-# Test End
-# ---------------------------------------------------------------
drop table t1;
+#
+# MDEV-12600 crash during install_db with innodb_page_size=32K
+# and ibdata1=3M
+#
+SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
+FOUND 1 /\[ERROR\] InnoDB: Cannot create doublewrite buffer/ in mysqld.1.err
diff --git a/mysql-test/suite/innodb/r/drop_table_background.result b/mysql-test/suite/innodb/r/drop_table_background.result
new file mode 100644
index 00000000000..a6f5672ba7f
--- /dev/null
+++ b/mysql-test/suite/innodb/r/drop_table_background.result
@@ -0,0 +1,9 @@
+CREATE TABLE t(c0 SERIAL, c1 INT, c2 INT, c3 INT, c4 INT,
+KEY(c1), KEY(c2), KEY(c2,c1),
+KEY(c3), KEY(c3,c1), KEY(c3,c2), KEY(c3,c2,c1),
+KEY(c4), KEY(c4,c1), KEY(c4,c2), KEY(c4,c2,c1),
+KEY(c4,c3), KEY(c4,c3,c1), KEY(c4,c3,c2), KEY(c4,c3,c2,c1)) ENGINE=InnoDB;
+SET DEBUG_DBUG='+d,row_drop_table_add_to_background';
+DROP TABLE t;
+CREATE TABLE t (a INT) ENGINE=InnoDB;
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_default.result b/mysql-test/suite/innodb/r/innodb-page_compression_default.result
index 9c1d8924230..39a14072571 100644
--- a/mysql-test/suite/innodb/r/innodb-page_compression_default.result
+++ b/mysql-test/suite/innodb/r/innodb-page_compression_default.result
@@ -1,19 +1,96 @@
-SET GLOBAL innodb_file_per_table = ON;
-create table t1 (c1 int not null primary key auto_increment, b char(200)) engine=innodb page_compressed=1;
-insert into t1 values(NULL,'compressed_text_aaaaaaaaabbbbbbbbbbbbbccccccccccccc');
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-# t1 compressed expected NOT FOUND
-NOT FOUND /compressed_text/ in t1.ibd
-drop table t1;
+call mtr.add_suppression("InnoDB: Compression failed for space [0-9]+ name test/innodb_page_compressed[0-9] len [0-9]+ err 2 write_size [0-9]+.");
+create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb;
+create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
+create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
+create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3;
+create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4;
+create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5;
+create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6;
+create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7;
+create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8;
+create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9;
+select count(*) from innodb_page_compressed1;
+count(*)
+10000
+select count(*) from innodb_page_compressed3;
+count(*)
+10000
+select count(*) from innodb_page_compressed4;
+count(*)
+10000
+select count(*) from innodb_page_compressed5;
+count(*)
+10000
+select count(*) from innodb_page_compressed6;
+count(*)
+10000
+select count(*) from innodb_page_compressed6;
+count(*)
+10000
+select count(*) from innodb_page_compressed7;
+count(*)
+10000
+select count(*) from innodb_page_compressed8;
+count(*)
+10000
+select count(*) from innodb_page_compressed9;
+count(*)
+10000
+# innodb_normal expected FOUND
+FOUND 24084 /AaAaAaAa/ in innodb_normal.ibd
+# innodb_page_compressed1 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed1.ibd
+# innodb_page_compressed2 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed2.ibd
+# innodb_page_compressed3 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed3.ibd
+# innodb_page_compressed4 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed4.ibd
+# innodb_page_compressed5 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed5.ibd
+# innodb_page_compressed6 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed6.ibd
+# innodb_page_compressed7 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed7.ibd
+# innodb_page_compressed8 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed8.ibd
+# innodb_page_compressed9 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed9.ibd
+select count(*) from innodb_page_compressed1;
+count(*)
+10000
+select count(*) from innodb_page_compressed3;
+count(*)
+10000
+select count(*) from innodb_page_compressed4;
+count(*)
+10000
+select count(*) from innodb_page_compressed5;
+count(*)
+10000
+select count(*) from innodb_page_compressed6;
+count(*)
+10000
+select count(*) from innodb_page_compressed6;
+count(*)
+10000
+select count(*) from innodb_page_compressed7;
+count(*)
+10000
+select count(*) from innodb_page_compressed8;
+count(*)
+10000
+select count(*) from innodb_page_compressed9;
+count(*)
+10000
+drop table innodb_normal;
+drop table innodb_page_compressed1;
+drop table innodb_page_compressed2;
+drop table innodb_page_compressed3;
+drop table innodb_page_compressed4;
+drop table innodb_page_compressed5;
+drop table innodb_page_compressed6;
+drop table innodb_page_compressed7;
+drop table innodb_page_compressed8;
+drop table innodb_page_compressed9;
+#done
diff --git a/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result b/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result
index 442885755fd..e99e55ed9a8 100644
--- a/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result
+++ b/mysql-test/suite/innodb/r/innodb-page_compression_snappy.result
@@ -1,430 +1,90 @@
-call mtr.add_suppression("InnoDB: Compression failed for space.*");
-set global innodb_compression_algorithm = 6;
-create table innodb_compressed(c1 int, b char(200)) engine=innodb row_format=compressed key_block_size=8;
-show warnings;
-Level Code Message
-create table innodb_normal (c1 int, b char(200)) engine=innodb;
-show warnings;
-Level Code Message
-create table innodb_page_compressed1 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
-show warnings;
-Level Code Message
-show create table innodb_page_compressed1;
-Table Create Table
-innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1
-create table innodb_page_compressed2 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
-show warnings;
-Level Code Message
-show create table innodb_page_compressed2;
-Table Create Table
-innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2
-create table innodb_page_compressed3 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=3;
-show warnings;
-Level Code Message
-show create table innodb_page_compressed3;
-Table Create Table
-innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3
-create table innodb_page_compressed4 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=4;
-show warnings;
-Level Code Message
-show create table innodb_page_compressed4;
-Table Create Table
-innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4
-create table innodb_page_compressed5 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=5;
-show warnings;
-Level Code Message
-show create table innodb_page_compressed5;
-Table Create Table
-innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5
-create table innodb_page_compressed6 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=6;
-show warnings;
-Level Code Message
-show create table innodb_page_compressed6;
-Table Create Table
-innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6
-create table innodb_page_compressed7 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=7;
-show warnings;
-Level Code Message
-show create table innodb_page_compressed7;
-Table Create Table
-innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7
-create table innodb_page_compressed8 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=8;
-show warnings;
-Level Code Message
-show create table innodb_page_compressed8;
-Table Create Table
-innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
-create table innodb_page_compressed9 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=9;
-show warnings;
-Level Code Message
-show create table innodb_page_compressed9;
-Table Create Table
-innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9
-create procedure innodb_insert_proc (repeat_count int)
-begin
-declare current_num int;
-set current_num = 0;
-while current_num < repeat_count do
-insert into innodb_normal values(current_num,'aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccc');
-set current_num = current_num + 1;
-end while;
-end//
-commit;
-set autocommit=0;
-call innodb_insert_proc(5000);
-commit;
-set autocommit=1;
-select count(*) from innodb_normal;
-count(*)
-5000
-insert into innodb_compressed select * from innodb_normal;
-insert into innodb_page_compressed1 select * from innodb_normal;
-insert into innodb_page_compressed2 select * from innodb_normal;
-insert into innodb_page_compressed3 select * from innodb_normal;
-insert into innodb_page_compressed4 select * from innodb_normal;
-insert into innodb_page_compressed5 select * from innodb_normal;
-insert into innodb_page_compressed6 select * from innodb_normal;
-insert into innodb_page_compressed7 select * from innodb_normal;
-insert into innodb_page_compressed8 select * from innodb_normal;
-insert into innodb_page_compressed9 select * from innodb_normal;
-commit;
-select count(*) from innodb_compressed;
-count(*)
-5000
+call mtr.add_suppression("InnoDB: Compression failed for space [0-9]+ name test/innodb_page_compressed[0-9] len [0-9]+ err 2 write_size [0-9]+.");
+set global innodb_compression_algorithm = snappy;
+create table innodb_normal (c1 int not null auto_increment primary key, b char(200)) engine=innodb;
+create table innodb_page_compressed1 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
+create table innodb_page_compressed2 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
+create table innodb_page_compressed3 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=3;
+create table innodb_page_compressed4 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=4;
+create table innodb_page_compressed5 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=5;
+create table innodb_page_compressed6 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=6;
+create table innodb_page_compressed7 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=7;
+create table innodb_page_compressed8 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=8;
+create table innodb_page_compressed9 (c1 int not null auto_increment primary key, b char(200)) engine=innodb page_compressed=1 page_compression_level=9;
select count(*) from innodb_page_compressed1;
count(*)
-5000
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-count(*)
-5000
-alter table innodb_normal page_compressed=1 page_compression_level=8;
-show warnings;
-Level Code Message
-show create table innodb_normal;
-Table Create Table
-innodb_normal CREATE TABLE `innodb_normal` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
-alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0;
-show warnings;
-Level Code Message
-show create table innodb_compressed;
-Table Create Table
-innodb_compressed CREATE TABLE `innodb_compressed` (
- `c1` int(11) DEFAULT NULL,
- `b` char(200) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-select count(*) from innodb_compressed;
-count(*)
-5000
+10000
+select count(*) from innodb_page_compressed3;
+count(*)
+10000
+select count(*) from innodb_page_compressed4;
+count(*)
+10000
+select count(*) from innodb_page_compressed5;
+count(*)
+10000
+select count(*) from innodb_page_compressed6;
+count(*)
+10000
+select count(*) from innodb_page_compressed6;
+count(*)
+10000
+select count(*) from innodb_page_compressed7;
+count(*)
+10000
+select count(*) from innodb_page_compressed8;
+count(*)
+10000
+select count(*) from innodb_page_compressed9;
+count(*)
+10000
+# innodb_normal expected FOUND
+FOUND 24084 /AaAaAaAa/ in innodb_normal.ibd
+# innodb_page_compressed1 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed1.ibd
+# innodb_page_compressed2 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed2.ibd
+# innodb_page_compressed3 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed3.ibd
+# innodb_page_compressed4 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed4.ibd
+# innodb_page_compressed5 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed5.ibd
+# innodb_page_compressed6 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed6.ibd
+# innodb_page_compressed7 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed7.ibd
+# innodb_page_compressed8 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed8.ibd
+# innodb_page_compressed9 page compressed expected NOT FOUND
+NOT FOUND /AaAaAaAa/ in innodb_page_compressed9.ibd
select count(*) from innodb_page_compressed1;
count(*)
-5000
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-count(*)
-5000
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-select count(*) from innodb_compressed;
-count(*)
-5000
-select count(*) from innodb_page_compressed1;
-count(*)
-5000
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-count(*)
-5000
-set global innodb_compression_algorithm = 1;
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-commit;
-select count(*) from innodb_compressed;
-count(*)
-5000
-select count(*) from innodb_page_compressed1;
-count(*)
-5000
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-count(*)
-5000
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-select count(*) from innodb_compressed;
-count(*)
-5000
-select count(*) from innodb_page_compressed1;
-count(*)
-5000
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-count(*)
-5000
-set global innodb_compression_algorithm = 0;
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-commit;
-select count(*) from innodb_compressed;
-count(*)
-5000
-select count(*) from innodb_page_compressed1;
-count(*)
-5000
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-count(*)
-5000
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-select count(*) from innodb_compressed;
-count(*)
-5000
-select count(*) from innodb_page_compressed1;
-count(*)
-5000
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-count(*)
-5000
-select count(*) from innodb_page_compressed2 where c1 < 500000;
+10000
+select count(*) from innodb_page_compressed3;
count(*)
-5000
-select count(*) from innodb_page_compressed3 where c1 < 500000;
+10000
+select count(*) from innodb_page_compressed4;
count(*)
-5000
-select count(*) from innodb_page_compressed4 where c1 < 500000;
+10000
+select count(*) from innodb_page_compressed5;
count(*)
-5000
-select count(*) from innodb_page_compressed5 where c1 < 500000;
+10000
+select count(*) from innodb_page_compressed6;
count(*)
-5000
-select count(*) from innodb_page_compressed6 where c1 < 500000;
+10000
+select count(*) from innodb_page_compressed6;
count(*)
-5000
-select count(*) from innodb_page_compressed7 where c1 < 500000;
+10000
+select count(*) from innodb_page_compressed7;
count(*)
-5000
-select count(*) from innodb_page_compressed8 where c1 < 500000;
+10000
+select count(*) from innodb_page_compressed8;
count(*)
-5000
-select count(*) from innodb_page_compressed9 where c1 < 500000;
+10000
+select count(*) from innodb_page_compressed9;
count(*)
-5000
-drop procedure innodb_insert_proc;
+10000
drop table innodb_normal;
-drop table innodb_compressed;
drop table innodb_page_compressed1;
drop table innodb_page_compressed2;
drop table innodb_page_compressed3;
@@ -434,3 +94,4 @@ drop table innodb_page_compressed6;
drop table innodb_page_compressed7;
drop table innodb_page_compressed8;
drop table innodb_page_compressed9;
+#done
diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result
index ad8b3cac4ed..edac0d0ab69 100644
--- a/mysql-test/suite/innodb/r/innodb.result
+++ b/mysql-test/suite/innodb/r/innodb.result
@@ -1917,6 +1917,9 @@ 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 '{ ' for key 'v_2'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry 'v' for key 'v_2'
alter table t1 add key(v);
Warnings:
Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release
diff --git a/mysql-test/suite/innodb/r/innodb_stats_del_mark.result b/mysql-test/suite/innodb/r/innodb_stats_del_mark.result
deleted file mode 100644
index 67538bf8eb3..00000000000
--- a/mysql-test/suite/innodb/r/innodb_stats_del_mark.result
+++ /dev/null
@@ -1,91 +0,0 @@
-#
-# Bug 23333990 PERSISTENT INDEX STATISTICS UPDATE BEFORE
-# TRANSACTION IS COMMITTED
-#
-"Test 1:- Uncommited delete test"
-CREATE TABLE t1 (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
-val INT UNSIGNED NOT NULL,
-INDEX (val)) ENGINE=INNODB
-STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
-INSERT INTO t1 (val) VALUES (CEIL(RAND()*20));
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-262144
-ANALYZE TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 analyze status OK
-connect con1, localhost, root,,;
-START TRANSACTION;
-DELETE FROM t1;
-SELECT COUNT(*) FROM t1;
-connection default;
-Test correctly estimates the number of rows as > 20000
-even when in other uncommmited transaction
-all rows have been deleted.
-connection con1;
-COUNT(*)
-0
-commit;
-connection default;
-Test 2:- Insert and rollback test
-CREATE TABLE t2 (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
-val INT UNSIGNED NOT NULL,
-INDEX (val)) ENGINE=INNODB
-STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
-connection con1;
-START TRANSACTION;
-INSERT INTO t2 (val) VALUES (CEIL(RAND()*20));
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-SELECT COUNT(*) FROM t2;
-connection default;
-select count(*) from t2;
-count(*)
-0
-Test correctly estimates the number of rows as > 20000
-even when in other uncommited transaction
-many rows are inserted.
-connection con1;
-COUNT(*)
-262144
-Rollback the insert
-rollback;
-disconnect con1;
-connection default;
-Test correctly estimates the number of rows as 1
-after rollback.
-DROP TABLE t1,t2;
diff --git a/mysql-test/suite/innodb/r/innodb_stats_persistent.result b/mysql-test/suite/innodb/r/innodb_stats_persistent.result
new file mode 100644
index 00000000000..f4de4b6b82e
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_stats_persistent.result
@@ -0,0 +1,116 @@
+SET @saved_include_delete_marked = @@GLOBAL.innodb_stats_include_delete_marked;
+SET GLOBAL innodb_stats_include_delete_marked = ON;
+SET @saved_traditional = @@GLOBAL.innodb_stats_traditional;
+SET GLOBAL innodb_stats_traditional=false;
+SET @saved_modified_counter = @@GLOBAL.innodb_stats_modified_counter;
+SET GLOBAL innodb_stats_modified_counter=1;
+CREATE TABLE t0 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
+ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
+CREATE TABLE t1 LIKE t0;
+CREATE TABLE t2 LIKE t0;
+INSERT INTO t0 (val) VALUES (4);
+INSERT INTO t0 (val) SELECT 4 FROM t0;
+INSERT INTO t0 (val) SELECT 4 FROM t0;
+INSERT INTO t0 (val) SELECT 4 FROM t0;
+INSERT INTO t0 (val) SELECT 4 FROM t0;
+INSERT INTO t1 SELECT * FROM t0;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+16
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+connect con1, localhost, root,,;
+START TRANSACTION;
+DELETE FROM t1;
+SELECT COUNT(*) FROM t1;
+connection default;
+# With innodb_stats_include_delete_marked=ON,
+# DELETE must not affect statistics before COMMIT.
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref val val 4 const 16 Using index
+connection con1;
+COUNT(*)
+0
+ROLLBACK;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+16
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref val val 4 const 16 Using index
+BEGIN;
+DELETE FROM t1;
+COMMIT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+connection default;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t0;
+# The INSERT will show up before COMMIT.
+EXPLAIN SELECT * FROM t2 WHERE val=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref val val 4 const 16 Using index
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+16
+# The ROLLBACK of the INSERT must affect the statistics.
+ROLLBACK;
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+0
+connection con1;
+EXPLAIN SELECT * FROM t2 WHERE val=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref val val 4 const 1 Using index
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
+InnoDB 0 transactions not purged
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
+# After COMMIT and purge, the DELETE must show up.
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref val val 4 const 1 Using index
+SET GLOBAL innodb_stats_include_delete_marked = OFF;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t0;
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref val val 4 const 16 Using index
+ROLLBACK;
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref val val 4 const 1 Using index
+BEGIN;
+INSERT INTO t1 SELECT * FROM t0;
+COMMIT;
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref val val 4 const 16 Using index
+BEGIN;
+DELETE FROM t1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+# With innodb_stats_include_delete_marked=OFF,
+# DELETE must affect statistics even before COMMIT.
+# However, if there was a WHERE condition,
+# ha_innobase::records_in_range() would count the delete-marked records.
+EXPLAIN SELECT * FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL val 4 NULL 1 Using index
+ROLLBACK;
+EXPLAIN SELECT * FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL val 4 NULL 16 Using index
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+16
+disconnect con1;
+connection default;
+DROP TABLE t0,t1,t2;
+SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked;
+SET GLOBAL innodb_stats_traditional = @saved_traditional;
+SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter;
diff --git a/mysql-test/suite/innodb/r/row_format_redundant.result b/mysql-test/suite/innodb/r/row_format_redundant.result
new file mode 100644
index 00000000000..2bc8769092f
--- /dev/null
+++ b/mysql-test/suite/innodb/r/row_format_redundant.result
@@ -0,0 +1,79 @@
+SET GLOBAL innodb_file_per_table=1;
+#
+# Bug#21644827 - FTS, ASSERT !SRV_READ_ONLY_MODE || M_IMPL.M_LOG_MODE ==
+# MTR_LOG_NO_REDO
+#
+SET GLOBAL innodb_file_per_table=ON;
+create table t1 (a int not null, d varchar(15) not null, b
+varchar(198) not null, c char(156),
+fulltext ftsic(c)) engine=InnoDB
+row_format=redundant;
+insert into t1 values(123, 'abcdef', 'jghikl', 'mnop');
+insert into t1 values(456, 'abcdef', 'jghikl', 'mnop');
+insert into t1 values(789, 'abcdef', 'jghikl', 'mnop');
+insert into t1 values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf');
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+SET GLOBAL innodb_file_per_table=OFF;
+create table t2 (a int not null, d varchar(15) not null, b
+varchar(198) not null, c char(156), fulltext ftsic(c)) engine=InnoDB
+row_format=redundant;
+insert into t2 select * from t1;
+create table t3 (a int not null, d varchar(15) not null, b varchar(198),
+c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB
+row_format=redundant;
+insert into t3 values(444, 'dddd', 'bbbbb', 'aaaaa');
+insert into t3 values(555, 'eeee', 'ccccc', 'aaaaa');
+SET GLOBAL innodb_fast_shutdown=0;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+4096
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+4096
+SELECT COUNT(*) FROM t3;
+COUNT(*)
+2
+TRUNCATE TABLE t1;
+ERROR HY000: Table 't1' is read only
+TRUNCATE TABLE t2;
+ERROR HY000: Table 't2' is read only
+TRUNCATE TABLE t3;
+ERROR HY000: Table 't3' is read only
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+corrupted SYS_TABLES.MIX_LEN for test/t1
+corrupted SYS_TABLES.MIX_LEN for test/t2
+corrupted SYS_TABLES.MIX_LEN for test/t3
+TRUNCATE TABLE t1;
+ERROR 42S02: Table 'test.t1' doesn't exist in engine
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+SELECT COUNT(*) FROM t1;
+ERROR 42S02: Table 'test.t1' doesn't exist in engine
+SELECT COUNT(*) FROM t2;
+COUNT(*)
+0
+SELECT COUNT(*) FROM t3;
+COUNT(*)
+0
+RENAME TABLE t1 TO tee_one;
+ERROR HY000: Error on rename of './test/t1' to './test/tee_one' (errno: 155 "The table does not exist in engine")
+DROP TABLE t1;
+Warnings:
+Warning 1932 Table 'test.t1' doesn't exist in engine
+DROP TABLE t2,t3;
+FOUND 49 /\[ERROR\] InnoDB: Table `test`\.`t1` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=255\b/ in mysqld.1.err
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ibdata1
diff --git a/mysql-test/suite/innodb/r/table_flags,32k.rdiff b/mysql-test/suite/innodb/r/table_flags,32k.rdiff
new file mode 100644
index 00000000000..ea2d7048bb7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/table_flags,32k.rdiff
@@ -0,0 +1,105 @@
+--- suite/innodb/r/table_flags.result
++++ suite/innodb/r/table_flags,32k.reject
+@@ -5,6 +5,8 @@
+ SET innodb_strict_mode=OFF;
+ CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED
+ KEY_BLOCK_SIZE=1;
++Warnings:
++Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+ SET innodb_strict_mode=ON;
+ CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
+ PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
+@@ -13,7 +15,7 @@
+ header=0x01000003016e (NAME=0x696e66696d756d00)
+ header=0x00002815008d (NAME='SYS_DATAFILES',
+ DB_TRX_ID=0x000000000302,
+- DB_ROLL_PTR=0x81000001320194,
++ DB_ROLL_PTR=0x81000001310194,
+ ID=0x000000000000000e,
+ N_COLS=0x00000002,
+ TYPE=0x00000001,
+@@ -23,7 +25,7 @@
+ SPACE=0x00000000)
+ header=0x0000101500d5 (NAME='SYS_FOREIGN',
+ DB_TRX_ID=0x000000000300,
+- DB_ROLL_PTR=0x800000012d0110,
++ DB_ROLL_PTR=0x800000012c0110,
+ ID=0x000000000000000b,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+@@ -33,7 +35,7 @@
+ SPACE=0x00000000)
+ header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
+ DB_TRX_ID=0x000000000300,
+- DB_ROLL_PTR=0x800000012d0201,
++ DB_ROLL_PTR=0x800000012c0201,
+ ID=0x000000000000000c,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+@@ -43,7 +45,7 @@
+ SPACE=0x00000000)
+ header=0x0400201501b8 (NAME='SYS_TABLESPACES',
+ DB_TRX_ID=0x000000000302,
+- DB_ROLL_PTR=0x81000001320110,
++ DB_ROLL_PTR=0x81000001310110,
+ ID=0x000000000000000d,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+@@ -53,7 +55,7 @@
+ SPACE=0x00000000)
+ header=0x000030150244 (NAME='SYS_VIRTUAL',
+ DB_TRX_ID=0x000000000304,
+- DB_ROLL_PTR=0x82000001350110,
++ DB_ROLL_PTR=0x82000001340110,
+ ID=0x000000000000000f,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+@@ -63,7 +65,7 @@
+ SPACE=0x00000000)
+ header=0x000040150288 (NAME='test/tc',
+ DB_TRX_ID=0x000000000308,
+- DB_ROLL_PTR=0x84000001380110,
++ DB_ROLL_PTR=0x84000001370110,
+ ID=0x0000000000000011,
+ N_COLS=0x80000001,
+ TYPE=0x00000001,
+@@ -73,7 +75,7 @@
+ SPACE=0x00000002)
+ header=0x000048150310 (NAME='test/td',
+ DB_TRX_ID=0x00000000030a,
+- DB_ROLL_PTR=0x85000001390110,
++ DB_ROLL_PTR=0x85000001380110,
+ ID=0x0000000000000012,
+ N_COLS=0x80000001,
+ TYPE=0x00000021,
+@@ -83,7 +85,7 @@
+ SPACE=0x00000003)
+ header=0x000058150200 (NAME='test/tp',
+ DB_TRX_ID=0x00000000030e,
+- DB_ROLL_PTR=0x870000013b0110,
++ DB_ROLL_PTR=0x870000013a0110,
+ ID=0x0000000000000014,
+ N_COLS=0x80000001,
+ TYPE=0x000009a1,
+@@ -93,7 +95,7 @@
+ SPACE=0x00000005)
+ header=0x0000381502cc (NAME='test/tr',
+ DB_TRX_ID=0x000000000306,
+- DB_ROLL_PTR=0x83000001370110,
++ DB_ROLL_PTR=0x83000001360110,
+ ID=0x0000000000000010,
+ N_COLS=0x00000001,
+ TYPE=0x00000001,
+@@ -103,10 +105,10 @@
+ SPACE=0x00000001)
+ header=0x000050150074 (NAME='test/tz',
+ DB_TRX_ID=0x00000000030c,
+- DB_ROLL_PTR=0x860000013a0110,
++ DB_ROLL_PTR=0x86000001390110,
+ ID=0x0000000000000013,
+ N_COLS=0x80000001,
+- TYPE=0x00000023,
++ TYPE=0x00000021,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
diff --git a/mysql-test/suite/innodb/r/table_flags,4k.rdiff b/mysql-test/suite/innodb/r/table_flags,4k.rdiff
new file mode 100644
index 00000000000..0e469ee631b
--- /dev/null
+++ b/mysql-test/suite/innodb/r/table_flags,4k.rdiff
@@ -0,0 +1,92 @@
+--- suite/innodb/r/table_flags.result
++++ suite/innodb/r/table_flags,4k.reject
+@@ -13,7 +13,7 @@
+ header=0x01000003016e (NAME=0x696e66696d756d00)
+ header=0x00002815008d (NAME='SYS_DATAFILES',
+ DB_TRX_ID=0x000000000302,
+- DB_ROLL_PTR=0x81000001320194,
++ DB_ROLL_PTR=0x81000003260194,
+ ID=0x000000000000000e,
+ N_COLS=0x00000002,
+ TYPE=0x00000001,
+@@ -23,7 +23,7 @@
+ SPACE=0x00000000)
+ header=0x0000101500d5 (NAME='SYS_FOREIGN',
+ DB_TRX_ID=0x000000000300,
+- DB_ROLL_PTR=0x800000012d0110,
++ DB_ROLL_PTR=0x80000003200110,
+ ID=0x000000000000000b,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+@@ -33,7 +33,7 @@
+ SPACE=0x00000000)
+ header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
+ DB_TRX_ID=0x000000000300,
+- DB_ROLL_PTR=0x800000012d0201,
++ DB_ROLL_PTR=0x80000003200201,
+ ID=0x000000000000000c,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+@@ -43,7 +43,7 @@
+ SPACE=0x00000000)
+ header=0x0400201501b8 (NAME='SYS_TABLESPACES',
+ DB_TRX_ID=0x000000000302,
+- DB_ROLL_PTR=0x81000001320110,
++ DB_ROLL_PTR=0x81000003260110,
+ ID=0x000000000000000d,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+@@ -53,7 +53,7 @@
+ SPACE=0x00000000)
+ header=0x000030150244 (NAME='SYS_VIRTUAL',
+ DB_TRX_ID=0x000000000304,
+- DB_ROLL_PTR=0x82000001350110,
++ DB_ROLL_PTR=0x820000032a0110,
+ ID=0x000000000000000f,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+@@ -63,7 +63,7 @@
+ SPACE=0x00000000)
+ header=0x000040150288 (NAME='test/tc',
+ DB_TRX_ID=0x000000000308,
+- DB_ROLL_PTR=0x84000001380110,
++ DB_ROLL_PTR=0x840000032d0110,
+ ID=0x0000000000000011,
+ N_COLS=0x80000001,
+ TYPE=0x00000001,
+@@ -73,7 +73,7 @@
+ SPACE=0x00000002)
+ header=0x000048150310 (NAME='test/td',
+ DB_TRX_ID=0x00000000030a,
+- DB_ROLL_PTR=0x85000001390110,
++ DB_ROLL_PTR=0x850000032f0110,
+ ID=0x0000000000000012,
+ N_COLS=0x80000001,
+ TYPE=0x00000021,
+@@ -83,7 +83,7 @@
+ SPACE=0x00000003)
+ header=0x000058150200 (NAME='test/tp',
+ DB_TRX_ID=0x00000000030e,
+- DB_ROLL_PTR=0x870000013b0110,
++ DB_ROLL_PTR=0x87000003310110,
+ ID=0x0000000000000014,
+ N_COLS=0x80000001,
+ TYPE=0x000009a1,
+@@ -93,7 +93,7 @@
+ SPACE=0x00000005)
+ header=0x0000381502cc (NAME='test/tr',
+ DB_TRX_ID=0x000000000306,
+- DB_ROLL_PTR=0x83000001370110,
++ DB_ROLL_PTR=0x830000032c0110,
+ ID=0x0000000000000010,
+ N_COLS=0x00000001,
+ TYPE=0x00000001,
+@@ -103,7 +103,7 @@
+ SPACE=0x00000001)
+ header=0x000050150074 (NAME='test/tz',
+ DB_TRX_ID=0x00000000030c,
+- DB_ROLL_PTR=0x860000013a0110,
++ DB_ROLL_PTR=0x86000003300110,
+ ID=0x0000000000000013,
+ N_COLS=0x80000001,
+ TYPE=0x00000023,
diff --git a/mysql-test/suite/innodb/r/table_flags,64k.rdiff b/mysql-test/suite/innodb/r/table_flags,64k.rdiff
new file mode 100644
index 00000000000..ce2d7faa925
--- /dev/null
+++ b/mysql-test/suite/innodb/r/table_flags,64k.rdiff
@@ -0,0 +1,105 @@
+--- suite/innodb/r/table_flags.result
++++ suite/innodb/r/table_flags,64k.reject
+@@ -5,6 +5,8 @@
+ SET innodb_strict_mode=OFF;
+ CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED
+ KEY_BLOCK_SIZE=1;
++Warnings:
++Warning 1478 InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=DYNAMIC.
+ SET innodb_strict_mode=ON;
+ CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
+ PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
+@@ -13,7 +15,7 @@
+ header=0x01000003016e (NAME=0x696e66696d756d00)
+ header=0x00002815008d (NAME='SYS_DATAFILES',
+ DB_TRX_ID=0x000000000302,
+- DB_ROLL_PTR=0x81000001320194,
++ DB_ROLL_PTR=0x81000001310194,
+ ID=0x000000000000000e,
+ N_COLS=0x00000002,
+ TYPE=0x00000001,
+@@ -23,7 +25,7 @@
+ SPACE=0x00000000)
+ header=0x0000101500d5 (NAME='SYS_FOREIGN',
+ DB_TRX_ID=0x000000000300,
+- DB_ROLL_PTR=0x800000012d0110,
++ DB_ROLL_PTR=0x800000012c0110,
+ ID=0x000000000000000b,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+@@ -33,7 +35,7 @@
+ SPACE=0x00000000)
+ header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
+ DB_TRX_ID=0x000000000300,
+- DB_ROLL_PTR=0x800000012d0201,
++ DB_ROLL_PTR=0x800000012c0201,
+ ID=0x000000000000000c,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+@@ -43,7 +45,7 @@
+ SPACE=0x00000000)
+ header=0x0400201501b8 (NAME='SYS_TABLESPACES',
+ DB_TRX_ID=0x000000000302,
+- DB_ROLL_PTR=0x81000001320110,
++ DB_ROLL_PTR=0x81000001310110,
+ ID=0x000000000000000d,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+@@ -53,7 +55,7 @@
+ SPACE=0x00000000)
+ header=0x000030150244 (NAME='SYS_VIRTUAL',
+ DB_TRX_ID=0x000000000304,
+- DB_ROLL_PTR=0x82000001350110,
++ DB_ROLL_PTR=0x82000001340110,
+ ID=0x000000000000000f,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+@@ -63,7 +65,7 @@
+ SPACE=0x00000000)
+ header=0x000040150288 (NAME='test/tc',
+ DB_TRX_ID=0x000000000308,
+- DB_ROLL_PTR=0x84000001380110,
++ DB_ROLL_PTR=0x84000001370110,
+ ID=0x0000000000000011,
+ N_COLS=0x80000001,
+ TYPE=0x00000001,
+@@ -73,7 +75,7 @@
+ SPACE=0x00000002)
+ header=0x000048150310 (NAME='test/td',
+ DB_TRX_ID=0x00000000030a,
+- DB_ROLL_PTR=0x85000001390110,
++ DB_ROLL_PTR=0x85000001380110,
+ ID=0x0000000000000012,
+ N_COLS=0x80000001,
+ TYPE=0x00000021,
+@@ -83,7 +85,7 @@
+ SPACE=0x00000003)
+ header=0x000058150200 (NAME='test/tp',
+ DB_TRX_ID=0x00000000030e,
+- DB_ROLL_PTR=0x870000013b0110,
++ DB_ROLL_PTR=0x870000013a0110,
+ ID=0x0000000000000014,
+ N_COLS=0x80000001,
+ TYPE=0x000009a1,
+@@ -93,7 +95,7 @@
+ SPACE=0x00000005)
+ header=0x0000381502cc (NAME='test/tr',
+ DB_TRX_ID=0x000000000306,
+- DB_ROLL_PTR=0x83000001370110,
++ DB_ROLL_PTR=0x83000001360110,
+ ID=0x0000000000000010,
+ N_COLS=0x00000001,
+ TYPE=0x00000001,
+@@ -103,10 +105,10 @@
+ SPACE=0x00000001)
+ header=0x000050150074 (NAME='test/tz',
+ DB_TRX_ID=0x00000000030c,
+- DB_ROLL_PTR=0x860000013a0110,
++ DB_ROLL_PTR=0x86000001390110,
+ ID=0x0000000000000013,
+ N_COLS=0x80000001,
+- TYPE=0x00000023,
++ TYPE=0x00000021,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
diff --git a/mysql-test/suite/innodb/r/table_flags,8k.rdiff b/mysql-test/suite/innodb/r/table_flags,8k.rdiff
new file mode 100644
index 00000000000..d5b5731b305
--- /dev/null
+++ b/mysql-test/suite/innodb/r/table_flags,8k.rdiff
@@ -0,0 +1,92 @@
+--- suite/innodb/r/table_flags.result
++++ suite/innodb/r/table_flags,8k.reject
+@@ -13,7 +13,7 @@
+ header=0x01000003016e (NAME=0x696e66696d756d00)
+ header=0x00002815008d (NAME='SYS_DATAFILES',
+ DB_TRX_ID=0x000000000302,
+- DB_ROLL_PTR=0x81000001320194,
++ DB_ROLL_PTR=0x81000001d70194,
+ ID=0x000000000000000e,
+ N_COLS=0x00000002,
+ TYPE=0x00000001,
+@@ -23,7 +23,7 @@
+ SPACE=0x00000000)
+ header=0x0000101500d5 (NAME='SYS_FOREIGN',
+ DB_TRX_ID=0x000000000300,
+- DB_ROLL_PTR=0x800000012d0110,
++ DB_ROLL_PTR=0x80000001d10110,
+ ID=0x000000000000000b,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+@@ -33,7 +33,7 @@
+ SPACE=0x00000000)
+ header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
+ DB_TRX_ID=0x000000000300,
+- DB_ROLL_PTR=0x800000012d0201,
++ DB_ROLL_PTR=0x80000001d10201,
+ ID=0x000000000000000c,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+@@ -43,7 +43,7 @@
+ SPACE=0x00000000)
+ header=0x0400201501b8 (NAME='SYS_TABLESPACES',
+ DB_TRX_ID=0x000000000302,
+- DB_ROLL_PTR=0x81000001320110,
++ DB_ROLL_PTR=0x81000001d70110,
+ ID=0x000000000000000d,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+@@ -53,7 +53,7 @@
+ SPACE=0x00000000)
+ header=0x000030150244 (NAME='SYS_VIRTUAL',
+ DB_TRX_ID=0x000000000304,
+- DB_ROLL_PTR=0x82000001350110,
++ DB_ROLL_PTR=0x82000001da0110,
+ ID=0x000000000000000f,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+@@ -63,7 +63,7 @@
+ SPACE=0x00000000)
+ header=0x000040150288 (NAME='test/tc',
+ DB_TRX_ID=0x000000000308,
+- DB_ROLL_PTR=0x84000001380110,
++ DB_ROLL_PTR=0x84000001dd0110,
+ ID=0x0000000000000011,
+ N_COLS=0x80000001,
+ TYPE=0x00000001,
+@@ -73,7 +73,7 @@
+ SPACE=0x00000002)
+ header=0x000048150310 (NAME='test/td',
+ DB_TRX_ID=0x00000000030a,
+- DB_ROLL_PTR=0x85000001390110,
++ DB_ROLL_PTR=0x85000001de0110,
+ ID=0x0000000000000012,
+ N_COLS=0x80000001,
+ TYPE=0x00000021,
+@@ -83,7 +83,7 @@
+ SPACE=0x00000003)
+ header=0x000058150200 (NAME='test/tp',
+ DB_TRX_ID=0x00000000030e,
+- DB_ROLL_PTR=0x870000013b0110,
++ DB_ROLL_PTR=0x87000001e00110,
+ ID=0x0000000000000014,
+ N_COLS=0x80000001,
+ TYPE=0x000009a1,
+@@ -93,7 +93,7 @@
+ SPACE=0x00000005)
+ header=0x0000381502cc (NAME='test/tr',
+ DB_TRX_ID=0x000000000306,
+- DB_ROLL_PTR=0x83000001370110,
++ DB_ROLL_PTR=0x83000001dc0110,
+ ID=0x0000000000000010,
+ N_COLS=0x00000001,
+ TYPE=0x00000001,
+@@ -103,7 +103,7 @@
+ SPACE=0x00000001)
+ header=0x000050150074 (NAME='test/tz',
+ DB_TRX_ID=0x00000000030c,
+- DB_ROLL_PTR=0x860000013a0110,
++ DB_ROLL_PTR=0x86000001df0110,
+ ID=0x0000000000000013,
+ N_COLS=0x80000001,
+ TYPE=0x00000023,
diff --git a/mysql-test/suite/innodb/r/table_flags.result b/mysql-test/suite/innodb/r/table_flags.result
new file mode 100644
index 00000000000..ac7187cd610
--- /dev/null
+++ b/mysql-test/suite/innodb/r/table_flags.result
@@ -0,0 +1,188 @@
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE tr(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+CREATE TABLE tc(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPACT;
+CREATE TABLE td(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+SET innodb_strict_mode=OFF;
+CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED
+KEY_BLOCK_SIZE=1;
+SET innodb_strict_mode=ON;
+CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
+PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
+SYS_TABLES clustered index root page (8):
+N_RECS=10; LEVEL=0; INDEX_ID=0x0000000000000001
+header=0x01000003016e (NAME=0x696e66696d756d00)
+header=0x00002815008d (NAME='SYS_DATAFILES',
+ DB_TRX_ID=0x000000000302,
+ DB_ROLL_PTR=0x81000001320194,
+ ID=0x000000000000000e,
+ N_COLS=0x00000002,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+header=0x0000101500d5 (NAME='SYS_FOREIGN',
+ DB_TRX_ID=0x000000000300,
+ DB_ROLL_PTR=0x800000012d0110,
+ ID=0x000000000000000b,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+header=0x000018150122 (NAME='SYS_FOREIGN_COLS',
+ DB_TRX_ID=0x000000000300,
+ DB_ROLL_PTR=0x800000012d0201,
+ ID=0x000000000000000c,
+ N_COLS=0x00000004,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+header=0x0400201501b8 (NAME='SYS_TABLESPACES',
+ DB_TRX_ID=0x000000000302,
+ DB_ROLL_PTR=0x81000001320110,
+ ID=0x000000000000000d,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+header=0x000030150244 (NAME='SYS_VIRTUAL',
+ DB_TRX_ID=0x000000000304,
+ DB_ROLL_PTR=0x82000001350110,
+ ID=0x000000000000000f,
+ N_COLS=0x00000003,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000040,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000000)
+header=0x000040150288 (NAME='test/tc',
+ DB_TRX_ID=0x000000000308,
+ DB_ROLL_PTR=0x84000001380110,
+ ID=0x0000000000000011,
+ N_COLS=0x80000001,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000002)
+header=0x000048150310 (NAME='test/td',
+ DB_TRX_ID=0x00000000030a,
+ DB_ROLL_PTR=0x85000001390110,
+ ID=0x0000000000000012,
+ N_COLS=0x80000001,
+ TYPE=0x00000021,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000003)
+header=0x000058150200 (NAME='test/tp',
+ DB_TRX_ID=0x00000000030e,
+ DB_ROLL_PTR=0x870000013b0110,
+ ID=0x0000000000000014,
+ N_COLS=0x80000001,
+ TYPE=0x000009a1,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000005)
+header=0x0000381502cc (NAME='test/tr',
+ DB_TRX_ID=0x000000000306,
+ DB_ROLL_PTR=0x83000001370110,
+ ID=0x0000000000000010,
+ N_COLS=0x00000001,
+ TYPE=0x00000001,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000001)
+header=0x000050150074 (NAME='test/tz',
+ DB_TRX_ID=0x00000000030c,
+ DB_ROLL_PTR=0x860000013a0110,
+ ID=0x0000000000000013,
+ N_COLS=0x80000001,
+ TYPE=0x00000023,
+ MIX_ID=0x0000000000000000,
+ MIX_LEN=0x00000050,
+ CLUSTER_NAME=NULL(0 bytes),
+ SPACE=0x00000004)
+header=0x070008030000 (NAME=0x73757072656d756d00)
+SHOW CREATE TABLE tr;
+ERROR 42S02: Table 'test.tr' doesn't exist in engine
+SHOW CREATE TABLE tc;
+ERROR 42S02: Table 'test.tc' doesn't exist in engine
+SHOW CREATE TABLE td;
+ERROR 42S02: Table 'test.td' doesn't exist in engine
+SHOW CREATE TABLE tz;
+Table Create Table
+tz CREATE TABLE `tz` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1
+BEGIN;
+INSERT INTO tz VALUES(42);
+ROLLBACK;
+SELECT * FROM tz;
+a
+42
+SHOW CREATE TABLE tp;
+ERROR 42S02: Table 'test.tp' doesn't exist in engine
+FOUND 4 /InnoDB: Table `test`.`t[cp]` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=(129|289|3873|1232[13]) SYS_TABLES\.N_COLS=2147483649/ in mysqld.1.err
+FOUND 2 /InnoDB: Refusing to load '\..test.td\.ibd' \(id=3, flags=0x1?[2ae]1\); dictionary contains id=3, flags=0x10[01][2ae]1\b/ in mysqld.1.err
+FOUND 2 /InnoDB: Table `test`\.`tr` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=65 SYS_TABLES\.MIX_LEN=4294967295\b/ in mysqld.1.err
+Restoring SYS_TABLES clustered index root page (8)
+SHOW CREATE TABLE tr;
+Table Create Table
+tr CREATE TABLE `tr` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
+SHOW CREATE TABLE tc;
+Table Create Table
+tc CREATE TABLE `tc` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
+SHOW CREATE TABLE td;
+Table Create Table
+td CREATE TABLE `td` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+SHOW CREATE TABLE tz;
+Table Create Table
+tz CREATE TABLE `tz` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1
+SHOW CREATE TABLE tp;
+Table Create Table
+tp CREATE TABLE `tp` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=9
+BEGIN;
+INSERT INTO tr VALUES(1);
+INSERT INTO tc VALUES(1);
+INSERT INTO td VALUES(1);
+INSERT INTO tp VALUES(1);
+ROLLBACK;
+SELECT * FROM tr;
+a
+SELECT * FROM tc;
+a
+SELECT * FROM td;
+a
+SELECT * FROM tp;
+a
+DROP TABLE tr,tc,td,tz,tp;
+ib_buffer_pool
+ib_logfile0
+ib_logfile1
+ibdata1
+sys_tables.bin
diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result
index da5ff361eeb..074dd413947 100644
--- a/mysql-test/suite/innodb/r/temporary_table.result
+++ b/mysql-test/suite/innodb/r/temporary_table.result
@@ -149,10 +149,6 @@ FOUND 2 /support raw device/ in mysqld.1.err
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
-FOUND 1 /The innodb_temporary data file 'ibtmp1' must be at least/ in mysqld.1.err
-SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'
-AND support IN ('YES', 'DEFAULT', 'ENABLED');
-ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: syntax error in file path/ in mysqld.1.err
SELECT * FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
diff --git a/mysql-test/suite/innodb/t/101_compatibility.test b/mysql-test/suite/innodb/t/101_compatibility.test
index 83ab7914a69..78dee53e52f 100644
--- a/mysql-test/suite/innodb/t/101_compatibility.test
+++ b/mysql-test/suite/innodb/t/101_compatibility.test
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+--source include/innodb_page_size.inc
--source include/not_embedded.inc
-- echo #
diff --git a/mysql-test/suite/innodb/t/alter_missing_tablespace.test b/mysql-test/suite/innodb/t/alter_missing_tablespace.test
index 643b7a4833d..d877b8f3b5d 100644
--- a/mysql-test/suite/innodb/t/alter_missing_tablespace.test
+++ b/mysql-test/suite/innodb/t/alter_missing_tablespace.test
@@ -1,5 +1,5 @@
--source include/not_embedded.inc
---source include/have_innodb.inc
+--source include/innodb_page_size.inc
--echo #
--echo # Bug#13955083 ALLOW IN-PLACE DDL OPERATIONS ON MISSING
diff --git a/mysql-test/suite/innodb/t/doublewrite.test b/mysql-test/suite/innodb/t/doublewrite.test
index a153ad66b19..bdeaba2dcec 100644
--- a/mysql-test/suite/innodb/t/doublewrite.test
+++ b/mysql-test/suite/innodb/t/doublewrite.test
@@ -4,22 +4,27 @@
--echo # PAGE OF SYSTEM TABLESPACE
--echo #
---source include/have_innodb.inc
+--source include/innodb_page_size.inc
--source include/have_debug.inc
--source include/not_embedded.inc
# Slow shutdown and restart to make sure ibuf merge is finished
SET GLOBAL innodb_fast_shutdown = 0;
--disable_query_log
-call mtr.add_suppression("Header page consists of zero bytes");
-call mtr.add_suppression("Checksum mismatch in datafile");
-call mtr.add_suppression("but the innodb_page_size start-up parameter is");
-call mtr.add_suppression("adjusting FSP_SPACE_FLAGS");
+call mtr.add_suppression("InnoDB: Header page consists of zero bytes");
+call mtr.add_suppression("InnoDB: Checksum mismatch in datafile: .*, Space ID:0, Flags: 0");
+call mtr.add_suppression("InnoDB: Data file .* uses page size .* but the innodb_page_size start-up parameter is");
+call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS");
+call mtr.add_suppression("InnoDB: New log files created");
+call mtr.add_suppression("InnoDB: Cannot create doublewrite buffer: the first file in innodb_data_file_path must be at least (3|6|12)M\\.");
+call mtr.add_suppression("InnoDB: Database creation was aborted");
+call mtr.add_suppression("Plugin 'InnoDB' (init function returned error|registration as a STORAGE ENGINE failed)");
--enable_query_log
--source include/restart_mysqld.inc
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
let MYSQLD_DATADIR=`select @@datadir`;
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
show variables like 'innodb_doublewrite';
show variables like 'innodb_fil_make_page_dirty_debug';
@@ -392,9 +397,38 @@ EOF
--source include/start_mysqld.inc
check table t1;
-select f1, f2 from t1;
+--let SEARCH_PATTERN= \[ERROR\] InnoDB: .*test.t1\\.ibd.*
+--source include/search_pattern_in_file.inc
---echo # Test End
---echo # ---------------------------------------------------------------
+select f1, f2 from t1;
drop table t1;
+
+--echo #
+--echo # MDEV-12600 crash during install_db with innodb_page_size=32K
+--echo # and ibdata1=3M
+--echo #
+let bugdir= $MYSQLTEST_VARDIR/tmp/doublewrite;
+--mkdir $bugdir
+
+let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES
+WHERE engine = 'innodb'
+AND support IN ('YES', 'DEFAULT', 'ENABLED');
+
+--let $ibp=--innodb-log-group-home-dir=$bugdir --innodb-data-home-dir=$bugdir
+--let $ibd=$ibp --innodb-undo-tablespaces=0 --innodb-log-files-in-group=2
+--let $ibp=$ibp --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
+
+--let $restart_parameters= $ibp
+--source include/restart_mysqld.inc
+eval $check_no_innodb;
+--let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot create doublewrite buffer
+--source include/search_pattern_in_file.inc
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+--remove_file $bugdir/ibdata1
+--remove_file $bugdir/ibdata2
+--remove_file $bugdir/ib_logfile0
+--remove_file $bugdir/ib_logfile1
+--rmdir $bugdir
diff --git a/mysql-test/suite/innodb/t/drop_table_background.test b/mysql-test/suite/innodb/t/drop_table_background.test
new file mode 100644
index 00000000000..0f596dec574
--- /dev/null
+++ b/mysql-test/suite/innodb/t/drop_table_background.test
@@ -0,0 +1,30 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+# Embedded server does not support restarting
+--source include/not_embedded.inc
+
+CREATE TABLE t(c0 SERIAL, c1 INT, c2 INT, c3 INT, c4 INT,
+KEY(c1), KEY(c2), KEY(c2,c1),
+KEY(c3), KEY(c3,c1), KEY(c3,c2), KEY(c3,c2,c1),
+KEY(c4), KEY(c4,c1), KEY(c4,c2), KEY(c4,c2,c1),
+KEY(c4,c3), KEY(c4,c3,c1), KEY(c4,c3,c2), KEY(c4,c3,c2,c1)) ENGINE=InnoDB;
+
+let $n= 10;
+
+SET DEBUG_DBUG='+d,row_drop_table_add_to_background';
+--disable_query_log
+let $i= $n;
+while ($i) {
+ eval CREATE TABLE t$i LIKE t;
+ dec $i;
+}
+let $i= $n;
+while ($i) {
+ eval DROP TABLE t$i;
+ dec $i;
+}
+--enable_query_log
+DROP TABLE t;
+--source include/restart_mysqld.inc
+CREATE TABLE t (a INT) ENGINE=InnoDB;
+DROP TABLE t;
diff --git a/mysql-test/suite/innodb/t/innodb-alter-debug.test b/mysql-test/suite/innodb/t/innodb-alter-debug.test
index 70017ffba35..f4996916e9f 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-debug.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-debug.test
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+--source include/innodb_page_size.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
diff --git a/mysql-test/suite/innodb/t/innodb-alter-nullable.test b/mysql-test/suite/innodb/t/innodb-alter-nullable.test
index 3f1e82b3183..bb5cdee000a 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-nullable.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-nullable.test
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+--source include/innodb_page_size.inc
# Save the initial number of concurrent sessions.
--source include/count_sessions.inc
diff --git a/mysql-test/suite/innodb/t/innodb-alter-table.test b/mysql-test/suite/innodb/t/innodb-alter-table.test
index 45342b4a218..97f0075f344 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-table.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-table.test
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+--source include/innodb_page_size.inc
#
# MMDEV-8386: MariaDB creates very big tmp file and hangs on xtradb
diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
index ec1ea35f1cf..d3f34b12ea6 100644
--- a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
+++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test
@@ -10,8 +10,7 @@
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
-# InnoDB is required
---source include/have_innodb.inc
+--source include/innodb_page_size.inc
--echo #
--echo # Bug #18734396 INNODB IN-PLACE ALTER FAILURES BLOCK FUTURE ALTERS
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_default.test b/mysql-test/suite/innodb/t/innodb-page_compression_default.test
index c5d6b36a97e..1cc6c917548 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_default.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_default.test
@@ -1,42 +1,10 @@
--source include/have_innodb.inc
+--source include/not_embedded.inc
-let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
-let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
+call mtr.add_suppression("InnoDB: Compression failed for space [0-9]+ name test/innodb_page_compressed[0-9] len [0-9]+ err 2 write_size [0-9]+.");
-SET GLOBAL innodb_file_per_table = ON;
+# All page compression test use the same
+--source include/innodb-page-compression.inc
-create table t1 (c1 int not null primary key auto_increment, b char(200)) engine=innodb page_compressed=1;
-insert into t1 values(NULL,'compressed_text_aaaaaaaaabbbbbbbbbbbbbccccccccccccc');
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
-insert into t1(b) select b from t1;
+-- echo #done
-let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
---source include/wait_condition.inc
-
---let $MYSQLD_DATADIR=`select @@datadir`
---let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd
---let SEARCH_RANGE = 10000000
---let SEARCH_PATTERN=compressed_text
-
---echo # t1 compressed expected NOT FOUND
--- let SEARCH_FILE=$t1_IBD
--- source include/search_pattern_in_file.inc
-
-drop table t1;
-
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
-EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
---enable_query_log
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test b/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test
index b90d15f1fa3..532ec294d28 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_snappy.test
@@ -1,244 +1,13 @@
-- source include/have_innodb.inc
-- source include/have_innodb_snappy.inc
+--source include/not_embedded.inc
-call mtr.add_suppression("InnoDB: Compression failed for space.*");
-
-let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`;
+call mtr.add_suppression("InnoDB: Compression failed for space [0-9]+ name test/innodb_page_compressed[0-9] len [0-9]+ err 2 write_size [0-9]+.");
# snappy
-set global innodb_compression_algorithm = 6;
-
-create table innodb_compressed(c1 int, b char(200)) engine=innodb row_format=compressed key_block_size=8;
-show warnings;
-create table innodb_normal (c1 int, b char(200)) engine=innodb;
-show warnings;
-create table innodb_page_compressed1 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=1;
-show warnings;
-show create table innodb_page_compressed1;
-create table innodb_page_compressed2 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=2;
-show warnings;
-show create table innodb_page_compressed2;
-create table innodb_page_compressed3 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=3;
-show warnings;
-show create table innodb_page_compressed3;
-create table innodb_page_compressed4 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=4;
-show warnings;
-show create table innodb_page_compressed4;
-create table innodb_page_compressed5 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=5;
-show warnings;
-show create table innodb_page_compressed5;
-create table innodb_page_compressed6 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=6;
-show warnings;
-show create table innodb_page_compressed6;
-create table innodb_page_compressed7 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=7;
-show warnings;
-show create table innodb_page_compressed7;
-create table innodb_page_compressed8 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=8;
-show warnings;
-show create table innodb_page_compressed8;
-create table innodb_page_compressed9 (c1 int, b char(200)) engine=innodb page_compressed=1 page_compression_level=9;
-show warnings;
-show create table innodb_page_compressed9;
-delimiter //;
-create procedure innodb_insert_proc (repeat_count int)
-begin
- declare current_num int;
- set current_num = 0;
- while current_num < repeat_count do
- insert into innodb_normal values(current_num,'aaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbccccccccccccccccccccccc');
- set current_num = current_num + 1;
- end while;
-end//
-delimiter ;//
-commit;
-
-set autocommit=0;
-call innodb_insert_proc(5000);
-commit;
-set autocommit=1;
-select count(*) from innodb_normal;
-insert into innodb_compressed select * from innodb_normal;
-insert into innodb_page_compressed1 select * from innodb_normal;
-insert into innodb_page_compressed2 select * from innodb_normal;
-insert into innodb_page_compressed3 select * from innodb_normal;
-insert into innodb_page_compressed4 select * from innodb_normal;
-insert into innodb_page_compressed5 select * from innodb_normal;
-insert into innodb_page_compressed6 select * from innodb_normal;
-insert into innodb_page_compressed7 select * from innodb_normal;
-insert into innodb_page_compressed8 select * from innodb_normal;
-insert into innodb_page_compressed9 select * from innodb_normal;
-commit;
-select count(*) from innodb_compressed;
-select count(*) from innodb_page_compressed1;
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-
-alter table innodb_normal page_compressed=1 page_compression_level=8;
-show warnings;
-show create table innodb_normal;
-alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0;
-show warnings;
-show create table innodb_compressed;
-
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-select count(*) from innodb_compressed;
-select count(*) from innodb_page_compressed1;
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-
---source include/restart_mysqld.inc
-
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-select count(*) from innodb_compressed;
-select count(*) from innodb_page_compressed1;
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-
-# zlib
-set global innodb_compression_algorithm = 1;
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-commit;
-select count(*) from innodb_compressed;
-select count(*) from innodb_page_compressed1;
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-
---source include/restart_mysqld.inc
-
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-select count(*) from innodb_compressed;
-select count(*) from innodb_page_compressed1;
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-
-# none
-set global innodb_compression_algorithm = 0;
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-commit;
-select count(*) from innodb_compressed;
-select count(*) from innodb_page_compressed1;
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-select count(*) from innodb_page_compressed9 where c1 < 500000;
-
---source include/restart_mysqld.inc
-
-update innodb_page_compressed1 set c1 = c1 + 1;
-update innodb_page_compressed2 set c1 = c1 + 1;
-update innodb_page_compressed3 set c1 = c1 + 1;
-update innodb_page_compressed4 set c1 = c1 + 1;
-update innodb_page_compressed5 set c1 = c1 + 1;
-update innodb_page_compressed6 set c1 = c1 + 1;
-update innodb_page_compressed7 set c1 = c1 + 1;
-update innodb_page_compressed8 set c1 = c1 + 1;
-update innodb_page_compressed9 set c1 = c1 + 1;
-select count(*) from innodb_compressed;
-select count(*) from innodb_page_compressed1;
-select count(*) from innodb_page_compressed1 where c1 < 500000;
-select count(*) from innodb_page_compressed2 where c1 < 500000;
-select count(*) from innodb_page_compressed3 where c1 < 500000;
-select count(*) from innodb_page_compressed4 where c1 < 500000;
-select count(*) from innodb_page_compressed5 where c1 < 500000;
-select count(*) from innodb_page_compressed6 where c1 < 500000;
-select count(*) from innodb_page_compressed7 where c1 < 500000;
-select count(*) from innodb_page_compressed8 where c1 < 500000;
-select count(*) from innodb_page_compressed9 where c1 < 500000;
+set global innodb_compression_algorithm = snappy;
-drop procedure innodb_insert_proc;
-drop table innodb_normal;
-drop table innodb_compressed;
-drop table innodb_page_compressed1;
-drop table innodb_page_compressed2;
-drop table innodb_page_compressed3;
-drop table innodb_page_compressed4;
-drop table innodb_page_compressed5;
-drop table innodb_page_compressed6;
-drop table innodb_page_compressed7;
-drop table innodb_page_compressed8;
-drop table innodb_page_compressed9;
+# All page compression test use the same
+--source include/innodb-page-compression.inc
-# reset system
---disable_query_log
-EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
---enable_query_log
+-- echo #done
diff --git a/mysql-test/suite/innodb/t/innodb_stats_del_mark-master.opt b/mysql-test/suite/innodb/t/innodb_stats_del_mark-master.opt
deleted file mode 100644
index 145ee2b4264..00000000000
--- a/mysql-test/suite/innodb/t/innodb_stats_del_mark-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb_stats_include_delete_marked=on
diff --git a/mysql-test/suite/innodb/t/innodb_stats_del_mark.test b/mysql-test/suite/innodb/t/innodb_stats_del_mark.test
deleted file mode 100644
index 36f7a2ea099..00000000000
--- a/mysql-test/suite/innodb/t/innodb_stats_del_mark.test
+++ /dev/null
@@ -1,113 +0,0 @@
---source include/have_innodb.inc
---source include/big_test.inc
-
---echo #
---echo # Bug 23333990 PERSISTENT INDEX STATISTICS UPDATE BEFORE
---echo # TRANSACTION IS COMMITTED
---echo #
-
---echo "Test 1:- Uncommited delete test"
-CREATE TABLE t1 (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
- val INT UNSIGNED NOT NULL,
- INDEX (val)) ENGINE=INNODB
- STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
-
-
-INSERT INTO t1 (val) VALUES (CEIL(RAND()*20));
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-INSERT INTO t1 (val) SELECT CEIL(RAND()*20) FROM t1;
-
-SELECT COUNT(*) FROM t1;
-ANALYZE TABLE t1;
-
-connect(con1, localhost, root,,);
-START TRANSACTION;
-DELETE FROM t1;
-send SELECT COUNT(*) FROM t1;
-
-connection default;
-let $row_count= query_get_value(EXPLAIN SELECT * FROM t1 WHERE val=4, rows,1);
-if ($row_count > 20000)
-{
---echo Test correctly estimates the number of rows as > 20000
---echo even when in other uncommmited transaction
---echo all rows have been deleted.
-}
-
-connection con1;
-reap;
-commit;
-
-connection default;
-
---echo Test 2:- Insert and rollback test
-CREATE TABLE t2 (id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
- val INT UNSIGNED NOT NULL,
- INDEX (val)) ENGINE=INNODB
- STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
-
-connection con1;
-
-START TRANSACTION;
-INSERT INTO t2 (val) VALUES (CEIL(RAND()*20));
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-INSERT INTO t2 (val) SELECT CEIL(RAND()*20) FROM t2;
-send SELECT COUNT(*) FROM t2;
-
-connection default;
-select count(*) from t2;
-let $row_count= query_get_value(EXPLAIN SELECT * FROM t2 WHERE val=4, rows,1);
-if ($row_count > 20000)
-{
---echo Test correctly estimates the number of rows as > 20000
---echo even when in other uncommited transaction
---echo many rows are inserted.
-}
-
-connection con1;
-reap;
---echo Rollback the insert
-rollback;
-disconnect con1;
-
-connection default;
-let $row_count= query_get_value(EXPLAIN SELECT * FROM t2 WHERE val=4, rows,1);
-if ($row_count <= 1)
-{
---echo Test correctly estimates the number of rows as $row_count
---echo after rollback.
-}
-
-DROP TABLE t1,t2;
diff --git a/mysql-test/suite/innodb/t/innodb_stats_persistent.test b/mysql-test/suite/innodb/t/innodb_stats_persistent.test
new file mode 100644
index 00000000000..652b201c4b4
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_stats_persistent.test
@@ -0,0 +1,95 @@
+--source include/have_innodb.inc
+--source include/big_test.inc
+
+SET @saved_include_delete_marked = @@GLOBAL.innodb_stats_include_delete_marked;
+SET GLOBAL innodb_stats_include_delete_marked = ON;
+SET @saved_traditional = @@GLOBAL.innodb_stats_traditional;
+SET GLOBAL innodb_stats_traditional=false;
+SET @saved_modified_counter = @@GLOBAL.innodb_stats_modified_counter;
+SET GLOBAL innodb_stats_modified_counter=1;
+
+CREATE TABLE t0 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
+ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
+CREATE TABLE t1 LIKE t0;
+CREATE TABLE t2 LIKE t0;
+
+INSERT INTO t0 (val) VALUES (4);
+INSERT INTO t0 (val) SELECT 4 FROM t0;
+INSERT INTO t0 (val) SELECT 4 FROM t0;
+INSERT INTO t0 (val) SELECT 4 FROM t0;
+INSERT INTO t0 (val) SELECT 4 FROM t0;
+
+INSERT INTO t1 SELECT * FROM t0;
+SELECT COUNT(*) FROM t1;
+ANALYZE TABLE t1;
+
+connect(con1, localhost, root,,);
+START TRANSACTION;
+DELETE FROM t1;
+send SELECT COUNT(*) FROM t1;
+
+connection default;
+--echo # With innodb_stats_include_delete_marked=ON,
+--echo # DELETE must not affect statistics before COMMIT.
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+
+connection con1;
+reap;
+ROLLBACK;
+SELECT COUNT(*) FROM t1;
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+
+BEGIN;
+DELETE FROM t1;
+COMMIT;
+SELECT COUNT(*) FROM t1;
+
+connection default;
+BEGIN;
+INSERT INTO t2 SELECT * FROM t0;
+
+--echo # The INSERT will show up before COMMIT.
+EXPLAIN SELECT * FROM t2 WHERE val=4;
+SELECT COUNT(*) FROM t2;
+--echo # The ROLLBACK of the INSERT must affect the statistics.
+ROLLBACK;
+SELECT COUNT(*) FROM t2;
+
+connection con1;
+EXPLAIN SELECT * FROM t2 WHERE val=4;
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
+--source include/wait_all_purged.inc
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
+--echo # After COMMIT and purge, the DELETE must show up.
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+
+SET GLOBAL innodb_stats_include_delete_marked = OFF;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t0;
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+ROLLBACK;
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+BEGIN;
+INSERT INTO t1 SELECT * FROM t0;
+COMMIT;
+EXPLAIN SELECT * FROM t1 WHERE val=4;
+BEGIN;
+DELETE FROM t1;
+SELECT COUNT(*) FROM t1;
+--echo # With innodb_stats_include_delete_marked=OFF,
+--echo # DELETE must affect statistics even before COMMIT.
+--echo # However, if there was a WHERE condition,
+--echo # ha_innobase::records_in_range() would count the delete-marked records.
+EXPLAIN SELECT * FROM t1;
+ROLLBACK;
+EXPLAIN SELECT * FROM t1;
+SELECT COUNT(*) FROM t1;
+disconnect con1;
+
+connection default;
+
+DROP TABLE t0,t1,t2;
+SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked;
+SET GLOBAL innodb_stats_traditional = @saved_traditional;
+SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter;
diff --git a/mysql-test/suite/innodb/t/log_data_file_size.test b/mysql-test/suite/innodb/t/log_data_file_size.test
index 56a9d35bd92..8a0e88efc76 100644
--- a/mysql-test/suite/innodb/t/log_data_file_size.test
+++ b/mysql-test/suite/innodb/t/log_data_file_size.test
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+--source include/innodb_page_size.inc
--source include/not_embedded.inc
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
diff --git a/mysql-test/suite/innodb/t/log_file_size.test b/mysql-test/suite/innodb/t/log_file_size.test
index ae6442a7994..14cc889e34b 100644
--- a/mysql-test/suite/innodb/t/log_file_size.test
+++ b/mysql-test/suite/innodb/t/log_file_size.test
@@ -1,5 +1,5 @@
# Test resizing the InnoDB redo log.
---source include/have_innodb.inc
+--source include/innodb_page_size_small.inc
# Embedded server tests do not support restarting
--source include/not_embedded.inc
# DBUG_EXECUTE_IF is needed
@@ -24,6 +24,12 @@ call mtr.add_suppression("InnoDB: Unable to open .*ib_logfile0. to check native
FLUSH TABLES;
--enable_query_log
+--let $restart_parameters= --innodb-thread-concurrency=1 --innodb-log-file-size=1m --innodb-log-files-in-group=2
+--source include/restart_mysqld.inc
+
+--let $restart_parameters= --innodb-thread-concurrency=100 --innodb-log-file-size=10M --innodb-log-files-in-group=2
+--source include/restart_mysqld.inc
+
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES (42);
diff --git a/mysql-test/suite/innodb/t/row_format_redundant.test b/mysql-test/suite/innodb/t/row_format_redundant.test
new file mode 100644
index 00000000000..af3fe3b52cf
--- /dev/null
+++ b/mysql-test/suite/innodb/t/row_format_redundant.test
@@ -0,0 +1,157 @@
+--source include/have_innodb.inc
+# Embedded mode doesn't allow restarting
+--source include/not_embedded.inc
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: Table `mysql`\\.`innodb_table_stats` not found");
+call mtr.add_suppression("InnoDB: Table `test`.`t1` in InnoDB data dictionary contains invalid flags. SYS_TABLES\\.TYPE=1 SYS_TABLES\\.MIX_LEN=255\\r?$");
+call mtr.add_suppression("InnoDB: Parent table of FTS auxiliary table test/FTS_.* not found");
+call mtr.add_suppression("InnoDB: Cannot open table test/t1 from the internal data dictionary");
+call mtr.add_suppression("InnoDB: Table `test`.`t1` does not exist in the InnoDB internal data dictionary though MariaDB is trying to (rename|drop)");
+FLUSH TABLES;
+--enable_query_log
+
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+
+let bugdir= $MYSQLTEST_VARDIR/tmp/row_format_redundant;
+--mkdir $bugdir
+--let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err
+
+--let $d=--innodb-data-home-dir=$bugdir --innodb-log-group-home-dir=$bugdir
+--let $d=$d --innodb-data-file-path=ibdata1:1M:autoextend
+--let $d=$d --innodb-undo-tablespaces=0 --innodb-stats-persistent=0
+--let $restart_parameters= $d
+--source include/restart_mysqld.inc
+
+SET GLOBAL innodb_file_per_table=1;
+
+--echo #
+--echo # Bug#21644827 - FTS, ASSERT !SRV_READ_ONLY_MODE || M_IMPL.M_LOG_MODE ==
+--echo # MTR_LOG_NO_REDO
+--echo #
+
+SET GLOBAL innodb_file_per_table=ON;
+create table t1 (a int not null, d varchar(15) not null, b
+varchar(198) not null, c char(156),
+fulltext ftsic(c)) engine=InnoDB
+row_format=redundant;
+
+insert into t1 values(123, 'abcdef', 'jghikl', 'mnop');
+insert into t1 values(456, 'abcdef', 'jghikl', 'mnop');
+insert into t1 values(789, 'abcdef', 'jghikl', 'mnop');
+insert into t1 values(134, 'kasdfsdsadf', 'adfjlasdkfjasd', 'adfsadflkasdasdfljasdf');
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+
+SET GLOBAL innodb_file_per_table=OFF;
+create table t2 (a int not null, d varchar(15) not null, b
+varchar(198) not null, c char(156), fulltext ftsic(c)) engine=InnoDB
+row_format=redundant;
+
+insert into t2 select * from t1;
+
+create table t3 (a int not null, d varchar(15) not null, b varchar(198),
+c varchar(150), index k1(c(99), b(56)), index k2(b(5), c(10))) engine=InnoDB
+row_format=redundant;
+
+insert into t3 values(444, 'dddd', 'bbbbb', 'aaaaa');
+insert into t3 values(555, 'eeee', 'ccccc', 'aaaaa');
+
+# read-only restart requires the change buffer to be empty; therefore we
+# do a slow shutdown.
+SET GLOBAL innodb_fast_shutdown=0;
+--let $restart_parameters= $d --innodb-read-only
+--source include/restart_mysqld.inc
+
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t3;
+
+--error ER_OPEN_AS_READONLY
+TRUNCATE TABLE t1;
+--error ER_OPEN_AS_READONLY
+TRUNCATE TABLE t2;
+--error ER_OPEN_AS_READONLY
+TRUNCATE TABLE t3;
+
+--let $restart_parameters= $d
+--source include/restart_mysqld.inc
+
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+
+--source include/shutdown_mysqld.inc
+--perl
+use strict;
+my $ps= $ENV{INNODB_PAGE_SIZE};
+my $file= "$ENV{bugdir}/ibdata1";
+open(FILE, "+<", $file) || die "Unable to open $file\n";
+# Read DICT_HDR_TABLES, the root page number of CLUST_IND (SYS_TABLES.NAME).
+sysseek(FILE, 7*$ps+38+32, 0) || die "Unable to seek $file";
+die "Unable to read $file" unless sysread(FILE, $_, 4) == 4;
+my $sys_tables_root = unpack("N", $_);
+my $page;
+sysseek(FILE, $sys_tables_root*$ps, 0) || die "Unable to seek $file";
+die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
+for (my $offset= 0x65; $offset;
+ $offset= unpack("n", substr($page,$offset-2,2)))
+{
+ my $n_fields= unpack("n", substr($page,$offset-4,2)) >> 1 & 0x3ff;
+ my $start= 0;
+ my $end= unpack("C", substr($page, $offset-7, 1));
+ my $name= substr($page,$offset+$start,$end-$start);
+ for (my $i= 0; $i < $n_fields; $i++) {
+ my $end= unpack("C", substr($page, $offset-7-$i, 1));
+ # Corrupt SYS_TABLES.MIX_LEN (ignored for ROW_FORMAT=REDUNDANT)
+ if ($i == 7 && $name =~ '^test/t[123]')
+ {
+ print "corrupted SYS_TABLES.MIX_LEN for $name\n";
+ substr($page,$offset+$start,$end-$start)= pack("N", 255);
+ }
+ $start= $end & 0x7f;
+ }
+}
+substr($page,0,4)=pack("N",0xdeadbeef);
+substr($page,$ps-8,4)=pack("N",0xdeadbeef);
+sysseek(FILE, $sys_tables_root*$ps, 0) || die "Unable to seek $file";
+syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
+close(FILE) || die "Unable to close $file\n";
+EOF
+
+--source include/start_mysqld.inc
+--error ER_NO_SUCH_TABLE_IN_ENGINE
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
+TRUNCATE TABLE t3;
+--error ER_NO_SUCH_TABLE_IN_ENGINE
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t2;
+SELECT COUNT(*) FROM t3;
+--error ER_ERROR_ON_RENAME
+RENAME TABLE t1 TO tee_one;
+DROP TABLE t1;
+DROP TABLE t2,t3;
+
+--let SEARCH_PATTERN= \[ERROR\] InnoDB: Table `test`\.`t1` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=255\b
+--source include/search_pattern_in_file.inc
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+--list_files $bugdir
+--remove_files_wildcard $bugdir
+--rmdir $bugdir
+
+# Remove the data file, because DROP TABLE skipped it for the "corrupted" table
+--let MYSQLD_DATADIR=`select @@datadir`
+--remove_file $MYSQLD_DATADIR/test/t1.ibd
+--list_files $MYSQLD_DATADIR/test
diff --git a/mysql-test/suite/innodb/t/table_flags.test b/mysql-test/suite/innodb/t/table_flags.test
new file mode 100644
index 00000000000..7f47b8254e2
--- /dev/null
+++ b/mysql-test/suite/innodb/t/table_flags.test
@@ -0,0 +1,206 @@
+--source include/innodb_page_size.inc
+# Embedded server tests do not support restarting
+--source include/not_embedded.inc
+
+--disable_query_log
+call mtr.add_suppression("InnoDB: Table `mysql`\\.`innodb_table_stats` not found");
+call mtr.add_suppression("InnoDB: incorrect flags in SYS_TABLES");
+call mtr.add_suppression("InnoDB: Table `test`.`t[cp]` in InnoDB data dictionary contains invalid flags\\. SYS_TABLES\\.TYPE=(129|289|3873|1232[31]) SYS_TABLES\\.N_COLS=2147483649\\r?$");
+call mtr.add_suppression("InnoDB: Table `test`\\.`tr` in InnoDB data dictionary contains invalid flags\\. SYS_TABLES\\.TYPE=65 SYS_TABLES\\.MIX_LEN=4294967295\\r?$");
+call mtr.add_suppression("InnoDB: Refusing to load '\\..test.td\\.ibd' \\(id=3, flags=0x([2e]1)\\); dictionary contains id=3, flags=0x100\\1\\r?$");
+call mtr.add_suppression("InnoDB: Refusing to load '\\..test.td\\.ibd' \\(id=3, flags=0x(1[2ae]1)\\); dictionary contains id=3, flags=0x10\\1\\r?$");
+call mtr.add_suppression("InnoDB: Ignoring tablespace for `test`.`td` because it could not be opened\\.");
+# FIXME: Remove the following spam due to invalid flags for test.td
+call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation");
+call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified");
+call mtr.add_suppression("InnoDB: If you are installing InnoDB, remember that you must create directories yourself");
+FLUSH TABLES;
+--enable_query_log
+
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+let MYSQLD_DATADIR=`select @@datadir`;
+
+let bugdir= $MYSQLTEST_VARDIR/tmp/table_flags;
+--mkdir $bugdir
+--let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err
+
+--let $d=--innodb-data-home-dir=$bugdir --innodb-log-group-home-dir=$bugdir
+--let $d=$d --innodb-data-file-path=ibdata1:1M:autoextend
+--let $d=$d --innodb-undo-tablespaces=0
+--let $restart_parameters=$d --innodb-stats-persistent=0
+--source include/restart_mysqld.inc
+
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE tr(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+CREATE TABLE tc(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPACT;
+CREATE TABLE td(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+SET innodb_strict_mode=OFF;
+CREATE TABLE tz(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=COMPRESSED
+KEY_BLOCK_SIZE=1;
+SET innodb_strict_mode=ON;
+# PAGE_COMPRESSED is supported starting with MariaDB 10.1.0
+CREATE TABLE tp(a INT PRIMARY KEY)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
+PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
+
+--source include/shutdown_mysqld.inc
+--perl
+use strict;
+my $ps= $ENV{INNODB_PAGE_SIZE};
+my $file= "$ENV{bugdir}/ibdata1";
+open(FILE, "+<", $file) || die "Unable to open $file\n";
+# Read DICT_HDR_TABLES, the root page number of CLUST_IND (SYS_TABLES.NAME).
+sysseek(FILE, 7*$ps+38+32, 0) || die "Unable to seek $file";
+die "Unable to read $file" unless sysread(FILE, $_, 4) == 4;
+my $sys_tables_root = unpack("N", $_);
+my $page;
+print "SYS_TABLES clustered index root page ($sys_tables_root):\n";
+sysseek(FILE, $sys_tables_root*$ps, 0) || die "Unable to seek $file";
+die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
+open(BACKUP, ">$ENV{bugdir}/sys_tables.bin") || die "Unable to open backup\n";
+syswrite(BACKUP, $page, $ps)==$ps || die "Unable to write backup\n";
+close(BACKUP) || die "Unable to close backup\n";
+print "N_RECS=", unpack("n", substr($page,38+16,2));
+print "; LEVEL=", unpack("n", substr($page,38+26,2));
+print "; INDEX_ID=0x", unpack("H*", substr($page,38+28,8)), "\n";
+my @fields=("NAME","DB_TRX_ID","DB_ROLL_PTR",
+ "ID","N_COLS","TYPE","MIX_ID","MIX_LEN","CLUSTER_NAME","SPACE");
+for (my $offset= 0x65; $offset;
+ $offset= unpack("n", substr($page,$offset-2,2)))
+{
+ print "header=0x", unpack("H*",substr($page,$offset-6,6)), " (";
+ my $n_fields= unpack("n", substr($page,$offset-4,2)) >> 1 & 0x3ff;
+ my $start= 0;
+ my $name;
+ for (my $i= 0; $i < $n_fields; $i++) {
+ my $end= unpack("C", substr($page, $offset-7-$i, 1));
+ print ",\n " if $i;
+ print "$fields[$i]=";
+ if ($end & 0x80) {
+ print "NULL(", ($end & 0x7f) - $start, " bytes)"
+ } elsif ($n_fields > 1 && $i == 0) {
+ $name= substr($page,$offset+$start,$end-$start);
+ print "'$name'"
+ } else {
+ print "0x", unpack("H*", substr($page,$offset+$start,$end-$start))
+ }
+ # Corrupt SYS_TABLES.TYPE
+ if ($i == 5)
+ {
+ my $flags= 0;
+ if ($name eq 'test/tr') {
+ $flags= 0x40 # DATA_DIR (largely ignored by 10.1+)
+ } elsif ($name eq 'test/tc') {
+ $flags= 0x80 # 10.1 PAGE_COMPRESSED
+ } elsif ($name eq 'test/td') {
+ $flags= 0xf00 # PAGE_COMPRESSION_LEVEL=15 (0..9 is valid)
+ # As part of the MDEV-12873 fix, because the
+ # PAGE_COMPRESSED=YES flag was not set, we will assume that
+ # this table was actually created with 10.2.2..10.2.6
+ # using PAGE_COMPRESSED=YES PAGE_COMPRESSION_LEVEL=7.
+ } elsif ($name eq 'test/tz') {
+ $flags= 0x3000 # 10.1 ATOMIC_WRITES=3 (0..2 is valid)
+ } elsif ($name eq 'test/tp') {
+ $flags= 0x880 # 10.1 PAGE_COMPRESSED, PAGE_COMPRESSION_LEVEL=8
+ # (in 10.2.2 through 10.2.6, this is interpreted as
+ # PAGE_COMPRESSION_LEVEL=4 without PAGE_COMPRESSED
+ # but with SHARED_SPACE, which should be invalid)
+ }
+
+ substr($page,$offset+$start,$end-$start)= pack(
+ "N", $flags ^
+ unpack("N", substr($page,$offset+$start,$end-$start)))
+ if $flags;
+ }
+ # Corrupt SYS_TABLES.MIX_LEN (ignored for ROW_FORMAT=REDUNDANT)
+ if ($i == 7 && $name eq 'test/tr')
+ {
+ substr($page,$offset+$start,$end-$start)= chr(255) x 4;
+ }
+ $start= $end & 0x7f;
+ }
+ print ")\n";
+}
+substr($page,0,4)=pack("N",0xdeadbeef);
+substr($page,$ps-8,4)=pack("N",0xdeadbeef);
+sysseek(FILE, $sys_tables_root*$ps, 0) || die "Unable to seek $file";
+syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
+close(FILE) || die "Unable to close $file\n";
+EOF
+--source include/start_mysqld.inc
+
+--error ER_NO_SUCH_TABLE_IN_ENGINE
+SHOW CREATE TABLE tr;
+--error ER_NO_SUCH_TABLE_IN_ENGINE
+SHOW CREATE TABLE tc;
+--error ER_NO_SUCH_TABLE_IN_ENGINE
+SHOW CREATE TABLE td;
+# This table was converted to NO_ROLLBACK due to the SYS_TABLES.TYPE change.
+SHOW CREATE TABLE tz;
+BEGIN;
+INSERT INTO tz VALUES(42);
+ROLLBACK;
+SELECT * FROM tz;
+--error ER_NO_SUCH_TABLE_IN_ENGINE
+SHOW CREATE TABLE tp;
+
+--source include/shutdown_mysqld.inc
+
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
+--let SEARCH_PATTERN= InnoDB: Table `test`.`t[cp]` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=(129|289|3873|1232[13]) SYS_TABLES\.N_COLS=2147483649
+--source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN= InnoDB: Refusing to load '\..test.td\.ibd' \(id=3, flags=0x1?[2ae]1\); dictionary contains id=3, flags=0x10[01][2ae]1\b
+--source include/search_pattern_in_file.inc
+--let SEARCH_PATTERN= InnoDB: Table `test`\.`tr` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=65 SYS_TABLES\.MIX_LEN=4294967295\b
+--source include/search_pattern_in_file.inc
+
+# Restore the backup of the corrupted SYS_TABLES clustered index root page
+--perl
+use strict;
+my $ps= $ENV{INNODB_PAGE_SIZE};
+my $file= "$ENV{bugdir}/ibdata1";
+open(FILE, "+<", $file) || die "Unable to open $file\n";
+open(BACKUP, "<$ENV{bugdir}/sys_tables.bin") || die "Unable to open backup\n";
+# Read DICT_HDR_TABLES, the root page number of CLUST_IND (SYS_TABLES.NAME).
+sysseek(FILE, 7*$ps+38+32, 0) || die "Unable to seek $file";
+die "Unable to read $file\n" unless sysread(FILE, $_, 4) == 4;
+my $sys_tables_root = unpack("N", $_);
+print "Restoring SYS_TABLES clustered index root page ($sys_tables_root)\n";
+sysseek(FILE, $sys_tables_root*$ps, 0) || die "Unable to seek $file";
+die "Unable to read backup\n" unless sysread(BACKUP, $_, $ps) == $ps;
+die "Unable to restore backup\n" unless syswrite(FILE, $_, $ps) == $ps;
+close(BACKUP);
+close(FILE) || die "Unable to close $file\n";
+EOF
+--source include/start_mysqld.inc
+
+SHOW CREATE TABLE tr;
+SHOW CREATE TABLE tc;
+SHOW CREATE TABLE td;
+SHOW CREATE TABLE tz;
+SHOW CREATE TABLE tp;
+
+BEGIN;
+INSERT INTO tr VALUES(1);
+INSERT INTO tc VALUES(1);
+INSERT INTO td VALUES(1);
+# We cannot access tz, because due to our fiddling of the NO_ROLLBACK flag,
+# it now has a record with DB_TRX_ID=0, which is invalid for
+# transactional tables until MDEV-12288 is implemented.
+# INSERT INTO tz VALUES(1);
+INSERT INTO tp VALUES(1);
+ROLLBACK;
+
+SELECT * FROM tr;
+SELECT * FROM tc;
+SELECT * FROM td;
+# SELECT * FROM tz;
+SELECT * FROM tp;
+
+DROP TABLE tr,tc,td,tz,tp;
+
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+
+--list_files $bugdir
+--remove_files_wildcard $bugdir
+--rmdir $bugdir
diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test
index f841acff1c0..1148f2ee1a0 100644
--- a/mysql-test/suite/innodb/t/temporary_table.test
+++ b/mysql-test/suite/innodb/t/temporary_table.test
@@ -15,7 +15,6 @@ call mtr.add_suppression("The table 't1' is full");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("InnoDB: Tablespace doesn't support raw devices");
-call mtr.add_suppression("InnoDB: The innodb_temporary data file 'ibtmp1' must be at least");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("innodb_temporary and innodb_system file names seem to be the same");
call mtr.add_suppression("Could not create the shared innodb_temporary");
@@ -143,12 +142,6 @@ eval $check_no_innodb;
--source include/search_pattern_in_file.inc
eval $check_no_innodb;
---let $restart_parameters= --innodb_temp_data_file_path=ibtmp1:2M:autoextend
---source include/restart_mysqld.inc
---let SEARCH_PATTERN = The innodb_temporary data file 'ibtmp1' must be at least
---source include/search_pattern_in_file.inc
-eval $check_no_innodb;
-
--let $restart_parameters= --innodb_temp_data_file_path=
--source include/restart_mysqld.inc
--let SEARCH_PATTERN = InnoDB: syntax error in file path
diff --git a/mysql-test/suite/innodb/t/truncate_purge_debug.test b/mysql-test/suite/innodb/t/truncate_purge_debug.test
index 513c59e12c8..e8f5768f557 100644
--- a/mysql-test/suite/innodb/t/truncate_purge_debug.test
+++ b/mysql-test/suite/innodb/t/truncate_purge_debug.test
@@ -33,25 +33,8 @@ COMMIT;
disconnect con2;
connection default;
+--source include/wait_all_purged.inc
-# Wait for everything to be purged.
-
-let $wait_counter= 300;
-while ($wait_counter)
-{
- --replace_regex /.*History list length ([0-9]+).*/\1/
- let $remaining= `SHOW ENGINE INNODB STATUS`;
- if ($remaining == 'InnoDB 0')
- {
- let $wait_counter= 0;
- }
- if ($wait_counter)
- {
- real_sleep 0.1;
- dec $wait_counter;
- }
-}
-echo $remaining transactions not purged;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
SET DEBUG_SYNC = 'now SIGNAL finish_scan';
diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result b/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result
index 0b011639e2e..b0f7d7727d6 100644
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_multiple_index.result
@@ -46,9 +46,9 @@ id a b
1 MySQL Tutorial DBMS stands for DataBase ...
select *, MATCH(a) AGAINST("Optimizing MySQL" IN BOOLEAN MODE) as x from t1;
id a b x
-1 MySQL Tutorial DBMS stands for DataBase ... 0.0906190574169159
-2 How To Use MySQL Well After you went through a ... 0.0906190574169159
-3 Optimizing MySQL In this tutorial we will show ... 0.6961383819580078
+1 MySQL Tutorial DBMS stands for DataBase ... 0.000000001885928302414186
+2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186
+3 Optimizing MySQL In this tutorial we will show ... 0.22764469683170319
select *, MATCH(b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
id a b x
1 MySQL Tutorial DBMS stands for DataBase ... 0
@@ -90,9 +90,9 @@ id a b
1 MySQL Tutorial DBMS stands for DataBase ...
select *, MATCH(a) AGAINST("Optimizing MySQL" IN BOOLEAN MODE) as x from t1;
id a b x
-1 MySQL Tutorial DBMS stands for DataBase ... 0.0906190574169159
-2 How To Use MySQL Well After you went through a ... 0.0906190574169159
-3 Optimizing MySQL In this tutorial we will show ... 0.6961383819580078
+1 MySQL Tutorial DBMS stands for DataBase ... 0.000000001885928302414186
+2 How To Use MySQL Well After you went through a ... 0.000000001885928302414186
+3 Optimizing MySQL In this tutorial we will show ... 0.22764469683170319
select *, MATCH(b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
id a b x
1 MySQL Tutorial DBMS stands for DataBase ... 0
diff --git a/mysql-test/suite/innodb_zip/include/have_innodb_zip.inc b/mysql-test/suite/innodb_zip/include/have_innodb_zip.inc
deleted file mode 100644
index 6af83d51304..00000000000
--- a/mysql-test/suite/innodb_zip/include/have_innodb_zip.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_page_size' AND variable_value <= 16384`)
-{
- --skip Test with InnoDB zip requires page size not greater than 16k.
-}
diff --git a/mysql-test/suite/innodb_zip/r/wl6344_compress_level.result b/mysql-test/suite/innodb_zip/r/wl6344_compress_level.result
index 5cdfe162b6a..b33d9c0c8de 100644
--- a/mysql-test/suite/innodb_zip/r/wl6344_compress_level.result
+++ b/mysql-test/suite/innodb_zip/r/wl6344_compress_level.result
@@ -1,28 +1,13 @@
-USE test;
-DROP TABLE IF EXISTS tab5;
-Warnings:
-Note 1051 Unknown table 'test.tab5'
-DROP TABLE IF EXISTS tab6;
-Warnings:
-Note 1051 Unknown table 'test.tab6'
-#set the other madatory flags before test starts
SET GLOBAL Innodb_file_per_table=on;
-#set the compression level=0 (No compress)
+SET @save_innodb_compression_level = @@global.innodb_compression_level;
SET global innodb_compression_level=0;
-#check the compression level and the compressed_pages is default
-SELECT @@innodb_compression_level;
-@@innodb_compression_level
-0
-SELECT @@Innodb_file_per_table;
-@@Innodb_file_per_table
-1
#create table with 1K block size
CREATE TABLE tab5 (col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 longtext,
col_4 longtext,col_5 longtext,
col_6 longtext , col_7 longtext ,
col_8 longtext ,col_9 longtext ,
-col_10 longtext ,col_11 int auto_increment primary key)
+col_10 longtext ,col_11 int auto_increment primary key)
ENGINE = innodb ROW_FORMAT=compressed key_block_size=1;
#create indexes
CREATE INDEX idx1 ON tab5(col_4(10));
@@ -42,7 +27,8 @@ SET @col_7 = repeat('g', 100);
SET @col_8 = repeat('h', 100);
SET @col_9 = repeat('i', 100);
SET @col_10 = repeat('j', 100);
-#insert 10 records
+#insert 10 records
+BEGIN;
INSERT INTO tab5(col_1,col_2,col_3,col_4,col_5,col_6,col_7,col_8,col_9,col_10)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9,@col_10);
INSERT INTO tab5(col_1,col_2,col_3,col_4,col_5,col_6,col_7,col_8,col_9,col_10)
@@ -63,7 +49,8 @@ INSERT INTO tab5(col_1,col_2,col_3,col_4,col_5,col_6,col_7,col_8,col_9,col_10)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9,@col_10);
INSERT INTO tab5(col_1,col_2,col_3,col_4,col_5,col_6,col_7,col_8,col_9,col_10)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9,@col_10);
-#set the compression level=9 (High compress)
+COMMIT;
+#set the compression level=9 (High compress)
SET global innodb_compression_level=9;
#create table with 1K block size
CREATE TABLE tab6 (col_1 CHAR (255) ,
@@ -80,18 +67,8 @@ CREATE INDEX idx3 ON tab6(col_6(10));
CREATE INDEX idx4 ON tab6(col_7(10));
CREATE INDEX idx5 ON tab6(col_8(10));
CREATE INDEX idx6 ON tab6(col_11);
-#load the with repeat function
-SET @col_1 = repeat('a', 100);
-SET @col_2 = repeat('b', 100);
-SET @col_3 = repeat('c', 100);
-SET @col_4 = repeat('d', 100);
-SET @col_5 = repeat('e', 100);
-SET @col_6 = repeat('f', 100);
-SET @col_7 = repeat('g', 100);
-SET @col_8 = repeat('h', 100);
-SET @col_9 = repeat('i', 100);
-SET @col_10 = repeat('j', 100);
-#insert 10 records
+#insert 10 records
+BEGIN;
INSERT INTO tab6(col_1,col_2,col_3,col_4,col_5,col_6,col_7,col_8,col_9,col_10)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9,@col_10);
INSERT INTO tab6(col_1,col_2,col_3,col_4,col_5,col_6,col_7,col_8,col_9,col_10)
@@ -112,24 +89,21 @@ INSERT INTO tab6(col_1,col_2,col_3,col_4,col_5,col_6,col_7,col_8,col_9,col_10)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9,@col_10);
INSERT INTO tab6(col_1,col_2,col_3,col_4,col_5,col_6,col_7,col_8,col_9,col_10)
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9,@col_10);
+COMMIT;
#diff the sizes of the No compressed table and high compressed table
-SET @size=(SELECT
-(SELECT (SUM(DATA_LENGTH+INDEX_LENGTH)/1024/1024)
-FROM INFORMATION_SCHEMA.TABLES
+SET @size=(SELECT
+(SELECT (SUM(DATA_LENGTH+INDEX_LENGTH)/1024/1024)
+FROM INFORMATION_SCHEMA.TABLES
WHERE table_name='tab5' AND ENGINE='InnoDB' AND table_schema='test')
-
-(SELECT SUM(DATA_LENGTH+INDEX_LENGTH)/1024/1024
-FROM INFORMATION_SCHEMA.TABLES
+(SELECT SUM(DATA_LENGTH+INDEX_LENGTH)/1024/1024
+FROM INFORMATION_SCHEMA.TABLES
WHERE table_name='tab6' AND ENGINE='InnoDB' AND table_schema='test')
FROM DUAL);
-#check the size of the table, it should not be Negative value
+#check the size of the table, it should not be Negative value
#The results of this query Test pass = 1 and fail=0
SELECT @size >= 0;
@size >= 0
1
-#
-# Cleanup
-#
-DROP TABLE tab5;
-DROP TABLE tab6;
-#reset back the compression_level to default.
+DROP TABLE tab5, tab6;
+SET GLOBAL innodb_compression_level = @save_innodb_compression_level;
diff --git a/mysql-test/suite/innodb_zip/t/bug36169.test b/mysql-test/suite/innodb_zip/t/bug36169.test
index 5452c929b92..07566b204bd 100644
--- a/mysql-test/suite/innodb_zip/t/bug36169.test
+++ b/mysql-test/suite/innodb_zip/t/bug36169.test
@@ -3,8 +3,7 @@
# http://bugs.mysql.com/36169
#
--- source include/have_innodb.inc
--- source include/have_innodb_zip.inc
+-- source include/innodb_page_size_small.inc
let $file_per_table=`select @@innodb_file_per_table`;
SET GLOBAL innodb_file_per_table=ON;
diff --git a/mysql-test/suite/innodb_zip/t/bug52745.test b/mysql-test/suite/innodb_zip/t/bug52745.test
index a3de7323efe..be4b5c2bfcb 100644
--- a/mysql-test/suite/innodb_zip/t/bug52745.test
+++ b/mysql-test/suite/innodb_zip/t/bug52745.test
@@ -1,5 +1,4 @@
--- source include/have_innodb.inc
--- source include/have_innodb_zip.inc
+-- source include/innodb_page_size_small.inc
let $file_per_table=`select @@innodb_file_per_table`;
SET GLOBAL innodb_file_per_table=on;
diff --git a/mysql-test/suite/innodb_zip/t/bug53591.test b/mysql-test/suite/innodb_zip/t/bug53591.test
index 1943c59fe17..67223027bad 100644
--- a/mysql-test/suite/innodb_zip/t/bug53591.test
+++ b/mysql-test/suite/innodb_zip/t/bug53591.test
@@ -1,5 +1,4 @@
--- source include/have_innodb.inc
--- source include/have_innodb_zip.inc
+-- source include/innodb_page_size_small.inc
let $file_per_table=`select @@innodb_file_per_table`;
diff --git a/mysql-test/suite/innodb_zip/t/bug56680.test b/mysql-test/suite/innodb_zip/t/bug56680.test
index 694c5ffac59..da37f6a28b4 100644
--- a/mysql-test/suite/innodb_zip/t/bug56680.test
+++ b/mysql-test/suite/innodb_zip/t/bug56680.test
@@ -3,8 +3,7 @@
#
# Bug #56680 InnoDB may return wrong results from a case-insensitive index
#
--- source include/have_innodb.inc
--- source include/have_innodb_zip.inc
+-- source include/innodb_page_size_small.inc
-- disable_query_log
SET @tx_isolation_orig = @@tx_isolation;
diff --git a/mysql-test/suite/innodb_zip/t/create_options.test b/mysql-test/suite/innodb_zip/t/create_options.test
index dbc421184bb..f91cd7d42dd 100644
--- a/mysql-test/suite/innodb_zip/t/create_options.test
+++ b/mysql-test/suite/innodb_zip/t/create_options.test
@@ -56,8 +56,7 @@
# since they are rejected for InnoDB page sizes of 8k and 16k.
# See innodb_16k and innodb_8k for those tests.
--- source include/have_innodb.inc
--- source include/have_innodb_zip.inc
+--source include/innodb_page_size_small.inc
SET default_storage_engine=InnoDB;
# These values can change during the test
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum.test b/mysql-test/suite/innodb_zip/t/innochecksum.test
index 0403251bf64..63a4b418677 100644
--- a/mysql-test/suite/innodb_zip/t/innochecksum.test
+++ b/mysql-test/suite/innodb_zip/t/innochecksum.test
@@ -1,8 +1,7 @@
#************************************************************
# WL6045:Improve Innochecksum
#************************************************************
---source include/have_innodb.inc
---source include/have_innodb_zip.inc
+--source include/innodb_page_size_small.inc
--source include/no_valgrind_without_big.inc
# Embedded server does not support crashing.
--source include/not_embedded.inc
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum_2.test b/mysql-test/suite/innodb_zip/t/innochecksum_2.test
index 7f4ad336805..330bb81ba75 100644
--- a/mysql-test/suite/innodb_zip/t/innochecksum_2.test
+++ b/mysql-test/suite/innodb_zip/t/innochecksum_2.test
@@ -1,8 +1,7 @@
#************************************************************
# WL6045:Improve Innochecksum
#************************************************************
---source include/have_innodb.inc
---source include/have_innodb_zip.inc
+--source include/innodb_page_size_small.inc
--source include/have_debug.inc
--source include/no_valgrind_without_big.inc
# Avoid CrashReporter popup on Mac.
diff --git a/mysql-test/suite/innodb_zip/t/innochecksum_3.test b/mysql-test/suite/innodb_zip/t/innochecksum_3.test
index 7895510b335..54c67ff1a9b 100644
--- a/mysql-test/suite/innodb_zip/t/innochecksum_3.test
+++ b/mysql-test/suite/innodb_zip/t/innochecksum_3.test
@@ -1,8 +1,7 @@
#************************************************************
# WL6045:Improve Innochecksum
#************************************************************
---source include/have_innodb.inc
---source include/have_innodb_zip.inc
+--source include/innodb_page_size_small.inc
--source include/no_valgrind_without_big.inc
diff --git a/mysql-test/suite/innodb_zip/t/innodb-zip.test b/mysql-test/suite/innodb_zip/t/innodb-zip.test
index 7a35a3fe50b..ff73c99f41d 100644
--- a/mysql-test/suite/innodb_zip/t/innodb-zip.test
+++ b/mysql-test/suite/innodb_zip/t/innodb-zip.test
@@ -1,4 +1,4 @@
--- source include/have_innodb.inc
+--source include/innodb_page_size_small.inc
CREATE DATABASE mysqltest_innodb_zip;
USE mysqltest_innodb_zip;
diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug36169.test b/mysql-test/suite/innodb_zip/t/innodb_bug36169.test
index 93051d56639..6a9b2099fa8 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_bug36169.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_bug36169.test
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+--source include/innodb_page_size_small.inc
#
# Bug#36169 create innodb compressed table with too large row size crashed
# http://bugs.mysql.com/36169
diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug36172.test b/mysql-test/suite/innodb_zip/t/innodb_bug36172.test
index 622e0c56b15..6d21d656fd8 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_bug36172.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_bug36172.test
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+--source include/innodb_page_size_small.inc
#
# Test case for bug 36172
#
diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug52745.test b/mysql-test/suite/innodb_zip/t/innodb_bug52745.test
index 5882278ab9b..b7efd0692ca 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_bug52745.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_bug52745.test
@@ -1,4 +1,4 @@
--- source include/have_innodb.inc
+--source include/innodb_page_size_small.inc
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
CREATE TABLE bug52745 (
diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug53591.test b/mysql-test/suite/innodb_zip/t/innodb_bug53591.test
index 1366e0e43ac..0bce587f106 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_bug53591.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_bug53591.test
@@ -1,4 +1,4 @@
--- source include/have_innodb.inc
+--source include/innodb_page_size_small.inc
SET GLOBAL innodb_strict_mode=on;
set old_alter_table=0;
diff --git a/mysql-test/suite/innodb_zip/t/innodb_bug56680.test b/mysql-test/suite/innodb_zip/t/innodb_bug56680.test
index 4e73b1fce0f..0cb1c897f2e 100644
--- a/mysql-test/suite/innodb_zip/t/innodb_bug56680.test
+++ b/mysql-test/suite/innodb_zip/t/innodb_bug56680.test
@@ -1,4 +1,4 @@
---source include/have_innodb.inc
+--source include/innodb_page_size_small.inc
#
# Bug #56680 InnoDB may return wrong results from a case-insensitive index
#
diff --git a/mysql-test/suite/innodb_zip/t/recover.test b/mysql-test/suite/innodb_zip/t/recover.test
index 3969cd2f44e..0cfc2b672fb 100644
--- a/mysql-test/suite/innodb_zip/t/recover.test
+++ b/mysql-test/suite/innodb_zip/t/recover.test
@@ -2,6 +2,13 @@
--source include/have_innodb_max_16k.inc
--source include/not_embedded.inc
+--disable_query_log
+# This test kills the server, which could corrupt some mysql.* tables
+# that are not created with ENGINE=InnoDB.
+# Flush any non-InnoDB tables to prevent that from happening.
+FLUSH TABLES;
+--enable_query_log
+
--echo #
--echo # MDEV-12720 recovery fails with "Generic error"
--echo # for ROW_FORMAT=compressed
diff --git a/mysql-test/suite/innodb_zip/t/restart.test b/mysql-test/suite/innodb_zip/t/restart.test
index a2dacdb4a05..05ac8274278 100644
--- a/mysql-test/suite/innodb_zip/t/restart.test
+++ b/mysql-test/suite/innodb_zip/t/restart.test
@@ -1,9 +1,7 @@
#
# These test make sure that tables are visible after rebooting
#
-
---source include/have_innodb.inc
---source include/have_innodb_zip.inc
+--source include/innodb_page_size_small.inc
--source include/have_partition.inc
--source include/not_embedded.inc
SET default_storage_engine=InnoDB;
diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
index 392a3ed2879..0898a32fbf5 100644
--- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
+++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
@@ -10,8 +10,7 @@
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
--- source include/have_innodb.inc
--- source include/have_innodb_zip.inc
+-- source include/innodb_page_size_small.inc
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
diff --git a/mysql-test/suite/innodb_zip/t/wl5522_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_zip.test
index 7863c2b3ffb..d92093262ac 100644
--- a/mysql-test/suite/innodb_zip/t/wl5522_zip.test
+++ b/mysql-test/suite/innodb_zip/t/wl5522_zip.test
@@ -1,8 +1,7 @@
# Not supported in embedded
--source include/not_embedded.inc
--- source include/have_innodb.inc
--- source include/have_innodb_zip.inc
+-- source include/innodb_page_size_small.inc
call mtr.add_suppression("InnoDB: Unable to import tablespace .* because it already exists. Please DISCARD the tablespace before IMPORT.");
diff --git a/mysql-test/suite/innodb_zip/t/wl6344_compress_level.test b/mysql-test/suite/innodb_zip/t/wl6344_compress_level.test
index df4e66967f7..690efffed56 100644
--- a/mysql-test/suite/innodb_zip/t/wl6344_compress_level.test
+++ b/mysql-test/suite/innodb_zip/t/wl6344_compress_level.test
@@ -9,31 +9,20 @@
# greater than the
# the size of the table when compression level=9
#*******************************************************************
---source include/have_innodb.inc
---source include/have_innodb_zip.inc
+--source include/innodb_page_size_small.inc
-USE test;
-DROP TABLE IF EXISTS tab5;
-DROP TABLE IF EXISTS tab6;
-
---echo #set the other madatory flags before test starts
SET GLOBAL Innodb_file_per_table=on;
-let $innodb_compression_level = `SELECT @@global.innodb_compression_level`;
+SET @save_innodb_compression_level = @@global.innodb_compression_level;
---echo #set the compression level=0 (No compress)
SET global innodb_compression_level=0;
--- echo #check the compression level and the compressed_pages is default
-SELECT @@innodb_compression_level;
-SELECT @@Innodb_file_per_table;
-
-- echo #create table with 1K block size
CREATE TABLE tab5 (col_1 CHAR (255) ,
col_2 VARCHAR (255), col_3 longtext,
col_4 longtext,col_5 longtext,
col_6 longtext , col_7 longtext ,
col_8 longtext ,col_9 longtext ,
-col_10 longtext ,col_11 int auto_increment primary key)
+col_10 longtext ,col_11 int auto_increment primary key)
ENGINE = innodb ROW_FORMAT=compressed key_block_size=1;
-- echo #create indexes
@@ -56,7 +45,8 @@ SET @col_8 = repeat('h', 100);
SET @col_9 = repeat('i', 100);
SET @col_10 = repeat('j', 100);
---echo #insert 10 records
+--echo #insert 10 records
+BEGIN;
let $i = 10;
while ($i) {
@@ -65,8 +55,9 @@ VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9,@col_10);
dec $i;
}
+COMMIT;
---echo #set the compression level=9 (High compress)
+--echo #set the compression level=9 (High compress)
SET global innodb_compression_level=9;
-- echo #create table with 1K block size
@@ -86,19 +77,8 @@ CREATE INDEX idx4 ON tab6(col_7(10));
CREATE INDEX idx5 ON tab6(col_8(10));
CREATE INDEX idx6 ON tab6(col_11);
---echo #load the with repeat function
-SET @col_1 = repeat('a', 100);
-SET @col_2 = repeat('b', 100);
-SET @col_3 = repeat('c', 100);
-SET @col_4 = repeat('d', 100);
-SET @col_5 = repeat('e', 100);
-SET @col_6 = repeat('f', 100);
-SET @col_7 = repeat('g', 100);
-SET @col_8 = repeat('h', 100);
-SET @col_9 = repeat('i', 100);
-SET @col_10 = repeat('j', 100);
-
---echo #insert 10 records
+--echo #insert 10 records
+BEGIN;
let $i = 10;
while ($i) {
@@ -106,30 +86,23 @@ eval INSERT INTO tab6(col_1,col_2,col_3,col_4,col_5,col_6,col_7,col_8,col_9,col_
VALUES (@col_1,@col_2,@col_3,@col_4,@cl_5,@col_6,@col_7,@col_8,@col_9,@col_10);
dec $i;
}
+COMMIT;
-- echo #diff the sizes of the No compressed table and high compressed table
-SET @size=(SELECT
-(SELECT (SUM(DATA_LENGTH+INDEX_LENGTH)/1024/1024)
-FROM INFORMATION_SCHEMA.TABLES
+SET @size=(SELECT
+(SELECT (SUM(DATA_LENGTH+INDEX_LENGTH)/1024/1024)
+FROM INFORMATION_SCHEMA.TABLES
WHERE table_name='tab5' AND ENGINE='InnoDB' AND table_schema='test')
-
-(SELECT SUM(DATA_LENGTH+INDEX_LENGTH)/1024/1024
-FROM INFORMATION_SCHEMA.TABLES
+(SELECT SUM(DATA_LENGTH+INDEX_LENGTH)/1024/1024
+FROM INFORMATION_SCHEMA.TABLES
WHERE table_name='tab6' AND ENGINE='InnoDB' AND table_schema='test')
FROM DUAL);
---echo #check the size of the table, it should not be Negative value
+--echo #check the size of the table, it should not be Negative value
--echo #The results of this query Test pass = 1 and fail=0
SELECT @size >= 0;
+DROP TABLE tab5, tab6;
---echo #
---echo # Cleanup
---echo #
-DROP TABLE tab5;
-DROP TABLE tab6;
-
---echo #reset back the compression_level to default.
---disable_query_log
-eval SET GLOBAL innodb_compression_level=$innodb_compression_level;
---enable_query_log
+SET GLOBAL innodb_compression_level = @save_innodb_compression_level;
diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result
index 04b042059fb..88f39827f27 100644
--- a/mysql-test/suite/maria/maria.result
+++ b/mysql-test/suite/maria/maria.result
@@ -1145,6 +1145,9 @@ 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 '{ ' for key 'v_2'
+show warnings;
+Level Code Message
+Error 1062 Duplicate entry 'a' for key 'v_2'
alter table t1 add key(v);
Warnings:
Note 1831 Duplicate index `v_2`. This is deprecated and will be disallowed in a future release
diff --git a/mysql-test/suite/mariabackup/full_backup.test b/mysql-test/suite/mariabackup/full_backup.test
index a79f54c67e4..f987410cf76 100644
--- a/mysql-test/suite/mariabackup/full_backup.test
+++ b/mysql-test/suite/mariabackup/full_backup.test
@@ -13,7 +13,6 @@ INSERT INTO t VALUES(2);
echo # xtrabackup prepare;
--disable_result_log
exec $XTRABACKUP --prepare --target-dir=$targetdir;
-exec $XTRABACKUP --defaults-file=$targetdir/backup-my.cnf --stats --datadir=$targetdir;
-- source include/restart_and_restore.inc
--enable_result_log
diff --git a/mysql-test/suite/mariabackup/include/restart_and_restore.inc b/mysql-test/suite/mariabackup/include/restart_and_restore.inc
index 39616cc6f15..7ee4a660b78 100644
--- a/mysql-test/suite/mariabackup/include/restart_and_restore.inc
+++ b/mysql-test/suite/mariabackup/include/restart_and_restore.inc
@@ -7,7 +7,7 @@ shutdown_server;
echo # remove datadir;
rmdir $_datadir;
echo # xtrabackup move back;
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir --parallel=2;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir --parallel=2 --throttle=1;
echo # restart server;
exec echo "restart" > $_expect_file_name;
enable_reconnect;
diff --git a/mysql-test/suite/mariabackup/incremental_encrypted.test b/mysql-test/suite/mariabackup/incremental_encrypted.test
index c379b3c8165..04f4ba5d18a 100644
--- a/mysql-test/suite/mariabackup/incremental_encrypted.test
+++ b/mysql-test/suite/mariabackup/incremental_encrypted.test
@@ -27,11 +27,6 @@ echo # Prepare full backup, apply incremental one;
exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir;
exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir;
-# stats also can support encryption, but needs plugin-load and plugin variables, they are stored in backup-my.cnf
-# We need to prepare again to create log files though.
-exec $XTRABACKUP --prepare --target-dir=$basedir;
-exec $XTRABACKUP --defaults-file=$basedir/backup-my.cnf --stats --datadir=$basedir;
-
echo # Restore and check results;
let $targetdir=$basedir;
-- source include/restart_and_restore.inc
diff --git a/mysql-test/suite/mariabackup/suite.pm b/mysql-test/suite/mariabackup/suite.pm
index 8eecd4e8018..26d5c06cdad 100644
--- a/mysql-test/suite/mariabackup/suite.pm
+++ b/mysql-test/suite/mariabackup/suite.pm
@@ -21,11 +21,6 @@ $ENV{XBSTREAM}= ::mtr_exe_maybe_exists(
"$::bindir/extra/mariabackup/$::opt_vs_config/mbstream",
"$::path_client_bindir/mbstream");
-my $tar_version = `tar --version 2>&1`;
-$ENV{HAVE_TAR} = $! ? 0: 1;
-my $mariabackup_help=`$mariabackup_exe --help 2>&1`;
-$ENV{HAVE_XTRABACKUP_TAR_SUPPORT} = (index($mariabackup_help,"'tar'") == -1) ? 0 : 1;
-
$ENV{INNOBACKUPEX}= "$mariabackup_exe --innobackupex";
sub skip_combinations {
diff --git a/mysql-test/suite/mariabackup/tar.result b/mysql-test/suite/mariabackup/tar.result
deleted file mode 100644
index bbb546d7add..00000000000
--- a/mysql-test/suite/mariabackup/tar.result
+++ /dev/null
@@ -1,12 +0,0 @@
-CREATE TABLE t(i INT) ENGINE INNODB;
-INSERT INTO t VALUES(1);
-# xtrabackup backup
-# xtrabackup prepare
-# shutdown server
-# remove datadir
-# xtrabackup move back
-# restart server
-SELECT * FROM t;
-i
-1
-DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/tar.test b/mysql-test/suite/mariabackup/tar.test
deleted file mode 100644
index 3938d597e05..00000000000
--- a/mysql-test/suite/mariabackup/tar.test
+++ /dev/null
@@ -1,30 +0,0 @@
-if (`select $HAVE_TAR = 0`)
-{
- --skip No tar
-}
-if (`select $HAVE_XTRABACKUP_TAR_SUPPORT = 0`)
-{
- --skip Compiled without libarchive
-}
-
-
-CREATE TABLE t(i INT) ENGINE INNODB;
-INSERT INTO t VALUES(1);
-
-echo # xtrabackup backup;
-let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
-let $streamfile=$MYSQLTEST_VARDIR/tmp/backup.tar;
-mkdir $targetdir;
-
-
-exec $XTRABACKUP "--defaults-file=$MYSQLTEST_VARDIR/my.cnf" --backup --stream=tar > $streamfile 2>$targetdir/backup_stream.log;
---disable_result_log
-exec tar -C $targetdir -x < $streamfile;
-echo # xtrabackup prepare;
-exec $XTRABACKUP --prepare --target-dir=$targetdir;
-
--- source include/restart_and_restore.inc
---enable_result_log
-SELECT * FROM t;
-DROP TABLE t;
-rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/xb_file_key_management.test b/mysql-test/suite/mariabackup/xb_file_key_management.test
index bc975a7cdc4..be0b15eb387 100644
--- a/mysql-test/suite/mariabackup/xb_file_key_management.test
+++ b/mysql-test/suite/mariabackup/xb_file_key_management.test
@@ -19,7 +19,6 @@ echo # xtrabackup prepare;
--disable_result_log
exec $XTRABACKUP --prepare --target-dir=$targetdir;
-exec $XTRABACKUP --defaults-file=$targetdir/backup-my.cnf --stats --datadir=$targetdir ;
-- source include/restart_and_restore.inc
--enable_result_log
diff --git a/mysql-test/suite/mariabackup/xbstream.test b/mysql-test/suite/mariabackup/xbstream.test
index 06e5685276c..f2b4704a87e 100644
--- a/mysql-test/suite/mariabackup/xbstream.test
+++ b/mysql-test/suite/mariabackup/xbstream.test
@@ -9,7 +9,7 @@ echo # xtrabackup backup to stream;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --stream=xbstream > $streamfile 2>$targetdir/backup_stream.log;
echo # xbstream extract;
--disable_result_log
-exec $XBSTREAM -x -C $targetdir --parallel=16 < $streamfile;
+exec $XBSTREAM -x -C $targetdir < $streamfile;
echo # xtrabackup prepare;
exec $XTRABACKUP --prepare --target-dir=$targetdir;
diff --git a/mysql-test/suite/multi_source/mdev-9544.cnf b/mysql-test/suite/multi_source/mdev-9544.cnf
new file mode 100644
index 00000000000..b43aca5370d
--- /dev/null
+++ b/mysql-test/suite/multi_source/mdev-9544.cnf
@@ -0,0 +1,22 @@
+!include my.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
+
+[mysqld.3]
+log-bin
+log-slave-updates
+
+[mysqld.4]
+server-id=4
+log-bin=server4-bin
+log-slave-updates
+
+[ENV]
+SERVER_MYPORT_4= @mysqld.4.port
+SERVER_MYSOCK_4= @mysqld.4.socket
diff --git a/mysql-test/suite/multi_source/mdev-9544.result b/mysql-test/suite/multi_source/mdev-9544.result
new file mode 100644
index 00000000000..42e6b6a9f56
--- /dev/null
+++ b/mysql-test/suite/multi_source/mdev-9544.result
@@ -0,0 +1,90 @@
+connect server_1,127.0.0.1,root,,,$SERVER_MYPORT_1;
+connect server_2,127.0.0.1,root,,,$SERVER_MYPORT_2;
+connect server_3,127.0.0.1,root,,,$SERVER_MYPORT_3;
+connect server_4,127.0.0.1,root,,,$SERVER_MYPORT_4;
+connection server_1;
+create database a;
+use a;
+create table t1(a int);
+insert into t1 values(1);
+create table t2(a int);
+insert into t2 values(1);
+connection server_2;
+create database b;
+use b;
+create table t1(a int);
+insert into t1 values(1);
+create table t2(a int);
+insert into t2 values(1);
+connection server_3;
+create database c;
+use c;
+create table t1(a int);
+insert into t1 values(1);
+create table t2(a int);
+insert into t2 values(1);
+connection server_4;
+change master 'm1' to master_port=MYPORT_1 , master_host='127.0.0.1', master_user='root';
+change master 'm2' to master_port=MYPORT_2 , master_host='127.0.0.1', master_user='root';
+change master to master_port=MYPORT_3 , master_host='127.0.0.1', master_user='root';
+start all slaves;
+set default_master_connection = 'm1';
+include/wait_for_slave_to_start.inc
+set default_master_connection = 'm2';
+include/wait_for_slave_to_start.inc
+set default_master_connection = '';
+include/wait_for_slave_to_start.inc
+use a;
+show tables;
+Tables_in_a
+t1
+t2
+use b;
+show tables;
+Tables_in_b
+t1
+t2
+use c;
+show tables;
+Tables_in_c
+t1
+t2
+#TEST
+SET default_master_connection = "m1";
+SET default_master_connection = "m2";
+SET default_master_connection = "";
+flush logs;
+SET default_master_connection = "m1";
+#log Rotated
+mysqld-relay-bin.000002
+mysqld-relay-bin.000003
+mysqld-relay-bin.index
+SET default_master_connection = "m2";
+#log Rotated
+mysqld-relay-bin-m1.000002
+mysqld-relay-bin-m1.000003
+mysqld-relay-bin-m1.index
+SET default_master_connection = "";
+#log Rotated
+mysqld-relay-bin-m2.000002
+mysqld-relay-bin-m2.000003
+mysqld-relay-bin-m2.index
+#CleanUp
+connection server_1;
+drop database a;
+connection server_2;
+drop database b;
+connection server_3;
+drop database c;
+connection server_4;
+stop all slaves;
+Warnings:
+Note 1938 SLAVE 'm2' stopped
+Note 1938 SLAVE '' stopped
+Note 1938 SLAVE 'm1' stopped
+SET default_master_connection = "m1";
+include/wait_for_slave_to_stop.inc
+SET default_master_connection = "m2";
+include/wait_for_slave_to_stop.inc
+SET default_master_connection = "";
+include/wait_for_slave_to_stop.inc
diff --git a/mysql-test/suite/multi_source/mdev-9544.test b/mysql-test/suite/multi_source/mdev-9544.test
new file mode 100644
index 00000000000..f532a63a585
--- /dev/null
+++ b/mysql-test/suite/multi_source/mdev-9544.test
@@ -0,0 +1,116 @@
+--source include/not_embedded.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+--connect (server_1,127.0.0.1,root,,,$SERVER_MYPORT_1)
+--connect (server_2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+--connect (server_3,127.0.0.1,root,,,$SERVER_MYPORT_3)
+--connect (server_4,127.0.0.1,root,,,$SERVER_MYPORT_4)
+
+--connection server_1
+create database a;
+use a;
+create table t1(a int);
+insert into t1 values(1);
+create table t2(a int);
+insert into t2 values(1);
+--save_master_pos
+
+--connection server_2
+create database b;
+use b;
+create table t1(a int);
+insert into t1 values(1);
+create table t2(a int);
+insert into t2 values(1);
+--save_master_pos
+
+--connection server_3
+create database c;
+use c;
+create table t1(a int);
+insert into t1 values(1);
+create table t2(a int);
+insert into t2 values(1);
+--save_master_pos
+
+--connection server_4
+--disable_warnings
+--replace_result $SERVER_MYPORT_1 MYPORT_1
+eval change master 'm1' to master_port=$SERVER_MYPORT_1 , master_host='127.0.0.1', master_user='root';
+--replace_result $SERVER_MYPORT_2 MYPORT_2
+eval change master 'm2' to master_port=$SERVER_MYPORT_2 , master_host='127.0.0.1', master_user='root';
+--replace_result $SERVER_MYPORT_3 MYPORT_3
+eval change master to master_port=$SERVER_MYPORT_3 , master_host='127.0.0.1', master_user='root';
+start all slaves;
+set default_master_connection = 'm1';
+--source include/wait_for_slave_to_start.inc
+set default_master_connection = 'm2';
+--source include/wait_for_slave_to_start.inc
+set default_master_connection = '';
+--source include/wait_for_slave_to_start.inc
+
+--enable_warnings
+--sync_with_master 0,'m1'
+--sync_with_master 0,'m2'
+--sync_with_master 0,''
+use a;
+show tables;
+use b;
+show tables;
+use c;
+show tables;
+--echo #TEST
+SET default_master_connection = "m1";
+--let $old_m1 = query_get_value("show relaylog events;", "Log_name",1)
+SET default_master_connection = "m2";
+--let $old_m2 = query_get_value("show relaylog events;", "Log_name",1)
+SET default_master_connection = "";
+--let $old__ = query_get_value("show relaylog events;", "Log_name",1)
+flush logs;
+--sleep 2
+--let $MYSQLD_DATADIR = `select @@datadir`
+SET default_master_connection = "m1";
+--let $new_m1 = query_get_value("show relaylog events;", "Log_name",1)
+--if ($new_m1 != $old_m1) {
+ --echo #log Rotated
+ --exec ls $MYSQLD_DATADIR | grep "mysqld-relay-bin\."
+}
+SET default_master_connection = "m2";
+--let $new_m2 = query_get_value("show relaylog events;", "Log_name",1)
+--if ($new_m2 != $old_m2) {
+ --echo #log Rotated
+ --exec ls $MYSQLD_DATADIR | grep "mysqld-relay-bin-m1"
+}
+SET default_master_connection = "";
+--let $new__ = query_get_value("show relaylog events;", "Log_name",1)
+--if ($new__ != $old__) {
+ --echo #log Rotated
+ --exec ls $MYSQLD_DATADIR | grep "mysqld-relay-bin-m2"
+}
+
+--echo #CleanUp
+--connection server_1
+drop database a;
+--save_master_pos
+
+--connection server_2
+drop database b;
+--save_master_pos
+
+--connection server_3
+drop database c;
+--save_master_pos
+
+--connection server_4
+--sync_with_master 0,'m1'
+--sync_with_master 0,'m2'
+--sync_with_master 0,''
+stop all slaves;
+SET default_master_connection = "m1";
+--source include/wait_for_slave_to_stop.inc
+SET default_master_connection = "m2";
+--source include/wait_for_slave_to_stop.inc
+SET default_master_connection = "";
+--source include/wait_for_slave_to_stop.inc
+
diff --git a/mysql-test/suite/perfschema/r/start_server_1_digest.result b/mysql-test/suite/perfschema/r/start_server_1_digest.result
new file mode 100644
index 00000000000..cf07022d344
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/start_server_1_digest.result
@@ -0,0 +1,7 @@
+SELECT "Digest table has a size 1 and is full already." as use_case;
+use_case
+Digest table has a size 1 and is full already.
+select SCHEMA_NAME, DIGEST, DIGEST_TEXT
+from performance_schema.events_statements_summary_by_digest;
+SCHEMA_NAME DIGEST DIGEST_TEXT
+NULL NULL NULL
diff --git a/mysql-test/suite/perfschema/r/view_table_io.result b/mysql-test/suite/perfschema/r/view_table_io.result
index 5d8ad26ae77..2f9a70cdeaa 100644
--- a/mysql-test/suite/perfschema/r/view_table_io.result
+++ b/mysql-test/suite/perfschema/r/view_table_io.result
@@ -51,7 +51,7 @@ bar 2
insert into marker set a = 1;
optimize table test.v1;
Table Op Msg_type Msg_text
-test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE'
test.v1 optimize status Operation failed
insert into marker set a = 1;
select * from test.v1;
diff --git a/mysql-test/suite/perfschema/t/start_server_1_digest-master.opt b/mysql-test/suite/perfschema/t/start_server_1_digest-master.opt
new file mode 100644
index 00000000000..c3a6012fbac
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/start_server_1_digest-master.opt
@@ -0,0 +1 @@
+--loose-performance-schema-digests-size=1
diff --git a/mysql-test/suite/perfschema/t/start_server_1_digest.test b/mysql-test/suite/perfschema/t/start_server_1_digest.test
new file mode 100644
index 00000000000..998d9a5eebe
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/start_server_1_digest.test
@@ -0,0 +1,15 @@
+# -----------------------------------------------------------------------
+# Tests for the performance schema statement Digests.
+# -----------------------------------------------------------------------
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/no_protocol.inc
+
+SELECT "Digest table has a size 1 and is full already." as use_case;
+
+select SCHEMA_NAME, DIGEST, DIGEST_TEXT
+ from performance_schema.events_statements_summary_by_digest;
+
+
+
diff --git a/mysql-test/suite/plugins/r/show_all_plugins.result b/mysql-test/suite/plugins/r/show_all_plugins.result
index 4471011b660..dd6cbfce4c4 100644
--- a/mysql-test/suite/plugins/r/show_all_plugins.result
+++ b/mysql-test/suite/plugins/r/show_all_plugins.result
@@ -26,7 +26,7 @@ three_attempts NOT INSTALLED AUTHENTICATION dialog_examples.so GPL
two_questions NOT INSTALLED AUTHENTICATION dialog_examples.so GPL
show status like '%libraries%';
Variable_name Value
-Opened_plugin_libraries 8
+Opened_plugin_libraries 7
show plugins soname where library = 'ha_example.so';
Name Status Type Library License
EXAMPLE NOT INSTALLED STORAGE ENGINE ha_example.so GPL
diff --git a/mysql-test/suite/rpl/r/rpl_mdev-11092.result b/mysql-test/suite/rpl/r/rpl_mdev-11092.result
new file mode 100644
index 00000000000..90b809477b2
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_mdev-11092.result
@@ -0,0 +1,21 @@
+include/master-slave.inc
+[connection master]
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*");
+SET GLOBAL max_binlog_cache_size = 4096;
+SET GLOBAL binlog_cache_size = 4096;
+SET GLOBAL max_binlog_stmt_cache_size = 4096;
+SET GLOBAL binlog_stmt_cache_size = 4096;
+disconnect master;
+connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
+CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MYISAM;
+connection master;
+ERROR HY000: Writing one row to the row-based binary log failed
+include/wait_for_slave_sql_error_and_skip.inc [errno=1590]
+connection master;
+SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
+SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
+SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
+SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
+DROP TABLE t1;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/sequence.result b/mysql-test/suite/rpl/r/sequence.result
index 9e0c8b7bc5b..6286c5c7106 100644
--- a/mysql-test/suite/rpl/r/sequence.result
+++ b/mysql-test/suite/rpl/r/sequence.result
@@ -38,7 +38,7 @@ insert into t1 select * from s1;
insert into s1 values(-100,-1000,9223372036854775806,1,1,1000,0,0);
insert into t1 select * from s1;
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 10 0 0
21 1 9223372036854775806 1 1 10 0 0
21 1 9223372036854775806 1 1 10 0 0
@@ -47,7 +47,7 @@ next_value min_value max_value start increment cache cycle round
-100 -1000 9223372036854775806 1 1 1000 0 0
connection slave;
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 10 0 0
21 1 9223372036854775806 1 1 10 0 0
21 1 9223372036854775806 1 1 10 0 0
@@ -56,7 +56,7 @@ next_value min_value max_value start increment cache cycle round
-100 -1000 9223372036854775806 1 1 1000 0 0
connection slave2;
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 10 0 0
21 1 9223372036854775806 1 1 10 0 0
21 1 9223372036854775806 1 1 10 0 0
@@ -69,14 +69,14 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE SEQUENCE s1 cache=10
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) PAGE_CHECKSUM=1
master-bin.000001 # Annotate_rows # # create table t1 select * from s1
master-bin.000001 # Table_map # # table_id: # (test.t1)
diff --git a/mysql-test/suite/rpl/t/rpl_mdev-11092.opt b/mysql-test/suite/rpl/t/rpl_mdev-11092.opt
new file mode 100644
index 00000000000..7f1d270d29f
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mdev-11092.opt
@@ -0,0 +1 @@
+--binlog_checksum=1 --binlog-annotate-row-events=1
diff --git a/mysql-test/suite/rpl/t/rpl_mdev-11092.test b/mysql-test/suite/rpl/t/rpl_mdev-11092.test
new file mode 100644
index 00000000000..c8b2b7f2ad1
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_mdev-11092.test
@@ -0,0 +1,53 @@
+--source include/have_innodb.inc
+--source include/master-slave.inc
+--source include/not_embedded.inc
+--source include/not_windows.inc
+--source include/have_binlog_format_row.inc
+
+########################################################################################
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*");
+
+let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1);
+let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1);
+let $old_max_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_stmt_cache_size", Value, 1);
+let $old_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_stmt_cache_size", Value, 1);
+
+SET GLOBAL max_binlog_cache_size = 4096;
+SET GLOBAL binlog_cache_size = 4096;
+SET GLOBAL max_binlog_stmt_cache_size = 4096;
+SET GLOBAL binlog_stmt_cache_size = 4096;
+disconnect master;
+connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
+
+CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MYISAM;
+
+let $data = `select concat('"', repeat('a',2000), '"')`;
+
+connection master;
+
+--disable_query_log
+--error ER_BINLOG_ROW_LOGGING_FAILED
+eval INSERT INTO t1 (a, data) VALUES (2,
+ CONCAT($data, $data, $data, $data, $data, $data));
+--enable_query_log
+
+# Incident event
+# 1590=ER_SLAVE_INCIDENT
+--let $slave_sql_errno= 1590
+--source include/wait_for_slave_sql_error_and_skip.inc
+
+connection master;
+
+--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE
+--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
+--replace_result $old_binlog_cache_size ORIGINAL_VALUE
+--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
+--replace_result $old_max_binlog_stmt_cache_size ORIGINAL_VALUE
+--eval SET GLOBAL max_binlog_stmt_cache_size= $old_max_binlog_stmt_cache_size
+--replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE
+--eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size
+
+DROP TABLE t1;
+
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result
index bb57a704c11..76ebdeda0f7 100644
--- a/mysql-test/suite/sql_sequence/alter.result
+++ b/mysql-test/suite/sql_sequence/alter.result
@@ -6,7 +6,7 @@ Note 1051 Unknown table 'test.t1'
#
CREATE SEQUENCE t1 nocache engine=myisam;
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 0 0 0
select next value for t1;
next value for t1
@@ -16,7 +16,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 50 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
2 1 9223372036854775806 50 1 0 0 0
select next value for t1;
next value for t1
@@ -26,7 +26,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 50 minvalue -100 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 -100 9223372036854775806 50 1 0 0 0
alter sequence t1 minvalue=100 start=100;
ERROR HY000: Sequence 'test.t1' values are conflicting
@@ -35,14 +35,14 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 100 minvalue 100 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
100 100 9223372036854775806 100 1 0 0 0
alter sequence t1 maxvalue=500;
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 100 minvalue 100 maxvalue 500 increment by 1 nocache nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
100 100 500 100 1 0 0 0
drop sequence t1;
CREATE SEQUENCE t1 engine=myisam;
@@ -64,7 +64,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 0 0 0
select next value for t1;
next value for t1
@@ -75,8 +75,8 @@ next value for t1
select next value for t1;
next value for t1
3
-select next_value, round from t1;
-next_value round
+select next_not_cached_value, cycle_count from t1;
+next_not_cached_value cycle_count
4 0
drop sequence t1;
CREATE SEQUENCE t1 maxvalue=100 engine=myisam;
@@ -85,7 +85,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
alter sequence t1 cycle;
show create sequence t1;
@@ -97,7 +97,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 15 minvalue 10 maxvalue 20 increment by 1 cache 1000 cycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
15 10 20 15 1 1000 1 0
select NEXT VALUE for t1 from seq_1_to_10;
NEXT VALUE for t1
@@ -131,7 +131,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 50 minvalue -100 maxvalue 100 increment by -2 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 -100 100 50 -2 1000 0 0
select NEXT VALUE for t1 from seq_1_to_10;
NEXT VALUE for t1
@@ -151,7 +151,7 @@ drop sequence t1;
CREATE SEQUENCE t1 cache 10 engine=innodb;
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 10 0 0
select next value for t1;
next value for t1
@@ -161,7 +161,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 100 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 10 nocycle ENGINE=InnoDB
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 9223372036854775806 100 1 10 0 0
select next value for t1;
next value for t1
@@ -195,7 +195,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB COMMENT='foo'
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3001 1 9223372036854775806 1 1 1000 0 0
drop sequence t1;
CREATE SEQUENCE t1 engine=myisam;
@@ -227,7 +227,7 @@ next value for t1
select next value for t1;
ERROR HY000: Sequence 'test.t1' has run out
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
0 1 100 50 -2 1000 0 0
alter sequence t1 restart;
select next value for t1;
diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test
index 584bb6f19aa..fd1809ccd2f 100644
--- a/mysql-test/suite/sql_sequence/alter.test
+++ b/mysql-test/suite/sql_sequence/alter.test
@@ -43,7 +43,7 @@ select * from t1;
select next value for t1;
select next value for t1;
select next value for t1;
-select next_value, round from t1;
+select next_not_cached_value, cycle_count from t1;
drop sequence t1;
CREATE SEQUENCE t1 maxvalue=100 engine=myisam;
diff --git a/mysql-test/suite/sql_sequence/aria.result b/mysql-test/suite/sql_sequence/aria.result
index 8bf45563a6f..b39d85d58ca 100644
--- a/mysql-test/suite/sql_sequence/aria.result
+++ b/mysql-test/suite/sql_sequence/aria.result
@@ -26,7 +26,7 @@ NEXT VALUE for t1 seq
19 19
20 20
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
21 1 9223372036854775806 1 1 10 0 0
drop sequence t1;
create sequence s1;
diff --git a/mysql-test/suite/sql_sequence/binlog.result b/mysql-test/suite/sql_sequence/binlog.result
index b4f772a204b..f01b3234e96 100644
--- a/mysql-test/suite/sql_sequence/binlog.result
+++ b/mysql-test/suite/sql_sequence/binlog.result
@@ -1,15 +1,15 @@
create or replace sequence s1 cache 3;
-select next value for s1, min_value from s1 where max_value> 1;
-next value for s1 min_value
+select next value for s1, minimum_value from s1 where maximum_value> 1;
+next value for s1 minimum_value
1 1
-select next value for s1, min_value from s1 where max_value> 2;
-next value for s1 min_value
+select next value for s1, minimum_value from s1 where maximum_value> 2;
+next value for s1 minimum_value
2 1
-select next value for s1, min_value from s1 where max_value> 3;
-next value for s1 min_value
+select next value for s1, minimum_value from s1 where maximum_value> 3;
+next value for s1 minimum_value
3 1
-select next value for s1, min_value from s1 where max_value> 4;
-next value for s1 min_value
+select next value for s1, minimum_value from s1 where maximum_value> 4;
+next value for s1 minimum_value
4 1
alter sequence s1 maxvalue 1000;
drop sequence s1;
@@ -18,12 +18,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; create or replace sequence s1 cache 3
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # select next value for s1, min_value from s1 where max_value> 1
+master-bin.000001 # Annotate_rows # # select next value for s1, minimum_value from s1 where maximum_value> 1
master-bin.000001 # Table_map # # table_id: # (test.s1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
-master-bin.000001 # Annotate_rows # # select next value for s1, min_value from s1 where max_value> 4
+master-bin.000001 # Annotate_rows # # select next value for s1, minimum_value from s1 where maximum_value> 4
master-bin.000001 # Table_map # # table_id: # (test.s1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
diff --git a/mysql-test/suite/sql_sequence/binlog.test b/mysql-test/suite/sql_sequence/binlog.test
index 56d835f05ca..5f2d52d7864 100644
--- a/mysql-test/suite/sql_sequence/binlog.test
+++ b/mysql-test/suite/sql_sequence/binlog.test
@@ -11,10 +11,10 @@ reset master; # get rid of previous tests binlog
--enable_query_log
create or replace sequence s1 cache 3;
-select next value for s1, min_value from s1 where max_value> 1;
-select next value for s1, min_value from s1 where max_value> 2;
-select next value for s1, min_value from s1 where max_value> 3;
-select next value for s1, min_value from s1 where max_value> 4;
+select next value for s1, minimum_value from s1 where maximum_value> 1;
+select next value for s1, minimum_value from s1 where maximum_value> 2;
+select next value for s1, minimum_value from s1 where maximum_value> 3;
+select next value for s1, minimum_value from s1 where maximum_value> 4;
#
# Alter sequence
diff --git a/mysql-test/suite/sql_sequence/create.result b/mysql-test/suite/sql_sequence/create.result
index 4962752c7d9..d7492f9a22b 100644
--- a/mysql-test/suite/sql_sequence/create.result
+++ b/mysql-test/suite/sql_sequence/create.result
@@ -8,17 +8,17 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
create or replace sequence t1 engine=innodb;
show create sequence t1;
@@ -27,17 +27,17 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
create or replace sequence t1 engine=maria;
show create sequence t1;
@@ -46,17 +46,17 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=Aria SEQUENCE=1
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
create or replace sequence t1 engine=archive;
ERROR HY000: Table storage engine 'ARCHIVE' does not support the create option 'SEQUENCE'
@@ -67,42 +67,42 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 10 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
10 1 9223372036854775806 10 1 1000 0 0
create or replace sequence t1 minvalue=11;
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 11 minvalue 11 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 11 9223372036854775806 11 1 1000 0 0
create or replace sequence t1 maxvalue=13 increment by -1;
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 13 minvalue -9223372036854775807 maxvalue 13 increment by -1 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
13 -9223372036854775807 13 13 -1 1000 0 0
create or replace sequence t1 increment by -1 cache 100;
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with -1 minvalue -9223372036854775807 maxvalue -1 increment by -1 cache 100 nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
-1 -9223372036854775807 -1 -1 -1 100 0 0
create or replace sequence t1 cycle;
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 cycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 1 0
create or replace sequence t1 nocycle;
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
show create sequence t1;
Table Create Table
@@ -112,7 +112,7 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 14 minvalue 14 maxvalue 9223372036854775806 increment by 1 cache 1000 cycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
14 14 9223372036854775806 14 1 1000 1 0
create or replace sequence t1 cycle increment by -1;
show create sequence t1;
@@ -124,7 +124,7 @@ create sequence if not exists t1 start with 10;
Warnings:
Note 1050 Table 't1' already exists
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
show create sequence t1;
Table Create Table
@@ -134,14 +134,14 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 10 minvalue 10 maxvalue 11 increment by 1 nocache cycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
10 10 11 10 1 0 1 0
create or replace sequence t1 start with 10 minvalue=-10 maxvalue=11 cache=10 cycle increment by 10;
show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 10 minvalue -10 maxvalue 11 increment by 10 cache 10 cycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
10 -10 11 10 10 10 1 0
create or replace sequence t1 start with 10 NO MAXVALUE NO MINVALUE;
create or replace sequence t1 start with 10 maxvalue 10;
@@ -155,12 +155,12 @@ show create sequence t1;
Table Create Table
t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 0 cache 1000 nocycle ENGINE=MyISAM
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 0 1000 0 0
drop sequence t1;
create table t1 (a int);
show create sequence t1;
-ERROR HY000: 'test.t1' is not SEQUENCE
+ERROR 42S02: 'test.t1' is not a SEQUENCE
drop sequence t1;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop sequence if exists t1;
@@ -193,46 +193,46 @@ drop sequence t1;
create sequence t1;
show fields from t1;
Field Type Null Key Default Extra
-next_value bigint(21) NO NULL
-min_value bigint(21) NO NULL
-max_value bigint(21) NO NULL
-start bigint(21) NO NULL
+next_not_cached_value bigint(21) NO NULL
+minimum_value bigint(21) NO NULL
+maximum_value bigint(21) NO NULL
+start_value bigint(21) NO NULL
increment bigint(21) NO NULL
-cache bigint(21) NO NULL
-cycle tinyint(1) unsigned NO NULL
-round bigint(21) NO NULL
+cache_size bigint(21) unsigned NO NULL
+cycle_option tinyint(1) unsigned NO NULL
+cycle_count bigint(21) NO NULL
flush tables;
show fields from t1;
Field Type Null Key Default Extra
-next_value bigint(21) NO NULL
-min_value bigint(21) NO NULL
-max_value bigint(21) NO NULL
-start bigint(21) NO NULL
+next_not_cached_value bigint(21) NO NULL
+minimum_value bigint(21) NO NULL
+maximum_value bigint(21) NO NULL
+start_value bigint(21) NO NULL
increment bigint(21) NO NULL
-cache bigint(21) NO NULL
-cycle tinyint(1) unsigned NO NULL
-round bigint(21) NO NULL
+cache_size bigint(21) unsigned NO NULL
+cycle_option tinyint(1) unsigned NO NULL
+cycle_count bigint(21) NO NULL
create or replace sequence t1 engine=aria;
show fields from t1;
Field Type Null Key Default Extra
-next_value bigint(21) NO NULL
-min_value bigint(21) NO NULL
-max_value bigint(21) NO NULL
-start bigint(21) NO NULL
+next_not_cached_value bigint(21) NO NULL
+minimum_value bigint(21) NO NULL
+maximum_value bigint(21) NO NULL
+start_value bigint(21) NO NULL
increment bigint(21) NO NULL
-cache bigint(21) NO NULL
-cycle tinyint(1) unsigned NO NULL
-round bigint(21) NO NULL
+cache_size bigint(21) unsigned NO NULL
+cycle_option tinyint(1) unsigned NO NULL
+cycle_count bigint(21) NO NULL
show fields from t1;
Field Type Null Key Default Extra
-next_value bigint(21) NO NULL
-min_value bigint(21) NO NULL
-max_value bigint(21) NO NULL
-start bigint(21) NO NULL
+next_not_cached_value bigint(21) NO NULL
+minimum_value bigint(21) NO NULL
+maximum_value bigint(21) NO NULL
+start_value bigint(21) NO NULL
increment bigint(21) NO NULL
-cache bigint(21) NO NULL
-cycle tinyint(1) unsigned NO NULL
-round bigint(21) NO NULL
+cache_size bigint(21) unsigned NO NULL
+cycle_option tinyint(1) unsigned NO NULL
+cycle_count bigint(21) NO NULL
flush tables;
create or replace sequence t1 comment= "test 1";
show create sequence t1;
@@ -241,14 +241,14 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1 COMMENT='test 1'
create or replace sequence t1 comment= "test 2" min_rows=1 max_rows=2;
show create sequence t1;
@@ -257,27 +257,28 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM MIN_ROWS=1 MAX_ROWS=2 SEQUENCE=1 COMMENT='test 2'
create or replace sequence t1 start=1 increment= 2;
create or replace sequence t1 start 1 increment 2;
+create or replace sequence t1 cache +1;
drop sequence t1;
CREATE TABLE t1 (
-`next_value` bigint(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`next_not_cached_value` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
-`cache` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` bigint(21) NOT NULL
+`cache_size` bigint(21) unsigned NOT NULL,
+`cycle_option` tinyint(1) unsigned NOT NULL,
+`cycle_count` bigint(21) NOT NULL
) sequence=1;
show create sequence t1;
Table Create Table
@@ -285,93 +286,93 @@ t1 CREATE SEQUENCE `t1` start with 1 minvalue 1 maxvalue 9223372036854775806 inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
- `cache` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` bigint(21) NOT NULL
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count` bigint(21) NOT NULL
) ENGINE=MyISAM SEQUENCE=1
drop sequence t1;
CREATE OR REPLACE TABLE t1 (
-`next_val` bigint(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`next_not_cached_value` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
-`cache` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` bigint(21) NOT NULL
+`cache_size` bigint(21) unsigned NOT NULL,
+`cycle_option` tinyint(1) unsigned NOT NULL,
+`cycle_count_not_exists` bigint(21) NOT NULL
) sequence=1;
-ERROR HY000: Sequence 'test.t1' table structure is invalid (next_val)
+ERROR HY000: Sequence 'test.t1' table structure is invalid (cycle_count_not_exists)
CREATE OR REPLACE TABLE t1 (
-`next_value` int(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`next_not_cached_value` int(21) NOT NULL,
+`minimum_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
-`cache` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` bigint(21) NOT NULL
+`cache_size` bigint(21) unsigned NOT NULL,
+`cycle_option` tinyint(1) unsigned NOT NULL,
+`cycle_count` bigint(21) NOT NULL
) sequence=1;
-ERROR HY000: Sequence 'test.t1' table structure is invalid (next_value)
+ERROR HY000: Sequence 'test.t1' table structure is invalid (next_not_cached_value)
CREATE OR REPLACE TABLE t1 (
-`next_val` bigint(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`next_not_cached_value` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
-`cache` bigint(21) NOT NULL,
+`cache_size` bigint(21) unsigned NOT NULL,
`cycle` bigint(21) unsigned NOT NULL, /* error */
-`round` bigint(21) NOT NULL
+`cycle_count` bigint(21) NOT NULL
) sequence=1;
-ERROR HY000: Sequence 'test.t1' table structure is invalid (next_val)
+ERROR HY000: Sequence 'test.t1' table structure is invalid (cycle)
CREATE OR REPLACE TABLE t1 (
-`next_value` bigint(21),
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`next_not_cached_value` bigint(21), /* error */
+`minimum_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
-`cache` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` bigint(21) NOT NULL
+`cache_size` bigint(21) unsigned NOT NULL,
+`cycle_option` tinyint(1) unsigned NOT NULL,
+`cycle_count` bigint(21) NOT NULL
) sequence=1;
-ERROR HY000: Sequence 'test.t1' table structure is invalid (next_value)
+ERROR HY000: Sequence 'test.t1' table structure is invalid (next_not_cached_value)
CREATE OR REPLACE TABLE t1 (
-`next_value` bigint(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`next_not_cached_value` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
-`cache` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` bigint(21) NOT NULL,
+`cache_size` bigint(21) unsigned NOT NULL,
+`cycle_option` tinyint(1) unsigned NOT NULL,
+`cycle_count` bigint(21) NOT NULL,
extra_field bigint(21)
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (Wrong number of columns)
CREATE OR REPLACE TABLE t1 (
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`next_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NULL,
+`next_not_cached_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
-`cache` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` bigint(21) NOT NULL
+`cache_size` bigint(21) unsigned NOT NULL,
+`cycle_option` tinyint(1) unsigned NOT NULL,
+`cycle_count` bigint(21) NOT NULL
) sequence=1;
-ERROR HY000: Sequence 'test.t1' table structure is invalid (min_value)
+ERROR HY000: Sequence 'test.t1' table structure is invalid (minimum_value)
CREATE OR REPLACE TABLE t1 (
-`next_value` bigint(21) NOT NULL,
-`min_value` bigint(21) NOT NULL,
-`max_value` bigint(21) NOT NULL,
-`start` bigint(21) NOT NULL,
+`next_not_cached_value` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
-`cache` bigint(21) NOT NULL,
-`cycle` tinyint(1) unsigned NOT NULL,
-`round` bigint(21) NOT NULL,
-key key1 (next_value)
+`cache_size` bigint(21) unsigned NOT NULL,
+`cycle_option` tinyint(1) unsigned NOT NULL,
+`cycle_count` bigint(21) NOT NULL,
+key key1 (next_not_cached_value)
) sequence=1;
ERROR HY000: Sequence 'test.t1' table structure is invalid (Sequence tables cannot have any keys)
drop sequence if exists t1;
diff --git a/mysql-test/suite/sql_sequence/create.test b/mysql-test/suite/sql_sequence/create.test
index cf094c2cedd..23c32939efc 100644
--- a/mysql-test/suite/sql_sequence/create.test
+++ b/mysql-test/suite/sql_sequence/create.test
@@ -92,7 +92,7 @@ drop sequence t1;
#
create table t1 (a int);
---error ER_WRONG_OBJECT
+--error ER_NOT_SEQUENCE
show create sequence t1;
--error ER_NOT_SEQUENCE2
drop sequence t1;
@@ -149,6 +149,7 @@ show create sequence t1;
show create table t1;
create or replace sequence t1 start=1 increment= 2;
create or replace sequence t1 start 1 increment 2;
+create or replace sequence t1 cache +1;
drop sequence t1;
#
@@ -156,14 +157,14 @@ drop sequence t1;
#
CREATE TABLE t1 (
- `next_value` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
- `cache` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` bigint(21) NOT NULL
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count` bigint(21) NOT NULL
) sequence=1;
show create sequence t1;
@@ -174,40 +175,40 @@ drop sequence t1;
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_val` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
- `cache` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` bigint(21) NOT NULL
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count_not_exists` bigint(21) NOT NULL
) sequence=1;
# Wrong type
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_value` int(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `next_not_cached_value` int(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
- `cache` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` bigint(21) NOT NULL
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count` bigint(21) NOT NULL
) sequence=1;
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_val` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
- `cache` bigint(21) NOT NULL,
+ `cache_size` bigint(21) unsigned NOT NULL,
`cycle` bigint(21) unsigned NOT NULL, /* error */
- `round` bigint(21) NOT NULL
+ `cycle_count` bigint(21) NOT NULL
) sequence=1;
@@ -215,28 +216,28 @@ CREATE OR REPLACE TABLE t1 (
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_value` bigint(21),
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `next_not_cached_value` bigint(21), /* error */
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
- `cache` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` bigint(21) NOT NULL
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count` bigint(21) NOT NULL
) sequence=1;
# Extra field
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_value` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
- `cache` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` bigint(21) NOT NULL,
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count` bigint(21) NOT NULL,
extra_field bigint(21)
) sequence=1;
@@ -244,29 +245,29 @@ CREATE OR REPLACE TABLE t1 (
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `next_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
- `cache` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` bigint(21) NOT NULL
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count` bigint(21) NOT NULL
) sequence=1;
# key
--error ER_SEQUENCE_INVALID_TABLE_STRUCTURE
CREATE OR REPLACE TABLE t1 (
- `next_value` bigint(21) NOT NULL,
- `min_value` bigint(21) NOT NULL,
- `max_value` bigint(21) NOT NULL,
- `start` bigint(21) NOT NULL,
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
`increment` bigint(21) NOT NULL,
- `cache` bigint(21) NOT NULL,
- `cycle` tinyint(1) unsigned NOT NULL,
- `round` bigint(21) NOT NULL,
- key key1 (next_value)
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count` bigint(21) NOT NULL,
+ key key1 (next_not_cached_value)
) sequence=1;
drop sequence if exists t1;
diff --git a/mysql-test/suite/sql_sequence/gtid.result b/mysql-test/suite/sql_sequence/gtid.result
index ce8e8b7bb80..4c0a4e0e8fc 100644
--- a/mysql-test/suite/sql_sequence/gtid.result
+++ b/mysql-test/suite/sql_sequence/gtid.result
@@ -24,28 +24,28 @@ create sequence s1;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
connection slave;
use s_db;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
connection master;
use s_db;
@@ -161,13 +161,13 @@ priv test
connection m_normal_1;
create sequence s_db.s1;
select * from s_db.s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
select next value for s_db.s1;
next value for s_db.s1
1
select * from s_db.s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1001 1 9223372036854775806 1 1 1000 0 0
create sequence s_db.s2;
drop sequence s_db.s2;
@@ -250,20 +250,20 @@ connection slave;
connection s_normal_3;
use s_db;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 20 1 1 5 1 0
connection m_normal_1;
select next value for s_t;
next value for s_t
1
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
6 1 20 1 1 5 1 0
connection master;
connection slave;
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
6 1 20 1 1 5 1 0
------------------------------------------
master update nextval;
@@ -272,12 +272,12 @@ connection m_normal_1;
select next value for s_t;
next value for s_t
2
-update s_t set next_value= 11;
+update s_t set next_not_cached_value= 11;
ERROR HY000: Storage engine SEQUENCE of the table `s_db`.`s_t` doesn't have this option
alter sequence s_t restart=11;
commit;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 20 1 1 5 1 0
connection master;
connection slave;
@@ -286,29 +286,29 @@ show slave nextval;
------------------------------------------
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 20 1 1 5 1 0
connection m_normal_1;
select next value for s_t;
next value for s_t
11
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
connection master;
connection slave;
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
------------------------------------------
update into invalid sequence
------------------------------------------
connection m_normal_1;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
-update s_t set next_value= 11,start=10, min_value=11;
+update s_t set next_not_cached_value= 11,start_value=10, minimum_value=11;
ERROR HY000: Storage engine SEQUENCE of the table `s_db`.`s_t` doesn't have this option
ALTER SEQUENCE s_t restart with 11 start=10 minvalue=11;
ERROR HY000: Sequence 's_db.s_t' values are conflicting
@@ -549,14 +549,14 @@ next value for s1
4
commit;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
connection slave;
use s_db;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
------------------------------------------
close session binlog.
@@ -577,14 +577,14 @@ next value for s1
8
set session sql_log_bin=on;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
9 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
connection slave;
use s_db;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
connection m_normal_1;
use s_db;
@@ -609,13 +609,13 @@ select next value for s1;
next value for s1
1
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
use s_db;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 1 9223372036854775806 1 1 2 0 0
connection m_normal_1;
use s_db;
@@ -788,7 +788,7 @@ select * from t1;
a
1
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1001 1 9223372036854775806 1 1 1000 0 0
select previous value for s1;
previous value for s1
@@ -810,7 +810,7 @@ a (next value for s1)
2 3
do setval(s1,10000,0);
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
10000 1 9223372036854775806 1 1 1000 0 0
connection m_normal_2;
drop table t1;
diff --git a/mysql-test/suite/sql_sequence/gtid.test b/mysql-test/suite/sql_sequence/gtid.test
index 98760119b53..a354062a05c 100644
--- a/mysql-test/suite/sql_sequence/gtid.test
+++ b/mysql-test/suite/sql_sequence/gtid.test
@@ -263,7 +263,7 @@ select * from s_t;
connection m_normal_1;
select next value for s_t;
--error ER_ILLEGAL_HA
-update s_t set next_value= 11;
+update s_t set next_not_cached_value= 11;
alter sequence s_t restart=11;
commit;
@@ -295,7 +295,7 @@ select * from s_t;
connection m_normal_1;
select * from s_t;
--error ER_ILLEGAL_HA
-update s_t set next_value= 11,start=10, min_value=11;
+update s_t set next_not_cached_value= 11,start_value=10, minimum_value=11;
--error ER_SEQUENCE_INVALID_DATA
ALTER SEQUENCE s_t restart with 11 start=10 minvalue=11;
commit;
diff --git a/mysql-test/suite/sql_sequence/mysqldump.result b/mysql-test/suite/sql_sequence/mysqldump.result
index 30f0719f16e..0067709db54 100644
--- a/mysql-test/suite/sql_sequence/mysqldump.result
+++ b/mysql-test/suite/sql_sequence/mysqldump.result
@@ -5,14 +5,14 @@ CREATE SEQUENCE x1 engine=innodb;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `a1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=Aria SEQUENCE=1;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `a1` VALUES (1,1,9223372036854775806,1,1,1000,0,0);
@@ -27,14 +27,14 @@ INSERT INTO `t1` VALUES (1),(2);
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `x1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO `x1` VALUES (1,1,9223372036854775806,1,1,1000,0,0);
diff --git a/mysql-test/suite/sql_sequence/next.result b/mysql-test/suite/sql_sequence/next.result
index b7d3a8ff26d..a10c131e0e1 100644
--- a/mysql-test/suite/sql_sequence/next.result
+++ b/mysql-test/suite/sql_sequence/next.result
@@ -2,80 +2,80 @@ CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 2 cy
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
select next value for t1;
next value for t1
1
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
3 0
select next value for t1;
next value for t1
2
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
3 0
select next value for t1;
next value for t1
3
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
5 0
select next value for t1;
next value for t1
4
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
5 0
select next value for t1;
next value for t1
5
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
7 0
select next value for t1;
next value for t1
6
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
7 0
select next value for t1;
next value for t1
7
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
9 0
select next value for t1;
next value for t1
8
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
9 0
select next value for t1;
next value for t1
9
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
11 0
select next value for t1;
next value for t1
10
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
11 0
select next value for t1;
next value for t1
1
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
3 1
select NEXT VALUE for t1,seq from seq_1_to_20;
NEXT VALUE for t1 seq
@@ -104,68 +104,68 @@ CREATE SEQUENCE t1 minvalue 1 maxvalue 10 increment by -1 cache 2 cycle engine=a
select next value for t1;
next value for t1
10
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
8 0
select next value for t1;
next value for t1
9
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
8 0
select next value for t1;
next value for t1
8
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
6 0
select next value for t1;
next value for t1
7
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
6 0
select next value for t1;
next value for t1
6
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
4 0
select next value for t1;
next value for t1
5
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
4 0
select next value for t1;
next value for t1
4
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
2 0
select next value for t1;
next value for t1
3
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
2 0
select next value for t1;
next value for t1
2
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
0 0
select next value for t1;
next value for t1
1
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
0 0
select next value for t1;
next value for t1
10
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
8 1
select NEXT VALUE for t1,seq from seq_1_to_20;
NEXT VALUE for t1 seq
@@ -235,7 +235,7 @@ select next value for t1;
next value for t1
1
select * from t1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 100 1 1 10 0 0
flush tables;
select next value for t1;
@@ -284,58 +284,58 @@ seq previous value for t9 NEXT VALUE for t9 previous value for t9
19 10 1 1
20 1 2 2
select * from t9;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
6 1 10 1 1 5 1 2
drop sequence t9;
CREATE SEQUENCE s1 cache=0;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 0 0 0
select next value for s1;
next value for s1
1
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
2
select next value for s1;
next value for s1
2
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
3
DROP SEQUENCE s1;
CREATE SEQUENCE s1 cache=1;
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
1
select next value for s1;
next value for s1
1
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
2
select next value for s1;
next value for s1
2
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
3
DROP SEQUENCE s1;
CREATE SEQUENCE s1 cache=2;
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
1
select next value for s1;
next value for s1
1
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
3
select next value for s1;
next value for s1
2
-select next_value from s1;
-next_value
+select next_not_cached_value from s1;
+next_not_cached_value
3
DROP SEQUENCE s1;
CREATE SEQUENCE s1;
@@ -353,7 +353,7 @@ next value for s1
4
alter sequence s1 increment -2;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1001 1 9223372036854775806 1 -2 1000 0 0
select next value for s1;
next value for s1
@@ -404,17 +404,17 @@ INCREMENT BY 1 START WITH 3984356 CACHE 20 CYCLE engine=innodb;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3984356 1 9999999999 3984356 1 20 1 0
select NEXT VALUE FOR s1;
NEXT VALUE FOR s1
@@ -426,24 +426,24 @@ select NEXT VALUE FOR s1;
NEXT VALUE FOR s1
3984358
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3984376 1 9999999999 3984356 1 20 1 0
FLUSH TABLES;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3984376 1 9999999999 3984356 1 20 1 0
select NEXT VALUE FOR s1;
NEXT VALUE FOR s1
3984376
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3984396 1 9999999999 3984356 1 20 1 0
drop sequence s1;
CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
explain select next value for t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
-explain select next value for t1, min_value from t1;
+explain select next value for t1, minimum_value from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
drop table t1;
@@ -472,7 +472,7 @@ a b
drop table t1,s1;
CREATE OR REPLACE SEQUENCE s1 MINVALUE 1 MAXVALUE 9999999999 INCREMENT BY 1 START WITH 3984356 nocache CYCLE engine='innodb';
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3984356 1 9999999999 3984356 1 0 1 0
select next value for s1;
next value for s1
@@ -496,8 +496,8 @@ create sequence t1;
select next value for t1;
next value for t1
1
-select next value for t1, min_value;
-ERROR 42S22: Unknown column 'min_value' in 'field list'
+select next value for t1, minimum_value;
+ERROR 42S22: Unknown column 'minimum_value' in 'field list'
drop sequence t1;
#
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
diff --git a/mysql-test/suite/sql_sequence/next.test b/mysql-test/suite/sql_sequence/next.test
index cf67b7a2752..271c4a6558a 100644
--- a/mysql-test/suite/sql_sequence/next.test
+++ b/mysql-test/suite/sql_sequence/next.test
@@ -8,27 +8,27 @@
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 10 increment by 1 cache 2 cycle;
show create table t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select NEXT VALUE for t1,seq from seq_1_to_20;
@@ -36,27 +36,27 @@ drop sequence t1;
CREATE SEQUENCE t1 minvalue 1 maxvalue 10 increment by -1 cache 2 cycle engine=aria;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select NEXT VALUE for t1,seq from seq_1_to_20;
@@ -85,7 +85,7 @@ select next value for s1;
drop sequence s1;
#
-# Test that flush tables jumps to next next_value
+# Test that flush tables jumps to next next_not_cached_value
#
CREATE SEQUENCE t1 start with 1 minvalue 1 maxvalue 100 increment by 1 cache 10;
@@ -116,23 +116,23 @@ drop sequence t9;
CREATE SEQUENCE s1 cache=0;
select * from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
DROP SEQUENCE s1;
CREATE SEQUENCE s1 cache=1;
-select next_value from s1;
+select next_not_cached_value from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
DROP SEQUENCE s1;
CREATE SEQUENCE s1 cache=2;
-select next_value from s1;
+select next_not_cached_value from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
select next value for s1;
-select next_value from s1;
+select next_not_cached_value from s1;
DROP SEQUENCE s1;
#
@@ -196,7 +196,7 @@ drop sequence s1;
CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle;
explain select next value for t1;
-explain select next value for t1, min_value from t1;
+explain select next value for t1, minimum_value from t1;
drop table t1;
#
@@ -244,7 +244,7 @@ drop table t1;
create sequence t1;
select next value for t1;
--error ER_BAD_FIELD_ERROR
-select next value for t1, min_value;
+select next value for t1, minimum_value;
drop sequence t1;
--echo #
diff --git a/mysql-test/suite/sql_sequence/other.result b/mysql-test/suite/sql_sequence/other.result
index ea72e264b34..90e3a0737c6 100644
--- a/mysql-test/suite/sql_sequence/other.result
+++ b/mysql-test/suite/sql_sequence/other.result
@@ -37,16 +37,16 @@ select next value for s1;
next value for s1
1001
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
2001 1 9223372036854775806 1 1 1000 0 0
drop sequence s1;
#
-# ÌNSERT
+# INSERT
#
create sequence s1;
create sequence s2;
-insert into s1 (next_value, min_value) values (100,1000);
-ERROR HY000: Field 'max_value' doesn't have a default value
+insert into s1 (next_not_cached_value, minimum_value) values (100,1000);
+ERROR HY000: Field 'maximum_value' doesn't have a default value
insert into s1 values (next value for s1, 1,9223372036854775806,1,1,1000,0,0);
ERROR HY000: Table 's1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into s1 values (next value for s2, 1,9223372036854775806,1,1,1000,0,0);
@@ -58,17 +58,17 @@ ERROR HY000: Sequence 'test.s1' values are conflicting
insert into s1 values(0,9223372036854775806,1,1,1,1000,0,0);
ERROR HY000: Sequence 'test.s1' values are conflicting
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
insert into s1 values(1000,1,9223372036854775806,1,1,1000,0,0);
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1000 1 9223372036854775806 1 1 1000 0 0
select next value for s1;
next value for s1
1000
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
2000 1 9223372036854775806 1 1 1000 0 0
insert into s2 values(0, 1, 10, 1, 2, 1, 1, 0);
ERROR HY000: Sequence 'test.s2' values are conflicting
@@ -77,9 +77,9 @@ drop sequence s1,s2;
# UPDATE and DELETE
#
create sequence s1;
-update s1 set next_value=100;
+update s1 set next_not_cached_value=100;
ERROR HY000: Storage engine SEQUENCE of the table `test`.`s1` doesn't have this option
-delete from s1 where next_value > 0;
+delete from s1 where next_not_cached_value > 0;
ERROR HY000: Storage engine SEQUENCE of the table `test`.`s1` doesn't have this option
drop sequence s1;
#
@@ -106,7 +106,7 @@ drop view v1;
create sequence s1 engine=innodb;
LOCK TABLES s1 READ;
SELECT * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
UNLOCK TABLES;
LOCK TABLES s1 WRITE;
@@ -123,7 +123,7 @@ count(nextval(s1))
2000
commit;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
2001 1 9223372036854775806 1 1 1000 0 0
drop sequence s1;
create sequence s1 cache=1000 engine=innodb;
@@ -138,13 +138,27 @@ select count(nextval(s1)) from seq_1_to_2000;
count(nextval(s1))
2000
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
4001 1 9223372036854775806 1 1 1000 0 0
commit;
disconnect addconroot;
connection default;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
4001 1 9223372036854775806 1 1 1000 0 0
commit;
drop sequence s1;
+#
+# Flush tables with read lock
+#
+create sequence s1;
+select next value for s1;
+next value for s1
+1
+flush tables with read lock;
+create sequence s2;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+select next value for s1;
+ERROR HY000: Can't execute the query because you have a conflicting read lock
+unlock tables;
+drop sequence s1;
diff --git a/mysql-test/suite/sql_sequence/other.test b/mysql-test/suite/sql_sequence/other.test
index 0caeb342bc9..d816ec7c108 100644
--- a/mysql-test/suite/sql_sequence/other.test
+++ b/mysql-test/suite/sql_sequence/other.test
@@ -29,13 +29,13 @@ select * from s1;
drop sequence s1;
--echo #
---echo # ÌNSERT
+--echo # INSERT
--echo #
create sequence s1;
create sequence s2;
--error ER_NO_DEFAULT_FOR_FIELD
-insert into s1 (next_value, min_value) values (100,1000);
+insert into s1 (next_not_cached_value, minimum_value) values (100,1000);
--error ER_UPDATE_TABLE_USED
insert into s1 values (next value for s1, 1,9223372036854775806,1,1,1000,0,0);
--error ER_WRONG_INSERT_INTO_SEQUENCE
@@ -61,9 +61,9 @@ drop sequence s1,s2;
create sequence s1;
--error ER_ILLEGAL_HA
-update s1 set next_value=100;
+update s1 set next_not_cached_value=100;
--error ER_ILLEGAL_HA
-delete from s1 where next_value > 0;
+delete from s1 where next_not_cached_value > 0;
drop sequence s1;
--echo #
@@ -117,3 +117,17 @@ connection default;
select * from s1;
commit;
drop sequence s1;
+
+--echo #
+--echo # Flush tables with read lock
+--echo #
+
+create sequence s1;
+select next value for s1;
+flush tables with read lock;
+--error 1223
+create sequence s2;
+--error 1223
+select next value for s1;
+unlock tables;
+drop sequence s1;
diff --git a/mysql-test/suite/sql_sequence/read_only.result b/mysql-test/suite/sql_sequence/read_only.result
index 3f6a95610dd..38edcc0894b 100644
--- a/mysql-test/suite/sql_sequence/read_only.result
+++ b/mysql-test/suite/sql_sequence/read_only.result
@@ -23,3 +23,16 @@ select next value for s1;
ERROR HY000: Table 's1' is read only
select next value for s1;
ERROR HY000: Table 's1' is read only
+select * from s1;
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
+1 1 9223372036854775806 1 1 2 0 0
+select * from s1;
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
+1 1 9223372036854775806 1 1 2 0 0
+select next value for s1;
+next value for s1
+1
+select * from s1;
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
+3 1 9223372036854775806 1 1 2 0 0
+drop sequence s1;
diff --git a/mysql-test/suite/sql_sequence/read_only.test b/mysql-test/suite/sql_sequence/read_only.test
index 04dab2bb525..73103384882 100644
--- a/mysql-test/suite/sql_sequence/read_only.test
+++ b/mysql-test/suite/sql_sequence/read_only.test
@@ -7,12 +7,8 @@
create sequence s1 cache 2 engine=innodb;
---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---shutdown_server 10
---source include/wait_until_disconnected.inc
---enable_reconnect
---exec echo "restart":--innodb_read_only=1 > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
---source include/wait_until_connected_again.inc
+--let $restart_parameters= --innodb-read-only
+--source include/restart_mysqld.inc
connection default;
show global variables like 'innodb_read_only';
@@ -38,3 +34,11 @@ select next value for s1;
select next value for s1;
--error ER_OPEN_AS_READONLY
select next value for s1;
+
+select * from s1;
+--let $restart_parameters=
+--source include/restart_mysqld.inc
+select * from s1;
+select next value for s1;
+select * from s1;
+drop sequence s1;
diff --git a/mysql-test/suite/sql_sequence/replication.result b/mysql-test/suite/sql_sequence/replication.result
index 12355851f7b..5c7d45614e9 100644
--- a/mysql-test/suite/sql_sequence/replication.result
+++ b/mysql-test/suite/sql_sequence/replication.result
@@ -23,27 +23,27 @@ create sequence s1;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
connection slave;
show create table s1;
Table Create Table
s1 CREATE TABLE `s1` (
- `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
+ `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=MyISAM SEQUENCE=1
connection master;
drop sequence s1;
@@ -73,38 +73,37 @@ support create sequence
connection master;
create table t_1(id int);
show create sequence t_1;
-ERROR HY000: 's_db.t_1' is not SEQUENCE
+ERROR 42S02: 's_db.t_1' is not a SEQUENCE
drop table t_1;
CREATE SEQUENCE `s2` (
-`currval` bigint(21) NOT NULL COMMENT 'current value',
-`nextval` bigint(21) NOT NULL COMMENT 'next value',
-`minvalue` bigint(21) NOT NULL COMMENT 'min value',
-`maxvalue` bigint(21) NOT NULL COMMENT 'max value',
-`start` bigint(21) NOT NULL COMMENT 'start value',
-`increment` bigint(21) NOT NULL COMMENT 'increment value',
-`cache` bigint(21) NOT NULL COMMENT 'cache size',
-`cycle` bigint(21) NOT NULL COMMENT 'cycle state',
-`round` bigint(21) NOT NULL COMMENT 'already how many round'
+`next_not_cached_value` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
+`increment` bigint(21) NOT NULL,
+`cache_size` bigint(21) unsigned NOT NULL,
+`cycle_option` tinyint(1) unsigned NOT NULL,
+`cycle_count` bigint(21) NOT NULL
) ENGINE=InnoDB sequence=1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(
-`currval` bigint(21) NOT NULL COMMENT 'current value',
-`nextval` bigint(21) NO' at line 1
+`next_not_cached_value` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NU' at line 1
CREATE TABLE `s2` (
-`next_value` bigint(21) NOT NULL COMMENT 'next value',
-`min_value` bigint(21) NOT NULL COMMENT 'min value',
-`max_value` bigint(21) NOT NULL COMMENT 'max value',
-`start` bigint(21) NOT NULL COMMENT 'start value',
-`increment` bigint(21) NOT NULL COMMENT 'increment value',
-`cache` bigint(21) NOT NULL COMMENT 'cache size',
-`cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
-`round` bigint(21) NOT NULL COMMENT 'already how many round'
+`next_not_cached_value` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
+`increment` bigint(21) NOT NULL,
+`cache_size` bigint(21) unsigned NOT NULL,
+`cycle_option` tinyint(1) unsigned NOT NULL,
+`cycle_count` bigint(21) NOT NULL
) ENGINE=InnoDB sequence=1;
insert into s2 values(1, 1, 10, 1, 2, 1, 1, 0);
commit;
select * for s2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 's2' at line 1
select * from s2;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 10 1 2 1 1 0
select NEXT VALUE for s2;
NEXT VALUE for s2
@@ -128,25 +127,25 @@ select NEXT VALUE for s2;
NEXT VALUE for s2
3
select * from s2;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 10 1 2 1 1 1
commit;
connection master;
connection slave;
select * from s2;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 10 1 2 1 1 1
connection master;
drop sequence s2;
CREATE TABLE `s2` (
-`next_value` bigint(21) NOT NULL COMMENT 'next value',
-`min_value` bigint(21) NOT NULL COMMENT 'min value',
-`max_value` bigint(21) NOT NULL COMMENT 'max value',
-`start` bigint(21) NOT NULL COMMENT 'start value',
-`increment` bigint(21) NOT NULL COMMENT 'increment value',
-`cache` bigint(21) NOT NULL COMMENT 'cache size',
-`cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
-`round` bigint(21) NOT NULL COMMENT 'already how many round'
+`next_not_cached_value` bigint(21) NOT NULL,
+`minimum_value` bigint(21) NOT NULL,
+`maximum_value` bigint(21) NOT NULL,
+`start_value` bigint(21) NOT NULL,
+`increment` bigint(21) NOT NULL,
+`cache_size` bigint(21) unsigned NOT NULL,
+`cycle_option` tinyint(1) unsigned NOT NULL,
+`cycle_count` bigint(21) NOT NULL
) ENGINE=myisam DEFAULT CHARSET=latin1 sequence=1;
show create sequence s2;
Table Create Table
@@ -159,7 +158,7 @@ connection master;
create sequence s2;
create table t2 (id int);
select * from s2;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
select * from t2;
id
@@ -171,7 +170,7 @@ NEXT VALUE for s2
select NEXT VALUE for t2;
ERROR 42S02: 's_db.t2' is not a SEQUENCE
select * from s2, t2;
-next_value min_value max_value start increment cache cycle round id
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count id
1001 1 9223372036854775806 1 1 1000 0 0 1
select * for s2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 's2' at line 1
@@ -191,7 +190,7 @@ show create sequence s2_2;
Table Create Table
s2_2 CREATE SEQUENCE `s2_2` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=MyISAM
select * from s2_2;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
truncate table s2_2;
ERROR HY000: Storage engine SEQUENCE of the table `s_db`.`s2_2` doesn't have this option
@@ -339,7 +338,7 @@ show global variables like 'read_only';
Variable_name Value
read_only OFF
select * from s_db.s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
connection master;
connection slave;
@@ -360,7 +359,7 @@ connection master;
connection slave;
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 20 1 1 5 1 0
connection m_normal_1;
select next value for s_t;
@@ -369,8 +368,8 @@ next value for s_t
connection master;
connection slave;
connection s_normal_3;
-select next_value from s_t;
-next_value
+select next_not_cached_value from s_t;
+next_not_cached_value
6
------------------------------------------
master ALTER SEQUENCE
@@ -381,7 +380,7 @@ next value for s_t
2
alter sequence s_t restart= 11;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 20 1 1 5 1 0
connection master;
connection slave;
@@ -390,7 +389,7 @@ show slave nextval;
------------------------------------------
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 20 1 1 5 1 0
connection m_normal_1;
select next value for s_t;
@@ -400,7 +399,7 @@ connection master;
connection slave;
connection s_normal_3;
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
------------------------------------------
update into invalid sequence
@@ -410,17 +409,17 @@ select next value for s_t;
next value for s_t
12
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
alter sequence s_t minvalue=11 maxvalue=9;
ERROR HY000: Sequence 's_db.s_t' values are conflicting
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
alter sequence s_t restart= 12 start=10 minvalue=11 maxvalue=20;
ERROR HY000: Sequence 's_db.s_t' values are conflicting
select * from s_t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
16 1 20 1 1 5 1 0
------------------------------------------
delete sequence row
@@ -457,7 +456,7 @@ id
2
2222
select * from s_1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
6 1 9223372036854775806 1 1 5 0 0
connection master;
connection slave;
@@ -505,7 +504,7 @@ id
2
2222
select * from s_1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 9223372036854775806 1 1 5 0 0
select next value for s_1;
next value for s_1
@@ -643,12 +642,12 @@ next value for s1
4
commit;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
------------------------------------------
close session binlog.
@@ -669,23 +668,23 @@ next value for s1
8
set session sql_log_bin=on;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
9 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
5 1 9223372036854775806 1 1 2 0 0
connection master;
select next value for s1;
next value for s1
9
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 9223372036854775806 1 1 2 0 0
connection slave;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
11 1 9223372036854775806 1 1 2 0 0
connection master;
drop sequence s1;
@@ -711,7 +710,7 @@ next value for s1
connection master;
connection slave;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 1 9223372036854775806 1 1 2 0 0
connection m_normal_1;
drop sequence s1;
@@ -733,12 +732,12 @@ select next value for s1;
next value for s1
2
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 1 9223372036854775806 1 1 2 0 0
connection master;
connection slave;
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
3 1 9223372036854775806 1 1 2 0 0
connection m_normal_1;
drop sequence s1;
@@ -784,7 +783,7 @@ connection m_normal_1;
create sequence s1 cache 2;
create table t as select * from s1;
select * from t;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 2 0 0
drop table t;
create table t as select next value for s1;
@@ -918,7 +917,7 @@ test value boundary
###########################################
connection m_normal_1;
------------------------------------------
-round increment by round
+cycle_count increment by cycle_count
------------------------------------------
create sequence s1 start with 5 minvalue 2 maxvalue 7 cache 1 cycle;
select next value for s1;
@@ -950,39 +949,39 @@ next value for s1
select next value for s1;
ERROR HY000: Sequence 's_db.s1' has run out
select * from s1;
-next_value min_value max_value start increment cache cycle round
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
8 2 7 5 1 10 0 0
drop sequence s1;
create sequence s1 start with 2 minvalue 1 maxvalue 3 increment by 3 nocache cycle;
select next value for s1;
next value for s1
2
-select next_value,round from s1;
-next_value round
+select next_not_cached_value,cycle_count from s1;
+next_not_cached_value cycle_count
4 0
select next value for s1;
next value for s1
1
-select next_value,round from s1;
-next_value round
+select next_not_cached_value,cycle_count from s1;
+next_not_cached_value cycle_count
4 1
select next value for s1;
next value for s1
1
-select next_value,round from s1;
-next_value round
+select next_not_cached_value,cycle_count from s1;
+next_not_cached_value cycle_count
4 2
select next value for s1;
next value for s1
1
-select next_value,round from s1;
-next_value round
+select next_not_cached_value,cycle_count from s1;
+next_not_cached_value cycle_count
4 3
select next value for s1;
next value for s1
1
-select next_value,round from s1;
-next_value round
+select next_not_cached_value,cycle_count from s1;
+next_not_cached_value cycle_count
4 4
drop sequence s1;
create sequence s1 start with 2 minvalue 1 maxvalue 3 increment by 3 cache 2 nocycle;
@@ -996,67 +995,67 @@ drop sequence s1;
beyond ulonglong maxvalue
------------------------------------------
create sequence s1 start with 9223372036854775805 minvalue 9223372036854775804 maxvalue 9223372036854775806 cache 1 cycle;
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 3
drop sequence s1;
create sequence s1 start with 9223372036854775805 minvalue 9223372036854775804 maxvalue 9223372036854775806 cache 10 cycle;
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 0
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 1
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775806 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775804 2
-select next value for s1, round from s1;
-next value for s1 round
+select next value for s1, cycle_count from s1;
+next value for s1 cycle_count
9223372036854775805 3
drop sequence s1;
connection master;
diff --git a/mysql-test/suite/sql_sequence/replication.test b/mysql-test/suite/sql_sequence/replication.test
index c1a28a9b5c4..7bd6f00e2ed 100644
--- a/mysql-test/suite/sql_sequence/replication.test
+++ b/mysql-test/suite/sql_sequence/replication.test
@@ -79,33 +79,32 @@ drop sequence s2;
connection master;
create table t_1(id int);
---error ER_WRONG_OBJECT
+--error ER_NOT_SEQUENCE
show create sequence t_1;
drop table t_1;
--error ER_PARSE_ERROR
CREATE SEQUENCE `s2` (
- `currval` bigint(21) NOT NULL COMMENT 'current value',
- `nextval` bigint(21) NOT NULL COMMENT 'next value',
- `minvalue` bigint(21) NOT NULL COMMENT 'min value',
- `maxvalue` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
- `increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` bigint(21) NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'already how many round'
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
+ `increment` bigint(21) NOT NULL,
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count` bigint(21) NOT NULL
) ENGINE=InnoDB sequence=1;
CREATE TABLE `s2` (
- `next_value` bigint(21) NOT NULL COMMENT 'next value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
- `increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'already how many round'
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
+ `increment` bigint(21) NOT NULL,
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count` bigint(21) NOT NULL
) ENGINE=InnoDB sequence=1;
insert into s2 values(1, 1, 10, 1, 2, 1, 1, 0);
@@ -131,14 +130,14 @@ connection master;
drop sequence s2;
CREATE TABLE `s2` (
- `next_value` bigint(21) NOT NULL COMMENT 'next value',
- `min_value` bigint(21) NOT NULL COMMENT 'min value',
- `max_value` bigint(21) NOT NULL COMMENT 'max value',
- `start` bigint(21) NOT NULL COMMENT 'start value',
- `increment` bigint(21) NOT NULL COMMENT 'increment value',
- `cache` bigint(21) NOT NULL COMMENT 'cache size',
- `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
- `round` bigint(21) NOT NULL COMMENT 'already how many round'
+ `next_not_cached_value` bigint(21) NOT NULL,
+ `minimum_value` bigint(21) NOT NULL,
+ `maximum_value` bigint(21) NOT NULL,
+ `start_value` bigint(21) NOT NULL,
+ `increment` bigint(21) NOT NULL,
+ `cache_size` bigint(21) unsigned NOT NULL,
+ `cycle_option` tinyint(1) unsigned NOT NULL,
+ `cycle_count` bigint(21) NOT NULL
) ENGINE=myisam DEFAULT CHARSET=latin1 sequence=1;
show create sequence s2;
@@ -355,7 +354,7 @@ connection master;
--sync_slave_with_master
connection s_normal_3;
-select next_value from s_t;
+select next_not_cached_value from s_t;
--echo ------------------------------------------
--echo master ALTER SEQUENCE
@@ -785,7 +784,7 @@ drop sequence s1;
connection m_normal_1;
--echo ------------------------------------------
---echo round increment by round
+--echo cycle_count increment by cycle_count
--echo ------------------------------------------
create sequence s1 start with 5 minvalue 2 maxvalue 7 cache 1 cycle;
select next value for s1;
@@ -806,15 +805,15 @@ drop sequence s1;
create sequence s1 start with 2 minvalue 1 maxvalue 3 increment by 3 nocache cycle;
select next value for s1;
-select next_value,round from s1;
+select next_not_cached_value,cycle_count from s1;
select next value for s1;
-select next_value,round from s1;
+select next_not_cached_value,cycle_count from s1;
select next value for s1;
-select next_value,round from s1;
+select next_not_cached_value,cycle_count from s1;
select next value for s1;
-select next_value,round from s1;
+select next_not_cached_value,cycle_count from s1;
select next value for s1;
-select next_value,round from s1;
+select next_not_cached_value,cycle_count from s1;
drop sequence s1;
create sequence s1 start with 2 minvalue 1 maxvalue 3 increment by 3 cache 2 nocycle;
@@ -827,29 +826,29 @@ drop sequence s1;
--echo beyond ulonglong maxvalue
--echo ------------------------------------------
create sequence s1 start with 9223372036854775805 minvalue 9223372036854775804 maxvalue 9223372036854775806 cache 1 cycle;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
drop sequence s1;
create sequence s1 start with 9223372036854775805 minvalue 9223372036854775804 maxvalue 9223372036854775806 cache 10 cycle;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
-select next value for s1, round from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
+select next value for s1, cycle_count from s1;
drop sequence s1;
connection master;
diff --git a/mysql-test/suite/sql_sequence/setval.result b/mysql-test/suite/sql_sequence/setval.result
index 8e68a717cbf..b7cda27cf96 100644
--- a/mysql-test/suite/sql_sequence/setval.result
+++ b/mysql-test/suite/sql_sequence/setval.result
@@ -5,26 +5,26 @@ Note 1051 Unknown table 'test.t1'
# Test setval function
#
CREATE SEQUENCE t1 cache 10 engine=myisam;
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1 0
do setval(t1,10);
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
11 0
select next value for t1;
next value for t1
11
do setval(t1,12,1);
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
21 0
select next value for t1;
next value for t1
13
do setval(t1,15,0);
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
21 0
select next value for t1;
next value for t1
@@ -39,15 +39,15 @@ do setval(t1,1000,0);
select next value for t1;
next value for t1
1000
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1010 0
do setval(t1,2000,0);
select next value for t1;
next value for t1
2000
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
2010 0
select setval(t1,1000,0);
setval(t1,1000,0)
@@ -61,8 +61,8 @@ NULL
select next value for t1;
next value for t1
2002
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
2010 0
select setval(t1,2002,0);
setval(t1,2002,0)
@@ -76,40 +76,40 @@ setval(t1,2010,0)
select next value for t1;
next value for t1
2010
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
2020 0
drop sequence t1;
#
# Testing with cycle
#
CREATE SEQUENCE t1 cache=10 maxvalue=100 cycle engine=innodb;
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1 0
select setval(t1,100,0);
setval(t1,100,0)
100
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
100 0
select next value for t1;
next value for t1
100
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
101 0
select setval(t1,100,0);
setval(t1,100,0)
NULL
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
101 0
select next value for t1;
next value for t1
1
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
11 1
select next value for t1;
next value for t1
@@ -117,8 +117,8 @@ next value for t1
select setval(t1,100,0,1);
setval(t1,100,0,1)
100
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
100 1
select next value for t1;
next value for t1
@@ -126,8 +126,8 @@ next value for t1
select setval(t1,100,1,2);
setval(t1,100,1,2)
100
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
101 2
select next value for t1;
next value for t1
@@ -135,8 +135,8 @@ next value for t1
select setval(t1,100,0,3);
setval(t1,100,0,3)
100
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
100 3
select next value for t1;
next value for t1
@@ -146,27 +146,27 @@ drop sequence t1;
# Testing extreme values
#
CREATE SEQUENCE t1 cache=10 maxvalue=100 engine=innodb;
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1 0
select setval(t1,200);
setval(t1,200)
200
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
101 0
select next value for t1;
ERROR HY000: Sequence 'test.t1' has run out
drop sequence t1;
CREATE SEQUENCE t1 cache=10 maxvalue=100 cycle engine=innodb;
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1 0
select setval(t1,200);
setval(t1,200)
200
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
101 0
select next value for t1;
next value for t1
@@ -176,8 +176,8 @@ CREATE SEQUENCE t1 cache=10 maxvalue=0 increment=-10;
select setval(t1,-10);
setval(t1,-10)
-10
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
-20 0
select next value for t1;
next value for t1
@@ -185,8 +185,8 @@ next value for t1
select setval(t1,-15);
setval(t1,-15)
NULL
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
-120 0
select next value for t1;
next value for t1
@@ -214,8 +214,8 @@ CREATE SEQUENCE t1 cache=10 maxvalue=0 increment=-10;
select setval(t1,-10,0);
setval(t1,-10,0)
-10
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
-10 0
select next value for t1;
next value for t1
@@ -231,8 +231,8 @@ setval(t1,10,0) setval(t1,15,1) setval(t1,5,1)
select next value for t1;
next value for t1
16
-select next_value,round from t1;
-next_value round
+select next_not_cached_value,cycle_count from t1;
+next_not_cached_value cycle_count
1016 0
explain extended select setval(t1,100),setval(t1,100,TRUE),setval(t1,100,FALSE,50);
id select_type table type possible_keys key key_len ref rows filtered Extra
diff --git a/mysql-test/suite/sql_sequence/setval.test b/mysql-test/suite/sql_sequence/setval.test
index dbb2620d4e4..8f8059fdcae 100644
--- a/mysql-test/suite/sql_sequence/setval.test
+++ b/mysql-test/suite/sql_sequence/setval.test
@@ -8,35 +8,35 @@ drop table if exists t1;
--echo #
CREATE SEQUENCE t1 cache 10 engine=myisam;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
do setval(t1,10);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
do setval(t1,12,1);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
do setval(t1,15,0);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,16,0);
select next value for t1;
do setval(t1,1000,0);
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
do setval(t1,2000,0);
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
# Set smaller value
select setval(t1,1000,0);
select next value for t1;
select setval(t1,1000,TRUE);
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select setval(t1,2002,0);
select next value for t1;
select setval(t1,2010,0);
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
drop sequence t1;
--echo #
@@ -44,24 +44,24 @@ drop sequence t1;
--echo #
CREATE SEQUENCE t1 cache=10 maxvalue=100 cycle engine=innodb;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select setval(t1,100,0);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select setval(t1,100,0);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,100,0,1);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,100,1,2);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,100,0,3);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
drop sequence t1;
@@ -70,26 +70,26 @@ drop sequence t1;
--echo #
CREATE SEQUENCE t1 cache=10 maxvalue=100 engine=innodb;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select setval(t1,200);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
--error ER_SEQUENCE_RUN_OUT
select next value for t1;
drop sequence t1;
CREATE SEQUENCE t1 cache=10 maxvalue=100 cycle engine=innodb;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select setval(t1,200);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
drop sequence t1;
CREATE SEQUENCE t1 cache=10 maxvalue=0 increment=-10;
select setval(t1,-10);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,-15);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
select setval(t1,-500,FALSE);
select next value for t1;
@@ -101,7 +101,7 @@ drop sequence t1;
CREATE SEQUENCE t1 cache=10 maxvalue=0 increment=-10;
select setval(t1,-10,0);
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
select next value for t1;
drop sequence t1;
@@ -112,7 +112,7 @@ drop sequence t1;
CREATE SEQUENCE t1;
select setval(t1,10,0),setval(t1,15,1),setval(t1,5,1);
select next value for t1;
-select next_value,round from t1;
+select next_not_cached_value,cycle_count from t1;
explain extended select setval(t1,100),setval(t1,100,TRUE),setval(t1,100,FALSE,50);
drop sequence t1;
diff --git a/mysql-test/suite/sql_sequence/temporary.result b/mysql-test/suite/sql_sequence/temporary.result
new file mode 100644
index 00000000000..4885b5f8a26
--- /dev/null
+++ b/mysql-test/suite/sql_sequence/temporary.result
@@ -0,0 +1,12 @@
+#
+# Create
+#
+create temporary sequence s1 engine=innodb;
+alter table s1 engine myisam;
+select nextval(s1);
+nextval(s1)
+1
+select * from s1;
+next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
+1001 1 9223372036854775806 1 1 1000 0 0
+drop temporary sequence s1;
diff --git a/mysql-test/suite/sql_sequence/temporary.test b/mysql-test/suite/sql_sequence/temporary.test
new file mode 100644
index 00000000000..158f6b4961e
--- /dev/null
+++ b/mysql-test/suite/sql_sequence/temporary.test
@@ -0,0 +1,16 @@
+--source include/have_sequence.inc
+--source include/have_innodb.inc
+
+#
+# Test temporary sequences
+#
+
+--echo #
+--echo # Create
+--echo #
+
+create temporary sequence s1 engine=innodb;
+alter table s1 engine myisam;
+select nextval(s1);
+select * from s1;
+drop temporary sequence s1;
diff --git a/mysql-test/suite/storage_engine/alter_table.result b/mysql-test/suite/storage_engine/alter_table.result
index 09696e0e6b6..85db1514421 100644
--- a/mysql-test/suite/storage_engine/alter_table.result
+++ b/mysql-test/suite/storage_engine/alter_table.result
@@ -13,7 +13,7 @@ ALTER TABLE t1 ALTER COLUMN a SET DEFAULT '0';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` int(11) DEFAULT '0',
+ `a` int(11) DEFAULT 0,
`c` char(8) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
diff --git a/mysql-test/suite/storage_engine/alter_tablespace.result b/mysql-test/suite/storage_engine/alter_tablespace.result
index b54d7c99e9e..ff3da9f68bb 100644
--- a/mysql-test/suite/storage_engine/alter_tablespace.result
+++ b/mysql-test/suite/storage_engine/alter_tablespace.result
@@ -10,7 +10,7 @@ a
2
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT a FROM t1;
-ERROR HY000: Tablespace has been discarded for table 't1'
+ERROR HY000: Tablespace has been discarded for table `t1`
ALTER TABLE t1 IMPORT TABLESPACE;
Warnings:
Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1.cfg', will attempt to import without schema verification
diff --git a/mysql-test/suite/storage_engine/create_table.result b/mysql-test/suite/storage_engine/create_table.result
index 87bf37046ba..6936854eb65 100644
--- a/mysql-test/suite/storage_engine/create_table.result
+++ b/mysql-test/suite/storage_engine/create_table.result
@@ -27,7 +27,7 @@ CREATE TABLE t1 ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> AS SELECT 1 UNION
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `1` bigint(20) NOT NULL DEFAULT '0'
+ `1` bigint(20) NOT NULL DEFAULT 0
) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1
SELECT * FROM t1;
1
diff --git a/mysql-test/suite/storage_engine/disabled.def b/mysql-test/suite/storage_engine/disabled.def
index e69de29bb2d..658d0c240db 100644
--- a/mysql-test/suite/storage_engine/disabled.def
+++ b/mysql-test/suite/storage_engine/disabled.def
@@ -0,0 +1,12 @@
+alter_table_online : MDEV-9705 - Field type conversion warnings have changed to worse
+col_opt_null : MDEV-10252 - Row count in 'out of range' warnings is off
+col_opt_not_null : MDEV-10252 - Row count in 'out of range' warnings is off
+col_opt_unsigned : MDEV-10252 - Row count in 'out of range' warnings is off
+col_opt_zerofill : MDEV-10252 - Row count in 'out of range' warnings is off
+type_binary : MDEV-10252 - Row count in 'out of range' warnings is off
+type_char : MDEV-10252 - Row count in 'out of range' warnings is off
+type_fixed : MDEV-10252 - Row count in 'out of range' warnings is off
+type_float : MDEV-10252 - Row count in 'out of range' warnings is off
+type_int : MDEV-10252 - Row count in 'out of range' warnings is off
+type_varbinary : MDEV-10252 - Row count in 'out of range' warnings is off
+type_varchar : MDEV-10252 - Row count in 'out of range' warnings is off
diff --git a/mysql-test/suite/storage_engine/insert_delayed.test b/mysql-test/suite/storage_engine/insert_delayed.test
index 3ded1686714..ece0bf3cf68 100644
--- a/mysql-test/suite/storage_engine/insert_delayed.test
+++ b/mysql-test/suite/storage_engine/insert_delayed.test
@@ -1,4 +1,4 @@
-#
+#
# INSERT DELAYED
#
diff --git a/mysql-test/suite/storage_engine/repair_table.inc b/mysql-test/suite/storage_engine/repair_table.inc
index aa3b4e6304d..a295b4c19f2 100644
--- a/mysql-test/suite/storage_engine/repair_table.inc
+++ b/mysql-test/suite/storage_engine/repair_table.inc
@@ -91,6 +91,9 @@ if ($have_default_index)
call mtr.add_suppression(" '\..test.t1'");
call mtr.add_suppression("Couldn't repair table: test.t1");
+ # In 10.2 with log_warnings=2 the error message is printed to the error log
+ call mtr.add_suppression("Table 't1' is marked as crashed.*");
+
--let $create_definition = a $int_indexed_col, b $char_col, $default_index (a)
--source create_table.inc
REPAIR TABLE t1;
diff --git a/mysql-test/suite/storage_engine/repair_table.result b/mysql-test/suite/storage_engine/repair_table.result
index a20b9be3ba1..d518e47756f 100644
--- a/mysql-test/suite/storage_engine/repair_table.result
+++ b/mysql-test/suite/storage_engine/repair_table.result
@@ -59,6 +59,7 @@ call mtr.add_suppression("Got an error from thread_id=.*");
call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table");
call mtr.add_suppression(" '\..test.t1'");
call mtr.add_suppression("Couldn't repair table: test.t1");
+call mtr.add_suppression("Table 't1' is marked as crashed.*");
CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, <CUSTOM_INDEX> (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
REPAIR TABLE t1;
Table Op Msg_type Msg_text
@@ -85,7 +86,7 @@ Table Op Msg_type Msg_text
test.t1 check error Size of datafile is: 39 Should be: 65
test.t1 check error Corrupt
SELECT a,b FROM t1;
-ERROR HY000: Incorrect key file for table 't1'; try to repair it
+ERROR HY000: Index for table 't1' is corrupt; try to repair it
# Statement ended with one of expected results (0,ER_NOT_KEYFILE,144).
# If you got a difference in error message, just add it to rdiff file
INSERT INTO t1 (a,b) VALUES (14,'n'),(15,'o');
diff --git a/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.result b/mysql-test/suite/storage_engine/tbl_opt_data_dir.result
index b8c5e75c88c..19b7d539b45 100644
--- a/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.result
+++ b/mysql-test/suite/storage_engine/tbl_opt_data_dir.result
@@ -1,16 +1,19 @@
DROP TABLE IF EXISTS t1;
+# Running CREATE TABLE .. DATA DIRECTORY = <>
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(8) DEFAULT NULL
-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR_1>'
+# For ALTER TABLE the option is ignored
+# Running ALTER TABLE .. DATA DIRECTORY = <>
Warnings:
-Warning 1618 <INDEX DIRECTORY> option ignored
+Warning 1618 <DATA DIRECTORY> option ignored
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(8) DEFAULT NULL
-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR>' INDEX DIRECTORY='<INDEX_DIR>'
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 DATA DIRECTORY='<DATA_DIR_1>'
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_data_dir.test b/mysql-test/suite/storage_engine/tbl_opt_data_dir.test
new file mode 100644
index 00000000000..434ca449125
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_data_dir.test
@@ -0,0 +1,52 @@
+#
+# Check whether DATA DIRECTORY is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only that it is accepted
+#
+
+--source include/have_symlink.inc
+--source have_engine.inc
+
+--let $data_dir1 = $MYSQLTEST_VARDIR/storage_engine_data_dir1/
+--let $data_dir2 = $MYSQLTEST_VARDIR/storage_engine_data_dir2/
+--mkdir $data_dir1
+--mkdir $data_dir2
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = DATA DIRECTORY = '$data_dir1'
+# We cannot mask the folder name here and further, but we can switch off query logging
+--let $disable_query_log = 1
+--echo # Running CREATE TABLE .. DATA DIRECTORY = <>
+--source create_table.inc
+
+--source mask_engine.inc
+--replace_result $data_dir1 <DATA_DIR_1>
+SHOW CREATE TABLE t1;
+
+--echo # For ALTER TABLE the option is ignored
+
+--let $alter_definition = DATA DIRECTORY = '$data_dir2'
+--disable_query_log
+--echo # Running ALTER TABLE .. DATA DIRECTORY = <>
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--enable_query_log
+--source mask_engine.inc
+--replace_result $data_dir1 <DATA_DIR_1>
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
+--rmdir $data_dir1
+--rmdir $data_dir2
diff --git a/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.test b/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.test
deleted file mode 100644
index 4a83cc46b84..00000000000
--- a/mysql-test/suite/storage_engine/tbl_opt_data_index_dir.test
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Check whether DATA DIRECTORY and INDEX DIRECTORY
-# are supported in CREATE and ALTER TABLE
-#
-# Note: the test does not check whether the options
-# have any real effect on the table, only
-# that they are accepted
-#
-
---source include/have_symlink.inc
---source have_engine.inc
-
---let $data_dir = $MYSQLTEST_VARDIR/storage_engine_data_dir/
---let $index_dir = $MYSQLTEST_VARDIR/storage_engine_index_dir/
---mkdir $data_dir
---mkdir $index_dir
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
---let $table_options = DATA DIRECTORY = '$data_dir' INDEX DIRECTORY = '$index_dir'
-# We cannot mask the folders name here, but we can switch off query logging
---let $disable_query_log = 1
---source create_table.inc
-
---source mask_engine.inc
---replace_result $data_dir <DATA_DIR> $index_dir <INDEX_DIR>
-SHOW CREATE TABLE t1;
-
---let $alter_definition = INDEX DIRECTORY = '$data_dir'
---disable_query_log
---source alter_table.inc
-if ($mysql_errname)
-{
- --let $my_last_stmt = $alter_statement
- --let $functionality = ALTER TABLE
- --source unexpected_result.inc
-}
---enable_query_log
---source mask_engine.inc
---replace_result $data_dir <DATA_DIR> $index_dir <INDEX_DIR>
-SHOW CREATE TABLE t1;
-
-DROP TABLE t1;
-
---source cleanup_engine.inc
-
---rmdir $data_dir
---rmdir $index_dir
-
-
diff --git a/mysql-test/suite/storage_engine/tbl_opt_index_dir.result b/mysql-test/suite/storage_engine/tbl_opt_index_dir.result
new file mode 100644
index 00000000000..c7368e9a84a
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_index_dir.result
@@ -0,0 +1,19 @@
+DROP TABLE IF EXISTS t1;
+# Running CREATE TABLE .. INDEX DIRECTORY = <>
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INDEX DIRECTORY='<INDEX_DIR_1>'
+# For ALTER TABLE the option is ignored
+# Running ALTER TABLE .. INDEX DIRECTORY = <>
+Warnings:
+Warning 1618 <INDEX DIRECTORY> option ignored
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 INDEX DIRECTORY='<INDEX_DIR_1>'
+DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_index_dir.test b/mysql-test/suite/storage_engine/tbl_opt_index_dir.test
new file mode 100644
index 00000000000..03d2ef2bf82
--- /dev/null
+++ b/mysql-test/suite/storage_engine/tbl_opt_index_dir.test
@@ -0,0 +1,52 @@
+#
+# Check whether INDEX DIRECTORY is supported in CREATE and ALTER TABLE
+#
+# Note: the test does not check whether the option
+# has any real effect on the table, only that it is accepted
+#
+
+--source include/have_symlink.inc
+--source have_engine.inc
+
+--let $index_dir1 = $MYSQLTEST_VARDIR/storage_engine_index_dir1/
+--let $index_dir2 = $MYSQLTEST_VARDIR/storage_engine_index_dir2/
+--mkdir $index_dir1
+--mkdir $index_dir2
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $table_options = INDEX DIRECTORY = '$index_dir1'
+# We cannot mask the folder name here and further, but we can switch off query logging
+--let $disable_query_log = 1
+--echo # Running CREATE TABLE .. INDEX DIRECTORY = <>
+--source create_table.inc
+
+--source mask_engine.inc
+--replace_result $index_dir1 <INDEX_DIR_1>
+SHOW CREATE TABLE t1;
+
+--echo # For ALTER TABLE the option is ignored
+
+--let $alter_definition = INDEX DIRECTORY = '$index_dir2'
+--disable_query_log
+--echo # Running ALTER TABLE .. INDEX DIRECTORY = <>
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--enable_query_log
+--source mask_engine.inc
+--replace_result $index_dir1 <INDEX_DIR_1>
+SHOW CREATE TABLE t1;
+
+DROP TABLE t1;
+
+--source cleanup_engine.inc
+
+--rmdir $index_dir1
+--rmdir $index_dir2
diff --git a/mysql-test/suite/storage_engine/tbl_opt_row_format.result b/mysql-test/suite/storage_engine/tbl_opt_row_format.result
index 5f1cf713bb6..57000e295f7 100644
--- a/mysql-test/suite/storage_engine/tbl_opt_row_format.result
+++ b/mysql-test/suite/storage_engine/tbl_opt_row_format.result
@@ -1,16 +1,30 @@
DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> ROW_FORMAT=FIXED;
+CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> ROW_FORMAT=DYNAMIC;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+ALTER TABLE t1 ROW_FORMAT=FIXED;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(8) DEFAULT NULL
) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
-ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 ROW_FORMAT=PAGE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(8) DEFAULT NULL
-) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=PAGE
+ALTER TABLE t1 ROW_FORMAT=COMPACT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `b` char(8) DEFAULT NULL
+) ENGINE=<STORAGE_ENGINE> DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
DROP TABLE t1;
diff --git a/mysql-test/suite/storage_engine/tbl_opt_row_format.test b/mysql-test/suite/storage_engine/tbl_opt_row_format.test
index d6347551da0..17fe2f36429 100644
--- a/mysql-test/suite/storage_engine/tbl_opt_row_format.test
+++ b/mysql-test/suite/storage_engine/tbl_opt_row_format.test
@@ -13,12 +13,12 @@
DROP TABLE IF EXISTS t1;
--enable_warnings
---let $table_options = ROW_FORMAT=FIXED
+--let $table_options = ROW_FORMAT=DYNAMIC
--source create_table.inc
--source mask_engine.inc
SHOW CREATE TABLE t1;
---let $alter_definition = ROW_FORMAT=DYNAMIC
+--let $alter_definition = ROW_FORMAT=FIXED
--source alter_table.inc
if ($mysql_errname)
{
@@ -29,6 +29,30 @@ if ($mysql_errname)
--source mask_engine.inc
SHOW CREATE TABLE t1;
+--let $alter_definition = ROW_FORMAT=PAGE
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+
+--let $alter_definition = ROW_FORMAT=COMPACT
+--source alter_table.inc
+if ($mysql_errname)
+{
+ --let $my_last_stmt = $alter_statement
+ --let $functionality = ALTER TABLE
+ --source unexpected_result.inc
+}
+--source mask_engine.inc
+SHOW CREATE TABLE t1;
+
+
DROP TABLE t1;
--source cleanup_engine.inc
diff --git a/mysql-test/suite/storage_engine/type_char_indexes.result b/mysql-test/suite/storage_engine/type_char_indexes.result
index 5be07bdf53f..73c076863ab 100644
--- a/mysql-test/suite/storage_engine/type_char_indexes.result
+++ b/mysql-test/suite/storage_engine/type_char_indexes.result
@@ -97,7 +97,7 @@ varchar2b 1
varchar3b 1
SET SESSION optimizer_switch = 'engine_condition_pushdown=on';
Warnings:
-Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release.
+Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release
EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a';
id select_type table type possible_keys key key_len ref rows Extra
# # # range c_v c_v # # # Using index condition
diff --git a/mysql-test/suite/storage_engine/type_date_time.result b/mysql-test/suite/storage_engine/type_date_time.result
index 473a7e67494..f136dd93f34 100644
--- a/mysql-test/suite/storage_engine/type_date_time.result
+++ b/mysql-test/suite/storage_engine/type_date_time.result
@@ -13,7 +13,7 @@ SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
d date # # #
dt datetime # # #
-ts timestamp # # # on update CURRENT_TIMESTAMP
+ts timestamp # # # on update current_timestamp()
t time # # #
y year(4) # # #
y4 year(4) # # #
diff --git a/mysql-test/suite/storage_engine/vcol.result b/mysql-test/suite/storage_engine/vcol.result
index d51ab038576..e56a1b0543d 100644
--- a/mysql-test/suite/storage_engine/vcol.result
+++ b/mysql-test/suite/storage_engine/vcol.result
@@ -3,12 +3,12 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1)) ENGIN
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
a int(11) # #
-b int(11) # # VIRTUAL
+b int(11) # # VIRTUAL GENERATED
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
Warnings:
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' ignored
SELECT a,b FROM t1;
a b
1 2
@@ -20,12 +20,12 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) PERSIS
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
a int(11) # #
-b int(11) # # PERSISTENT
+b int(11) # # STORED GENERATED
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
Warnings:
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' ignored
SELECT a,b FROM t1;
a b
1 2
@@ -37,12 +37,12 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> GENERATED ALWAYS AS (a+1) VIRTUA
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
a int(11) # #
-b int(11) # # VIRTUAL
+b int(11) # # VIRTUAL GENERATED
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
Warnings:
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' ignored
SELECT a,b FROM t1;
a b
1 2
@@ -54,12 +54,12 @@ CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN> AS (a+1) PERSISTENT) ENGINE=<STO
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
a int(11) # #
-b int(11) # # PERSISTENT
+b int(11) # # STORED GENERATED
INSERT INTO t1 (a) VALUES (1),(2);
INSERT INTO t1 (a,b) VALUES (3,3),(4,4);
Warnings:
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
-Warning 1906 The value specified for computed column 'b' in table 't1' ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' ignored
+Warning 1906 The value specified for generated column 'b' in table 't1' ignored
SELECT a,b FROM t1;
a b
1 2
diff --git a/mysql-test/suite/sys_vars/r/delay_key_write_func.result b/mysql-test/suite/sys_vars/r/delay_key_write_func.result
index 0fd1d492ef4..5cc4b2eaaad 100644
--- a/mysql-test/suite/sys_vars/r/delay_key_write_func.result
+++ b/mysql-test/suite/sys_vars/r/delay_key_write_func.result
@@ -1,24 +1,20 @@
'#--------------------FN_DYNVARS_023_01-------------------------#'
SET @start_value= @@global.delay_key_write;
-SET @@global.delay_key_write = ON;
-SELECT @@global.delay_key_write;
-@@global.delay_key_write
-ON
-connect user1,localhost,root,,,,;
-connection user1;
-SELECT @@global.delay_key_write AS res_is_ON;
-res_is_ON
-ON
-SET @@global.delay_key_write = ALL;
-disconnect user1;
-connect user1,localhost,root,,,,;
-connection user1;
-SELECT @@global.delay_key_write AS res_is_ALL;
-res_is_ALL
-ALL
'#--------------------FN_DYNVARS_023_02-------------------------#'
+CREATE PROCEDURE sp_addRecords (IN var1 INT,IN var2 INT)
+BEGIN
+WHILE (var1 < var2) DO
+INSERT INTO t1 VALUES(var1,REPEAT('MYSQL',10),100000.0/var1);
+SET var1=var1+1;
+END WHILE;
+END//
'---check when delay_key_write is OFF---'
SET @@global.delay_key_write = OFF;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b VARCHAR(512),
+c DOUBLE
+) DELAY_KEY_WRITE = 1;
FLUSH STATUS;
CALL sp_addRecords(1,10);
SHOW STATUS LIKE 'Key_reads';
@@ -33,8 +29,14 @@ Key_write_requests 9
SELECT COUNT(*) FROM t1;
COUNT(*)
9
+DROP TABLE t1;
'----check when delay_key_write is ON---'
SET @@global.delay_key_write = ON;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b VARCHAR(512),
+c DOUBLE
+) DELAY_KEY_WRITE = 1;
FLUSH STATUS;
CALL sp_addRecords(1,10);
SHOW STATUS LIKE 'Key_reads';
@@ -49,8 +51,14 @@ Key_write_requests 9
SELECT COUNT(*) FROM t1;
COUNT(*)
9
+DROP TABLE t1;
'----check when delay_key_write is ALL---'
SET @@global.delay_key_write = ALL;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b VARCHAR(512),
+c DOUBLE
+) DELAY_KEY_WRITE = 0;
FLUSH STATUS;
CALL sp_addRecords(1,10);
SHOW STATUS LIKE 'Key_reads';
@@ -67,6 +75,4 @@ COUNT(*)
9
DROP PROCEDURE sp_addRecords;
DROP TABLE t1;
-disconnect user1;
-connection default;
SET @@global.delay_key_write= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_sched_priority_cleaner_basic.result b/mysql-test/suite/sys_vars/r/innodb_sched_priority_cleaner_basic.result
index 1183fb27732..f2bfaf2ed61 100644
--- a/mysql-test/suite/sys_vars/r/innodb_sched_priority_cleaner_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_sched_priority_cleaner_basic.result
@@ -1,4 +1,4 @@
-SET @start_value = @@GLOBAL.innodb_sched_priority_cleaner;
+SET GLOBAL innodb_sched_priority_cleaner=39;
SELECT @@GLOBAL.innodb_sched_priority_cleaner;
@@GLOBAL.innodb_sched_priority_cleaner
19
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
index 858df585a7b..f5ce4d77c6b 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
@@ -1218,8 +1218,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
--GLOBAL_VALUE 5.6.35
-+GLOBAL_VALUE 5.6.35-80.0
+-GLOBAL_VALUE 5.6.36
++GLOBAL_VALUE 5.6.36-82.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
index d801270c6b6..9199653b460 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
@@ -661,8 +661,8 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
--GLOBAL_VALUE 5.6.35
-+GLOBAL_VALUE 5.6.35-80.0
+-GLOBAL_VALUE 5.6.36
++GLOBAL_VALUE 5.6.36-82.0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 8026c4a15ec..d74f15e90ae 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -1428,8 +1428,8 @@ DEFAULT_VALUE 50331648
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT
VARIABLE_COMMENT Size of each log file in a log group.
-NUMERIC_MIN_VALUE 4194304
-NUMERIC_MAX_VALUE 9223372036854775807
+NUMERIC_MIN_VALUE 1048576
+NUMERIC_MAX_VALUE 549755813888
NUMERIC_BLOCK_SIZE 1048576
ENUM_VALUE_LIST NULL
READ_ONLY YES
@@ -2458,7 +2458,7 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT NONE
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.7.14
+GLOBAL_VALUE 5.7.18
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
index 7ceea1a295c..b75960bfbb1 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
@@ -2909,9 +2909,9 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES
SESSION_VALUE NULL
-GLOBAL_VALUE 190
+GLOBAL_VALUE 191
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 190
+DEFAULT_VALUE 191
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Maximum number of statement instruments.
diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
index 957485b4e4b..13072f5afe1 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
@@ -3105,9 +3105,9 @@ READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME PERFORMANCE_SCHEMA_MAX_STATEMENT_CLASSES
SESSION_VALUE NULL
-GLOBAL_VALUE 190
+GLOBAL_VALUE 191
GLOBAL_VALUE_ORIGIN COMPILE-TIME
-DEFAULT_VALUE 190
+DEFAULT_VALUE 191
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Maximum number of statement instruments.
diff --git a/mysql-test/suite/sys_vars/t/delay_key_write_func.test b/mysql-test/suite/sys_vars/t/delay_key_write_func.test
index 89f40ba544b..e823e51954c 100644
--- a/mysql-test/suite/sys_vars/t/delay_key_write_func.test
+++ b/mysql-test/suite/sys_vars/t/delay_key_write_func.test
@@ -20,32 +20,14 @@
###############################################################################
--echo '#--------------------FN_DYNVARS_023_01-------------------------#'
-#######################################################################
-# Check if setting delay_key_write is changed in every new connection #
-#######################################################################
-
SET @start_value= @@global.delay_key_write;
-SET @@global.delay_key_write = ON;
-SELECT @@global.delay_key_write;
-
-connect (user1,localhost,root,,,,);
-connection user1;
-SELECT @@global.delay_key_write AS res_is_ON;
-SET @@global.delay_key_write = ALL;
-disconnect user1;
-
-connect (user1,localhost,root,,,,);
-connection user1;
-SELECT @@global.delay_key_write AS res_is_ALL;
-
--echo '#--------------------FN_DYNVARS_023_02-------------------------#'
######################################################
# Begin the functionality Testing of delay_key_write #
######################################################
# create procedure to add rows
---disable_query_log
DELIMITER //;
CREATE PROCEDURE sp_addRecords (IN var1 INT,IN var2 INT)
BEGIN
@@ -55,28 +37,19 @@ BEGIN
END WHILE;
END//
DELIMITER ;//
---enable_query_log
#==============================================================================
--echo '---check when delay_key_write is OFF---'
#==============================================================================
-
SET @@global.delay_key_write = OFF;
-
---disable_query_log
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
# create a table with delay_key_write enabled
CREATE TABLE t1(
a INT PRIMARY KEY,
b VARCHAR(512),
c DOUBLE
) DELAY_KEY_WRITE = 1;
---enable_query_log
-
FLUSH STATUS;
@@ -86,6 +59,7 @@ SHOW STATUS LIKE 'Key_reads';
SHOW STATUS LIKE 'Key_writes';
SHOW STATUS LIKE 'Key_write_requests';
SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
#==============================================================================
--echo '----check when delay_key_write is ON---'
@@ -93,17 +67,12 @@ SELECT COUNT(*) FROM t1;
SET @@global.delay_key_write = ON;
---disable_query_log
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
# create a table with delay_key_write enabled
CREATE TABLE t1(
a INT PRIMARY KEY,
b VARCHAR(512),
c DOUBLE
) DELAY_KEY_WRITE = 1;
---enable_query_log
FLUSH STATUS;
CALL sp_addRecords(1,10);
@@ -112,23 +81,19 @@ SHOW STATUS LIKE 'Key_reads';
SHOW STATUS LIKE 'Key_writes';
SHOW STATUS LIKE 'Key_write_requests';
SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
#==============================================================================
--echo '----check when delay_key_write is ALL---'
#==============================================================================
SET @@global.delay_key_write = ALL;
---disable_query_log
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
# create a table with delay_key_write disabled
CREATE TABLE t1(
a INT PRIMARY KEY,
b VARCHAR(512),
c DOUBLE
) DELAY_KEY_WRITE = 0;
---enable_query_log
FLUSH STATUS;
CALL sp_addRecords(1,10);
@@ -140,12 +105,9 @@ SELECT COUNT(*) FROM t1;
DROP PROCEDURE sp_addRecords;
DROP TABLE t1;
-disconnect user1;
-connection default;
SET @@global.delay_key_write= @start_value;
####################################################
# End of functionality testing for delay_key_write #
####################################################
-
diff --git a/mysql-test/suite/sys_vars/t/innodb_sched_priority_cleaner_basic.test b/mysql-test/suite/sys_vars/t/innodb_sched_priority_cleaner_basic.test
index b2382fd7844..2c2037f167f 100644
--- a/mysql-test/suite/sys_vars/t/innodb_sched_priority_cleaner_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_sched_priority_cleaner_basic.test
@@ -4,7 +4,15 @@
# A dynamic, global variable
-SET @start_value = @@GLOBAL.innodb_sched_priority_cleaner;
+# Test in read-only mode
+--let $restart_parameters= --innodb-read-only
+--source include/restart_mysqld.inc
+--let $restart_parameters=
+
+# This has no actual effect in innodb_read_only mode
+SET GLOBAL innodb_sched_priority_cleaner=39;
+
+--source include/restart_mysqld.inc
# Default value
SELECT @@GLOBAL.innodb_sched_priority_cleaner;
diff --git a/mysql-test/suite/wsrep/include/check_galera_version.inc b/mysql-test/suite/wsrep/include/check_galera_version.inc
index 38b4ada98b9..cb35269249b 100644
--- a/mysql-test/suite/wsrep/include/check_galera_version.inc
+++ b/mysql-test/suite/wsrep/include/check_galera_version.inc
@@ -12,11 +12,29 @@
--disable_query_log
-eval SET @GALERA_VERSION=(SELECT CONCAT('$galera_version', '%'));
+# Required Version
-if (!`SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE
- VARIABLE_NAME LIKE 'wsrep_provider_version' AND
- VARIABLE_VALUE LIKE @GALERA_VERSION`)
+eval SET @GALERA_VERSION='$galera_version';
+SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @GALERA_MAJOR_VERSION;
+SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+)\\.(\\d+).*','\\2') AS UNSIGNED) INTO @GALERA_MID_VERSION;
+SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+)\\.(\\d+).*','\\3') AS UNSIGNED) INTO @GALERA_MINOR_VERSION;
+
+# Actual
+SELECT VARIABLE_VALUE INTO @ACTUAL_GALERA_VERSION FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version';
+
+SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MAJOR_VERSION;
+SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+)\\.(\\d+).*','\\2') AS UNSIGNED) INTO @ACTUAL_GALERA_MID_VERSION;
+SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+)\\.(\\d+).*','\\3') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION;
+
+# For testing
+#SELECT @GALERA_MAJOR_VERSION, @GALERA_MID_VERSION, @GALERA_MINOR_VERSION;
+#SELECT @ACTUAL_GALERA_VERSION;
+#SELECT @ACTUAL_GALERA_MAJOR_VERSION, @ACTUAL_GALERA_MID_VERSION, @ACTUAL_GALERA_MINOR_VERSION;
+
+if (!`SELECT (@ACTUAL_GALERA_MAJOR_VERSION > @GALERA_MAJOR_VERSION) OR
+ (@ACTUAL_GALERA_MAJOR_VERSION = @GALERA_MAJOR_VERSION AND @ACTUAL_GALERA_MID_VERSION > @GALERA_MID_VERSION) OR
+ (@ACTUAL_GALERA_MAJOR_VERSION = @GALERA_MAJOR_VERSION AND @ACTUAL_GALERA_MID_VERSION = @GALERA_MID_VERSION AND @ACTUAL_GALERA_MINOR_VERSION >= @GALERA_MINOR_VERSION)
+ `)
{
skip Test requires Galera library version $galera_version;
}
diff --git a/mysql-test/t/alter_table_online.test b/mysql-test/t/alter_table_online.test
index 22ebadd64f9..15df36e8009 100644
--- a/mysql-test/t/alter_table_online.test
+++ b/mysql-test/t/alter_table_online.test
@@ -285,6 +285,24 @@ CREATE TABLE t1 (a LONGTEXT COLLATE latin1_general_ci);
ALTER TABLE t1 MODIFY a LONGTEXT COLLATE latin1_swedish_ci, ALGORITHM=INPLACE;
DROP TABLE t1;
---echo #
---echo # End of MDEV-8948 ALTER ... INPLACE does work for BINARY, BLOB
---echo #
+#
+# MDEV-11335 Changing delay_key_write option for MyISAM table should not copy rows
+#
+select @@global.delay_key_write;
+create table t1 (a int, b int, key(b));
+flush tables;
+flush status;
+show status like 'Feature_delay_key_write';
+insert t1 values (1,2),(2,3),(3,4);
+show status like 'Feature_delay_key_write';
+alter online table t1 delay_key_write=1;
+show status like 'Feature_delay_key_write';
+flush tables;
+insert t1 values (1,2),(2,3),(3,4);
+show status like 'Feature_delay_key_write';
+alter online table t1 delay_key_write=0;
+show status like 'Feature_delay_key_write';
+flush tables;
+insert t1 values (1,2),(2,3),(3,4);
+show status like 'Feature_delay_key_write';
+drop table t1;
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 3a18e9a086e..9b0cf9dca7d 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1899,6 +1899,56 @@ deallocate prepare stmt1;
drop table t1,t2;
+--echo #
+--echo # Bug mdev-12670: mergeable derived / view with subqueries
+--echo # subject to semi-join optimizations
+--echo # (actually this is a 5.3 bug.)
+--echo #
+
+create table t1 (a int) engine=myisam;
+insert into t1 values (5),(3),(2),(7),(2),(5),(1);
+create table t2 (b int, index idx(b)) engine=myisam;
+insert into t2 values (2),(3),(2),(1),(3),(4);
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+analyze table t1,t2;
+
+explain select a from t1 where a in (select b from t2);
+explain select * from (select a from t1 where a in (select b from t2)) t;
+create view v1 as select a from t1 where a in (select b from t2);
+explain select * from v1;
+
+drop view v1;
+drop table t1,t2;
+
+--echo #
+--echo # Bug mdev-12812: mergeable derived / view with subqueries
+--echo # NOT subject to semi-join optimizations
+--echo #
+
+CREATE TABLE t1 (c1 varchar(3)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('foo');
+
+CREATE TABLE t2 (c2 varchar(3)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('bar'),('qux'),('foo');
+
+let $q=
+SELECT STRAIGHT_JOIN *
+ FROM ( SELECT * FROM t1 WHERE c1 IN ( SELECT c2 FROM t2 ) ) AS sq;
+
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+DROP TABLE t1, t2;
+
# The following command must be the last one the file
set optimizer_switch=@exit_optimizer_switch;
set join_cache_level=@exit_join_cache_level;
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 4928203e603..d847f7cd5f7 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -1693,6 +1693,17 @@ DROP TABLE t1;
--echo #
--echo #
+--echo # MDEV-13064: assertion `n < m_size' fails in Item::split_sum_func2()
+--echo #
+
+create table t1 (i int) engine=MyISAM;
+insert into t1 value (1),(2);
+
+select count(*)+sleep(0) from t1;
+
+drop table t1;
+
+--echo #
--echo # Start of 10.3 tests
--echo #
diff --git a/mysql-test/t/func_hybrid_type.test b/mysql-test/t/func_hybrid_type.test
index f353eb7a628..954c7de53fa 100644
--- a/mysql-test/t/func_hybrid_type.test
+++ b/mysql-test/t/func_hybrid_type.test
@@ -553,6 +553,42 @@ SELECT * FROM t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
+CREATE TABLE t1 AS SELECT
+ 9 AS i1, COALESCE(9) AS c1,
+ 99 AS i2, COALESCE(99) AS c2,
+ 999 AS i3, COALESCE(999) AS c3,
+ 9999 AS i4, COALESCE(9999) AS c4,
+ 99999 AS i5, COALESCE(99999) AS c5,
+ 999999 AS i6, COALESCE(999999) AS c6,
+ 9999999 AS i7, COALESCE(9999999) AS c7,
+ 99999999 AS i8, COALESCE(99999999) AS c8,
+ 999999999 AS i9, COALESCE(999999999) AS c9,
+ 2147483647, COALESCE(2147483647),
+ 2147483648, COALESCE(2147483648),
+ 9999999999 AS i10, COALESCE(9999999999) AS c10,
+ 99999999999 AS i11, COALESCE(99999999999) AS c11,
+ 999999999999 AS i12, COALESCE(999999999999) AS c12,
+ 9999999999999 AS i13, COALESCE(9999999999999) AS c13,
+ 99999999999999 AS i14, COALESCE(99999999999999) AS c14,
+ 999999999999999 AS i15, COALESCE(999999999999999) AS c15,
+ 9999999999999999 AS i16, COALESCE(9999999999999999) AS c16,
+ 99999999999999999 AS i17, COALESCE(99999999999999999) AS c17,
+ 999999999999999999 AS i18, COALESCE(999999999999999999) AS c18,
+ 9223372036854775807, COALESCE(9223372036854775807),
+ 9223372036854775808, COALESCE(9223372036854775808),
+ 9999999999999999999 AS i19, COALESCE(9999999999999999999) AS c19,
+ 18446744073709551615, COALESCE(18446744073709551615),
+ 18446744073709551616, COALESCE(18446744073709551616),
+ 99999999999999999999 AS i20, COALESCE(99999999999999999999) AS c20,
+ 999999999999999999999 AS i21, COALESCE(999999999999999999999) AS c21,
+ 9999999999999999999999 AS i22, COALESCE(9999999999999999999999) AS c22;
+SHOW CREATE TABLE t1;
+--vertical_results
+SELECT * FROM t1;
+--horizontal_results
+DROP TABLE t1;
+
+
--echo #
--echo # MDEV-9406 CREATE TABLE..SELECT creates different columns for IFNULL() and equivalent COALESCE,CASE,IF
--echo #
diff --git a/mysql-test/t/func_regexp_pcre.test b/mysql-test/t/func_regexp_pcre.test
index 26294ce2e24..4b2c18e0674 100644
--- a/mysql-test/t/func_regexp_pcre.test
+++ b/mysql-test/t/func_regexp_pcre.test
@@ -428,3 +428,14 @@ SELECT 0xE001 REGEXP @regCheck;
SET NAMES latin1;
SET @regCheck= '\\xE0\\x01';
SELECT CAST(0xE001 AS BINARY) REGEXP @regCheck;
+
+--echo # MDEV-12420: Testing recursion overflow
+--replace_regex /[0-9]+ exceeded/NUM exceeded/
+SELECT 1 FROM dual WHERE ('Alpha,Bravo,Charlie,Delta,Echo,Foxtrot,StrataCentral,Golf,Hotel,India,Juliet,Kilo,Lima,Mike,StrataL3,November,Oscar,StrataL2,Sand,P3,P4SwitchTest,Arsys,Poppa,ExtensionMgr,Arp,Quebec,Romeo,StrataApiV2,PtReyes,Sierra,SandAcl,Arrow,Artools,BridgeTest,Tango,SandT,PAlaska,Namespace,Agent,Qos,PatchPanel,ProjectReport,Ark,Gimp,Agent,SliceAgent,Arnet,Bgp,Ale,Tommy,Central,AsicPktTestLib,Hsc,SandL3,Abuild,Pca9555,Standby,ControllerDut,CalSys,SandLib,Sb820,PointV2,BfnLib,Evpn,BfnSdk,Sflow,ManagementActive,AutoTest,GatedTest,Bgp,Sand,xinetd,BfnAgentLib,bf-utils,Hello,BfnState,Eos,Artest,Qos,Scd,ThermoMgr,Uniform,EosUtils,Eb,FanController,Central,BfnL3,BfnL2,tcp_wrappers,Victor,Environment,Route,Failover,Whiskey,Xray,Gimp,BfnFixed,Strata,SoCal,XApi,Msrp,XpProfile,tcpdump,PatchPanel,ArosTest,FhTest,Arbus,XpAcl,MacConc,XpApi,telnet,QosTest,Alpha2,BfnVlan,Stp,VxlanControllerTest,MplsAgent,Bravo2,Lanz,BfnMbb,Intf,XCtrl,Unicast,SandTunnel,L3Unicast,Ipsec,MplsTest,Rsvp,EthIntf,StageMgr,Sol,MplsUtils,Nat,Ira,P4NamespaceDut,Counters,Charlie2,Aqlc,Mlag,Power,OpenFlow,Lag,RestApi,BfdTest,strongs,Sfa,CEosUtils,Adt746,MaintenanceMode,MlagDut,EosImage,IpEth,MultiProtocol,Launcher,Max3179,Snmp,Acl,IpEthTest,PhyEee,bf-syslibs,tacc,XpL2,p4-ar-switch,p4-bf-switch,LdpTest,BfnPhy,Mirroring,Phy6,Ptp' REGEXP '^((?!\b(Strata|StrataApi|StrataApiV2)\b).)*$');
+
+#
+# MDEV-12942 REGEXP_INSTR returns 1 when using brackets
+#
+SELECT REGEXP_INSTR('a_kollision', 'oll');
+SELECT REGEXP_INSTR('a_kollision', '(oll)');
+SELECT REGEXP_INSTR('a_kollision', 'o([lm])\\1');
diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test
index bf94b7dd3d5..a721943e8bc 100644
--- a/mysql-test/t/innodb_ext_key.test
+++ b/mysql-test/t/innodb_ext_key.test
@@ -778,5 +778,46 @@ where index_date_updated= 10 and index_id < 800;
drop table t0,t1,t2;
-set optimizer_switch=@save_ext_key_optimizer_switch;
-SET SESSION STORAGE_ENGINE=DEFAULT;
+
+--echo #
+--echo # MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff'
+--echo # was corrupted, server crashes in opt_sum_query
+
+CREATE TABLE t1 (
+ pk INT,
+ f1 VARCHAR(3),
+ f2 VARCHAR(1024),
+ PRIMARY KEY (pk),
+ KEY(f2)
+) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
+
+INSERT INTO t1 VALUES (1,'foo','abc'),(2,'bar','def');
+SELECT MAX(t2.pk) FROM t1 t2 INNER JOIN t1 t3 ON t2.f1 = t3.f1 WHERE t2.pk <= 4;
+drop table t1;
+
+CREATE TABLE t1 (
+ pk1 INT,
+ pk2 INT,
+ f1 VARCHAR(3),
+ f2 VARCHAR(1021),
+ PRIMARY KEY (pk1,pk2),
+ KEY(f2)
+) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
+
+INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
+explain format= json
+select * from t1 force index(f2) where pk1 <= 5 and pk2 <=5 and f2 = 'abc' and f1 <= '3';
+drop table t1;
+
+CREATE TABLE t1 (
+f2 INT,
+pk2 INT,
+f1 VARCHAR(3),
+pk1 VARCHAR(1000),
+PRIMARY KEY (pk1,pk2),
+KEY k1(pk1,f2)
+) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
+INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def');
+explain format= json
+select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3';
+drop table t1;
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index a3a1278ef1e..88861511d79 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -1882,4 +1882,86 @@ WHERE v3 = 4;
drop table t1,t2,t3;
+--echo #
+--echo # MDEV-11958: LEFT JOIN with stored routine produces incorrect result
+--echo #
+
+CREATE TABLE t (x INT);
+INSERT INTO t VALUES(1),(NULL);
+CREATE FUNCTION f (val INT, ret INT) RETURNS INT DETERMINISTIC RETURN IFNULL(val, ret);
+
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+ FROM t t1 LEFT JOIN t t2
+ ON t1.x = t2.x
+ WHERE IFNULL(t2.x,0)=0;
+explain extended
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+ FROM t t1 LEFT JOIN t t2
+ ON t1.x = t2.x
+ WHERE IFNULL(t2.x,0)=0;
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+ FROM t t1 LEFT JOIN t t2
+ ON t1.x = t2.x
+ WHERE f(t2.x,0)=0;
+explain extended
+SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0)
+ FROM t t1 LEFT JOIN t t2
+ ON t1.x = t2.x
+ WHERE f(t2.x,0)=0;
+
+drop function f;
+drop table t;
+CREATE TABLE t1 (
+ col1 DECIMAL(33,5) NULL DEFAULT NULL,
+ col2 DECIMAL(33,5) NULL DEFAULT NULL
+);
+
+CREATE TABLE t2 (
+ col1 DECIMAL(33,5) NULL DEFAULT NULL,
+ col2 DECIMAL(33,5) NULL DEFAULT NULL,
+ col3 DECIMAL(33,5) NULL DEFAULT NULL
+);
+
+INSERT INTO t1 VALUES (2, 1.1), (2, 2.1);
+INSERT INTO t2 VALUES (3, 3.1, 4), (1, 1, NULL);
+
+DELIMITER |;
+
+CREATE FUNCTION f1 ( p_num DECIMAL(45,15), p_return DECIMAL(45,15))
+RETURNS decimal(33,5)
+LANGUAGE SQL
+DETERMINISTIC
+CONTAINS SQL
+SQL SECURITY INVOKER
+BEGIN
+ IF p_num IS NULL THEN
+ RETURN p_return;
+ ELSE
+ RETURN p_num;
+ END IF;
+END |
+
+DELIMITER ;|
+
+let $q1=
+SELECT t1.col1, t2.col1, t2.col3
+FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
+WHERE IFNULL(t2.col3,0) = 0;
+
+eval $q1;
+eval EXPLAIN EXTENDED $q1;
+
+let $q2=
+SELECT t1.col1, t2.col1, t2.col3
+FROM t1 LEFT OUTER JOIN t2 ON t1.col1 = t2.col2
+WHERE f1(t2.col3,0) = 0;
+eval $q2;
+eval EXPLAIN EXTENDED $q2;
+
+DROP FUNCTION f1;
+
+DROP TABLE t1,t2;
+
+--echo # end of 5.5 tests
+
SET optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/log_tables-big-master.opt b/mysql-test/t/log_tables-big-master.opt
index b9bc885d0e4..0cdf12d284b 100644
--- a/mysql-test/t/log_tables-big-master.opt
+++ b/mysql-test/t/log_tables-big-master.opt
@@ -1 +1 @@
---log-output=table,file --slow-query-log --general-log --general-log-file="" --slow-query-log-file=""
+--slow-query-log --general-log --general-log-file="" --slow-query-log-file=""
diff --git a/mysql-test/t/mdl_sync.test b/mysql-test/t/mdl_sync.test
index 4aa191d3dfc..fbecd6bf547 100644
--- a/mysql-test/t/mdl_sync.test
+++ b/mysql-test/t/mdl_sync.test
@@ -4075,6 +4075,30 @@ disconnect con2;
disconnect con3;
+--echo #
+--echo # MDEV-12620 - set lock_wait_timeout = 1;flush tables with read lock;
+--echo # lock not released after timeout
+--echo #
+CREATE TABLE t1(a INT) ENGINE=InnoDB;
+SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go';
+send SELECT * FROM t1;
+
+connect (con1,localhost,root,,);
+SET debug_sync='now WAIT_FOR ready';
+# lock_wait_timeout should be 0 in 10.3, so that we don't have to wait at all
+SET lock_wait_timeout=1;
+--error ER_LOCK_WAIT_TIMEOUT
+FLUSH TABLES WITH READ LOCK;
+SET debug_sync='now SIGNAL go';
+
+connection default;
+reap;
+SET debug_sync='RESET';
+DROP TABLE t1;
+
+disconnect con1;
+
+
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/myisam_debug.test b/mysql-test/t/myisam_debug.test
index b106ecdea5e..465ecd70895 100644
--- a/mysql-test/t/myisam_debug.test
+++ b/mysql-test/t/myisam_debug.test
@@ -57,3 +57,16 @@ KILL QUERY @thread_id;
CHECK TABLE t1;
DROP TABLE t1,t2;
DISCONNECT insertConn;
+
+#
+# MDEV-12761 Error return from external_lock make the server crash
+#
+call mtr.add_suppression("Index for table '.*test.t1\\.MYI' is corrupt; try to repair it");
+create table t1 (a int, index(a));
+lock tables t1 write;
+insert t1 values (1),(2),(1);
+set @old_dbug=@@debug_dbug;
+set debug_dbug='+d,mi_lock_database_failure';
+unlock tables;
+set debug_dbug=@old_dbug;
+drop table t1;
diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test
index e6499957cd2..01f26f09543 100644
--- a/mysql-test/t/mysqld--help.test
+++ b/mysql-test/t/mysqld--help.test
@@ -3,6 +3,7 @@
#
--source include/not_embedded.inc
--source include/have_perfschema.inc
+--source include/have_profiling.inc
--source include/platform.inc
#
diff --git a/mysql-test/t/partition_alter.test b/mysql-test/t/partition_alter.test
index 592d8fdaeaa..9194e9a8222 100644
--- a/mysql-test/t/partition_alter.test
+++ b/mysql-test/t/partition_alter.test
@@ -1,3 +1,4 @@
+--source include/have_innodb.inc
--source include/have_partition.inc
CREATE TABLE `test_data` (
@@ -64,3 +65,41 @@ deallocate prepare stmt;
drop table test_data;
+#
+# MDEV-12389 ADD CHECK leaves an orphaned .par file
+#
+
+--let $datadir=`SELECT @@datadir`
+
+# InnoDB
+create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
+engine=innodb
+partition by range columns (d) (
+partition p1 values less than ('2016-10-18'),
+partition p2 values less than ('2020-10-19'));
+insert t1 values (0, '2000-01-02', 0);
+insert t1 values (1, '2020-01-02', 10);
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CONSTRAINT_FAILED
+alter table t1 add check (b in (0, 1));
+alter table t1 add check (b in (0, 10));
+show create table t1;
+--error ER_CONSTRAINT_FAILED
+insert t1 values (2, '2020-01-03', 20);
+drop table t1;
+--list_files $datadir/test
+
+# MyISAM, different execution path
+create table t1(id int, d date not null, b bool not null default 0, primary key(id,d))
+partition by range columns (d) (
+partition p1 values less than ('2016-10-18'),
+partition p2 values less than ('2020-10-19'));
+insert t1 values (0, '2000-01-02', 0);
+insert t1 values (1, '2020-01-02', 10);
+# FIXME: MDEV-12923 MyISAM allows CHECK constraint violation in ALTER TABLE
+alter table t1 add check (b in (0, 1));
+show create table t1;
+--error ER_CONSTRAINT_FAILED
+insert t1 values (2, '2020-01-03', 20);
+drop table t1;
+--list_files $datadir/test
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index 2451bc60fee..544bcd994ed 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -576,3 +576,38 @@ from
t1;
drop table t1,t2;
+
+--echo #
+--echo # mdev-12931: semi-join in ON expression of STRAIGHT_JOIN
+--echo # joining a base table and a mergeable derived table
+--echo #
+
+CREATE TABLE t1 (f1 int) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (3),(2);
+
+CREATE TABLE t2 (f2 int) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (1),(4);
+
+CREATE TABLE t3 (f3 int) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (5),(6);
+
+CREATE TABLE t4 (f4 int) ENGINE=InnoDB;
+INSERT INTO t4 VALUES (1),(8);
+
+SELECT *
+FROM t1
+ INNER JOIN
+ ( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq
+ ON ( 1 IN ( SELECT f4 FROM t4 ) ) )
+ ON ( f1 >= f2 );
+
+EXPLAIN EXTENDED
+SELECT *
+FROM t1
+ INNER JOIN
+ ( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq
+ ON ( 1 IN ( SELECT f4 FROM t4 ) ) )
+ ON ( f1 >= f2 );
+
+DROP TABLE t1,t2,t3,t4;
+
diff --git a/mysql-test/t/subselect_mat_cost_bugs.test b/mysql-test/t/subselect_mat_cost_bugs.test
index 316ac707bef..9e3ac603ec6 100644
--- a/mysql-test/t/subselect_mat_cost_bugs.test
+++ b/mysql-test/t/subselect_mat_cost_bugs.test
@@ -406,6 +406,8 @@ drop table t3, t4, t5;
--echo # LP BUG#858038 The result of a query with NOT IN subquery depends on the state of the optimizer switch
--echo #
+set @optimizer_switch_save= @@optimizer_switch;
+
create table t1 (c1 char(2) not null, c2 char(2));
create table t2 (c3 char(2), c4 char(2));
@@ -425,6 +427,8 @@ select * from t1 where c1 = 'a2' and (c1, c2) not in (select * from t2);
drop table t1, t2;
+set optimizer_switch= @optimizer_switch_save;
+
--echo #
--echo # MDEV-12673: cost-based choice between materialization and in-to-exists
--echo #
@@ -463,3 +467,43 @@ SELECT * FROM t1 WHERE i1 NOT IN (
);
DROP TABLE t1,t2,t3;
+
+--echo #
+--echo # MDEV-7599: in-to-exists chosen after min/max optimization
+--echo #
+
+set @optimizer_switch_save= @@optimizer_switch;
+
+CREATE TABLE t1 (a INT, KEY(a)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (b INT, c INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1,6),(2,4), (8,9);
+
+let $q=
+SELECT * FROM t2 WHERE b != ALL (SELECT MIN(a) FROM t1, t2 WHERE t2.c = t2.b);
+
+eval $q;
+eval EXPLAIN EXTENDED $q;
+set optimizer_switch= 'materialization=off';
+eval $q;
+eval EXPLAIN EXTENDED $q;
+set optimizer_switch= @optimizer_switch_save;
+
+DROP TABLE t1,t2;
+
+CREATE TABLE t1 (f1 varchar(10)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('foo'),('bar');
+
+CREATE TABLE t2 (f2 varchar(10), key(f2)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('baz'),('qux');
+
+CREATE TABLE t3 (f3 varchar(10)) ENGINE=MyISAM;
+INSERT INTO t3 VALUES ('abc'),('def');
+
+SELECT * FROM t1
+ WHERE f1 = ALL( SELECT MAX(t2a.f2)
+ FROM t2 AS t2a INNER JOIN t2 t2b INNER JOIN t3
+ ON (f3 = t2b.f2) );
+
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index b6d6e0a5172..f90f1e2e927 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2773,5 +2773,77 @@ WHERE ( SELECT z.country
drop table t1, t2, t3;
set optimizer_switch= @tmp_mdev6859;
+--echo #
+--echo # MDEV-12675: subquery subject to semi-join optimizations
+--echo # in ON expression of INNER JOIN
+--echo #
+
+set @tmp_mdev12675=@@optimizer_switch;
+set optimizer_switch=default;
+create table t1 (a int) engine=myisam;
+insert into t1 values (5),(3),(2),(7),(2),(5),(1);
+create table t2 (b int, index idx(b)) engine=myisam;
+insert into t2 values (2),(3),(2),(1),(3),(4);
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+insert into t2 select b+10 from t2;
+analyze table t1,t2;
+
+explain
+select a from t1, t2 where b between 1 and 2 and a in (select b from t2);
+explain
+select a from t1 join t2 on b between 1 and 2 and a in (select b from t2);
+
+drop table t1,t2;
+set optimizer_switch= @tmp_mdev12675;
+
+--echo #
+--echo # MDEV-12817: subquery NOT subject to semi-join optimizations
+--echo # in ON expression of INNER JOIN
+--echo #
+
+CREATE TABLE t1 (c1 int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (c2 int) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+
+CREATE TABLE t3 (c3 int) ENGINE=MyISAM;
+INSERT INTO t3 VALUES (5),(6);
+
+CREATE TABLE t4 (c4 int) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (7),(8);
+
+let $q1=
+SELECT c1
+FROM t1
+LEFT JOIN
+( t2 INNER JOIN t3 ON ( 1 IN ( SELECT c4 FROM t4 ) ) )
+ON (c1 = c3);
+
+eval $q1;
+eval EXPLAIN EXTENDED $q1;
+
+let $q2=
+SELECT *
+FROM t1
+LEFT JOIN
+( ( SELECT * FROM t2 WHERE c2 IN ( SELECT c3 FROM t3 ) ) AS sq INNER JOIN t4 )
+ON (c1 = c2);
+
+--echo # mdev-12820
+eval $q2;
+eval EXPLAIN EXTENDED $q2;
+
+DROP TABLE t1,t2,t3,t4;
+
# The following command must be the last one the file
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/t/subselect_sj2_mat.test b/mysql-test/t/subselect_sj2_mat.test
index 61d9b09edff..0f2892ae2dc 100644
--- a/mysql-test/t/subselect_sj2_mat.test
+++ b/mysql-test/t/subselect_sj2_mat.test
@@ -263,3 +263,23 @@ DROP TABLE t1,t2,t3;
set join_cache_level= @save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
+--echo #
+--echo # mdev-7791: materialization of a semi-join subquery +
+--echo # RAND() in WHERE
+--echo # (materialized table is accessed last)
+--echo #
+
+set @save_optimizer_switch=@@optimizer_switch;
+set optimizer_switch='materialization=on';
+
+create table t1(i int);
+insert into t1 values (1), (2), (3), (7), (9), (10);
+create table t2(i int);
+insert into t2 values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
+
+select * from t1 where (rand() < 0) and i in (select i from t2);
+explain extended
+select * from t1 where (rand() < 0) and i in (select i from t2);
+
+drop table t1,t2;
+set optimizer_switch=@save_optimizer_switch;
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index d6eca47c0d8..aeab884670d 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -2677,6 +2677,30 @@ select trigger_name, action_order, created from information_schema.triggers
drop table t1;
set time_zone= @@global.time_zone;
+--echo # MDEV-12992: Increasing memory consumption
+--echo with each invocation of trigger
+--echo #
+
+--let $n= 20000
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (b INT);
+CREATE TRIGGER tr
+ AFTER UPDATE ON t1 FOR EACH ROW SELECT (SELECT b FROM t2) INTO @x;
+
+--disable_query_log
+--echo # Running $n queries
+while ($n)
+{
+ UPDATE t1 SET a = 2;
+ --dec $n
+}
+--enable_query_log
+
+DROP TABLE t1,t2;
+
+
--echo #
--echo # Start of 10.3 tests
--echo #
diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test
index c7a066cc203..8895677b79f 100644
--- a/mysql-test/t/truncate.test
+++ b/mysql-test/t/truncate.test
@@ -56,7 +56,7 @@ drop table t1;
# Test for Bug#5507 "TRUNCATE should work with views"
#
# when it'll be fixed, the error should become 1347
-# (test.v1' is not BASE TABLE)
+# (test.v1' is not of type 'BASE TABLE')
#
create table t1 (s1 int);
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index ce8b2bc9c2a..abea52fe584 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -1524,6 +1524,31 @@ SELECT * FROM t1 t1_1 LEFT JOIN t1 t1_2 ON ( t1_2.b = t1_1.a )
DROP TABLE t1;
+--echo # Bug mdev-12788: UNION ALL + impossible having for derived
+--echo # with IN subquery in WHERE
+--echo #
+
+CREATE TABLE t1 (i int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (pk int PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (1),(2);
+
+let $q=
+SELECT 1, 2
+UNION ALL
+SELECT i, COUNT(*) FROM (
+ SELECT * FROM t1 WHERE i IN ( SELECT pk FROM t2 )
+) AS sq
+GROUP BY i
+HAVING i = 10;
+
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+DROP TABLE t1,t2;
+
+
--echo #
--echo # Start of 10.3 tests
--echo #