Commit e47f61a0 authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge neptunus.(none):/home/msvensson/mysql/mysql-5.1

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-new-maint
parents f585407e 4a1bf59e
...@@ -15,7 +15,7 @@ DOT_FRM_VERSION=6 ...@@ -15,7 +15,7 @@ DOT_FRM_VERSION=6
# See the libtool docs for information on how to do shared lib versions. # See the libtool docs for information on how to do shared lib versions.
SHARED_LIB_MAJOR_VERSION=15 SHARED_LIB_MAJOR_VERSION=15
SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0 SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
# Set all version vars based on $VERSION. How do we do this more elegant ? # Set all version vars based on $VERSION. How do we do this more elegant ?
# Remember that regexps needs to quote [ and ] since this is run through m4 # Remember that regexps needs to quote [ and ] since this is run through m4
MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"` MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"`
......
...@@ -112,6 +112,7 @@ install-data-local: ...@@ -112,6 +112,7 @@ install-data-local:
uninstall-local: uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir) @RM@ -f -r $(DESTDIR)$(testdir)
SUFFIXES = .sh SUFFIXES = .sh
.sh: .sh:
......
...@@ -129,7 +129,6 @@ show binlog events; ...@@ -129,7 +129,6 @@ show binlog events;
drop table t1,t2,t3; drop table t1,t2,t3;
# End of 4.1 tests # End of 4.1 tests
# Test that a transaction which is rolled back does not go into binlog # Test that a transaction which is rolled back does not go into binlog
# and that a transaction which is committed does # and that a transaction which is committed does
...@@ -147,15 +146,6 @@ set autocommit=1; ...@@ -147,15 +146,6 @@ set autocommit=1;
--replace_column 2 # 5 # --replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/ --replace_regex /table_id: [0-9]+/table_id: #/
show binlog events; show binlog events;
#
# BUG#10952 - alter table ... lost data without errors and warnings
#
drop table if exists t1; drop table if exists t1;
create table t1 (c char(20)) engine=MyISAM;
insert into t1 values ("Monty"),("WAX"),("Walrus");
--error 1031
alter table t1 engine=blackhole;
drop table t1;
# End of 5.0 tests # End of 5.0 tests
...@@ -141,8 +141,3 @@ master-bin.000001 # Table_map 1 # table_id: # (test.t1) ...@@ -141,8 +141,3 @@ master-bin.000001 # Table_map 1 # table_id: # (test.t1)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; COMMIT
drop table if exists t1; drop table if exists t1;
create table t1 (c char(20)) engine=MyISAM;
insert into t1 values ("Monty"),("WAX"),("Walrus");
alter table t1 engine=blackhole;
ERROR HY000: Table storage engine for 't1' doesn't have this option
drop table t1;
...@@ -141,8 +141,3 @@ master-bin.000001 # Query 1 # use `test`; BEGIN ...@@ -141,8 +141,3 @@ master-bin.000001 # Query 1 # use `test`; BEGIN
master-bin.000001 # Query 1 # use `test`; insert into t1 values(1) master-bin.000001 # Query 1 # use `test`; insert into t1 values(1)
master-bin.000001 # Query 1 # use `test`; COMMIT master-bin.000001 # Query 1 # use `test`; COMMIT
drop table if exists t1; drop table if exists t1;
create table t1 (c char(20)) engine=MyISAM;
insert into t1 values ("Monty"),("WAX"),("Walrus");
alter table t1 engine=blackhole;
ERROR HY000: Table storage engine for 't1' doesn't have this option
drop table t1;
...@@ -7,9 +7,9 @@ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3); ...@@ -7,9 +7,9 @@ partition x3 values in (16, 8, 5+19, 70-43) tablespace ts3);
select * from information_schema.partitions where table_schema="test" select * from information_schema.partitions where table_schema="test"
and table_name="t1"; and table_name="t1";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t1 x1 NULL 1 NULL LIST NULL b*a NULL 1 0 0 0 # 1024 0 # # NULL NULL default 0 ts1 NULL test t1 x1 NULL 1 NULL LIST NULL b*a NULL 1 0 0 0 # 1024 0 # # NULL NULL default default ts1
NULL test t1 x2 NULL 2 NULL LIST NULL b*a NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default 0 ts2 NULL test t1 x2 NULL 2 NULL LIST NULL b*a NULL 3,11,5,7 0 0 0 # 1024 0 # # NULL NULL default default ts2
NULL test t1 x3 NULL 3 NULL LIST NULL b*a NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default 0 ts3 NULL test t1 x3 NULL 3 NULL LIST NULL b*a NULL 16,8,24,27 0 0 0 # 1024 0 # # NULL NULL default default ts3
create table t2 (a int not null,b int not null,c int not null, primary key(a,b)) create table t2 (a int not null,b int not null,c int not null, primary key(a,b))
partition by range (a) partition by range (a)
partitions 3 partitions 3
...@@ -19,27 +19,27 @@ partition x3 values less than maxvalue tablespace ts3); ...@@ -19,27 +19,27 @@ partition x3 values less than maxvalue tablespace ts3);
select * from information_schema.partitions where table_schema="test" select * from information_schema.partitions where table_schema="test"
and table_name="t2"; and table_name="t2";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t2 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 1024 0 # # NULL NULL default 0 ts1 NULL test t2 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 1024 0 # # NULL NULL default default ts1
NULL test t2 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 1024 0 # # NULL NULL default 0 ts2 NULL test t2 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 1024 0 # # NULL NULL default default ts2
NULL test t2 x3 NULL 3 NULL RANGE NULL a NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default 0 ts3 NULL test t2 x3 NULL 3 NULL RANGE NULL a NULL MAXVALUE 0 0 0 # 1024 0 # # NULL NULL default default ts3
create table t3 (f1 date) create table t3 (f1 date)
partition by hash(month(f1)) partition by hash(month(f1))
partitions 3; partitions 3;
select * from information_schema.partitions where table_schema="test" select * from information_schema.partitions where table_schema="test"
and table_name="t3"; and table_name="t3";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t3 p0 NULL 1 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default NULL test t3 p0 NULL 1 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
NULL test t3 p1 NULL 2 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default NULL test t3 p1 NULL 2 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
NULL test t3 p2 NULL 3 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default NULL test t3 p2 NULL 3 NULL HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
create table t4 (f1 date, f2 int) create table t4 (f1 date, f2 int)
partition by key(f1,f2) partition by key(f1,f2)
partitions 3; partitions 3;
select * from information_schema.partitions where table_schema="test" select * from information_schema.partitions where table_schema="test"
and table_name="t4"; and table_name="t4";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t4 p0 NULL 1 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default NULL test t4 p0 NULL 1 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
NULL test t4 p1 NULL 2 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default NULL test t4 p1 NULL 2 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
NULL test t4 p2 NULL 3 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default NULL test t4 p2 NULL 3 NULL KEY NULL f1,f2 NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;
create table t1 (a int not null,b int not null,c int not null,primary key (a,b)) create table t1 (a int not null,b int not null,c int not null,primary key (a,b))
partition by range (a) partition by range (a)
...@@ -63,14 +63,14 @@ subpartition x22 tablespace t2) ...@@ -63,14 +63,14 @@ subpartition x22 tablespace t2)
); );
select * from information_schema.partitions where table_schema="test"; select * from information_schema.partitions where table_schema="test";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default 0 t1 NULL test t1 x1 x11 1 1 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default default t1
NULL test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default 0 t2 NULL test t1 x1 x12 1 2 RANGE HASH a a+b 1 0 0 0 # 1024 0 # # NULL NULL default default t2
NULL test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default 0 t1 NULL test t1 x2 x21 2 1 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default default t1
NULL test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default 0 t2 NULL test t1 x2 x22 2 2 RANGE HASH a a+b 5 0 0 0 # 1024 0 # # NULL NULL default default t2
NULL test t2 x1 x11 1 1 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default 0 t1 NULL test t2 x1 x11 1 1 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default default t1
NULL test t2 x1 x12 1 2 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default 0 t2 NULL test t2 x1 x12 1 2 RANGE KEY a a 1 0 0 0 # 1024 0 # # NULL NULL default default t2
NULL test t2 x2 x21 2 1 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default 0 t1 NULL test t2 x2 x21 2 1 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default default t1
NULL test t2 x2 x22 2 2 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default 0 t2 NULL test t2 x2 x22 2 2 RANGE KEY a a 5 0 0 0 # 1024 0 # # NULL NULL default default t2
drop table t1,t2; drop table t1,t2;
create table t1 ( create table t1 (
a int not null, a int not null,
...@@ -99,7 +99,7 @@ drop table t1; ...@@ -99,7 +99,7 @@ drop table t1;
create table t1(f1 int, f2 int); create table t1(f1 int, f2 int);
select * from information_schema.partitions where table_schema="test"; select * from information_schema.partitions where table_schema="test";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t1 NULL NULL NULL NULL NULL NULL NULL NULL NULL 0 0 0 # 1024 0 # # NULL NULL 0 NULL test t1 NULL NULL NULL NULL NULL NULL NULL NULL NULL 0 0 0 # 1024 0 # # NULL NULL
drop table t1; drop table t1;
create table t1 (f1 date) create table t1 (f1 date)
partition by linear hash(month(f1)) partition by linear hash(month(f1))
...@@ -107,9 +107,9 @@ partitions 3; ...@@ -107,9 +107,9 @@ partitions 3;
select * from information_schema.partitions where table_schema="test" select * from information_schema.partitions where table_schema="test"
and table_name="t1"; and table_name="t1";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t1 p0 NULL 1 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default NULL test t1 p0 NULL 1 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
NULL test t1 p1 NULL 2 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default NULL test t1 p1 NULL 2 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
NULL test t1 p2 NULL 3 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default 0 default NULL test t1 p2 NULL 3 NULL LINEAR HASH NULL month(f1) NULL NULL 0 0 0 # 1024 0 # # NULL NULL default default default
drop table t1; drop table t1;
create table t1 (a int) create table t1 (a int)
PARTITION BY RANGE (a) PARTITION BY RANGE (a)
......
...@@ -771,14 +771,6 @@ Table Op Msg_type Msg_text ...@@ -771,14 +771,6 @@ Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
test.t2 check status OK test.t2 check status OK
drop table t1, t2, t3; drop table t1, t2, t3;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
create table t1 (c char(20)) engine=MyISAM;
insert into t1 values ("Monty"),("WAX"),("Walrus");
alter table t1 engine=MERGE;
ERROR HY000: Table storage engine for 't1' doesn't have this option
drop table t1;
create table t1 (b bit(1)); create table t1 (b bit(1));
create table t2 (b bit(1)); create table t2 (b bit(1));
create table tm (b bit(1)) engine = merge union = (t1,t2); create table tm (b bit(1)) engine = merge union = (t1,t2);
......
This diff is collapsed.
...@@ -194,6 +194,12 @@ c2 TEXT NOT NULL, ...@@ -194,6 +194,12 @@ c2 TEXT NOT NULL,
c3 INT NOT NULL, c3 INT NOT NULL,
PRIMARY KEY(c1,c3)) PRIMARY KEY(c1,c3))
ENGINE=NDB ENGINE=NDB
PARTITION BY KEY(c3); PARTITION BY KEY(c3)
(PARTITION p0 NODEGROUP 0, PARTITION p1 NODEGROUP 0);
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1; ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
SELECT NODEGROUP,PARTITION_NAME FROM information_schema.partitions WHERE
table_name = "t1";
NODEGROUP PARTITION_NAME
0 p0
0 p1
DROP TABLE t1; DROP TABLE t1;
...@@ -17,9 +17,9 @@ INSERT into t1 values (10, 1, 1); ...@@ -17,9 +17,9 @@ INSERT into t1 values (10, 1, 1);
INSERT into t1 values (15, 1, 1); INSERT into t1 values (15, 1, 1);
select * from information_schema.partitions where table_name= 't1'; select * from information_schema.partitions where table_name= 't1';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
NULL test t1 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 0 0 # # NULL NULL default 0 default NULL test t1 x1 NULL 1 NULL RANGE NULL a NULL 5 0 0 0 # 0 0 # # NULL NULL default default default
NULL test t1 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 0 0 # # NULL NULL default 0 default NULL test t1 x2 NULL 2 NULL RANGE NULL a NULL 10 0 0 0 # 0 0 # # NULL NULL default default default
NULL test t1 x3 NULL 3 NULL RANGE NULL a NULL 20 0 0 0 # 0 0 # # NULL NULL default 0 default NULL test t1 x3 NULL 3 NULL RANGE NULL a NULL 20 0 0 0 # 0 0 # # NULL NULL default default default
select * from t1 order by a; select * from t1 order by a;
a b c a b c
1 1 1 1 1 1
......
drop table if exists t1; drop table if exists t1;
create table t1 (a int unsigned)
partition by hash(a div 2)
partitions 4;
insert into t1 values (null),(0),(1),(2),(3),(4),(5),(6),(7);
select * from t1 where a < 0;
a
select * from t1 where a is null or (a >= 5 and a <= 7);
a
NULL
5
6
7
select * from t1 where a is null;
a
NULL
select * from t1 where a is not null;
a
0
1
2
3
4
5
6
7
select * from t1 where a >= 1 and a < 3;
a
1
2
select * from t1 where a >= 3 and a <= 5;
a
3
4
5
select * from t1 where a > 2 and a < 4;
a
3
select * from t1 where a > 3 and a <= 6;
a
4
5
6
select * from t1 where a > 5;
a
6
7
select * from t1 where a >= 1 and a <= 5;
a
1
2
3
4
5
explain partitions select * from t1 where a < 0;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
explain partitions select * from t1 where a is null or (a >= 5 and a <= 7);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 7 Using where
explain partitions select * from t1 where a is null;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 Using where
explain partitions select * from t1 where a is not null;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
explain partitions select * from t1 where a >= 1 and a < 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 Using where
explain partitions select * from t1 where a >= 3 and a <= 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t1 where a > 2 and a < 4;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a > 3 and a <= 6;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t1 where a > 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
explain partitions select * from t1 where a >= 1 and a <= 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where
drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
......
drop table if exists t1; drop table if exists t1;
create table t1 (a int unsigned)
partition by list (a)
(partition p0 values in (0),
partition p1 values in (1),
partition pnull values in (null),
partition p2 values in (2));
insert into t1 values (null),(0),(1),(2);
select * from t1 where a < 2;
a
0
1
select * from t1 where a <= 0;
a
0
select * from t1 where a < 1;
a
0
select * from t1 where a > 0;
a
1
2
select * from t1 where a > 1;
a
2
select * from t1 where a >= 0;
a
0
1
2
select * from t1 where a >= 1;
a
1
2
select * from t1 where a is null;
a
NULL
select * from t1 where a is not null;
a
0
1
2
select * from t1 where a is null or a > 0;
a
1
NULL
2
drop table t1;
create table t1 (a int unsigned, b int)
partition by list (a)
subpartition by hash (b)
subpartitions 2
(partition p0 values in (0),
partition p1 values in (1),
partition pnull values in (null, 2),
partition p3 values in (3));
insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1);
insert into t1 values (2,0),(2,1),(3,0),(3,1);
explain partitions select * from t1 where a is null;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 Using where
select * from t1 where a is null;
a b
NULL 0
NULL 1
explain partitions select * from t1 where a = 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 Using where
select * from t1 where a = 2;
a b
2 0
2 1
select * from t1 where a <= 0;
a b
0 0
0 1
select * from t1 where a < 3;
a b
0 0
0 1
1 0
1 1
2 0
2 1
select * from t1 where a >= 1 or a is null;
a b
1 0
1 1
NULL 0
2 0
NULL 1
2 1
3 0
3 1
drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
......
...@@ -149,6 +149,48 @@ id select_type table partitions type possible_keys key key_len ref rows Extra ...@@ -149,6 +149,48 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
explain partitions select * from t6 where a > 3 and a < 5; explain partitions select * from t6 where a > 3 and a < 5;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
drop table t6;
create table t6 (a int unsigned not null) partition by LIST(a) (
partition p1 values in (1),
partition p3 values in (3),
partition p5 values in (5),
partition p7 values in (7),
partition p9 values in (9)
);
insert into t6 values (1),(3),(5);
explain partitions select * from t6 where a < 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t6 where a <= 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t6 p1 system NULL NULL NULL NULL 1
explain partitions select * from t6 where a > 9;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t6 where a >= 9;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t6 where a > 0 and a < 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t6 p1,p3 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t6 where a > 5 and a < 12;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t6 where a > 3 and a < 8 ;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t6 p5,p7 system NULL NULL NULL NULL 1
explain partitions select * from t6 where a >= 0 and a <= 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t6 p1,p3,p5 ALL NULL NULL NULL NULL 3 Using where
explain partitions select * from t6 where a >= 5 and a <= 12;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1
explain partitions select * from t6 where a >= 3 and a <= 8;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t6 where a > 3 and a < 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
create table t7 (a int not null) partition by RANGE(a) ( create table t7 (a int not null) partition by RANGE(a) (
partition p10 values less than (10), partition p10 values less than (10),
partition p30 values less than (30), partition p30 values less than (30),
...@@ -184,6 +226,42 @@ id select_type table partitions type possible_keys key key_len ref rows Extra ...@@ -184,6 +226,42 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
explain partitions select * from t7 where a > 11 and a < 29; explain partitions select * from t7 where a > 11 and a < 29;
id select_type table partitions type possible_keys key key_len ref rows Extra id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
drop table t7;
create table t7 (a int unsigned not null) partition by RANGE(a) (
partition p10 values less than (10),
partition p30 values less than (30),
partition p50 values less than (50),
partition p70 values less than (70),
partition p90 values less than (90)
);
insert into t7 values (10),(30),(50);
explain partitions select * from t7 where a < 5;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t7 where a < 10;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t7 where a <= 10;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t7 p10,p30 system NULL NULL NULL NULL 1
explain partitions select * from t7 where a = 10;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t7 p30 system NULL NULL NULL NULL 1
explain partitions select * from t7 where a < 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where
explain partitions select * from t7 where a = 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t7 where a > 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t7 where a >= 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t7 where a > 11 and a < 29;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
create table t8 (a date not null) partition by RANGE(YEAR(a)) ( create table t8 (a date not null) partition by RANGE(YEAR(a)) (
partition p0 values less than (1980), partition p0 values less than (1980),
partition p1 values less than (1990), partition p1 values less than (1990),
......
drop table if exists t1; drop table if exists t1;
create table t1 (a int unsigned)
partition by range (a)
(partition pnull values less than (0),
partition p0 values less than (1),
partition p1 values less than(2));
insert into t1 values (null),(0),(1);
select * from t1 where a is null;
a
NULL
select * from t1 where a >= 0;
a
0
1
select * from t1 where a < 0;
a
select * from t1 where a <= 0;
a
0
select * from t1 where a > 1;
a
explain partitions select * from t1 where a is null;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull system NULL NULL NULL NULL 1
explain partitions select * from t1 where a >= 0;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a < 0;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
explain partitions select * from t1 where a <= 0;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a > 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
drop table t1;
create table t1 (a int unsigned, b int unsigned)
partition by range (a)
subpartition by hash (b)
subpartitions 2
(partition pnull values less than (0),
partition p0 values less than (1),
partition p1 values less than(2));
insert into t1 values (null,0),(null,1),(0,0),(0,1),(1,0),(1,1);
select * from t1 where a is null;
a b
NULL 0
NULL 1
select * from t1 where a >= 0;
a b
0 0
0 1
1 0
1 1
select * from t1 where a < 0;
a b
select * from t1 where a <= 0;
a b
0 0
0 1
select * from t1 where a > 1;
a b
explain partitions select * from t1 where a is null;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a >= 0;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t1 where a < 0;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where
explain partitions select * from t1 where a <= 0;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where
explain partitions select * from t1 where a > 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 2 Using where
drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int not null, a int not null,
b int not null, b int not null,
......
...@@ -14,11 +14,13 @@ ...@@ -14,11 +14,13 @@
#events : BUG#17619 2006-02-21 andrey Race conditions #events : BUG#17619 2006-02-21 andrey Race conditions
#events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked. #events_scheduling : BUG#19170 2006-04-26 andrey Test case of 19170 fails on some platforms. Has to be checked.
#im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly #im_instance_conf : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly
#im_options : Bug#20294 2006-06-06 monty Instance manager test im_instance_conf fails randomly im_options : Bug#20294 2006-07-24 stewart Instance manager test im_instance_conf fails randomly
#im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails #im_life_cycle : Bug#20368 2006-06-10 alik im_life_cycle test fails
ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog
ndb_binlog_ignore_db : BUG#21279 2006-07-25 ingo Randomly throws a warning
ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed ndb_load : BUG#17233 2006-05-04 tomas failed load data from infile causes mysqld dbug_assert, binlog not flushed
ndb_restore_compat : BUG#21283 2006-07-26 ingo Test fails randomly
partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table
ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open ps_7ndb : BUG#18950 2006-02-16 jmiller create table like does not obtain LOCK_open
rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated
......
...@@ -383,16 +383,6 @@ drop table t1, t2, t3; ...@@ -383,16 +383,6 @@ drop table t1, t2, t3;
# End of 4.1 tests # End of 4.1 tests
#
# BUG#10952 - alter table ... lost data without errors and warnings
#
drop table if exists t1;
create table t1 (c char(20)) engine=MyISAM;
insert into t1 values ("Monty"),("WAX"),("Walrus");
--error 1031
alter table t1 engine=MERGE;
drop table t1;
# #
# BUG#19648 - Merge table does not work with bit types # BUG#19648 - Merge table does not work with bit types
# #
......
...@@ -192,7 +192,10 @@ CREATE TABLE t1 ( ...@@ -192,7 +192,10 @@ CREATE TABLE t1 (
c3 INT NOT NULL, c3 INT NOT NULL,
PRIMARY KEY(c1,c3)) PRIMARY KEY(c1,c3))
ENGINE=NDB ENGINE=NDB
PARTITION BY KEY(c3); PARTITION BY KEY(c3)
(PARTITION p0 NODEGROUP 0, PARTITION p1 NODEGROUP 0);
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1; ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
SELECT NODEGROUP,PARTITION_NAME FROM information_schema.partitions WHERE
table_name = "t1";
DROP TABLE t1; DROP TABLE t1;
...@@ -9,6 +9,36 @@ ...@@ -9,6 +9,36 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
#
# More partition pruning tests, especially on interval walking
#
create table t1 (a int unsigned)
partition by hash(a div 2)
partitions 4;
insert into t1 values (null),(0),(1),(2),(3),(4),(5),(6),(7);
select * from t1 where a < 0;
select * from t1 where a is null or (a >= 5 and a <= 7);
select * from t1 where a is null;
select * from t1 where a is not null;
select * from t1 where a >= 1 and a < 3;
select * from t1 where a >= 3 and a <= 5;
select * from t1 where a > 2 and a < 4;
select * from t1 where a > 3 and a <= 6;
select * from t1 where a > 5;
select * from t1 where a >= 1 and a <= 5;
explain partitions select * from t1 where a < 0;
explain partitions select * from t1 where a is null or (a >= 5 and a <= 7);
explain partitions select * from t1 where a is null;
explain partitions select * from t1 where a is not null;
explain partitions select * from t1 where a >= 1 and a < 3;
explain partitions select * from t1 where a >= 3 and a <= 5;
explain partitions select * from t1 where a > 2 and a < 4;
explain partitions select * from t1 where a > 3 and a <= 6;
explain partitions select * from t1 where a > 5;
explain partitions select * from t1 where a >= 1 and a <= 5;
drop table t1;
# #
# Partition by hash, basic # Partition by hash, basic
# #
......
...@@ -9,6 +9,49 @@ ...@@ -9,6 +9,49 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
#
# Bug 20733: Zerofill columns gives wrong result with partitioned tables
#
create table t1 (a int unsigned)
partition by list (a)
(partition p0 values in (0),
partition p1 values in (1),
partition pnull values in (null),
partition p2 values in (2));
insert into t1 values (null),(0),(1),(2);
select * from t1 where a < 2;
select * from t1 where a <= 0;
select * from t1 where a < 1;
select * from t1 where a > 0;
select * from t1 where a > 1;
select * from t1 where a >= 0;
select * from t1 where a >= 1;
select * from t1 where a is null;
select * from t1 where a is not null;
select * from t1 where a is null or a > 0;
drop table t1;
create table t1 (a int unsigned, b int)
partition by list (a)
subpartition by hash (b)
subpartitions 2
(partition p0 values in (0),
partition p1 values in (1),
partition pnull values in (null, 2),
partition p3 values in (3));
insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1);
insert into t1 values (2,0),(2,1),(3,0),(3,1);
explain partitions select * from t1 where a is null;
select * from t1 where a is null;
explain partitions select * from t1 where a = 2;
select * from t1 where a = 2;
select * from t1 where a <= 0;
select * from t1 where a < 3;
select * from t1 where a >= 1 or a is null;
drop table t1;
# #
# Test ordinary list partitioning that it works ok # Test ordinary list partitioning that it works ok
# #
...@@ -136,3 +179,4 @@ insert into t1 values (null); ...@@ -136,3 +179,4 @@ insert into t1 values (null);
select * from t1; select * from t1;
drop table t1; drop table t1;
...@@ -137,6 +137,32 @@ explain partitions select * from t6 where a >= 3 and a <= 8; ...@@ -137,6 +137,32 @@ explain partitions select * from t6 where a >= 3 and a <= 8;
explain partitions select * from t6 where a > 3 and a < 5; explain partitions select * from t6 where a > 3 and a < 5;
drop table t6;
create table t6 (a int unsigned not null) partition by LIST(a) (
partition p1 values in (1),
partition p3 values in (3),
partition p5 values in (5),
partition p7 values in (7),
partition p9 values in (9)
);
insert into t6 values (1),(3),(5);
explain partitions select * from t6 where a < 1;
explain partitions select * from t6 where a <= 1;
explain partitions select * from t6 where a > 9;
explain partitions select * from t6 where a >= 9;
explain partitions select * from t6 where a > 0 and a < 5;
explain partitions select * from t6 where a > 5 and a < 12;
explain partitions select * from t6 where a > 3 and a < 8 ;
explain partitions select * from t6 where a >= 0 and a <= 5;
explain partitions select * from t6 where a >= 5 and a <= 12;
explain partitions select * from t6 where a >= 3 and a <= 8;
explain partitions select * from t6 where a > 3 and a < 5;
# RANGE(field) partitioning, interval analysis. # RANGE(field) partitioning, interval analysis.
create table t7 (a int not null) partition by RANGE(a) ( create table t7 (a int not null) partition by RANGE(a) (
partition p10 values less than (10), partition p10 values less than (10),
...@@ -162,6 +188,32 @@ explain partitions select * from t7 where a >= 90; ...@@ -162,6 +188,32 @@ explain partitions select * from t7 where a >= 90;
# misc intervals # misc intervals
explain partitions select * from t7 where a > 11 and a < 29; explain partitions select * from t7 where a > 11 and a < 29;
drop table t7;
create table t7 (a int unsigned not null) partition by RANGE(a) (
partition p10 values less than (10),
partition p30 values less than (30),
partition p50 values less than (50),
partition p70 values less than (70),
partition p90 values less than (90)
);
insert into t7 values (10),(30),(50);
# leftmost intervals
explain partitions select * from t7 where a < 5;
explain partitions select * from t7 where a < 10;
explain partitions select * from t7 where a <= 10;
explain partitions select * from t7 where a = 10;
#rightmost intervals
explain partitions select * from t7 where a < 90;
explain partitions select * from t7 where a = 90;
explain partitions select * from t7 where a > 90;
explain partitions select * from t7 where a >= 90;
# misc intervals
explain partitions select * from t7 where a > 11 and a < 29;
# LIST(monontonic_func) partitioning # LIST(monontonic_func) partitioning
create table t8 (a date not null) partition by RANGE(YEAR(a)) ( create table t8 (a date not null) partition by RANGE(YEAR(a)) (
partition p0 values less than (1980), partition p0 values less than (1980),
......
...@@ -9,6 +9,50 @@ ...@@ -9,6 +9,50 @@
drop table if exists t1; drop table if exists t1;
--enable_warnings --enable_warnings
#
# More checks for partition pruning
#
create table t1 (a int unsigned)
partition by range (a)
(partition pnull values less than (0),
partition p0 values less than (1),
partition p1 values less than(2));
insert into t1 values (null),(0),(1);
select * from t1 where a is null;
select * from t1 where a >= 0;
select * from t1 where a < 0;
select * from t1 where a <= 0;
select * from t1 where a > 1;
explain partitions select * from t1 where a is null;
explain partitions select * from t1 where a >= 0;
explain partitions select * from t1 where a < 0;
explain partitions select * from t1 where a <= 0;
explain partitions select * from t1 where a > 1;
drop table t1;
create table t1 (a int unsigned, b int unsigned)
partition by range (a)
subpartition by hash (b)
subpartitions 2
(partition pnull values less than (0),
partition p0 values less than (1),
partition p1 values less than(2));
insert into t1 values (null,0),(null,1),(0,0),(0,1),(1,0),(1,1);
select * from t1 where a is null;
select * from t1 where a >= 0;
select * from t1 where a < 0;
select * from t1 where a <= 0;
select * from t1 where a > 1;
explain partitions select * from t1 where a is null;
explain partitions select * from t1 where a >= 0;
explain partitions select * from t1 where a < 0;
explain partitions select * from t1 where a <= 0;
explain partitions select * from t1 where a > 1;
drop table t1;
# #
# Partition by range, basic # Partition by range, basic
# #
......
...@@ -555,7 +555,7 @@ static int myisammrg_init() ...@@ -555,7 +555,7 @@ static int myisammrg_init()
myisammrg_hton.db_type=DB_TYPE_MRG_MYISAM; myisammrg_hton.db_type=DB_TYPE_MRG_MYISAM;
myisammrg_hton.create=myisammrg_create_handler; myisammrg_hton.create=myisammrg_create_handler;
myisammrg_hton.panic=myrg_panic; myisammrg_hton.panic=myrg_panic;
myisammrg_hton.flags= HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE; myisammrg_hton.flags= HTON_CAN_RECREATE;
return 0; return 0;
} }
......
...@@ -679,7 +679,6 @@ struct handlerton ...@@ -679,7 +679,6 @@ struct handlerton
#define HTON_FLUSH_AFTER_RENAME (1 << 4) #define HTON_FLUSH_AFTER_RENAME (1 << 4)
#define HTON_NOT_USER_SELECTABLE (1 << 5) #define HTON_NOT_USER_SELECTABLE (1 << 5)
#define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported #define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported
#define HTON_ALTER_CANNOT_CREATE (1 << 7) //Cannot use alter to create
typedef struct st_thd_trans typedef struct st_thd_trans
{ {
......
...@@ -3203,7 +3203,12 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar) ...@@ -3203,7 +3203,12 @@ static bool create_partition_index_description(PART_PRUNE_PARAM *ppar)
ppar->is_part_keypart[part]= !in_subpart_fields; ppar->is_part_keypart[part]= !in_subpart_fields;
ppar->is_subpart_keypart[part]= in_subpart_fields; ppar->is_subpart_keypart[part]= in_subpart_fields;
/*
Check if this was last field in this array, in this case we
switch to subpartitioning fields. (This will only happens if
there are subpartitioning fields to cater for).
*/
if (!*(++field)) if (!*(++field))
{ {
field= part_info->subpart_field_array; field= part_info->subpart_field_array;
......
...@@ -2415,6 +2415,10 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info, ...@@ -2415,6 +2415,10 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info,
bool unsigned_flag= part_info->part_expr->unsigned_flag; bool unsigned_flag= part_info->part_expr->unsigned_flag;
DBUG_ENTER("get_list_array_idx_for_endpoint"); DBUG_ENTER("get_list_array_idx_for_endpoint");
if (part_info->part_expr->null_value)
{
DBUG_RETURN(0);
}
if (unsigned_flag) if (unsigned_flag)
part_func_value-= 0x8000000000000000ULL; part_func_value-= 0x8000000000000000ULL;
DBUG_ASSERT(part_info->no_list_values); DBUG_ASSERT(part_info->no_list_values);
...@@ -2539,6 +2543,13 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, ...@@ -2539,6 +2543,13 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
bool unsigned_flag= part_info->part_expr->unsigned_flag; bool unsigned_flag= part_info->part_expr->unsigned_flag;
DBUG_ENTER("get_partition_id_range_for_endpoint"); DBUG_ENTER("get_partition_id_range_for_endpoint");
if (part_info->part_expr->null_value)
{
uint32 ret_part_id= 0;
if (!left_endpoint && include_endpoint)
ret_part_id= 1;
DBUG_RETURN(ret_part_id);
}
if (unsigned_flag) if (unsigned_flag)
part_func_value-= 0x8000000000000000ULL; part_func_value-= 0x8000000000000000ULL;
while (max_part_id > min_part_id) while (max_part_id > min_part_id)
......
...@@ -5492,7 +5492,7 @@ ST_FIELD_INFO partitions_fields_info[]= ...@@ -5492,7 +5492,7 @@ ST_FIELD_INFO partitions_fields_info[]=
{"CHECK_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0}, {"CHECK_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0},
{"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, 0}, {"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
{"PARTITION_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, 0}, {"PARTITION_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, 0},
{"NODEGROUP", 21 , MYSQL_TYPE_LONG, 0, 0, 0}, {"NODEGROUP", 12 , MYSQL_TYPE_STRING, 0, 0, 0},
{"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0}, {"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0} {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
}; };
......
...@@ -5108,9 +5108,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -5108,9 +5108,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
ha_resolve_storage_engine_name(old_db_type), ha_resolve_storage_engine_name(old_db_type),
ha_resolve_storage_engine_name(new_db_type))); ha_resolve_storage_engine_name(new_db_type)));
if (ha_check_storage_engine_flag(old_db_type, HTON_ALTER_NOT_SUPPORTED) || if (ha_check_storage_engine_flag(old_db_type, HTON_ALTER_NOT_SUPPORTED) ||
ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED) || ha_check_storage_engine_flag(new_db_type, HTON_ALTER_NOT_SUPPORTED))
(old_db_type != new_db_type &&
ha_check_storage_engine_flag(new_db_type, HTON_ALTER_CANNOT_CREATE)))
{ {
DBUG_PRINT("info", ("doesn't support alter")); DBUG_PRINT("info", ("doesn't support alter"));
my_error(ER_ILLEGAL_HA, MYF(0), table_name); my_error(ER_ILLEGAL_HA, MYF(0), table_name);
......
...@@ -206,7 +206,7 @@ static int blackhole_init() ...@@ -206,7 +206,7 @@ static int blackhole_init()
blackhole_hton.state= SHOW_OPTION_YES; blackhole_hton.state= SHOW_OPTION_YES;
blackhole_hton.db_type= DB_TYPE_BLACKHOLE_DB; blackhole_hton.db_type= DB_TYPE_BLACKHOLE_DB;
blackhole_hton.create= blackhole_create_handler; blackhole_hton.create= blackhole_create_handler;
blackhole_hton.flags= HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE; blackhole_hton.flags= HTON_CAN_RECREATE;
return 0; return 0;
} }
......
...@@ -2,7 +2,7 @@ Next QMGR 1 ...@@ -2,7 +2,7 @@ Next QMGR 1
Next NDBCNTR 1000 Next NDBCNTR 1000
Next NDBFS 2000 Next NDBFS 2000
Next DBACC 3002 Next DBACC 3002
Next DBTUP 4013 Next DBTUP 4024
Next DBLQH 5043 Next DBLQH 5043
Next DBDICT 6007 Next DBDICT 6007
Next DBDIH 7177 Next DBDIH 7177
...@@ -437,6 +437,8 @@ Drop Table/Index: ...@@ -437,6 +437,8 @@ Drop Table/Index:
8036: Fail next index drop in TC 8036: Fail next index drop in TC
6006: Crash participant in create index 6006: Crash participant in create index
4013: verify TUP tab descr before and after next DROP TABLE
System Restart: System Restart:
--------------- ---------------
...@@ -484,3 +486,6 @@ Dbtup: ...@@ -484,3 +486,6 @@ Dbtup:
4019 - handleInsert - Alloc rowid error 4019 - handleInsert - Alloc rowid error
4020 - handleInsert - Size change error 4020 - handleInsert - Size change error
4021 - handleInsert - Out of disk space 4021 - handleInsert - Out of disk space
4022 - addTuxEntries - fail before add of first entry
4023 - addTuxEntries - fail add of last entry (the entry for last index)
...@@ -254,6 +254,8 @@ inline const Uint32* ALIGN_WORD(const void* ptr) ...@@ -254,6 +254,8 @@ inline const Uint32* ALIGN_WORD(const void* ptr)
#define ZSTORED_PROCEDURE_FREE 0xffff #define ZSTORED_PROCEDURE_FREE 0xffff
#define ZMIN_PAGE_LIMIT_TUP_COMMITREQ 2 #define ZMIN_PAGE_LIMIT_TUP_COMMITREQ 2
#define ZSKIP_TUX_TRIGGERS 0x1 // flag for TUP_ABORTREQ
#endif #endif
class Dbtup: public SimulatedBlock { class Dbtup: public SimulatedBlock {
...@@ -2155,6 +2157,7 @@ private: ...@@ -2155,6 +2157,7 @@ private:
//------------------------------------------------------------------ //------------------------------------------------------------------
//------------------------------------------------------------------ //------------------------------------------------------------------
void tupkeyErrorLab(Signal* signal); void tupkeyErrorLab(Signal* signal);
void do_tup_abortreq(Signal*, Uint32 flags);
//------------------------------------------------------------------ //------------------------------------------------------------------
//------------------------------------------------------------------ //------------------------------------------------------------------
...@@ -2373,15 +2376,18 @@ private: ...@@ -2373,15 +2376,18 @@ private:
// Public methods // Public methods
Uint32 getTabDescrOffsets(const Tablerec* regTabPtr, Uint32* offset); Uint32 getTabDescrOffsets(const Tablerec* regTabPtr, Uint32* offset);
Uint32 allocTabDescr(const Tablerec* regTabPtr, Uint32* offset); Uint32 allocTabDescr(const Tablerec* regTabPtr, Uint32* offset);
void freeTabDescr(Uint32 retRef, Uint32 retNo); void freeTabDescr(Uint32 retRef, Uint32 retNo, bool normal = true);
Uint32 getTabDescrWord(Uint32 index); Uint32 getTabDescrWord(Uint32 index);
void setTabDescrWord(Uint32 index, Uint32 word); void setTabDescrWord(Uint32 index, Uint32 word);
// Private methods // Private methods
Uint32 sizeOfReadFunction(); Uint32 sizeOfReadFunction();
void removeTdArea(Uint32 tabDesRef, Uint32 list); void removeTdArea(Uint32 tabDesRef, Uint32 list);
void insertTdArea(Uint32 sizeOfChunk, Uint32 tabDesRef, Uint32 list); void insertTdArea(Uint32 tabDesRef, Uint32 list);
Uint32 itdaMergeTabDescr(Uint32 retRef, Uint32 retNo); void itdaMergeTabDescr(Uint32& retRef, Uint32& retNo, bool normal);
#ifdef VM_TRACE
void verifytabdes();
#endif
void seizeOpRec(OperationrecPtr& regOperPtr); void seizeOpRec(OperationrecPtr& regOperPtr);
void seizeFragrecord(FragrecordPtr& regFragPtr); void seizeFragrecord(FragrecordPtr& regFragPtr);
......
...@@ -62,12 +62,17 @@ void Dbtup::freeAttrinbufrec(Uint32 anAttrBuf) ...@@ -62,12 +62,17 @@ void Dbtup::freeAttrinbufrec(Uint32 anAttrBuf)
* Abort abort this operation and all after (nextActiveOp's) * Abort abort this operation and all after (nextActiveOp's)
*/ */
void Dbtup::execTUP_ABORTREQ(Signal* signal) void Dbtup::execTUP_ABORTREQ(Signal* signal)
{
ljamEntry();
do_tup_abortreq(signal, 0);
}
void Dbtup::do_tup_abortreq(Signal* signal, Uint32 flags)
{ {
OperationrecPtr regOperPtr; OperationrecPtr regOperPtr;
FragrecordPtr regFragPtr; FragrecordPtr regFragPtr;
TablerecPtr regTabPtr; TablerecPtr regTabPtr;
ljamEntry();
regOperPtr.i = signal->theData[0]; regOperPtr.i = signal->theData[0];
c_operation_pool.getPtr(regOperPtr); c_operation_pool.getPtr(regOperPtr);
TransState trans_state= get_trans_state(regOperPtr.p); TransState trans_state= get_trans_state(regOperPtr.p);
...@@ -91,7 +96,8 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) ...@@ -91,7 +96,8 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal)
if (get_tuple_state(regOperPtr.p) == TUPLE_PREPARED) if (get_tuple_state(regOperPtr.p) == TUPLE_PREPARED)
{ {
ljam(); ljam();
if (!regTabPtr.p->tuxCustomTriggers.isEmpty()) if (!regTabPtr.p->tuxCustomTriggers.isEmpty() &&
(flags & ZSKIP_TUX_TRIGGERS) == 0)
executeTuxAbortTriggers(signal, executeTuxAbortTriggers(signal,
regOperPtr.p, regOperPtr.p,
regFragPtr.p, regFragPtr.p,
...@@ -103,7 +109,8 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal) ...@@ -103,7 +109,8 @@ void Dbtup::execTUP_ABORTREQ(Signal* signal)
ljam(); ljam();
c_operation_pool.getPtr(loopOpPtr); c_operation_pool.getPtr(loopOpPtr);
if (get_tuple_state(loopOpPtr.p) != TUPLE_ALREADY_ABORTED && if (get_tuple_state(loopOpPtr.p) != TUPLE_ALREADY_ABORTED &&
!regTabPtr.p->tuxCustomTriggers.isEmpty()) { !regTabPtr.p->tuxCustomTriggers.isEmpty() &&
(flags & ZSKIP_TUX_TRIGGERS) == 0) {
ljam(); ljam();
executeTuxAbortTriggers(signal, executeTuxAbortTriggers(signal,
loopOpPtr.p, loopOpPtr.p,
......
...@@ -747,6 +747,20 @@ void Dbtup::execTUPKEYREQ(Signal* signal) ...@@ -747,6 +747,20 @@ void Dbtup::execTUPKEYREQ(Signal* signal)
regFragPtr, regFragPtr,
regTabPtr) != 0) { regTabPtr) != 0) {
jam(); jam();
/*
* TUP insert succeeded but add of TUX entries failed. All
* TUX changes have been rolled back at this point.
*
* We will abort via tupkeyErrorLab() as usual. This routine
* however resets the operation to ZREAD. The TUP_ABORTREQ
* arriving later cannot then undo the insert.
*
* Therefore we call TUP_ABORTREQ already now. Diskdata etc
* should be in memory and timeslicing cannot occur. We must
* skip TUX abort triggers since TUX is already aborted.
*/
signal->theData[0] = operPtr.i;
do_tup_abortreq(signal, ZSKIP_TUX_TRIGGERS);
tupkeyErrorLab(signal); tupkeyErrorLab(signal);
return; return;
} }
...@@ -775,6 +789,11 @@ void Dbtup::execTUPKEYREQ(Signal* signal) ...@@ -775,6 +789,11 @@ void Dbtup::execTUPKEYREQ(Signal* signal)
regFragPtr, regFragPtr,
regTabPtr) != 0) { regTabPtr) != 0) {
jam(); jam();
/*
* See insert case.
*/
signal->theData[0] = operPtr.i;
do_tup_abortreq(signal, ZSKIP_TUX_TRIGGERS);
tupkeyErrorLab(signal); tupkeyErrorLab(signal);
return; return;
} }
......
...@@ -857,6 +857,11 @@ void ...@@ -857,6 +857,11 @@ void
Dbtup::execDROP_TAB_REQ(Signal* signal) Dbtup::execDROP_TAB_REQ(Signal* signal)
{ {
ljamEntry(); ljamEntry();
if (ERROR_INSERTED(4013)) {
#ifdef VM_TRACE
verifytabdes();
#endif
}
DropTabReq* req= (DropTabReq*)signal->getDataPtr(); DropTabReq* req= (DropTabReq*)signal->getDataPtr();
TablerecPtr tabPtr; TablerecPtr tabPtr;
...@@ -1109,7 +1114,6 @@ Dbtup::drop_fragment_free_var_pages(Signal* signal) ...@@ -1109,7 +1114,6 @@ Dbtup::drop_fragment_free_var_pages(Signal* signal)
} }
releaseFragPages(fragPtr.p); releaseFragPages(fragPtr.p);
Uint32 i; Uint32 i;
for(i= 0; i<MAX_FRAG_PER_NODE; i++) for(i= 0; i<MAX_FRAG_PER_NODE; i++)
if(tabPtr.p->fragrec[i] == fragPtr.i) if(tabPtr.p->fragrec[i] == fragPtr.i)
...@@ -1152,7 +1156,6 @@ Dbtup::start_restore_lcp(Uint32 tableId, Uint32 fragId) ...@@ -1152,7 +1156,6 @@ Dbtup::start_restore_lcp(Uint32 tableId, Uint32 fragId)
tabPtr.p->m_attributes[DD].m_no_of_fixsize = 0; tabPtr.p->m_attributes[DD].m_no_of_fixsize = 0;
tabPtr.p->m_attributes[DD].m_no_of_varsize = 0; tabPtr.p->m_attributes[DD].m_no_of_varsize = 0;
} }
void void
Dbtup::complete_restore_lcp(Uint32 tableId, Uint32 fragId) Dbtup::complete_restore_lcp(Uint32 tableId, Uint32 fragId)
{ {
......
...@@ -24,13 +24,15 @@ ...@@ -24,13 +24,15 @@
#define ljam() { jamLine(22000 + __LINE__); } #define ljam() { jamLine(22000 + __LINE__); }
#define ljamEntry() { jamEntryLine(22000 + __LINE__); } #define ljamEntry() { jamEntryLine(22000 + __LINE__); }
/* **************************************************************** */ /*
/* *********** TABLE DESCRIPTOR MEMORY MANAGER ******************** */ * TABLE DESCRIPTOR MEMORY MANAGER
/* **************************************************************** */ *
/* This module is used to allocate and deallocate table descriptor */ * Each table has a descriptor which is a contiguous array of words.
/* memory attached to fragments (could be allocated per table */ * The descriptor is allocated from a global array using a buddy
/* instead. Performs its task by a buddy algorithm. */ * algorithm. Free lists exist for each power of 2 words. Freeing
/* **************************************************************** */ * a piece first merges with free right and left neighbours and then
* divides itself up into free list chunks.
*/
Uint32 Uint32
Dbtup::getTabDescrOffsets(const Tablerec* regTabPtr, Uint32* offset) Dbtup::getTabDescrOffsets(const Tablerec* regTabPtr, Uint32* offset)
...@@ -59,7 +61,7 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset) ...@@ -59,7 +61,7 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset)
Uint32 reference = RNIL; Uint32 reference = RNIL;
Uint32 allocSize = getTabDescrOffsets(regTabPtr, offset); Uint32 allocSize = getTabDescrOffsets(regTabPtr, offset);
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* ALWAYS ALLOCATE A MULTIPLE OF 16 BYTES */ /* ALWAYS ALLOCATE A MULTIPLE OF 16 WORDS */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
allocSize = (((allocSize - 1) >> 4) + 1) << 4; allocSize = (((allocSize - 1) >> 4) + 1) << 4;
Uint32 list = nextHigherTwoLog(allocSize - 1); /* CALCULATE WHICH LIST IT BELONGS TO */ Uint32 list = nextHigherTwoLog(allocSize - 1); /* CALCULATE WHICH LIST IT BELONGS TO */
...@@ -72,9 +74,9 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset) ...@@ -72,9 +74,9 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset)
Uint32 retNo = (1 << i) - allocSize; /* CALCULATE THE DIFFERENCE */ Uint32 retNo = (1 << i) - allocSize; /* CALCULATE THE DIFFERENCE */
if (retNo >= ZTD_FREE_SIZE) { if (retNo >= ZTD_FREE_SIZE) {
ljam(); ljam();
Uint32 retRef = reference + allocSize; /* SET THE RETURN POINTER */ // return unused words, of course without attempting left merge
retNo = itdaMergeTabDescr(retRef, retNo); /* MERGE WITH POSSIBLE RIGHT NEIGHBOURS */ Uint32 retRef = reference + allocSize;
freeTabDescr(retRef, retNo); /* RETURN UNUSED TD SPACE TO THE TD AREA */ freeTabDescr(retRef, retNo, false);
} else { } else {
ljam(); ljam();
allocSize = 1 << i; allocSize = 1 << i;
...@@ -100,17 +102,19 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset) ...@@ -100,17 +102,19 @@ Uint32 Dbtup::allocTabDescr(const Tablerec* regTabPtr, Uint32* offset)
}//if }//if
}//Dbtup::allocTabDescr() }//Dbtup::allocTabDescr()
void Dbtup::freeTabDescr(Uint32 retRef, Uint32 retNo) void Dbtup::freeTabDescr(Uint32 retRef, Uint32 retNo, bool normal)
{ {
itdaMergeTabDescr(retRef, retNo, normal); /* MERGE WITH POSSIBLE NEIGHBOURS */
while (retNo >= ZTD_FREE_SIZE) { while (retNo >= ZTD_FREE_SIZE) {
ljam(); ljam();
Uint32 list = nextHigherTwoLog(retNo); Uint32 list = nextHigherTwoLog(retNo);
list--; /* RETURN TO NEXT LOWER LIST */ list--; /* RETURN TO NEXT LOWER LIST */
Uint32 sizeOfChunk = 1 << list; Uint32 sizeOfChunk = 1 << list;
insertTdArea(sizeOfChunk, retRef, list); insertTdArea(retRef, list);
retRef += sizeOfChunk; retRef += sizeOfChunk;
retNo -= sizeOfChunk; retNo -= sizeOfChunk;
}//while }//while
ndbassert(retNo == 0);
}//Dbtup::freeTabDescr() }//Dbtup::freeTabDescr()
Uint32 Uint32
...@@ -127,7 +131,7 @@ Dbtup::setTabDescrWord(Uint32 index, Uint32 word) ...@@ -127,7 +131,7 @@ Dbtup::setTabDescrWord(Uint32 index, Uint32 word)
tableDescriptor[index].tabDescr = word; tableDescriptor[index].tabDescr = word;
}//Dbtup::setTabDescrWord() }//Dbtup::setTabDescrWord()
void Dbtup::insertTdArea(Uint32 sizeOfChunk, Uint32 tabDesRef, Uint32 list) void Dbtup::insertTdArea(Uint32 tabDesRef, Uint32 list)
{ {
ndbrequire(list < 16); ndbrequire(list < 16);
setTabDescrWord(tabDesRef + ZTD_FL_HEADER, ZTD_TYPE_FREE); setTabDescrWord(tabDesRef + ZTD_FL_HEADER, ZTD_TYPE_FREE);
...@@ -144,19 +148,14 @@ void Dbtup::insertTdArea(Uint32 sizeOfChunk, Uint32 tabDesRef, Uint32 list) ...@@ -144,19 +148,14 @@ void Dbtup::insertTdArea(Uint32 sizeOfChunk, Uint32 tabDesRef, Uint32 list)
setTabDescrWord((tabDesRef + (1 << list)) - ZTD_TR_SIZE, 1 << list); setTabDescrWord((tabDesRef + (1 << list)) - ZTD_TR_SIZE, 1 << list);
}//Dbtup::insertTdArea() }//Dbtup::insertTdArea()
/* ---------------------------------------------------------------- */ /*
/* ----------------------- MERGE_TAB_DESCR ------------------------ */ * Merge to-be-removed chunk (which need not be initialized with header
/* ---------------------------------------------------------------- */ * and trailer) with left and right buddies. The start point retRef
/* INPUT: TAB_DESCR_PTR POINTING AT THE CURRENT CHUNK */ * moves to left and the size retNo increases to match the new chunk.
/* */ */
/* SHORTNAME: MTD */ void Dbtup::itdaMergeTabDescr(Uint32& retRef, Uint32& retNo, bool normal)
/* -----------------------------------------------------------------*/
Uint32 Dbtup::itdaMergeTabDescr(Uint32 retRef, Uint32 retNo)
{ {
/* THE SIZE OF THE PART TO MERGE MUST BE OF THE SAME SIZE AS THE INSERTED PART */ // merge right
/* THIS IS TRUE EITHER IF ONE PART HAS THE SAME SIZE OR THE SUM OF BOTH PARTS */
/* TOGETHER HAS THE SAME SIZE AS THE PART TO BE INSERTED */
/* FIND THE SIZES OF THE PARTS TO THE RIGHT OF THE PART TO BE REINSERTED */
while ((retRef + retNo) < cnoOfTabDescrRec) { while ((retRef + retNo) < cnoOfTabDescrRec) {
ljam(); ljam();
Uint32 tabDesRef = retRef + retNo; Uint32 tabDesRef = retRef + retNo;
...@@ -170,11 +169,28 @@ Uint32 Dbtup::itdaMergeTabDescr(Uint32 retRef, Uint32 retNo) ...@@ -170,11 +169,28 @@ Uint32 Dbtup::itdaMergeTabDescr(Uint32 retRef, Uint32 retNo)
removeTdArea(tabDesRef, list); removeTdArea(tabDesRef, list);
} else { } else {
ljam(); ljam();
return retNo; break;
}//if }
}//while }
ndbrequire((retRef + retNo) == cnoOfTabDescrRec); // merge left
return retNo; const bool mergeLeft = normal;
while (mergeLeft && retRef > 0) {
ljam();
Uint32 trailerWord = getTabDescrWord(retRef - ZTD_TR_TYPE);
if (trailerWord == ZTD_TYPE_FREE) {
ljam();
Uint32 sizeOfMergedPart = getTabDescrWord(retRef - ZTD_TR_SIZE);
ndbrequire(retRef >= sizeOfMergedPart);
retRef -= sizeOfMergedPart;
retNo += sizeOfMergedPart;
Uint32 list = nextHigherTwoLog(sizeOfMergedPart - 1);
removeTdArea(retRef, list);
} else {
ljam();
break;
}
}
ndbrequire((retRef + retNo) <= cnoOfTabDescrRec);
}//Dbtup::itdaMergeTabDescr() }//Dbtup::itdaMergeTabDescr()
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
...@@ -210,3 +226,94 @@ void Dbtup::removeTdArea(Uint32 tabDesRef, Uint32 list) ...@@ -210,3 +226,94 @@ void Dbtup::removeTdArea(Uint32 tabDesRef, Uint32 list)
setTabDescrWord(tabDescrPrevPtr + ZTD_FL_NEXT, tabDescrNextPtr); setTabDescrWord(tabDescrPrevPtr + ZTD_FL_NEXT, tabDescrNextPtr);
}//if }//if
}//Dbtup::removeTdArea() }//Dbtup::removeTdArea()
#ifdef VM_TRACE
void
Dbtup::verifytabdes()
{
struct WordType {
short fl; // free list 0-15
short ti; // table id
WordType() : fl(-1), ti(-1) {}
};
WordType* wt = new WordType [cnoOfTabDescrRec];
uint free_frags = 0;
// free lists
{
for (uint i = 0; i < 16; i++) {
Uint32 desc2 = RNIL;
Uint32 desc = cfreeTdList[i];
while (desc != RNIL) {
const Uint32 size = (1 << i);
ndbrequire(size >= ZTD_FREE_SIZE);
ndbrequire(desc + size <= cnoOfTabDescrRec);
{ Uint32 index = desc + ZTD_FL_HEADER;
ndbrequire(tableDescriptor[index].tabDescr == ZTD_TYPE_FREE);
}
{ Uint32 index = desc + ZTD_FL_SIZE;
ndbrequire(tableDescriptor[index].tabDescr == size);
}
{ Uint32 index = desc + size - ZTD_TR_TYPE;
ndbrequire(tableDescriptor[index].tabDescr == ZTD_TYPE_FREE);
}
{ Uint32 index = desc + size - ZTD_TR_SIZE;
ndbrequire(tableDescriptor[index].tabDescr == size);
}
{ Uint32 index = desc + ZTD_FL_PREV;
ndbrequire(tableDescriptor[index].tabDescr == desc2);
}
for (uint j = 0; j < size; j++) {
ndbrequire(wt[desc + j].fl == -1);
wt[desc + j].fl = i;
}
desc2 = desc;
desc = tableDescriptor[desc + ZTD_FL_NEXT].tabDescr;
free_frags++;
}
}
}
// tables
{
for (uint i = 0; i < cnoOfTablerec; i++) {
TablerecPtr ptr;
ptr.i = i;
ptrAss(ptr, tablerec);
if (ptr.p->tableStatus == DEFINED) {
Uint32 offset[10];
const Uint32 alloc = getTabDescrOffsets(ptr.p, offset);
const Uint32 desc = ptr.p->readKeyArray - offset[3];
Uint32 size = alloc;
if (size % ZTD_FREE_SIZE != 0)
size += ZTD_FREE_SIZE - size % ZTD_FREE_SIZE;
ndbrequire(desc + size <= cnoOfTabDescrRec);
{ Uint32 index = desc + ZTD_FL_HEADER;
ndbrequire(tableDescriptor[index].tabDescr == ZTD_TYPE_NORMAL);
}
{ Uint32 index = desc + ZTD_FL_SIZE;
ndbrequire(tableDescriptor[index].tabDescr == size);
}
{ Uint32 index = desc + size - ZTD_TR_TYPE;
ndbrequire(tableDescriptor[index].tabDescr == ZTD_TYPE_NORMAL);
}
{ Uint32 index = desc + size - ZTD_TR_SIZE;
ndbrequire(tableDescriptor[index].tabDescr == size);
}
for (uint j = 0; j < size; j++) {
ndbrequire(wt[desc + j].ti == -1);
wt[desc + j].ti = i;
}
}
}
}
// all words
{
for (uint i = 0; i < cnoOfTabDescrRec; i++) {
bool is_fl = wt[i].fl != -1;
bool is_ti = wt[i].ti != -1;
ndbrequire(is_fl != is_ti);
}
}
delete [] wt;
ndbout << "verifytabdes: frags=" << free_frags << endl;
}
#endif
...@@ -1111,6 +1111,12 @@ Dbtup::addTuxEntries(Signal* signal, ...@@ -1111,6 +1111,12 @@ Dbtup::addTuxEntries(Signal* signal,
Operationrec* regOperPtr, Operationrec* regOperPtr,
Tablerec* regTabPtr) Tablerec* regTabPtr)
{ {
if (ERROR_INSERTED(4022)) {
ljam();
CLEAR_ERROR_INSERT_VALUE;
terrorCode = 9999;
return -1;
}
TuxMaintReq* const req = (TuxMaintReq*)signal->getDataPtrSend(); TuxMaintReq* const req = (TuxMaintReq*)signal->getDataPtrSend();
const DLList<TupTriggerData>& triggerList = regTabPtr->tuxCustomTriggers; const DLList<TupTriggerData>& triggerList = regTabPtr->tuxCustomTriggers;
TriggerPtr triggerPtr; TriggerPtr triggerPtr;
...@@ -1120,6 +1126,14 @@ Dbtup::addTuxEntries(Signal* signal, ...@@ -1120,6 +1126,14 @@ Dbtup::addTuxEntries(Signal* signal,
ljam(); ljam();
req->indexId = triggerPtr.p->indexId; req->indexId = triggerPtr.p->indexId;
req->errorCode = RNIL; req->errorCode = RNIL;
if (ERROR_INSERTED(4023) &&
! triggerList.hasNext(triggerPtr)) {
ljam();
CLEAR_ERROR_INSERT_VALUE;
terrorCode = 9999;
failPtrI = triggerPtr.i;
goto fail;
}
EXECUTE_DIRECT(DBTUX, GSN_TUX_MAINT_REQ, EXECUTE_DIRECT(DBTUX, GSN_TUX_MAINT_REQ,
signal, TuxMaintReq::SignalLength); signal, TuxMaintReq::SignalLength);
ljamEntry(); ljamEntry();
......
...@@ -233,6 +233,101 @@ int runCreateAndDrop(NDBT_Context* ctx, NDBT_Step* step){ ...@@ -233,6 +233,101 @@ int runCreateAndDrop(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK; return NDBT_OK;
} }
int runCreateAndDropAtRandom(NDBT_Context* ctx, NDBT_Step* step)
{
myRandom48Init(NdbTick_CurrentMillisecond());
Ndb* pNdb = GETNDB(step);
NdbDictionary::Dictionary* pDic = pNdb->getDictionary();
int loops = ctx->getNumLoops();
int numTables = NDBT_Tables::getNumTables();
bool* tabList = new bool [ numTables ];
int tabCount;
{
for (int num = 0; num < numTables; num++) {
(void)pDic->dropTable(NDBT_Tables::getTable(num)->getName());
tabList[num] = false;
}
tabCount = 0;
}
NdbRestarter restarter;
int result = NDBT_OK;
int bias = 1; // 0-less 1-more
int i = 0;
while (i < loops) {
g_info << "loop " << i << " tabs " << tabCount << "/" << numTables << endl;
int num = myRandom48(numTables);
const NdbDictionary::Table* pTab = NDBT_Tables::getTable(num);
char tabName[200];
strcpy(tabName, pTab->getName());
if (tabList[num] == false) {
if (bias == 0 && myRandom48(100) < 80)
continue;
g_info << tabName << ": create" << endl;
if (pDic->createTable(*pTab) != 0) {
const NdbError err = pDic->getNdbError();
g_err << tabName << ": create failed: " << err << endl;
result = NDBT_FAILED;
break;
}
const NdbDictionary::Table* pTab2 = pDic->getTable(tabName);
if (pTab2 == NULL) {
const NdbError err = pDic->getNdbError();
g_err << tabName << ": verify create: " << err << endl;
result = NDBT_FAILED;
break;
}
tabList[num] = true;
assert(tabCount < numTables);
tabCount++;
if (tabCount == numTables)
bias = 0;
}
else {
if (bias == 1 && myRandom48(100) < 80)
continue;
g_info << tabName << ": drop" << endl;
if (restarter.insertErrorInAllNodes(4013) != 0) {
g_err << "error insert failed" << endl;
result = NDBT_FAILED;
break;
}
if (pDic->dropTable(tabName) != 0) {
const NdbError err = pDic->getNdbError();
g_err << tabName << ": drop failed: " << err << endl;
result = NDBT_FAILED;
break;
}
const NdbDictionary::Table* pTab2 = pDic->getTable(tabName);
if (pTab2 != NULL) {
g_err << tabName << ": verify drop: table exists" << endl;
result = NDBT_FAILED;
break;
}
if (pDic->getNdbError().code != 709 &&
pDic->getNdbError().code != 723) {
const NdbError err = pDic->getNdbError();
g_err << tabName << ": verify drop: " << err << endl;
result = NDBT_FAILED;
break;
}
tabList[num] = false;
assert(tabCount > 0);
tabCount--;
if (tabCount == 0)
bias = 1;
}
i++;
}
delete [] tabList;
return result;
}
int runCreateAndDropWithData(NDBT_Context* ctx, NDBT_Step* step){ int runCreateAndDropWithData(NDBT_Context* ctx, NDBT_Step* step){
Ndb* pNdb = GETNDB(step); Ndb* pNdb = GETNDB(step);
int loops = ctx->getNumLoops(); int loops = ctx->getNumLoops();
...@@ -1945,6 +2040,12 @@ TESTCASE("CreateAndDrop", ...@@ -1945,6 +2040,12 @@ TESTCASE("CreateAndDrop",
"Try to create and drop the table loop number of times\n"){ "Try to create and drop the table loop number of times\n"){
INITIALIZER(runCreateAndDrop); INITIALIZER(runCreateAndDrop);
} }
TESTCASE("CreateAndDropAtRandom",
"Try to create and drop table at random loop number of times\n"
"Uses all available tables\n"
"Uses error insert 4013 to make TUP verify table descriptor"){
INITIALIZER(runCreateAndDropAtRandom);
}
TESTCASE("CreateAndDropWithData", TESTCASE("CreateAndDropWithData",
"Try to create and drop the table when it's filled with data\n" "Try to create and drop the table when it's filled with data\n"
"do this loop number of times\n"){ "do this loop number of times\n"){
......
...@@ -495,6 +495,10 @@ max-time: 1500 ...@@ -495,6 +495,10 @@ max-time: 1500
cmd: testDict cmd: testDict
args: -n CreateAndDrop args: -n CreateAndDrop
max-time: 1500
cmd: testDict
args: -n CreateAndDropAtRandom -l 200 T1
max-time: 1500 max-time: 1500
cmd: testDict cmd: testDict
args: -n CreateAndDropWithData args: -n CreateAndDropWithData
......
...@@ -332,7 +332,6 @@ fi ...@@ -332,7 +332,6 @@ fi
(cd mysql-debug-%{mysql_version} ; \ (cd mysql-debug-%{mysql_version} ; \
./mysql-test-run.pl --comment=debug --skip-rpl --skip-ndbcluster --force ; \ ./mysql-test-run.pl --comment=debug --skip-rpl --skip-ndbcluster --force ; \
true) true)
############################################################################## ##############################################################################
# #
# Build the max binary # Build the max binary
...@@ -344,7 +343,6 @@ CFLAGS="${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS} -g" \ ...@@ -344,7 +343,6 @@ CFLAGS="${MYSQL_BUILD_CFLAGS:-$RPM_OPT_FLAGS} -g" \
CXXFLAGS="${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti} -g" \ CXXFLAGS="${MYSQL_BUILD_CXXFLAGS:-$RPM_OPT_FLAGS -felide-constructors -fno-exceptions -fno-rtti} -g" \
BuildMySQL "--enable-shared \ BuildMySQL "--enable-shared \
--with-berkeley-db \ --with-berkeley-db \
--with-innodb \
--with-ndbcluster \ --with-ndbcluster \
--with-archive-storage-engine \ --with-archive-storage-engine \
--with-csv-storage-engine \ --with-csv-storage-engine \
...@@ -384,7 +382,6 @@ BuildMySQL "--enable-shared \ ...@@ -384,7 +382,6 @@ BuildMySQL "--enable-shared \
--with-embedded-server \ --with-embedded-server \
--with-big-tables \ --with-big-tables \
--with-comment=\"MySQL Community Server (GPL)\"") --with-comment=\"MySQL Community Server (GPL)\"")
# We might want to save the config log file # We might want to save the config log file
if test -n "$MYSQL_CONFLOG_DEST" if test -n "$MYSQL_CONFLOG_DEST"
then then
...@@ -708,6 +705,15 @@ fi ...@@ -708,6 +705,15 @@ fi
# itself - note that they must be ordered by date (important when # itself - note that they must be ordered by date (important when
# merging BK trees) # merging BK trees)
%changelog %changelog
* Mon Jul 10 2006 Joerg Bruehe <joerg@mysql.com>
- Fix a typing error in the "make" target for the Perl script to run the tests.
* Tue Jul 04 2006 Joerg Bruehe <joerg@mysql.com>
- Use the Perl script to run the tests, because it will automatically check
whether the server is configured with SSL.
* Tue Jun 27 2006 Joerg Bruehe <joerg@mysql.com> * Tue Jun 27 2006 Joerg Bruehe <joerg@mysql.com>
- move "mysqldumpslow" from the client RPM to the server RPM (bug#20216) - move "mysqldumpslow" from the client RPM to the server RPM (bug#20216)
......
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