diff options
author | Monty <monty@mariadb.org> | 2018-02-14 02:30:11 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-03-29 13:59:40 +0300 |
commit | c3f37c070ce1224173fa5ed9033d50aa6f0bc535 (patch) | |
tree | cd420eceea1ab0fab740e1b1b7e801398e1ce9b3 /mysql-test | |
parent | 209375fdd07d9be79784984f8543be73d1f92a9a (diff) | |
download | mariadb-git-c3f37c070ce1224173fa5ed9033d50aa6f0bc535.tar.gz |
Fixed alter online table for Aria tables
fill_alter_table() always thought that index was changed because of
of a wrong check of block_size. Some engines had code to correct this
that should not be needed, Aria didn't and because of this some online
operations didn't work.
This code fixes the comparision of block_size to only compare if it's set.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/myisam.result | 78 | ||||
-rw-r--r-- | mysql-test/suite/maria/maria.result | 21 | ||||
-rw-r--r-- | mysql-test/suite/maria/maria.test | 3 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 17 |
4 files changed, 118 insertions, 1 deletions
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index ef7737c6777..cbc475cfd8a 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -2043,6 +2043,84 @@ t1 CREATE TABLE `t1` ( KEY `b` (`b`(1000)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8192 drop table t1; +create table t1 (a int not null, b varchar(512), key (a), key(b)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(512) DEFAULT NULL, + KEY `a` (`a`), + KEY `b` (`b`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 key_block_size=2048; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(512) DEFAULT NULL, + KEY `a` (`a`) KEY_BLOCK_SIZE=1024, + KEY `b` (`b`) KEY_BLOCK_SIZE=3072 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2048 +alter table t1 add c int, add key (c); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(512) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + KEY `a` (`a`) KEY_BLOCK_SIZE=1024, + KEY `b` (`b`) KEY_BLOCK_SIZE=4096, + KEY `c` (`c`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2048 +alter table t1 key_block_size=4096; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(512) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + KEY `a` (`a`) KEY_BLOCK_SIZE=1024, + KEY `b` (`b`), + KEY `c` (`c`) KEY_BLOCK_SIZE=2048 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4096 +alter table t1 key_block_size=0; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(512) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + KEY `a` (`a`) KEY_BLOCK_SIZE=1024, + KEY `b` (`b`) KEY_BLOCK_SIZE=4096, + KEY `c` (`c`) KEY_BLOCK_SIZE=2048 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 add d int, add key (d); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(512) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + KEY `a` (`a`) KEY_BLOCK_SIZE=1024, + KEY `b` (`b`) KEY_BLOCK_SIZE=4096, + KEY `c` (`c`) KEY_BLOCK_SIZE=2048, + KEY `d` (`d`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 key_block_size=8192; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(512) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + `d` int(11) DEFAULT NULL, + KEY `a` (`a`) KEY_BLOCK_SIZE=1024, + KEY `b` (`b`) KEY_BLOCK_SIZE=4096, + KEY `c` (`c`) KEY_BLOCK_SIZE=2048, + KEY `d` (`d`) KEY_BLOCK_SIZE=1024 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=8192 +drop table t1; create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192; Warnings: Warning 1071 Specified key was too long; max key length is 1000 bytes diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index 805fb536848..bd2403ad461 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -1904,7 +1904,28 @@ t1 CREATE TABLE `t1` ( KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=8192, KEY `c` (`c`) KEY_BLOCK_SIZE=8192 ) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=2048 +alter table t1 key_block_size=4096; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(2048) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + KEY `a` (`a`) KEY_BLOCK_SIZE=8192, + KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=8192, + KEY `c` (`c`) KEY_BLOCK_SIZE=8192 +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 KEY_BLOCK_SIZE=4096 alter table t1 key_block_size=0; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(2048) DEFAULT NULL, + `c` int(11) DEFAULT NULL, + KEY `a` (`a`) KEY_BLOCK_SIZE=8192, + KEY `b` (`b`(1000)) KEY_BLOCK_SIZE=8192, + KEY `c` (`c`) KEY_BLOCK_SIZE=8192 +) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=0 alter table t1 add d int, add key (d); show create table t1; Table Create Table diff --git a/mysql-test/suite/maria/maria.test b/mysql-test/suite/maria/maria.test index 34bd4a638bb..e4f8d2427c4 100644 --- a/mysql-test/suite/maria/maria.test +++ b/mysql-test/suite/maria/maria.test @@ -1166,7 +1166,10 @@ alter table t1 key_block_size=2048; show create table t1; alter table t1 add c int, add key (c); show create table t1; +alter table t1 key_block_size=4096; +show create table t1; alter table t1 key_block_size=0; +show create table t1; alter table t1 add d int, add key (d); show create table t1; drop table t1; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 450868721cd..24f3ff783c9 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1266,6 +1266,22 @@ create table t1 (a int not null, b varchar(2048), key (a), key(b)) key_block_siz show create table t1; drop table t1; +create table t1 (a int not null, b varchar(512), key (a), key(b)); +show create table t1; +alter table t1 key_block_size=2048; +show create table t1; +alter table t1 add c int, add key (c); +show create table t1; +alter table t1 key_block_size=4096; +show create table t1; +alter table t1 key_block_size=0; +show create table t1; +alter table t1 add d int, add key (d); +show create table t1; +alter table t1 key_block_size=8192; +show create table t1; +drop table t1; + create table t1 (a int not null, b varchar(2048), key (a) key_block_size=1024, key(b)) key_block_size=8192; show create table t1; drop table t1; @@ -1274,7 +1290,6 @@ create table t1 (a int not null, b int, key (a) key_block_size=1024, key(b) key_ show create table t1; drop table t1; - # Test limits and errors of key_block_size create table t1 (a int not null, key `a` (a) key_block_size=512); |