Commit bc9d94cb authored by unknown's avatar unknown
Browse files

Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.1

into mysql.com:/home/gluh/MySQL/Merge/5.1-kt

parents bddaa6f2 ea7f1a61
Loading
Loading
Loading
Loading
+104 −0
Original line number Diff line number Diff line
drop table if exists t1;
create table t1 (
a mediumint not null,
b text not null,
c int not null,
d longblob,
primary key using hash (a,c),
unique key (c)
)
engine=ndb
partition by range (c)
partitions 3
( partition p1 values less than (200),
partition p2 values less than (300),
partition p3 values less than (400));
insert into t1 values (1, @v1, 101, @v2);
insert into t1 values (1, @v2, 102, @v3);
insert into t1 values (1, @v3, 103, @v4);
insert into t1 values (2, @v4, 201, @v5);
insert into t1 values (2, @v5, 202, @v6);
insert into t1 values (2, @v6, 203, @v7);
insert into t1 values (3, @v7, 301, @v8);
insert into t1 values (3, @v8, 302, @v9);
insert into t1 values (3, @v9, 303, @v1);
select a, sha1(b), c, sha1(d) from t1 order by a;
a	sha1(b)	c	sha1(d)
1	1d42dd9090cf78314a06665d4ea938c35cc760f4	101	10d3c783026b310218d10b7188da96a2401648c6
1	10d3c783026b310218d10b7188da96a2401648c6	102	a33549d9844092289a58ac348dd59f09fc28406a
1	a33549d9844092289a58ac348dd59f09fc28406a	103	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
2	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c	201	70fc9a7d08beebc522258bfb02000a30c77a8f1d
2	70fc9a7d08beebc522258bfb02000a30c77a8f1d	202	090565c580809efed3d369481a4bbb168b20713e
2	090565c580809efed3d369481a4bbb168b20713e	203	1e0070bec426871a46291de27b9bd6e4255ab4e5
3	1e0070bec426871a46291de27b9bd6e4255ab4e5	301	acbaba01bc2e682f015f40e79d9cbe475db3002e
3	acbaba01bc2e682f015f40e79d9cbe475db3002e	302	9ee30d99162574f79c66ae95cdf132dcf9cbc259
3	9ee30d99162574f79c66ae95cdf132dcf9cbc259	303	1d42dd9090cf78314a06665d4ea938c35cc760f4
select a, sha1(b), c, sha1(d) from t1 where a = 1 and c = 101;
a	sha1(b)	c	sha1(d)
1	1d42dd9090cf78314a06665d4ea938c35cc760f4	101	10d3c783026b310218d10b7188da96a2401648c6
select a, sha1(b), c, sha1(d) from t1 where a = 2 and c = 201;
a	sha1(b)	c	sha1(d)
2	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c	201	70fc9a7d08beebc522258bfb02000a30c77a8f1d
select a, sha1(b), c, sha1(d) from t1 where a = 3 and c = 301;
a	sha1(b)	c	sha1(d)
3	1e0070bec426871a46291de27b9bd6e4255ab4e5	301	acbaba01bc2e682f015f40e79d9cbe475db3002e
update t1 set b = @v3, d = @v4 where a = 1 and c = 102;
update t1 set b = @v6, d = @v7 where a = 2 and c = 202;
update t1 set b = @v9, d = @v1 where a = 3 and c = 302;
select a, sha1(b), c, sha1(d) from t1 order by a;
a	sha1(b)	c	sha1(d)
1	1d42dd9090cf78314a06665d4ea938c35cc760f4	101	10d3c783026b310218d10b7188da96a2401648c6
1	a33549d9844092289a58ac348dd59f09fc28406a	102	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
1	a33549d9844092289a58ac348dd59f09fc28406a	103	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
2	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c	201	70fc9a7d08beebc522258bfb02000a30c77a8f1d
2	090565c580809efed3d369481a4bbb168b20713e	202	1e0070bec426871a46291de27b9bd6e4255ab4e5
2	090565c580809efed3d369481a4bbb168b20713e	203	1e0070bec426871a46291de27b9bd6e4255ab4e5
3	1e0070bec426871a46291de27b9bd6e4255ab4e5	301	acbaba01bc2e682f015f40e79d9cbe475db3002e
3	9ee30d99162574f79c66ae95cdf132dcf9cbc259	302	1d42dd9090cf78314a06665d4ea938c35cc760f4
3	9ee30d99162574f79c66ae95cdf132dcf9cbc259	303	1d42dd9090cf78314a06665d4ea938c35cc760f4
update t1 set b = @v4, d = @v5 where c = 103;
update t1 set b = @v7, d = @v8 where c = 203;
update t1 set b = @v1, d = @v2 where c = 303;
select a, sha1(b), c, sha1(d) from t1 order by a;
a	sha1(b)	c	sha1(d)
1	1d42dd9090cf78314a06665d4ea938c35cc760f4	101	10d3c783026b310218d10b7188da96a2401648c6
1	a33549d9844092289a58ac348dd59f09fc28406a	102	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c
1	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c	103	70fc9a7d08beebc522258bfb02000a30c77a8f1d
2	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c	201	70fc9a7d08beebc522258bfb02000a30c77a8f1d
2	090565c580809efed3d369481a4bbb168b20713e	202	1e0070bec426871a46291de27b9bd6e4255ab4e5
2	1e0070bec426871a46291de27b9bd6e4255ab4e5	203	acbaba01bc2e682f015f40e79d9cbe475db3002e
3	1e0070bec426871a46291de27b9bd6e4255ab4e5	301	acbaba01bc2e682f015f40e79d9cbe475db3002e
3	9ee30d99162574f79c66ae95cdf132dcf9cbc259	302	1d42dd9090cf78314a06665d4ea938c35cc760f4
3	1d42dd9090cf78314a06665d4ea938c35cc760f4	303	10d3c783026b310218d10b7188da96a2401648c6
update t1 set b = @v5, d = @v6;
select a, sha1(b), c, sha1(d) from t1 order by a;
a	sha1(b)	c	sha1(d)
1	70fc9a7d08beebc522258bfb02000a30c77a8f1d	101	090565c580809efed3d369481a4bbb168b20713e
1	70fc9a7d08beebc522258bfb02000a30c77a8f1d	102	090565c580809efed3d369481a4bbb168b20713e
1	70fc9a7d08beebc522258bfb02000a30c77a8f1d	103	090565c580809efed3d369481a4bbb168b20713e
2	70fc9a7d08beebc522258bfb02000a30c77a8f1d	201	090565c580809efed3d369481a4bbb168b20713e
2	70fc9a7d08beebc522258bfb02000a30c77a8f1d	202	090565c580809efed3d369481a4bbb168b20713e
2	70fc9a7d08beebc522258bfb02000a30c77a8f1d	203	090565c580809efed3d369481a4bbb168b20713e
3	70fc9a7d08beebc522258bfb02000a30c77a8f1d	301	090565c580809efed3d369481a4bbb168b20713e
3	70fc9a7d08beebc522258bfb02000a30c77a8f1d	302	090565c580809efed3d369481a4bbb168b20713e
3	70fc9a7d08beebc522258bfb02000a30c77a8f1d	303	090565c580809efed3d369481a4bbb168b20713e
update t1 set b = @v1, d = @v2 where 100 < c and c < 200;
update t1 set b = @v4, d = @v5 where 200 < c and c < 300;
update t1 set b = @v7, d = @v8 where 300 < c and c < 400;
select a, sha1(b), c, sha1(d) from t1 order by a;
a	sha1(b)	c	sha1(d)
1	1d42dd9090cf78314a06665d4ea938c35cc760f4	101	10d3c783026b310218d10b7188da96a2401648c6
1	1d42dd9090cf78314a06665d4ea938c35cc760f4	102	10d3c783026b310218d10b7188da96a2401648c6
1	1d42dd9090cf78314a06665d4ea938c35cc760f4	103	10d3c783026b310218d10b7188da96a2401648c6
2	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c	201	70fc9a7d08beebc522258bfb02000a30c77a8f1d
2	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c	202	70fc9a7d08beebc522258bfb02000a30c77a8f1d
2	daa61c6de36a0526f0d47dc29d6b9de7e6d2630c	203	70fc9a7d08beebc522258bfb02000a30c77a8f1d
3	1e0070bec426871a46291de27b9bd6e4255ab4e5	301	acbaba01bc2e682f015f40e79d9cbe475db3002e
3	1e0070bec426871a46291de27b9bd6e4255ab4e5	302	acbaba01bc2e682f015f40e79d9cbe475db3002e
3	1e0070bec426871a46291de27b9bd6e4255ab4e5	303	acbaba01bc2e682f015f40e79d9cbe475db3002e
delete from t1 where a = 1 and c = 101;
delete from t1 where c = 102;
delete from t1;
select a, sha1(b), c, sha1(d) from t1 order by a;
a	sha1(b)	c	sha1(d)
drop table t1;
+323 −0

File changed.

Preview size limit exceeded, changes collapsed.

+47 −0
Original line number Diff line number Diff line
drop table if exists t1;
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null,
primary key(a,b),
index (a))
engine = ndb
partition by range (a)
partitions 3
(partition x1 values less than (5) nodegroup 12,
partition x2 values less than (10) nodegroup 13,
partition x3 values less than (20) nodegroup 14);
ERROR HY000: Can't create table 'test.t1' (errno: 140)
show warnings;
Level	Code	Message
Error	1296	Got error 771 'Given NODEGROUP doesn't exist in this cluster' from NDB
Error	1005	Can't create table 'test.t1' (errno: 140)
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null,
primary key(a))
engine = ndb
partition by range (a)
partitions 3
(partition x1 values less than (5),
partition x2 values less than (10),
partition x3 values less than (20));
drop table t1;
CREATE TABLE t1 (id INT) ENGINE=NDB
PARTITION BY LIST(id)
(PARTITION p0 VALUES IN (2, 4),
PARTITION p1 VALUES IN (42, 142));
INSERT INTO t1 VALUES (2);
UPDATE t1 SET id=5 WHERE id=2;
ERROR HY000: Table has no partition for value 5
DROP TABLE t1;
create table t1 (a int,b int, c int)
engine = ndb
partition by list(a)
partitions 2
(partition x123 values in (11, 12),
partition x234 values in (5, 1));
insert into t1 values (NULL,1,1);
ERROR HY000: Table has no partition for value NULL
drop table t1;
+199 −0
Original line number Diff line number Diff line
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b,c))
ENGINE = NDB
PARTITION BY KEY (a,b);
insert into t1 values (1,1,1,1);
select * from t1;
a	b	c	d
1	1	1	1
update t1 set d = 2 where a = 1 and b = 1 and c = 1;
select * from t1;
a	b	c	d
1	1	1	2
delete from t1;
select * from t1;
a	b	c	d
drop table t1;
CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b))
ENGINE = NDB
PARTITION BY KEY (c);
ERROR HY000: A PRIMARY KEY need to include all fields in the partition function
CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY(a,b))
ENGINE = NDB
PARTITION BY KEY (a);
insert into t1 values 
(1,1,3),(1,2,3),(1,3,3),(1,4,3),(1,5,3),(1,6,3),
(1,7,3),(1,8,3),(1,9,3),(1,10,3),(1,11,3),(1,12,3);
select * from t1 order by b;
a	b	c
1	1	3
1	2	3
1	3	3
1	4	3
1	5	3
1	6	3
1	7	3
1	8	3
1	9	3
1	10	3
1	11	3
1	12	3
DROP TABLE t1;
CREATE TABLE t1 (a INT, b CHAR(10) COLLATE latin1_bin, c INT, d INT,
PRIMARY KEY (a,b,c) USING HASH)
ENGINE=NDB
DEFAULT CHARSET=latin1
PARTITION BY KEY (b);
insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
-- t1 --

Fragment type: 5
K Value: 6
Min load factor: 78
Max load factor: 80
Temporary table: no
Number of attributes: 4
Number of primary keys: 3
Length of frm data: #
Row Checksum: 1
Row GCI: 1
TableStatus: Retrieved
-- Attributes -- 
a Int PRIMARY KEY AT=FIXED ST=MEMORY
b Char(10;latin1_bin) PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
c Int PRIMARY KEY AT=FIXED ST=MEMORY
d Int NULL AT=FIXED ST=MEMORY

-- Indexes -- 
PRIMARY KEY(a, b, c) - UniqueHashIndex


NDBT_ProgramExit: 0 - OK

show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL DEFAULT '0',
  `b` char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
  `c` int(11) NOT NULL DEFAULT '0',
  `d` int(11) DEFAULT NULL,
  PRIMARY KEY (`a`,`b`,`c`) USING HASH
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (b) 
DROP TABLE t1;
CREATE TABLE t1 (a int not null primary key)
PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
drop table t1;
CREATE TABLE t1 (a int not null primary key);
ALTER TABLE t1
PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
drop table t1;
create table t1 (a int)
engine=ndb
partition by key(a)
(partition p0, partition p1);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = ndbcluster, PARTITION p1  ENGINE = ndbcluster)
alter table t1 engine=heap;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = MEMORY, PARTITION p1  ENGINE = MEMORY)
alter table t1 engine=ndb;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = ndbcluster, PARTITION p1  ENGINE = ndbcluster)
alter table t1 engine=heap remove partitioning;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
alter table t1 engine=ndb
partition by key(a)
(partition p0, partition p1 engine = ndb);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = ndbcluster, PARTITION p1  ENGINE = ndbcluster)
alter table t1
partition by key (a)
(partition p0 engine=ndb, partition p1 engine=ndb);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = ndbcluster, PARTITION p1  ENGINE = ndbcluster)
alter table t1 remove partitioning;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
alter table t1
partition by key(a)
(partition p0 engine=ndb, partition p1);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
alter table t1
engine=ndb
partition by key(a)
(partition p0 engine=ndb, partition p1 engine = ndb);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = ndbcluster, PARTITION p1  ENGINE = ndbcluster)
drop table t1;
CREATE TABLE t1 (
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
c2 TEXT NOT NULL,
c3 INT NOT NULL,
c4 BIT NOT NULL,
c5 FLOAT,
c6 VARCHAR(255),
c7 TIMESTAMP,
PRIMARY KEY(c1,c3))
ENGINE=NDB
PARTITION BY KEY(c3) PARTITIONS 5;
ALTER TABLE t1 COALESCE PARTITION 4;
DROP TABLE t1;
CREATE TABLE t1 (a int primary key)
ENGINE=NDB
PARTITION BY KEY(a);
ALTER TABLE t1 OPTIMIZE PARTITION p0;
ERROR HY000: Table storage engine for 't1' doesn't have this option
ALTER TABLE t1 CHECK PARTITION p0;
ERROR HY000: Table storage engine for 't1' doesn't have this option
ALTER TABLE t1 REPAIR PARTITION p0;
ERROR HY000: Table storage engine for 't1' doesn't have this option
ALTER TABLE t1 ANALYZE PARTITION p0;
ERROR HY000: Table storage engine for 't1' doesn't have this option
ALTER TABLE t1 REBUILD PARTITION p0;
ERROR HY000: Table storage engine for 't1' doesn't have this option
DROP TABLE t1;
CREATE TABLE t1 (
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
c2 TEXT NOT NULL,
c3 INT NOT NULL,
PRIMARY KEY(c1,c3))
ENGINE=NDB
PARTITION BY KEY(c3) PARTITIONS 5;
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
DROP TABLE t1;
CREATE TABLE t1 (
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
c2 TEXT NOT NULL,
c3 INT NOT NULL,
PRIMARY KEY(c1,c3))
ENGINE=NDB
PARTITION BY KEY(c3);
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
DROP TABLE t1;
+51 −0
Original line number Diff line number Diff line
drop table if exists t1;
CREATE TABLE t1 ( f_int1 INTEGER NOT NULL, f_int2 INTEGER NOT NULL, 
f_char1 CHAR(10),
f_char2 CHAR(10), f_charbig VARCHAR(1000),
PRIMARY KEY (f_int1,f_int2))
ENGINE = NDB
PARTITION BY LIST(MOD(f_int1 + f_int2,4)) 
(PARTITION part_3 VALUES IN (-3),
PARTITION part_2 VALUES IN (-2),
PARTITION part_1 VALUES IN (-1),
PARTITION part0 VALUES IN (0),
PARTITION part1 VALUES IN (1),
PARTITION part2 VALUES IN (2),
PARTITION part3 VALUES IN (3,4,5));
INSERT INTO t1 SET f_int1 = -2, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 3, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 4, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 5, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
SELECT * FROM t1 ORDER BY f_int1;
f_int1	f_int2	f_char1	f_char2	f_charbig
-2	20	20	20	===20===
1	1	1	1	===1===
2	1	1	1	===1===
3	1	1	1	===1===
4	1	1	1	===1===
5	1	1	1	===1===
20	1	1	1	===1===
DROP TABLE t1;
CREATE TABLE t1 ( f_int1 INTEGER, f_int2 INTEGER, f_char1 CHAR(10), 
f_char2 CHAR(10), f_charbig VARCHAR(1000))
ENGINE = NDB
PARTITION BY LIST(f_int1) 
(PARTITION part_1 VALUES IN (-1),
PARTITION part0 VALUES IN (0,1),
PARTITION part1 VALUES IN (2));
INSERT INTO t1 SET f_int1 = -1, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
INSERT INTO t1 SET f_int1 = 0, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
ERROR HY000: Table has no partition for value 20
SELECT * FROM t1 ORDER BY f_int1;
f_int1	f_int2	f_char1	f_char2	f_charbig
-1	20	20	20	===20===
0	20	20	20	===20===
1	1	1	1	===1===
2	1	1	1	===1===
DROP TABLE t1;
Loading