Commit f7cf71e0 authored by unknown's avatar unknown
Browse files

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

into  c-8808e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/bug17754


mysql-test/r/partition.result:
  Auto merged
mysql-test/t/partition.test:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_partition.cc:
  manual merge
parents 60bc9ad7 153f0947
Loading
Loading
Loading
Loading
+63 −0
Original line number Diff line number Diff line
@@ -89,6 +89,69 @@ 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 PARTITION BY KEY () 
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,
+129 −0
Original line number Diff line number Diff line
@@ -315,6 +315,135 @@ drop table t1;
create table t1 (s1 int, unique (s1)) partition by list (s1) (partition x1 VALUES in (10), partition x2 values in (20));
alter table t1 add partition (partition x3 values in (30));
drop table t1;
create table t1 (a int)
partition by key(a)
partitions 2
(partition p0 engine=myisam, partition p1 engine=myisam);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = MyISAM, PARTITION p1  ENGINE = MyISAM)
alter table t1;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = MyISAM, PARTITION p1  ENGINE = MyISAM)
alter table t1 engine=myisam;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = MyISAM, PARTITION p1  ENGINE = MyISAM)
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 remove partitioning;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int)
engine=myisam
partition by key(a)
partitions 2
(partition p0 engine=myisam, partition p1 engine=myisam);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = MyISAM, PARTITION p1  ENGINE = MyISAM)
alter table t1 add column b int remove partitioning;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1
engine=myisam
partition by key(a)
(partition p0 engine=myisam, partition p1);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = MyISAM, PARTITION p1  ENGINE = MyISAM)
alter table t1
engine=heap
partition by key(a)
(partition p0, partition p1 engine=heap);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` 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=myisam, add column c int remove partitioning;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1
engine=heap
partition by key (a)
(partition p0, partition p1);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = MEMORY, PARTITION p1  ENGINE = MEMORY)
alter table t1
partition by key (a)
(partition p0, partition p1);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL,
  `c` 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=heap
partition by key (a)
(partition p0, partition p1);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL,
  `c` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY KEY (a) (PARTITION p0  ENGINE = MEMORY, PARTITION p1  ENGINE = MEMORY)
alter table t1
partition by key(a)
(partition p0, partition p1 engine=heap);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
alter table t1
partition by key(a)
(partition p0 engine=heap, partition p1);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
alter table t1
engine=heap
partition by key (a)
(partition p0 engine=heap, partition p1 engine=myisam);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
alter table t1
partition by key (a)
(partition p0 engine=heap, partition p1 engine=myisam);
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
drop table t1;
CREATE TABLE t1 (
f_int1 INTEGER, f_int2 INTEGER,
f_char1 CHAR(10), f_char2 CHAR(10), f_charbig VARCHAR(1000)
+45 −0
Original line number Diff line number Diff line
@@ -80,6 +80,51 @@ PARTITION BY KEY(a)

drop table t1;

#
# Bug #17754 Improper handling of removal of partitioning in ALTER TABLE
# Also added a number of general test cases in the same area
#
create table t1 (a int)
engine=ndb
partition by key(a)
(partition p0, partition p1);
show create table t1;

alter table t1 engine=heap;
show create table t1;

alter table t1 engine=ndb;
show create table t1;

alter table t1 engine=heap remove partitioning;
show create table t1;

alter table t1 engine=ndb
partition by key(a)
(partition p0, partition p1 engine = ndb);
show create table t1;

alter table t1
partition by key (a)
(partition p0 engine=ndb, partition p1 engine=ndb);
show create table t1;

alter table t1 remove partitioning;
show create table t1;

--error ER_MIX_HANDLER_ERROR
alter table t1
partition by key(a)
(partition p0 engine=ndb, partition p1);

alter table t1
engine=ndb
partition by key(a)
(partition p0 engine=ndb, partition p1 engine = ndb);
show create table t1;

drop table t1;

#
# BUG 16810 Out of memory when coalesce partition
#
+90 −0
Original line number Diff line number Diff line
@@ -409,6 +409,96 @@ alter table t1 add partition (partition x3 values in (30));
drop table t1;

#
# Bug #17754 Change to explicit removal of partitioning scheme
# Also added a number of tests to ensure that proper engine is
# choosen in all kinds of scenarios.
#

create table t1 (a int)
partition by key(a)
partitions 2
(partition p0 engine=myisam, partition p1 engine=myisam);
show create table t1;

alter table t1;
show create table t1;

alter table t1 engine=myisam;
show create table t1;

alter table t1 engine=heap;
show create table t1;

alter table t1 remove partitioning;
show create table t1;

drop table t1;

create table t1 (a int)
engine=myisam
partition by key(a)
partitions 2
(partition p0 engine=myisam, partition p1 engine=myisam);
show create table t1;

alter table t1 add column b int remove partitioning;
show create table t1;

alter table t1
engine=myisam
partition by key(a)
(partition p0 engine=myisam, partition p1);
show create table t1;

alter table t1
engine=heap
partition by key(a)
(partition p0, partition p1 engine=heap);
show create table t1;

alter table t1 engine=myisam, add column c int remove partitioning;
show create table t1;

alter table t1
engine=heap
partition by key (a)
(partition p0, partition p1);
show create table t1;

alter table t1
partition by key (a)
(partition p0, partition p1);
show create table t1;

alter table t1
engine=heap
partition by key (a)
(partition p0, partition p1);
show create table t1;

--error ER_MIX_HANDLER_ERROR
alter table t1
partition by key(a)
(partition p0, partition p1 engine=heap);

--error ER_MIX_HANDLER_ERROR
alter table t1
partition by key(a)
(partition p0 engine=heap, partition p1);

--error ER_MIX_HANDLER_ERROR
alter table t1
engine=heap
partition by key (a)
(partition p0 engine=heap, partition p1 engine=myisam);

--error ER_MIX_HANDLER_ERROR
alter table t1
partition by key (a)
(partition p0 engine=heap, partition p1 engine=myisam);

drop table t1;

# Bug #17432: Partition functions containing NULL values should return
#             LONGLONG_MIN
#
+2 −0
Original line number Diff line number Diff line
@@ -391,6 +391,7 @@ static SYMBOL symbols[] = {
  { "PARSER",           SYM(PARSER_SYM)},
  { "PARTIAL",		SYM(PARTIAL)},
  { "PARTITION",        SYM(PARTITION_SYM)},
  { "PARTITIONING",     SYM(PARTITIONING_SYM)},
  { "PARTITIONS",       SYM(PARTITIONS_SYM)},
  { "PASSWORD",		SYM(PASSWORD)},
  { "PHASE",            SYM(PHASE_SYM)},
@@ -428,6 +429,7 @@ static SYMBOL symbols[] = {
  { "RELAY_THREAD",     SYM(RELAY_THREAD)},
  { "RELEASE",		SYM(RELEASE_SYM)},
  { "RELOAD",		SYM(RELOAD)},
  { "REMOVE",		SYM(REMOVE_SYM)},
  { "RENAME",		SYM(RENAME)},
  { "REORGANIZE",	SYM(REORGANIZE_SYM)},
  { "REPAIR",		SYM(REPAIR)},
Loading