Commit 4e3f4e97 authored by unknown's avatar unknown
Browse files

BUG#19010: Fix issues with that ALTER TABLE from auto-partitioned NDB table...

BUG#19010: Fix issues with that ALTER TABLE from auto-partitioned NDB table doesn't work unless primary key exists on table.


mysql-test/r/ndb_bitfield.result:
  Test cases changes now that auto-partitioning is remembered in frm file
mysql-test/r/ndb_dd_basic.result:
  Test cases changes now that auto-partitioning is remembered in frm file
mysql-test/r/ndb_dd_disk2memory.result:
  Test cases changes now that auto-partitioning is remembered in frm file
mysql-test/r/ndb_gis.result:
  Test cases changes now that auto-partitioning is remembered in frm file
mysql-test/r/ndb_partition_key.result:
  New test cases for auto-partitioning change that was made to fix bug
mysql-test/r/rpl_ndb_UUID.result:
  Test cases changes now that auto-partitioning is remembered in frm file
mysql-test/r/rpl_ndb_dd_advance.result:
  Test cases changes now that auto-partitioning is remembered in frm file
mysql-test/t/ndb_partition_key.test:
  New test cases for auto-partitioning change that was made to fix bug
sql/partition_info.h:
  New boolean to keep track of auto partitioned or not
sql/sql_partition.cc:
  Ensure that auto-partitiong flag is reset when partitions are dropped, added, reorganised or coalesced.
  Ensure that auto-partitioned tables are altered into non-partitioned table when ALTER TABLE t1 engine=X
  is performed.
sql/sql_show.cc:
  Only print partition info for non-auto-partitioned tables
sql/sql_table.cc:
  Set auto partition flag when auto partitions are generated in create table
sql/table.cc:
  Fix reading of frm file where new auto-partition flag is introduced.
sql/table.h:
  New flag for auto partition on share object
sql/unireg.cc:
  Fix code for writing frm to also write autopartition flag at end of partition info, fix some length issues
  at the same time that was in this part that caused no problems since partition info always was the last info
  in the file.
parent 3065eeb3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ t1 CREATE TABLE `t1` (
  `pk1` int(11) NOT NULL,
  `b` bit(64) DEFAULT NULL,
  PRIMARY KEY (`pk1`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () 
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
insert into t1 values 
(0,b'1111111111111111111111111111111111111111111111111111111111111111'),
(1,b'1000000000000000000000000000000000000000000000000000000000000000'),
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ t1 CREATE TABLE `t1` (
  `b` int(11) NOT NULL,
  `c` int(11) NOT NULL,
  PRIMARY KEY (`pk1`)
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () 
) TABLESPACE ts1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM t1;
pk1	b	c
+4 −4
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ t2 CREATE TABLE `t2` (
  `b2` int(11) NOT NULL,
  `c2` int(11) NOT NULL,
  PRIMARY KEY (`pk2`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () 
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW CREATE TABLE test.t1;
Table	Create Table
t1	CREATE TABLE `t1` (
@@ -226,7 +226,7 @@ t1 CREATE TABLE `t1` (
  `b` int(11) NOT NULL,
  `c` int(11) NOT NULL,
  PRIMARY KEY (`pk1`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () 
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t2 TABLESPACE table_space1 STORAGE DISK
ENGINE=NDB;
SHOW CREATE TABLE test.t2;
@@ -236,7 +236,7 @@ t2 CREATE TABLE `t2` (
  `b2` int(11) NOT NULL,
  `c2` int(11) NOT NULL,
  PRIMARY KEY (`pk2`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () 
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ENGINE=NDBCLUSTER;
SHOW CREATE TABLE test.t1;
Table	Create Table
@@ -245,7 +245,7 @@ t1 CREATE TABLE `t1` (
  `b` int(11) NOT NULL,
  `c` int(11) NOT NULL,
  PRIMARY KEY (`pk1`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () 
) ENGINE=ndbcluster DEFAULT CHARSET=latin1

DROP TABLE test.t1;
DROP TABLE test.t2;
+2 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ gis_point CREATE TABLE `gis_point` (
  `fid` int(11) NOT NULL AUTO_INCREMENT,
  `g` point DEFAULT NULL,
  PRIMARY KEY (`fid`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () 
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW FIELDS FROM gis_point;
Field	Type	Null	Key	Default	Extra
fid	int(11)	NO	PRI	NULL	auto_increment
@@ -476,7 +476,7 @@ gis_point CREATE TABLE `gis_point` (
  `fid` int(11) NOT NULL AUTO_INCREMENT,
  `g` point DEFAULT NULL,
  PRIMARY KEY (`fid`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () 
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
SHOW FIELDS FROM gis_point;
Field	Type	Null	Key	Default	Extra
fid	int(11)	NO	PRI	NULL	auto_increment
+38 −1
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () 
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
alter table t1
partition by key(a)
(partition p0 engine=ndb, partition p1);
@@ -197,3 +197,40 @@ ENGINE=NDB
PARTITION BY KEY(c3);
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
DROP TABLE t1;
create table t1 (a int) engine = ndb;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
alter table t1 add column b int;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
alter table t1 engine = myisam;
alter table t1 engine = ndb;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
alter table t1 coalesce partition 1;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 1 
drop table t1 ;
create table t1 (a int) engine = ndb;
alter table t1 add partition partitions 1;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 3 
drop table t1;
Loading