Commit 444fc862 authored by unknown's avatar unknown

Merge msvensson@bk-internal.mysql.com:/home/bk/mysql-4.1

into neptunus.(none):/home/magnus/mysql-4.1


mysql-test/mysql-test-run.sh:
  Auto merged
parents af847c22 316c128f
...@@ -1470,16 +1470,23 @@ $ECHO "Starting Tests" ...@@ -1470,16 +1470,23 @@ $ECHO "Starting Tests"
# #
if [ "$DO_BENCH" = 1 ] if [ "$DO_BENCH" = 1 ]
then then
start_master
if [ ! -z "$USE_NDBCLUSTER" ]
then
EXTRA_BENCH_ARGS="--create-options=TYPE=ndb"
fi
BENCHDIR=$BASEDIR/sql-bench/ BENCHDIR=$BASEDIR/sql-bench/
savedir=`pwd` savedir=`pwd`
cd $BENCHDIR cd $BENCHDIR
if [ -z "$1" ] if [ -z "$1" ]
then then
./run-all-tests --socket=$MASTER_MYSOCK --user=root ./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS
else else
if [ -x "./$1" ] if [ -x "./$1" ]
then then
./$1 --socket=$MASTER_MYSOCK --user=root ./$1 --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS
else else
echo "benchmark $1 not found" echo "benchmark $1 not found"
fi fi
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#NoOfFragmentLogfiles: 1 #NoOfFragmentLogfiles: 1
#TimeBetweenLocalCheckpoints: 31 #TimeBetweenLocalCheckpoints: 31
NoOfReplicas: 2 NoOfReplicas: 2
MaxNoOfConcurrentOperations: 100000
[COMPUTER] [COMPUTER]
Id: 1 Id: 1
......
...@@ -22,9 +22,9 @@ done ...@@ -22,9 +22,9 @@ done
stop_default_ndbcluster() { stop_default_ndbcluster() {
if [ ! -f $pidfile ] ; then #if [ ! -f $pidfile ] ; then
exit 0 # exit 0
fi #fi
if [ ! -f $cfgfile ] ; then if [ ! -f $cfgfile ] ; then
echo "$cfgfile missing" echo "$cfgfile missing"
...@@ -43,8 +43,11 @@ echo "all stop" | $exec_mgmtclient ...@@ -43,8 +43,11 @@ echo "all stop" | $exec_mgmtclient
sleep 5 sleep 5
kill `cat $pidfile` if [ -f $pidfile ] ; then
rm $pidfile kill `cat $pidfile`
rm $pidfile
fi
} }
stop_default_ndbcluster stop_default_ndbcluster
......
drop table if exists t1;
CREATE TABLE t1 (
PORT varchar(16) NOT NULL,
ACCESSNODE varchar(16) NOT NULL,
POP varchar(48) NOT NULL,
ACCESSTYPE int unsigned NOT NULL,
CUSTOMER_ID varchar(20) NOT NULL,
PROVIDER varchar(16),
TEXPIRE int unsigned,
NUM_IP int unsigned,
LEASED_NUM_IP int unsigned,
LOCKED_IP int unsigned,
STATIC_DNS int unsigned,
SUSPENDED_SERVICE int unsigned,
SUSPENDED_REASON int unsigned,
BGP_COMMUNITY int unsigned,
INDEX CUSTOMER_ID_INDEX(CUSTOMER_ID),
INDEX FQPN_INDEX(POP,ACCESSNODE,PORT),
PRIMARY KEY(POP,ACCESSNODE,PORT,ACCESSTYPE)
) engine=ndbcluster;
INSERT INTO t1 VALUES ('port67', 'node78', 'pop98', 1, 'kllopmn', 'pr_43', 121212, 1, 2, 3, 8, NULL, NULL, NULL);
INSERT INTO t1 VALUES ('port67', 'node78', 'pop99', 2, 'klkighh', 'pr_44', 121213, 3, 3, 6, 7, NULL, NULL, NULL);
INSERT INTO t1 VALUES ('port79', 'node79', 'pop79', 2, 'kpongfaa', 'pr_44', 981213, 2, 4, 10, 11, 2, 99, 1278);
select port, accessnode, pop, accesstype from t1 where port='port67' order by accesstype;
port accessnode pop accesstype
port67 node78 pop98 1
port67 node78 pop99 2
select port, accessnode, pop, accesstype from t1 where port='foo';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where accessnode='node78' order by accesstype;
port accessnode pop accesstype
port67 node78 pop98 1
port67 node78 pop99 2
select port, accessnode, pop, accesstype from t1 where accessnode='foo';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where pop='pop98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98' order by accesstype;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='POP98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='POP98' order by accesstype;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='foo';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where accesstype=1;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where accesstype=2 order by port;
port accessnode pop accesstype
port67 node78 pop99 2
port79 node79 pop79 2
select port, accessnode, pop, accesstype from t1 where accesstype=98 order by port;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where customer_id='KLLOPMN';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where customer_id='kLLoPMn';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where customer_id='foo';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where provider='pr_43';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where provider='foo';
port accessnode pop accesstype
select port, accessnode from t1 where texpire=121212;
port accessnode
port67 node78
select port, accessnode from t1 where texpire=2323;
port accessnode
select port, accessnode, pop, accesstype from t1 where num_ip=1;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where num_ip=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where leased_num_ip=2;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where leased_num_ip=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where locked_ip=3;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where locked_ip=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where static_dns=8;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where static_dns=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where suspended_service=8;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where suspended_service=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where suspended_reason=NULL;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where suspended_reason=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where suspended_reason=0;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where bgp_community=NULL;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where bgp_community=89;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where bgp_community=0;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where port='port67' and accessnode='node78' and pop='pop98' and accesstype=1;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78' and pop='pop98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98' and port='port67' and accesstype=1 and accessnode='node78';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo' and accesstype=99;
port accessnode
select port, accessnode, pop, accesstype from t1 where port='port67' and pop='pop98' and accesstype=1;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where accesstype=1 and accessnode='node78' and pop='pop98';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo';
port accessnode
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=1;
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=2;
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where accesstype=2 and customer_id='kllopmn';
port accessnode pop accesstype
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='kllopmn';
port accessnode pop accesstype
port67 node78 pop98 1
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='foo';
port accessnode pop accesstype
drop table t1;
drop table if exists t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
KEY(b)
) engine=ndbcluster;
insert t1 values(1, 2, 3), (2,3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t1 order by b;
a b c
1 2 3
2 3 5
3 4 6
4 5 8
5 6 2
6 7 2
select * from t1 where b >= 4 order by b;
a b c
3 4 6
4 5 8
5 6 2
6 7 2
select * from t1 where b = 4 order by b;
a b c
3 4 6
select * from t1 where b > 4 order by b;
a b c
4 5 8
5 6 2
6 7 2
select * from t1 where b < 4 order by b;
a b c
1 2 3
2 3 5
select * from t1 where b <= 4 order by b;
a b c
1 2 3
2 3 5
3 4 6
update t1 set c = 3 where b = 3;
select * from t1 order by a;
a b c
1 2 3
2 3 3
3 4 6
4 5 8
5 6 2
6 7 2
update t1 set c = 10 where b >= 6;
select * from t1 order by a;
a b c
1 2 3
2 3 3
3 4 6
4 5 8
5 6 10
6 7 10
update t1 set c = 11 where b < 5;
select * from t1 order by a;
a b c
1 2 11
2 3 11
3 4 11
4 5 8
5 6 10
6 7 10
update t1 set c = 12 where b > 0;
select * from t1 order by a;
a b c
1 2 12
2 3 12
3 4 12
4 5 12
5 6 12
6 7 12
update t1 set c = 13 where b <= 3;
select * from t1 order by a;
a b c
1 2 13
2 3 13
3 4 12
4 5 12
5 6 12
6 7 12
drop table t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
KEY(b)
) engine=ndbcluster;
insert t1 values(1, 2, 13), (2,3, 13), (3, 4, 12), (4, 5, 12), (5,6, 12), (6,7, 12);
delete from t1 where b = 3;
select * from t1 order by a;
a b c
1 2 13
3 4 12
4 5 12
5 6 12
6 7 12
delete from t1 where b >= 6;
select * from t1 order by a;
a b c
1 2 13
3 4 12
4 5 12
delete from t1 where b < 4;
select * from t1 order by a;
a b c
3 4 12
4 5 12
delete from t1 where b > 5;
select * from t1 order by a;
a b c
3 4 12
4 5 12
delete from t1 where b <= 4;
select * from t1 order by a;
a b c
4 5 12
drop table t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned not null,
) engine = ndb;
create index a1 on t1 (b, c);
insert into t1 values (1, 2, 13);
insert into t1 values (2,3, 13);
insert into t1 values (3, 4, 12);
insert into t1 values (4, 5, 12);
insert into t1 values (5,6, 12);
insert into t1 values (6,7, 12);
insert into t1 values (7, 2, 1);
insert into t1 values (8,3, 6);
insert into t1 values (9, 4, 12);
insert into t1 values (14, 5, 4);
insert into t1 values (15,5,5);
insert into t1 values (16,5, 6);
insert into t1 values (17,4,4);
insert into t1 values (18,1, 7);
select * from t1 order by a;
a b c
1 2 13
2 3 13
3 4 12
4 5 12
5 6 12
6 7 12
7 2 1
8 3 6
9 4 12
14 5 4
15 5 5
16 5 6
17 4 4
18 1 7
select * from t1 where b<=5 order by a;
a b c
1 2 13
2 3 13
3 4 12
4 5 12
7 2 1
8 3 6
9 4 12
14 5 4
15 5 5
16 5 6
17 4 4
18 1 7
select * from t1 where b<=5 and c=0;
a b c
insert into t1 values (19,4, 0);
select * from t1 where b<=5 and c=0;
a b c
19 4 0
select * from t1 where b=4 and c<=5;
a b c
19 4 0
17 4 4
select * from t1 where b<=4 and c<=5 order by a;
a b c
7 2 1
17 4 4
19 4 0
select * from t1 where b<=5 and c=0 or b<=5 and c=2;
a b c
19 4 0
drop table t1;
drop table if exists t1, t2, t3, t4, t5, t6, t7;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
UNIQUE(b)
) engine=ndbcluster;
insert t1 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t1 order by b;
a b c
1 2 3
2 3 5
3 4 6
4 5 8
5 6 2
6 7 2
select * from t1 where b = 4 order by b;
a b c
3 4 6
insert into t1 values(7,8,3);
select * from t1 where b = 4 order by a;
a b c
3 4 6
drop table t1;
CREATE TABLE t1 (
cid smallint(5) unsigned NOT NULL default '0',
cv varchar(250) NOT NULL default '',
PRIMARY KEY (cid),
UNIQUE KEY cv (cv)
) engine=ndbcluster;
INSERT INTO t1 VALUES (8,'dummy');
CREATE TABLE t2 (
cid bigint(20) unsigned NOT NULL auto_increment,
cap varchar(255) NOT NULL default '',
PRIMARY KEY (cid),
) engine=ndbcluster;
CREATE TABLE t3 (
gid bigint(20) unsigned NOT NULL auto_increment,
gn varchar(255) NOT NULL default '',
must tinyint(4) default NULL,
PRIMARY KEY (gid),
) engine=ndbcluster;
INSERT INTO t3 VALUES (1,'V1',NULL);
CREATE TABLE t4 (
uid bigint(20) unsigned NOT NULL default '0',
gid bigint(20) unsigned NOT NULL,
rid bigint(20) unsigned NOT NULL default '-1',
cid bigint(20) unsigned NOT NULL default '-1',
UNIQUE KEY m (uid,gid,rid,cid),
) engine=ndbcluster;
INSERT INTO t4 VALUES (1,1,2,4);
INSERT INTO t4 VALUES (1,1,2,3);
INSERT INTO t4 VALUES (1,1,5,7);
INSERT INTO t4 VALUES (1,1,10,8);
CREATE TABLE t5 (
rid bigint(20) unsigned NOT NULL auto_increment,
rl varchar(255) NOT NULL default '',
PRIMARY KEY (rid),
) engine=ndbcluster;
CREATE TABLE t6 (
uid bigint(20) unsigned NOT NULL auto_increment,
un varchar(250) NOT NULL default '',
uc smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (uid),
UNIQUE KEY nc (un,uc),
) engine=ndbcluster;
INSERT INTO t6 VALUES (1,'test',8);
INSERT INTO t6 VALUES (2,'test2',9);
INSERT INTO t6 VALUES (3,'tre',3);
CREATE TABLE t7 (
mid bigint(20) unsigned NOT NULL PRIMARY KEY,
uid bigint(20) unsigned NOT NULL default '0',
gid bigint(20) unsigned NOT NULL,
rid bigint(20) unsigned NOT NULL default '-1',
cid bigint(20) unsigned NOT NULL default '-1',
UNIQUE KEY m (uid,gid,rid,cid),
) engine=ndbcluster;
INSERT INTO t7 VALUES(1, 1, 1, 1, 1);
INSERT INTO t7 VALUES(2, 2, 1, 1, 1);
INSERT INTO t7 VALUES(3, 3, 1, 1, 1);
INSERT INTO t7 VALUES(4, 4, 1, 1, 1);
INSERT INTO t7 VALUES(5, 5, 1, 1, 1);
INSERT INTO t7 VALUES(6, 1, 1, 1, 6);
INSERT INTO t7 VALUES(7, 2, 1, 1, 7);
INSERT INTO t7 VALUES(8, 3, 1, 1, 8);
INSERT INTO t7 VALUES(9, 4, 1, 1, 9);
INSERT INTO t7 VALUES(10, 5, 1, 1, 10);
select * from t1 where cv = 'dummy';
cid cv
8 dummy
select * from t1 where cv = 'test';
cid cv
select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
uid gid rid cid
1 1 2 4
select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
uid gid rid cid
select * from t4 where uid = 1 order by cid;
uid gid rid cid
1 1 2 3
1 1 2 4
1 1 5 7
1 1 10 8
select * from t4 where rid = 2 order by cid;
uid gid rid cid
1 1 2 3
1 1 2 4
select * from t6 where un='test' and uc=8;
uid un uc
1 test 8
select * from t6 where un='test' and uc=7;
uid un uc
select * from t6 where un='test';
uid un uc
1 test 8
select * from t7 where mid = 8;
mid uid gid rid cid
8 3 1 1 8
select * from t7 where uid = 8;
mid uid gid rid cid
select * from t7 where uid = 1 order by mid;
mid uid gid rid cid
1 1 1 1 1
6 1 1 1 6
select * from t7 where uid = 4 order by mid;
mid uid gid rid cid
4 4 1 1 1
9 4 1 1 9
select * from t7 where gid = 4;
mid uid gid rid cid
select * from t7 where gid = 1 order by mid;
mid uid gid rid cid
1 1 1 1 1
2 2 1 1 1
3 3 1 1 1
4 4 1 1 1
5 5 1 1 1
6 1 1 1 6
7 2 1 1 7
8 3 1 1 8
9 4 1 1 9
10 5 1 1 10
select * from t7 where cid = 4;
mid uid gid rid cid
select * from t7 where cid = 8;
mid uid gid rid cid
8 3 1 1 8
select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
uid gid rid cid
1 1 2 4
select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
uid gid rid cid
select * from t4 where uid = 1 order by gid,cid;
uid gid rid cid
1 1 2 3
1 1 2 4
1 1 5 7
1 1 10 8
1 1 5 12
1 2 5 12
1 3 9 11
1 3 5 12
1 4 5 12
1 5 5 12
1 6 5 12
1 7 5 12
1 8 5 12
1 9 5 12
1 10 5 12
1 11 5 12
1 12 5 12
1 13 5 12
1 14 5 12
1 15 5 12
1 16 5 12
1 17 5 12
1 18 5 12
1 19 5 12
1 20 5 12
1 21 5 12
1 22 5 12
1 23 5 12
1 24 5 12
1 25 5 12
1 26 5 12
1 27 5 12
1 28 5 12
1 29 5 12
1 30 5 12
1 31 5 12
1 32 5 12
1 33 5 12
1 34 5 12
1 35 5 12
1 36 5 12
1 37 5 12
1 38 5 12
1 39 5 12
1 40 5 12
1 41 5 12
1 42 5 12
1 43 5 12
1 44 5 12
1 45 5 12
1 46 5 12
1 47 5 12
1 48 5 12
1 49 5 12
1 50 5 12
1 51 5 12
1 52 5 12
1 53 5 12
1 54 5 12
1 55 5 12
1 56 5 12
1 57 5 12
1 58 5 12
1 59 5 12
1 60 5 12
1 61 5 12
1 62 5 12
1 63 5 12
1 64 5 12
1 65 5 12
1 66 5 12
1 67 5 12
1 68 5 12
1 69 5 12
1 70 5 12
1 71 5 12
1 72 5 12
1 73 5 12
1 74 5 12
1 75 5 12
1 76 5 12
1 77 5 12
1 78 5 12
1 79 5 12
1 80 5 12
1 81 5 12
1 82 5 12
1 83 5 12
1 84 5 12
1 85 5 12
1 86 5 12
1 87 5 12
1 88 5 12
1 89 5 12
1 90 5 12
1 91 5 12
1 92 5 12
1 93 5 12
1 94 5 12
1 95 5 12
1 96 5 12
1 97 5 12
1 98 5 12
1 99 5 12
1 100 5 12
select * from t4 where uid = 1 order by gid,cid;
uid gid rid cid
1 1 2 3
1 1 2 4
1 1 5 7
1 1 10 8
1 1 5 12
1 2 5 12
1 3 9 11
1 3 5 12
1 4 5 12
1 5 5 12
1 6 5 12
1 7 5 12
1 8 5 12
1 9 5 12
1 10 5 12
1 11 5 12
1 12 5 12
1 13 5 12
1 14 5 12
1 15 5 12
1 16 5 12
1 17 5 12
1 18 5 12
1 19 5 12
1 20 5 12
1 21 5 12
1 22 5 12
1 23 5 12
1 24 5 12
1 25 5 12
1 26 5 12
1 27 5 12
1 28 5 12
1 29 5 12
1 30 5 12
1 31 5 12
1 32 5 12
1 33 5 12
1 34 5 12
1 35 5 12
1 36 5 12
1 37 5 12
1 38 5 12
1 39 5 12
1 40 5 12
1 41 5 12
1 42 5 12
1 43 5 12
1 44 5 12
1 45 5 12
1 46 5 12
1 47 5 12
1 48 5 12
1 49 5 12
1 50 5 12
1 51 5 12
1 52 5 12
1 53 5 12
1 54 5 12
1 55 5 12
1 56 5 12
1 57 5 12
1 58 5 12
1 59 5 12
1 60 5 12
1 61 5 12
1 62 5 12
1 63 5 12
1 64 5 12
1 65 5 12
1 66 5 12
1 67 5 12
1 68 5 12
1 69 5 12
1 70 5 12
1 71 5 12
1 72 5 12
1 73 5 12
1 74 5 12
1 75 5 12
1 76 5 12
1 77 5 12
1 78 5 12
1 79 5 12
1 80 5 12
1 81 5 12
1 82 5 12
1 83 5 12
1 84 5 12
1 85 5 12
1 86 5 12
1 87 5 12
1 88 5 12
1 89 5 12
1 90 5 12
1 91 5 12
1 92 5 12
1 93 5 12
1 94 5 12
1 95 5 12
1 96 5 12
1 97 5 12
1 98 5 12
1 99 5 12
1 100 5 12
select * from t4 where rid = 2 order by cid;
uid gid rid cid
1 1 2 3
1 1 2 4
drop table t1,t2,t3,t4,t5,t6,t7;
This diff is collapsed.
-- source include/have_ndb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
CREATE TABLE t1 (
PORT varchar(16) NOT NULL,
ACCESSNODE varchar(16) NOT NULL,
POP varchar(48) NOT NULL,
ACCESSTYPE int unsigned NOT NULL,
CUSTOMER_ID varchar(20) NOT NULL,
PROVIDER varchar(16),
TEXPIRE int unsigned,
NUM_IP int unsigned,
LEASED_NUM_IP int unsigned,
LOCKED_IP int unsigned,
STATIC_DNS int unsigned,
SUSPENDED_SERVICE int unsigned,
SUSPENDED_REASON int unsigned,
BGP_COMMUNITY int unsigned,
INDEX CUSTOMER_ID_INDEX(CUSTOMER_ID),
INDEX FQPN_INDEX(POP,ACCESSNODE,PORT),
PRIMARY KEY(POP,ACCESSNODE,PORT,ACCESSTYPE)
) engine=ndbcluster;
INSERT INTO t1 VALUES ('port67', 'node78', 'pop98', 1, 'kllopmn', 'pr_43', 121212, 1, 2, 3, 8, NULL, NULL, NULL);
INSERT INTO t1 VALUES ('port67', 'node78', 'pop99', 2, 'klkighh', 'pr_44', 121213, 3, 3, 6, 7, NULL, NULL, NULL);
INSERT INTO t1 VALUES ('port79', 'node79', 'pop79', 2, 'kpongfaa', 'pr_44', 981213, 2, 4, 10, 11, 2, 99, 1278);
# Test select using port
select port, accessnode, pop, accesstype from t1 where port='port67' order by accesstype;
select port, accessnode, pop, accesstype from t1 where port='foo';
# Test select using accessnode
select port, accessnode, pop, accesstype from t1 where accessnode='node78' order by accesstype;
select port, accessnode, pop, accesstype from t1 where accessnode='foo';
# Test select using pop
select port, accessnode, pop, accesstype from t1 where pop='pop98';
select port, accessnode, pop, accesstype from t1 where pop='pop98';
select port, accessnode, pop, accesstype from t1 where pop='pop98';
select port, accessnode, pop, accesstype from t1 where pop='pop98' order by accesstype;
select port, accessnode, pop, accesstype from t1 where pop='POP98';
select port, accessnode, pop, accesstype from t1 where pop='POP98' order by accesstype;
select port, accessnode, pop, accesstype from t1 where pop='foo';
# Test select using accesstype
select port, accessnode, pop, accesstype from t1 where accesstype=1;
select port, accessnode, pop, accesstype from t1 where accesstype=2 order by port;
select port, accessnode, pop, accesstype from t1 where accesstype=98 order by port;
# Test select using customer_id
# NOTE! customer_id has a INDEX (ordered index in NDB), it's case sensitive!
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
select port, accessnode, pop, accesstype from t1 where customer_id='KLLOPMN';
select port, accessnode, pop, accesstype from t1 where customer_id='kLLoPMn';
select port, accessnode, pop, accesstype from t1 where customer_id='foo';
# Test select using provider
select port, accessnode, pop, accesstype from t1 where provider='pr_43';
select port, accessnode, pop, accesstype from t1 where provider='foo';
# Test select using texpire
select port, accessnode from t1 where texpire=121212;
select port, accessnode from t1 where texpire=2323;
# Test select using num_ip
select port, accessnode, pop, accesstype from t1 where num_ip=1;
select port, accessnode, pop, accesstype from t1 where num_ip=89;
# Test select using leased_num_ip
select port, accessnode, pop, accesstype from t1 where leased_num_ip=2;
select port, accessnode, pop, accesstype from t1 where leased_num_ip=89;
# Test select using locked_ip
select port, accessnode, pop, accesstype from t1 where locked_ip=3;
select port, accessnode, pop, accesstype from t1 where locked_ip=89;
# Test select using static_dns
select port, accessnode, pop, accesstype from t1 where static_dns=8;
select port, accessnode, pop, accesstype from t1 where static_dns=89;
# Test select using suspended_service
select port, accessnode, pop, accesstype from t1 where suspended_service=8;
select port, accessnode, pop, accesstype from t1 where suspended_service=89;
# Test select using suspended_reason
select port, accessnode, pop, accesstype from t1 where suspended_reason=NULL;
select port, accessnode, pop, accesstype from t1 where suspended_reason=89;
select port, accessnode, pop, accesstype from t1 where suspended_reason=0;
# Test select using bgp_community
select port, accessnode, pop, accesstype from t1 where bgp_community=NULL;
select port, accessnode, pop, accesstype from t1 where bgp_community=89;
select port, accessnode, pop, accesstype from t1 where bgp_community=0;
# Test select using full primary key
select port, accessnode, pop, accesstype from t1 where port='port67' and accessnode='node78' and pop='pop98' and accesstype=1;
select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78' and pop='pop98';
select port, accessnode, pop, accesstype from t1 where pop='pop98' and port='port67' and accesstype=1 and accessnode='node78';
select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo' and accesstype=99;
# Test select using partial primary key
select port, accessnode, pop, accesstype from t1 where port='port67' and pop='pop98' and accesstype=1;
select port, accessnode, pop, accesstype from t1 where accesstype=1 and accessnode='node78' and pop='pop98';
select port, accessnode, pop, accesstype from t1 where port='port67' and accesstype=1 and accessnode='node78';
select port, accessnode from t1 where port='foo' and accessnode='foo' and pop='foo';
# Test select using CUSTOMER_ID_INDEX
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn';
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=1;
select port, accessnode, pop, accesstype from t1 where customer_id='kllopmn' and accesstype=2;
select port, accessnode, pop, accesstype from t1 where accesstype=2 and customer_id='kllopmn';
# Test select using FQPN_INDEX
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67';
#select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' order by accesstype;
#select port, accessnode, pop, accesstype from t1 where accessnode='node78' and port='port67' and pop='pop98' order by accesstype;
#select port, accessnode, pop, accesstype from t1 where port='port67' and pop='pop98' and accessnode='node78' order by accesstype;
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='kllopmn';
select port, accessnode, pop, accesstype from t1 where pop='pop98' and accessnode='node78' and port='port67' and customer_id='foo';
drop table t1;
-- source include/have_ndb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Simple test to show use of ordered indexes
#
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
KEY(b)
) engine=ndbcluster;
insert t1 values(1, 2, 3), (2,3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t1 order by b;
select * from t1 where b >= 4 order by b;
select * from t1 where b = 4 order by b;
select * from t1 where b > 4 order by b;
select * from t1 where b < 4 order by b;
select * from t1 where b <= 4 order by b;
#
# Here we should add some "explain select" to verify that the ordered index is
# used for these queries.
#
#
# Update using ordered index scan
#
update t1 set c = 3 where b = 3;
select * from t1 order by a;
update t1 set c = 10 where b >= 6;
select * from t1 order by a;
update t1 set c = 11 where b < 5;
select * from t1 order by a;
update t1 set c = 12 where b > 0;
select * from t1 order by a;
update t1 set c = 13 where b <= 3;
select * from t1 order by a;
#
# Delete using ordered index scan
#
drop table t1;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
KEY(b)
) engine=ndbcluster;
insert t1 values(1, 2, 13), (2,3, 13), (3, 4, 12), (4, 5, 12), (5,6, 12), (6,7, 12);
delete from t1 where b = 3;
select * from t1 order by a;
delete from t1 where b >= 6;
select * from t1 order by a;
delete from t1 where b < 4;
select * from t1 order by a;
delete from t1 where b > 5;
select * from t1 order by a;
delete from t1 where b <= 4;
select * from t1 order by a;
drop table t1;
#
#multi part key
#
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned not null,
) engine = ndb;
create index a1 on t1 (b, c);
insert into t1 values (1, 2, 13);
insert into t1 values (2,3, 13);
insert into t1 values (3, 4, 12);
insert into t1 values (4, 5, 12);
insert into t1 values (5,6, 12);
insert into t1 values (6,7, 12);
insert into t1 values (7, 2, 1);
insert into t1 values (8,3, 6);
insert into t1 values (9, 4, 12);
insert into t1 values (14, 5, 4);
insert into t1 values (15,5,5);
insert into t1 values (16,5, 6);
insert into t1 values (17,4,4);
insert into t1 values (18,1, 7);
select * from t1 order by a;
select * from t1 where b<=5 order by a;
select * from t1 where b<=5 and c=0;
insert into t1 values (19,4, 0);
select * from t1 where b<=5 and c=0;
select * from t1 where b=4 and c<=5;
select * from t1 where b<=4 and c<=5 order by a;
select * from t1 where b<=5 and c=0 or b<=5 and c=2;
drop table t1;
-- source include/have_ndb.inc
--disable_warnings
drop table if exists t1, t2, t3, t4, t5, t6, t7;
--enable_warnings
#
# Simple test to show use of UNIQUE indexes
#
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned,
UNIQUE(b)
) engine=ndbcluster;
insert t1 values(1, 2, 3), (2, 3, 5), (3, 4, 6), (4, 5, 8), (5,6, 2), (6,7, 2);
select * from t1 order by b;
select * from t1 where b = 4 order by b;
insert into t1 values(7,8,3);
select * from t1 where b = 4 order by a;
drop table t1;
#
# More complex tables
#
CREATE TABLE t1 (
cid smallint(5) unsigned NOT NULL default '0',
cv varchar(250) NOT NULL default '',
PRIMARY KEY (cid),
UNIQUE KEY cv (cv)
) engine=ndbcluster;
INSERT INTO t1 VALUES (8,'dummy');
CREATE TABLE t2 (
cid bigint(20) unsigned NOT NULL auto_increment,
cap varchar(255) NOT NULL default '',
PRIMARY KEY (cid),
) engine=ndbcluster;
CREATE TABLE t3 (
gid bigint(20) unsigned NOT NULL auto_increment,
gn varchar(255) NOT NULL default '',
must tinyint(4) default NULL,
PRIMARY KEY (gid),
) engine=ndbcluster;
INSERT INTO t3 VALUES (1,'V1',NULL);
CREATE TABLE t4 (
uid bigint(20) unsigned NOT NULL default '0',
gid bigint(20) unsigned NOT NULL,
rid bigint(20) unsigned NOT NULL default '-1',
cid bigint(20) unsigned NOT NULL default '-1',
UNIQUE KEY m (uid,gid,rid,cid),
) engine=ndbcluster;
INSERT INTO t4 VALUES (1,1,2,4);
INSERT INTO t4 VALUES (1,1,2,3);
INSERT INTO t4 VALUES (1,1,5,7);
INSERT INTO t4 VALUES (1,1,10,8);
CREATE TABLE t5 (
rid bigint(20) unsigned NOT NULL auto_increment,
rl varchar(255) NOT NULL default '',
PRIMARY KEY (rid),
) engine=ndbcluster;
CREATE TABLE t6 (
uid bigint(20) unsigned NOT NULL auto_increment,
un varchar(250) NOT NULL default '',
uc smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (uid),
UNIQUE KEY nc (un,uc),
) engine=ndbcluster;
INSERT INTO t6 VALUES (1,'test',8);
INSERT INTO t6 VALUES (2,'test2',9);
INSERT INTO t6 VALUES (3,'tre',3);
CREATE TABLE t7 (
mid bigint(20) unsigned NOT NULL PRIMARY KEY,
uid bigint(20) unsigned NOT NULL default '0',
gid bigint(20) unsigned NOT NULL,
rid bigint(20) unsigned NOT NULL default '-1',
cid bigint(20) unsigned NOT NULL default '-1',
UNIQUE KEY m (uid,gid,rid,cid),
) engine=ndbcluster;
INSERT INTO t7 VALUES(1, 1, 1, 1, 1);
INSERT INTO t7 VALUES(2, 2, 1, 1, 1);
INSERT INTO t7 VALUES(3, 3, 1, 1, 1);
INSERT INTO t7 VALUES(4, 4, 1, 1, 1);
INSERT INTO t7 VALUES(5, 5, 1, 1, 1);
INSERT INTO t7 VALUES(6, 1, 1, 1, 6);
INSERT INTO t7 VALUES(7, 2, 1, 1, 7);
INSERT INTO t7 VALUES(8, 3, 1, 1, 8);
INSERT INTO t7 VALUES(9, 4, 1, 1, 9);
INSERT INTO t7 VALUES(10, 5, 1, 1, 10);
select * from t1 where cv = 'dummy';
select * from t1 where cv = 'test';
select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
select * from t4 where uid = 1 order by cid;
select * from t4 where rid = 2 order by cid;
select * from t6 where un='test' and uc=8;
select * from t6 where un='test' and uc=7;
select * from t6 where un='test';
select * from t7 where mid = 8;
select * from t7 where uid = 8;
select * from t7 where uid = 1 order by mid;
select * from t7 where uid = 4 order by mid;
select * from t7 where gid = 4;
select * from t7 where gid = 1 order by mid;
select * from t7 where cid = 4;
select * from t7 where cid = 8;
#
# insert more records into t4
#
let $1=100;
disable_query_log;
while ($1)
{
eval insert into t4 values(1, $1, 5, 12);
eval insert into t4 values($1, 3, 9, 11);
dec $1;
}
enable_query_log;
select * from t4 where uid = 1 and gid=1 and rid=2 and cid=4;
select * from t4 where uid = 1 and gid=1 and rid=1 and cid=4;
select * from t4 where uid = 1 order by gid,cid;
select * from t4 where uid = 1 order by gid,cid;
select * from t4 where rid = 2 order by cid;
drop table t1,t2,t3,t4,t5,t6,t7;
This diff is collapsed.
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#define NDB_MAX_KEYSIZE_IN_WORDS 1023 #define NDB_MAX_KEYSIZE_IN_WORDS 1023
#define NDB_MAX_KEY_SIZE NDB_MAX_KEYSIZE_IN_WORDS*sizeof(Uint32) #define NDB_MAX_KEY_SIZE NDB_MAX_KEYSIZE_IN_WORDS*sizeof(Uint32)
#define NDB_MAX_TUPLE_SIZE 8191 #define NDB_MAX_TUPLE_SIZE 8191
#define NDB_MAX_CONNECTIONS 127
#define NDB_MAX_TRANSACTIONS 1024 #define NDB_MAX_TRANSACTIONS 1024
#define NDB_MAX_PARALLEL_SCANS 12 #define NDB_MAX_PARALLEL_SCANS 12
#define NDB_MAX_ACTIVE_EVENTS 100 #define NDB_MAX_ACTIVE_EVENTS 100
......
...@@ -183,6 +183,13 @@ sub new ...@@ -183,6 +183,13 @@ sub new
{ {
$self->{'transactions'} = 1; # Transactions enabled $self->{'transactions'} = 1; # Transactions enabled
} }
if (defined($main::opt_create_options) &&
$main::opt_create_options =~ /type=ndb/i)
{
$self->{'transactions'} = 1; # Transactions enabled
$limits{'max_columns'} = 90; # Max number of columns in table
$limits{'working_blobs'} = 0; # NDB tables can't handle BLOB's
}
if (defined($main::opt_create_options) && if (defined($main::opt_create_options) &&
$main::opt_create_options =~ /type=bdb/i) $main::opt_create_options =~ /type=bdb/i)
{ {
......
This diff is collapsed.
...@@ -76,6 +76,11 @@ class ha_ndbcluster: public handler ...@@ -76,6 +76,11 @@ class ha_ndbcluster: public handler
int rnd_next(byte *buf); int rnd_next(byte *buf);
int rnd_pos(byte *buf, byte *pos); int rnd_pos(byte *buf, byte *pos);
void position(const byte *record); void position(const byte *record);
int read_range_first(const key_range *start_key,
const key_range *end_key,
bool sorted);
int read_range_next(bool eq_range);
void info(uint); void info(uint);
int extra(enum ha_extra_function operation); int extra(enum ha_extra_function operation);
...@@ -127,6 +132,8 @@ class ha_ndbcluster: public handler ...@@ -127,6 +132,8 @@ class ha_ndbcluster: public handler
const byte *end_key,uint end_key_len, const byte *end_key,uint end_key_len,
enum ha_rkey_function end_search_flag); enum ha_rkey_function end_search_flag);
void start_bulk_insert(ha_rows rows);
int end_bulk_insert();
static Ndb* seize_ndb(); static Ndb* seize_ndb();
static void release_ndb(Ndb* ndb); static void release_ndb(Ndb* ndb);
...@@ -135,11 +142,14 @@ class ha_ndbcluster: public handler ...@@ -135,11 +142,14 @@ class ha_ndbcluster: public handler
private: private:
int alter_table_name(const char *from, const char *to); int alter_table_name(const char *from, const char *to);
int drop_table(); int drop_table();
int create_index(const char *name, KEY *key_info); int create_index(const char *name, KEY *key_info, bool unique);
int create_ordered_index(const char *name, KEY *key_info);
int create_unique_index(const char *name, KEY *key_info);
int initialize_autoincrement(const void* table); int initialize_autoincrement(const void* table);
int get_metadata(const char* path); int get_metadata(const char* path);
void release_metadata(); void release_metadata();
const char* get_index_name(uint idx_no) const; const char* get_index_name(uint idx_no) const;
const char* get_unique_index_name(uint idx_no) const;
NDB_INDEX_TYPE get_index_type(uint idx_no) const; NDB_INDEX_TYPE get_index_type(uint idx_no) const;
NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const; NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const;
...@@ -147,9 +157,9 @@ class ha_ndbcluster: public handler ...@@ -147,9 +157,9 @@ class ha_ndbcluster: public handler
byte *buf); byte *buf);
int unique_index_read(const byte *key, uint key_len, int unique_index_read(const byte *key, uint key_len,
byte *buf); byte *buf);
int ordered_index_scan(const byte *key, uint key_len, int ordered_index_scan(const key_range *start_key,
byte *buf, const key_range *end_key,
enum ha_rkey_function find_flag); bool sorted, byte* buf);
int full_table_scan(byte * buf); int full_table_scan(byte * buf);
int next_result(byte *buf); int next_result(byte *buf);
#if 0 #if 0
...@@ -172,6 +182,8 @@ class ha_ndbcluster: public handler ...@@ -172,6 +182,8 @@ class ha_ndbcluster: public handler
int get_ndb_value(NdbOperation*, uint fieldnr, byte *field_ptr); int get_ndb_value(NdbOperation*, uint fieldnr, byte *field_ptr);
int set_primary_key(NdbOperation *op, const byte *key); int set_primary_key(NdbOperation *op, const byte *key);
int set_primary_key(NdbOperation *op); int set_primary_key(NdbOperation *op);
int set_bounds(NdbOperation *ndb_op, const key_range *key,
int bound);
int key_cmp(uint keynr, const byte * old_row, const byte * new_row); int key_cmp(uint keynr, const byte * old_row, const byte * new_row);
void print_results(); void print_results();
...@@ -193,8 +205,12 @@ class ha_ndbcluster: public handler ...@@ -193,8 +205,12 @@ class ha_ndbcluster: public handler
THR_LOCK_DATA m_lock; THR_LOCK_DATA m_lock;
NDB_SHARE *m_share; NDB_SHARE *m_share;
NDB_INDEX_TYPE m_indextype[MAX_KEY]; NDB_INDEX_TYPE m_indextype[MAX_KEY];
const char* m_unique_index_name[MAX_KEY];
NdbRecAttr *m_value[NDB_MAX_ATTRIBUTES_IN_TABLE]; NdbRecAttr *m_value[NDB_MAX_ATTRIBUTES_IN_TABLE];
bool m_use_write; bool m_use_write;
ha_rows rows_to_insert;
ha_rows rows_inserted;
ha_rows bulk_insert_rows;
}; };
bool ndbcluster_init(void); bool ndbcluster_init(void);
......
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