Corrected index_flags returned when index are created with USING HASH

Updated ndb_ test cases 
parent 2bee88a4
...@@ -128,7 +128,10 @@ select * from t4; ...@@ -128,7 +128,10 @@ select * from t4;
id name id name
1 Automatic 1 Automatic
select * from t4; select * from t4;
ERROR HY000: Got error 284 'Table not defined in transaction coordinator' from NDBCLUSTER ERROR HY000: Got error 284 'Table not defined in transaction coordinator' from ndbcluster
flush table t4;
select * from t4;
ERROR HY000: Can't open file: 't4' (errno: 709)
show status like 'handler_discover%'; show status like 'handler_discover%';
Variable_name Value Variable_name Value
Handler_discover 0 Handler_discover 0
......
...@@ -303,26 +303,26 @@ insert into t7 values ...@@ -303,26 +303,26 @@ insert into t7 values
("Street Road 78", 3, 92, 3), ("Street Road 78", 3, 92, 3),
("Main street 89C", 5, 71, 4), ("Main street 89C", 5, 71, 4),
(NULL, 8, NULL, 12); (NULL, 8, NULL, 12);
select * from t7; select * from t7 order by a;
adress a b c adress a b c
Street Road 78 3 92 3
Highway 3456 1 23 2 Highway 3456 1 23 2
NULL 8 NULL 12 Street Road 78 3 92 3
Main street 89C 5 71 4 Main street 89C 5 71 4
select a, b from t7; NULL 8 NULL 12
select a, b from t7 order by a;
a b a b
3 92
1 23 1 23
8 NULL 3 92
5 71 5 71
8 NULL
update t7 set adress="End of road 09" where a=3; update t7 set adress="End of road 09" where a=3;
update t7 set adress="Gatuvägen 90C" where a=5 and c=4; update t7 set adress="Gatuvägen 90C" where a=5 and c=4;
update t7 set adress="No adress" where adress is NULL; update t7 set adress="No adress" where adress is NULL;
select * from t7; select * from t7 order by a;
adress a b c adress a b c
Gatuvägen 90C 5 71 4
End of road 09 3 92 3
Highway 3456 1 23 2 Highway 3456 1 23 2
End of road 09 3 92 3
Gatuvägen 90C 5 71 4
No adress 8 NULL 12 No adress 8 NULL 12
select * from t7 where a=1 and c=2; select * from t7 where a=1 and c=2;
adress a b c adress a b c
......
...@@ -22,6 +22,48 @@ select * from t1 where b = 4 order by a; ...@@ -22,6 +22,48 @@ select * from t1 where b = 4 order by a;
a b c a b c
3 4 6 3 4 6
drop table t1; drop table t1;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned not null,
UNIQUE USING HASH (b, c)
) engine=ndbcluster;
insert t2 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t2 where a = 3;
a b c
3 4 6
select * from t2 where b = 4;
a b c
3 4 6
select * from t2 where c = 6;
a b c
3 4 6
insert into t2 values(7,8,3);
select * from t2 where b = 4 order by a;
a b c
3 4 6
drop table t2;
CREATE TABLE t3 (
a int unsigned NOT NULL,
b int unsigned not null,
c int unsigned,
PRIMARY KEY USING HASH (a, b)
) engine=ndbcluster;
insert t3 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t3 where a = 3;
a b c
3 4 6
select * from t3 where b = 4;
a b c
3 4 6
select * from t3 where c = 6;
a b c
3 4 6
insert into t3 values(7,8,3);
select * from t3 where b = 4 order by a;
a b c
3 4 6
drop table t3;
CREATE TABLE t1 ( CREATE TABLE t1 (
cid smallint(5) unsigned NOT NULL default '0', cid smallint(5) unsigned NOT NULL default '0',
cv varchar(250) NOT NULL default '', cv varchar(250) NOT NULL default '',
......
...@@ -166,6 +166,10 @@ system drop_tab -c "host=localhost:2200;nodeid=5" -d test t4 > /dev/null ; ...@@ -166,6 +166,10 @@ system drop_tab -c "host=localhost:2200;nodeid=5" -d test t4 > /dev/null ;
--error 1296 --error 1296
select * from t4; select * from t4;
flush table t4;
--error 1016
select * from t4;
show status like 'handler_discover%'; show status like 'handler_discover%';
drop table t4; drop table t4;
flush tables; flush tables;
......
...@@ -299,13 +299,13 @@ insert into t7 values ...@@ -299,13 +299,13 @@ insert into t7 values
("Street Road 78", 3, 92, 3), ("Street Road 78", 3, 92, 3),
("Main street 89C", 5, 71, 4), ("Main street 89C", 5, 71, 4),
(NULL, 8, NULL, 12); (NULL, 8, NULL, 12);
select * from t7; select * from t7 order by a;
select a, b from t7; select a, b from t7 order by a;
update t7 set adress="End of road 09" where a=3; update t7 set adress="End of road 09" where a=3;
update t7 set adress="Gatuvägen 90C" where a=5 and c=4; update t7 set adress="Gatuvägen 90C" where a=5 and c=4;
update t7 set adress="No adress" where adress is NULL; update t7 set adress="No adress" where adress is NULL;
select * from t7; select * from t7 order by a;
select * from t7 where a=1 and c=2; select * from t7 where a=1 and c=2;
delete from t7 where a=1; delete from t7 where a=1;
delete from t7 where a=3 and c=3; delete from t7 where a=3 and c=3;
......
...@@ -23,6 +23,47 @@ select * from t1 where b = 4 order by a; ...@@ -23,6 +23,47 @@ select * from t1 where b = 4 order by a;
drop table t1; drop table t1;
#
# Show use of UNIQUE USING HASH indexes
#
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned not null,
UNIQUE USING HASH (b, c)
) engine=ndbcluster;
insert t2 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t2 where a = 3;
select * from t2 where b = 4;
select * from t2 where c = 6;
insert into t2 values(7,8,3);
select * from t2 where b = 4 order by a;
drop table t2;
#
# Show use of PRIMARY KEY USING HASH indexes
#
CREATE TABLE t3 (
a int unsigned NOT NULL,
b int unsigned not null,
c int unsigned,
PRIMARY KEY USING HASH (a, b)
) engine=ndbcluster;
insert t3 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t3 where a = 3;
select * from t3 where b = 4;
select * from t3 where c = 6;
insert into t3 values(7,8,3);
select * from t3 where b = 4 order by a;
drop table t3;
# #
# More complex tables # More complex tables
# #
......
...@@ -474,7 +474,8 @@ static const ulong index_type_flags[]= ...@@ -474,7 +474,8 @@ static const ulong index_type_flags[]=
0, 0,
/* PRIMARY_KEY_INDEX */ /* PRIMARY_KEY_INDEX */
HA_NOT_READ_PREFIX_LAST, HA_NOT_READ_PREFIX_LAST |
HA_ONLY_WHOLE_INDEX,
/* PRIMARY_KEY_ORDERED_INDEX */ /* PRIMARY_KEY_ORDERED_INDEX */
/* /*
...@@ -485,7 +486,8 @@ static const ulong index_type_flags[]= ...@@ -485,7 +486,8 @@ static const ulong index_type_flags[]=
HA_NOT_READ_PREFIX_LAST, HA_NOT_READ_PREFIX_LAST,
/* UNIQUE_INDEX */ /* UNIQUE_INDEX */
HA_NOT_READ_PREFIX_LAST, HA_NOT_READ_PREFIX_LAST |
HA_ONLY_WHOLE_INDEX,
/* UNIQUE_ORDERED_INDEX */ /* UNIQUE_ORDERED_INDEX */
HA_NOT_READ_PREFIX_LAST, HA_NOT_READ_PREFIX_LAST,
......
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