Commit f6aec10b authored by marko's avatar marko

branches/zip: innodb-index.test: Add more columns and rows, to ensure

that row_merge_blocks() will have some work to do when
row_merge_block_t is shrunk to 8192 bytes.

Currently, this will cause a debug assertion failure, because
row_merge_cmp() is considering all columns, not just the unique ones.
parent 0d905031
......@@ -1011,47 +1011,77 @@ explain select * from t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index
drop table t1;
create table t1(a int, b blob, c text, d text not null) engine=innodb default charset = utf8;
insert into t1 values (22,repeat('jejdkrun87',2200),repeat('jejdkrun87',440),'jejdkrun87');
insert into t1 values (44,repeat('adfd72nh9k',4400),repeat('adfd72nh9k',880),'adfd72nh9k');
create table t2(d varchar(17) primary key) engine=innodb default charset=utf8;
create table t3(a int primary key) engine=innodb;
insert into t3 values(22),(44),(33),(55),(66);
insert into t2 values ('jejdkrun87'),('adfd72nh9k'),
('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik');
create table t1(a int, b blob, c text, d text not null)
engine=innodb default charset = utf8;
insert into t1 values (null,null,null,'null');
insert into t1
select a,left(repeat(d,100*a),65535),repeat(d,20*a),d from t2,t3;
drop table t2, t3;
select count(*) from t1 where a=44;
count(*)
1
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
a b=repeat(d,100*a) c=repeat(d,20*a)
22 1 1
44 1 1
NULL NULL NULL
select a,length(b),length(c),d from t1;
a length(b) length(c) d
22 22000 4400 jejdkrun87
44 44000 8800 adfd72nh9k
NULL NULL NULL null
5
select a,
length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a) from t1;
a length(b) b=left(repeat(d,100*a),65535) length(c) c=repeat(d,20*a)
NULL NULL NULL NULL NULL
22 22000 1 4400 1
22 35200 1 7040 1
22 28600 1 5720 1
22 26400 1 5280 1
22 22000 1 4400 1
33 33000 1 6600 1
33 52800 1 10560 1
33 42900 1 8580 1
33 39600 1 7920 1
33 33000 1 6600 1
44 44000 1 8800 1
44 65535 1 14080 1
44 57200 1 11440 1
44 52800 1 10560 1
44 44000 1 8800 1
55 55000 1 11000 1
55 65535 1 17600 1
55 65535 1 14300 1
55 65535 1 13200 1
55 55000 1 11000 1
66 65535 1 13200 1
66 65535 1 21120 1
66 65535 1 17160 1
66 65535 1 15840 1
66 65535 1 13200 1
alter table t1 add primary key (a), add key (b(20));
ERROR 42000: All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead
delete from t1 where d='null';
alter table t1 add primary key (a,b(255),c(255)), add key (b(767));
alter table t1 drop primary key, drop key b;
alter table t1 add primary key (a), add key (b(20));
ERROR 23000: Duplicate entry '22' for key 'PRIMARY'
delete from t1 where a%2;
alter table t1 add primary key (a,b(255),c(255)), add key (b(767));
select count(*) from t1 where a=44;
count(*)
1
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
a b=repeat(d,100*a) c=repeat(d,20*a)
22 1 1
44 1 1
select a,length(b),length(c),d from t1;
a length(b) length(c) d
22 22000 4400 jejdkrun87
44 44000 8800 adfd72nh9k
insert into t1 values (33,repeat('adfdpplkeock',3300),repeat('adfdpplkeock',660),'adfdpplkeock');
insert into t1 values (55,repeat('adfdijnmnb78k',5500),repeat('adfdijnmnb78k',1100),'adfdijnmnb78k');
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
insert into t1 values (66,repeat('adfdijn0loKNHJik',6600),repeat('adfdijn0loKNHJik',1320),'adfdijn0loKNHJik');
Warnings:
Warning 1265 Data truncated for column 'b' at row 1
5
select a,
length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a) from t1;
a length(b) b=left(repeat(d,100*a),65535) length(c) c=repeat(d,20*a)
22 22000 1 4400 1
22 35200 1 7040 1
22 28600 1 5720 1
22 26400 1 5280 1
22 22000 1 4400 1
44 44000 1 8800 1
44 65535 1 14080 1
44 57200 1 11440 1
44 52800 1 10560 1
44 44000 1 8800 1
66 65535 1 13200 1
66 65535 1 21120 1
66 65535 1 17160 1
66 65535 1 15840 1
66 65535 1 13200 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -1059,27 +1089,13 @@ t1 CREATE TABLE `t1` (
`b` blob NOT NULL,
`c` text NOT NULL,
`d` text NOT NULL,
PRIMARY KEY (`a`),
KEY `b` (`b`(20))
PRIMARY KEY (`a`,`b`(255),`c`(255)),
KEY `b` (`b`(767))
) ENGINE=InnoDB DEFAULT CHARSET=utf8
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
explain select * from t1 where b like 'adfd%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range b b 22 NULL 2 Using where
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
a b=repeat(d,100*a) c=repeat(d,20*a)
22 1 1
33 1 1
44 1 1
55 0 1
66 0 1
select a,length(b),length(c),d from t1;
a length(b) length(c) d
22 22000 4400 jejdkrun87
33 39600 7920 adfdpplkeock
44 44000 8800 adfd72nh9k
55 65535 14300 adfdijnmnb78k
66 65535 21120 adfdijn0loKNHJik
1 SIMPLE t1 range b b 769 NULL 11 Using where
drop table t1;
......@@ -306,29 +306,35 @@ explain select * from t1;
explain select * from t1 order by a;
drop table t1;
create table t1(a int, b blob, c text, d text not null) engine=innodb default charset = utf8;
insert into t1 values (22,repeat('jejdkrun87',2200),repeat('jejdkrun87',440),'jejdkrun87');
insert into t1 values (44,repeat('adfd72nh9k',4400),repeat('adfd72nh9k',880),'adfd72nh9k');
insert into t1 values (null,null,null,'null');
create table t2(d varchar(17) primary key) engine=innodb default charset=utf8;
create table t3(a int primary key) engine=innodb;
insert into t3 values(22),(44),(33),(55),(66);
insert into t2 values ('jejdkrun87'),('adfd72nh9k'),
('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik');
create table t1(a int, b blob, c text, d text not null)
engine=innodb default charset = utf8;
insert into t1 values (null,null,null,'null');
insert into t1
select a,left(repeat(d,100*a),65535),repeat(d,20*a),d from t2,t3;
drop table t2, t3;
select count(*) from t1 where a=44;
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
select a,length(b),length(c),d from t1;
select a,
length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a) from t1;
--error ER_PRIMARY_CANT_HAVE_NULL
alter table t1 add primary key (a), add key (b(20));
delete from t1 where d='null';
alter table t1 add primary key (a,b(255),c(255)), add key (b(767));
alter table t1 drop primary key, drop key b;
--error ER_DUP_ENTRY
alter table t1 add primary key (a), add key (b(20));
delete from t1 where a%2;
alter table t1 add primary key (a,b(255),c(255)), add key (b(767));
select count(*) from t1 where a=44;
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
select a,length(b),length(c),d from t1;
insert into t1 values (33,repeat('adfdpplkeock',3300),repeat('adfdpplkeock',660),'adfdpplkeock');
insert into t1 values (55,repeat('adfdijnmnb78k',5500),repeat('adfdijnmnb78k',1100),'adfdijnmnb78k');
insert into t1 values (66,repeat('adfdijn0loKNHJik',6600),repeat('adfdijn0loKNHJik',1320),'adfdijn0loKNHJik');
select a,
length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a) from t1;
show create table t1;
check table t1;
explain select * from t1 where b like 'adfd%';
select a,b=repeat(d,100*a),c=repeat(d,20*a) from t1;
select a,length(b),length(c),d from t1;
drop table t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment