Commit e38bf24c authored by unknown's avatar unknown
Browse files

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

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


sql/sql_partition.cc:
  Auto merged
parents 3fc3d856 faefe2c6
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$fast_cflags $max_cflags -g"
extra_configs="$max_configs --with-ndb-test --with-ndb-ccflags="-DERROR_INSERT""
. "$path/FINISH.sh"
......@@ -175,7 +175,7 @@ t1 CREATE TABLE `t1` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 4
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
......@@ -184,7 +184,7 @@ t2 CREATE TABLE `t2` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t3;
Table Create Table
t3 CREATE TABLE `t3` (
......@@ -193,7 +193,7 @@ t3 CREATE TABLE `t3` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t4;
Table Create Table
t4 CREATE TABLE `t4` (
......@@ -202,7 +202,7 @@ t4 CREATE TABLE `t4` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 2
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 2 */
SHOW CREATE TABLE test.t5;
Table Create Table
t5 CREATE TABLE `t5` (
......@@ -211,7 +211,7 @@ t5 CREATE TABLE `t5` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t6;
Table Create Table
t6 CREATE TABLE `t6` (
......@@ -220,7 +220,7 @@ t6 CREATE TABLE `t6` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) */
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
NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
......@@ -341,7 +341,7 @@ t1 CREATE TABLE `t1` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 4
) TABLESPACE table_space1 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 4 */
SHOW CREATE TABLE test.t2;
Table Create Table
t2 CREATE TABLE `t2` (
......@@ -350,7 +350,7 @@ t2 CREATE TABLE `t2` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (c3) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t3;
Table Create Table
t3 CREATE TABLE `t3` (
......@@ -359,7 +359,7 @@ t3 CREATE TABLE `t3` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster)
) TABLESPACE table_space2 STORAGE DISK ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c3) (PARTITION x1 VALUES LESS THAN (105) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (720) ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t4;
Table Create Table
t4 CREATE TABLE `t4` (
......@@ -368,7 +368,7 @@ t4 CREATE TABLE `t4` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH (c3) PARTITIONS 2
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (c3) PARTITIONS 2 */
SHOW CREATE TABLE test.t5;
Table Create Table
t5 CREATE TABLE `t5` (
......@@ -377,7 +377,7 @@ t5 CREATE TABLE `t5` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (pk1) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
SHOW CREATE TABLE test.t6;
Table Create Table
t6 CREATE TABLE `t6` (
......@@ -386,7 +386,7 @@ t6 CREATE TABLE `t6` (
`c3` int(11) NOT NULL,
`c4` bit(1) NOT NULL,
PRIMARY KEY (`pk1`,`c3`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (pk1) (PARTITION x1 VALUES LESS THAN (333) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (720) ENGINE = ndbcluster) */
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
NULL test t1 p0 NULL 1 NULL HASH NULL c3 NULL NULL 0 0 0 NULL 0 0 NULL NULL NULL NULL default 0 default
......
......@@ -4,12 +4,12 @@ CREATE DATABASE mysqltest;
**** Begin Duplicate Statement Testing ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'undofile2.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
ERROR HY000: Failed to create LOGFILE GROUP
......@@ -19,35 +19,35 @@ Error 1296 Got error 1514 'Currently there is a limit of one logfile group' from
Error 1515 Failed to create LOGFILE GROUP
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
ERROR HY000: Failed to create LOGFILE GROUP
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE NDB;
INITIAL_SIZE 1M ENGINE NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE=NDB;
INITIAL_SIZE 1M ENGINE=NDB;
ERROR HY000: Failed to alter: CREATE UNDOFILE
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
ERROR HY000: Failed to create TABLESPACE
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE=NDB;
ERROR HY000: Failed to alter: CREATE DATAFILE
CREATE TABLE mysqltest.t1
......@@ -94,20 +94,20 @@ DROP DATABASE IF EXISTS mysqltest;
**** Begin Statment CaSe Testing ****
creaTE LOgfilE GrOuP lg1
adD undoFILE 'undofile.dat'
initiAL_siZE 16M
initiAL_siZE 1M
UnDo_BuFfEr_SiZe = 1M
ENGInE=NDb;
altER LOgFiLE GrOUp lg1
AdD UnDOfILe 'uNdOfiLe02.daT'
INItIAl_SIzE 4M ENgINE nDB;
INItIAl_SIzE 1M ENgINE nDB;
CrEAtE TABLEspaCE ts1
ADD DATAfilE 'datafile.dat'
UsE LoGFiLE GRoUP lg1
INITiaL_SizE 12M
INITiaL_SizE 1M
ENGiNe NDb;
AlTeR tAbLeSpAcE ts1
AdD DaTaFiLe 'dAtAfiLe2.daT'
InItIaL_SiZe 12M
InItIaL_SiZe 1M
EnGiNe=NDB;
CREATE TABLE t1
(pk1 int not null primary key, b int not null, c int not null)
......@@ -129,21 +129,21 @@ EnGiNe=nDb;
**** Begin = And No = Testing ****
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE=16M
INITIAL_SIZE=1M
UNDO_BUFFER_SIZE=1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE=4M
INITIAL_SIZE=1M
ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE=12M
INITIAL_SIZE=1M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE=12M
INITIAL_SIZE=1M
ENGINE=NDB;
CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
......@@ -165,21 +165,21 @@ ENGINE=NDB;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M
INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
......@@ -199,3 +199,19 @@ ENGINE NDB;
DROP LOGFILE GROUP lg1
ENGINE NDB;
**** End = And No = ****
create table t1 (a int primary key) engine = myisam;
create logfile group lg1 add undofile 'MYSQLTEST_VARDIR/master-data/test/t1.frm' initial_size 1M undo_buffer_size = 1M engine=ndb;;
ERROR HY000: Failed to create UNDOFILE
create logfile group lg1
add undofile 'undofile.dat'
initial_size 1M
undo_buffer_size = 1M
engine=ndb;
create tablespace ts1 add datafile 'MYSQLTEST_VARDIR/master-data/test/t1.frm' use logfile group lg1 initial_size 1M engine ndb;;
ERROR HY000: Failed to create DATAFILE
drop tablespace ts1
engine ndb;
ERROR HY000: Failed to drop TABLESPACE
drop logfile group lg1
engine ndb;
drop table t1;
......@@ -78,7 +78,7 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL DEFAULT '0',
`d` int(11) DEFAULT NULL,
PRIMARY KEY (`a`,`b`,`c`) USING HASH
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (b)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (b) */
DROP TABLE t1;
CREATE TABLE t1 (a int not null primary key)
PARTITION BY KEY(a)
......@@ -97,19 +97,19 @@ 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)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 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)
) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 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)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 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
......@@ -123,7 +123,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 (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 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);
......@@ -131,7 +131,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 (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
alter table t1 remove partitioning;
show create table t1;
Table Create Table
......@@ -150,7 +150,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 (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
drop table t1;
CREATE TABLE t1 (
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
......
......@@ -115,7 +115,7 @@ t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
PRIMARY KEY (`b`),
UNIQUE KEY `a` (`a`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (b) (PARTITION x1 VALUES LESS THAN (5) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (10) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (20) ENGINE = ndbcluster)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (b) (PARTITION x1 VALUES LESS THAN (5) ENGINE = ndbcluster, PARTITION x2 VALUES LESS THAN (10) ENGINE = ndbcluster, PARTITION x3 VALUES LESS THAN (20) ENGINE = ndbcluster) */
drop table t1;
CREATE TABLE t1
(id MEDIUMINT NOT NULL,
......
......@@ -40,7 +40,7 @@ CREATE DATABASE mysqltest;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
......@@ -48,7 +48,7 @@ ENGINE=NDB;
--error ER_CREATE_FILEGROUP_FAILED
CREATE LOGFILE GROUP lg2
ADD UNDOFILE 'undofile2.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
SHOW WARNINGS;
......@@ -56,42 +56,42 @@ SHOW WARNINGS;
--error ER_CREATE_FILEGROUP_FAILED
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE NDB;
INITIAL_SIZE 1M ENGINE NDB;
--error ER_ALTER_FILEGROUP_FAILED
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M ENGINE=NDB;
INITIAL_SIZE 1M ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
--error ER_CREATE_FILEGROUP_FAILED
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE=NDB;
--error ER_ALTER_FILEGROUP_FAILED
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE=NDB;
CREATE TABLE mysqltest.t1
......@@ -155,23 +155,23 @@ DROP DATABASE IF EXISTS mysqltest;
creaTE LOgfilE GrOuP lg1
adD undoFILE 'undofile.dat'
initiAL_siZE 16M
initiAL_siZE 1M
UnDo_BuFfEr_SiZe = 1M
ENGInE=NDb;
altER LOgFiLE GrOUp lg1
AdD UnDOfILe 'uNdOfiLe02.daT'
INItIAl_SIzE 4M ENgINE nDB;
INItIAl_SIzE 1M ENgINE nDB;
CrEAtE TABLEspaCE ts1
ADD DATAfilE 'datafile.dat'
UsE LoGFiLE GRoUP lg1
INITiaL_SizE 12M
INITiaL_SizE 1M
ENGiNe NDb;
AlTeR tAbLeSpAcE ts1
AdD DaTaFiLe 'dAtAfiLe2.daT'
InItIaL_SiZe 12M
InItIaL_SiZe 1M
EnGiNe=NDB;
CREATE TABLE t1
......@@ -203,24 +203,24 @@ EnGiNe=nDb;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE=16M
INITIAL_SIZE=1M
UNDO_BUFFER_SIZE=1M
ENGINE=NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE=4M
INITIAL_SIZE=1M
ENGINE=NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE=12M
INITIAL_SIZE=1M
ENGINE=NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE=12M
INITIAL_SIZE=1M
ENGINE=NDB;
CREATE TABLE t1
......@@ -250,24 +250,24 @@ ENGINE=NDB;
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
INITIAL_SIZE 1M
UNDO_BUFFER_SIZE 1M
ENGINE NDB;
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE 4M
INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.dat'
INITIAL_SIZE 12M
INITIAL_SIZE 1M
ENGINE NDB;
CREATE TABLE t1
......@@ -297,5 +297,32 @@ ENGINE NDB;
--echo **** End = And No = ****
############ End = And No = ##################
# End 5.1 test
###
#
# bug#16341
create table t1 (a int primary key) engine = myisam;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error ER_CREATE_FILEGROUP_FAILED
--eval create logfile group lg1 add undofile '$MYSQLTEST_VARDIR/master-data/test/t1.frm' initial_size 1M undo_buffer_size = 1M engine=ndb;
create logfile group lg1
add undofile 'undofile.dat'
initial_size 1M
undo_buffer_size = 1M
engine=ndb;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error ER_CREATE_FILEGROUP_FAILED
--eval create tablespace ts1 add datafile '$MYSQLTEST_VARDIR/master-data/test/t1.frm' use logfile group lg1 initial_size 1M engine ndb;
--error ER_DROP_FILEGROUP_FAILED
drop tablespace ts1
engine ndb;
drop logfile group lg1
engine ndb;
drop table t1;
# End 5.1 test
......@@ -9628,10 +9628,22 @@ static bool adjusted_frag_count(uint no_fragments, uint no_nodes,
return (reported_frags < no_fragments);
}
int ha_ndbcluster::get_default_no_partitions(ulonglong max_rows)
int ha_ndbcluster::get_default_no_partitions(HA_CREATE_INFO *info)
{
ha_rows max_rows, min_rows;
if (info)
{
max_rows= info->max_rows;
min_rows= info->min_rows;
}
else
{
max_rows= table_share->max_rows;
min_rows= table_share->min_rows;
}
uint reported_frags;
uint no_fragments= get_no_fragments(max_rows);
uint no_fragments=
get_no_fragments(max_rows >= min_rows ? max_rows : min_rows);
uint no_nodes= g_ndb_cluster_connection->no_db_nodes();
if (adjusted_frag_count(no_fragments, no_nodes, reported_frags))
{
......@@ -9879,7 +9891,17 @@ uint ha_ndbcluster::set_up_partition_info(partition_info *part_info,
} while (++i < part_info->no_parts);
tab->setDefaultNoPartitionsFlag(part_info->use_default_no_partitions);
tab->setLinearFlag(part_info->linear_hash_ind);
tab->setMaxRows(table->s->max_rows);
{
ha_rows max_rows= table_share->max_rows;
ha_rows min_rows= table_share->min_rows;
if (max_rows < min_rows)
max_rows= min_rows;
if (max_rows != (ha_rows)0) /* default setting, don't set fragmentation */
{
tab->setMaxRows(max_rows);
tab->setMinRows(min_rows);
}
}
tab->setTablespaceNames(ts_names, fd_index*sizeof(char*));
tab->setFragmentCount(fd_index);
tab->setFragmentData(&frag_data, fd_index*2);
......@@ -9982,7 +10004,8 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
{
DBUG_RETURN(HA_ERR_NO_CONNECTION);
}
NdbError err;
NDBDICT *dict = ndb->getDictionary();
int error;
const char * errmsg;
......@@ -9995,6 +10018,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
NdbDictionary::Tablespace ndb_ts;
NdbDictionary::Datafile ndb_df;
NdbDictionary::ObjectId objid;
if (set_up_tablespace(info, &ndb_ts))
{
DBUG_RETURN(1);
......@@ -10004,7 +10028,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
DBUG_RETURN(1);
}
errmsg= "TABLESPACE";
if (dict->createTablespace(ndb_ts))
if (dict->createTablespace(ndb_ts, &objid))
{
DBUG_PRINT("error", ("createTablespace returned %d", error));
goto ndberror;
......@@ -10013,8 +10037,17 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
errmsg= "DATAFILE";
if (dict->createDatafile(ndb_df))
{
err= dict->getNdbError();
NdbDictionary::Tablespace tmp= dict->getTablespace(ndb_ts.getName());
if (dict->getNdbError().code == 0 &&
tmp.getObjectId() == objid.getObjectId() &&
tmp.getObjectVersion() == objid.getObjectVersion())
{
dict->dropTablespace(tmp);
}
DBUG_PRINT("error", ("createDatafile returned %d", error));
goto ndberror;
goto ndberror2;
}
is_tablespace= 1;
break;
......@@ -10068,6 +10101,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
error= ER_CREATE_FILEGROUP_FAILED;
NdbDictionary::LogfileGroup ndb_lg;
NdbDictionary::Undofile ndb_uf;
NdbDictionary::ObjectId objid;
if (info->undo_file_name == NULL)
{
/*
......@@ -10080,7 +10114,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
DBUG_RETURN(1);
}
errmsg= "LOGFILE GROUP";
if (dict->createLogfileGroup(ndb_lg))
if (dict->createLogfileGroup(ndb_lg, &objid))
{
goto ndberror;
}
......@@ -10092,7 +10126,15 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
errmsg= "UNDOFILE";
if (dict->createUndofile(ndb_uf))
{
goto ndberror;
err= dict->getNdbError();
NdbDictionary::LogfileGroup tmp= dict->getLogfileGroup(ndb_lg.getName());
if (dict->getNdbError().code == 0 &&
tmp.getObjectId() == objid.getObjectId() &&
tmp.getObjectVersion() == objid.getObjectVersion())
{
dict->dropLogfileGroup(tmp);
}
goto ndberror2;
}
break;
}
......@@ -10169,7 +10211,8 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
DBUG_RETURN(FALSE);
ndberror:
const NdbError err= dict->getNdbError();
err= dict->getNdbError();
ndberror2:
ERR_PRINT(err);
ndb_to_mysql_error(&err);
......
......@@ -651,7 +651,7 @@ class ha_ndbcluster: public handler
int create(const char *name, TABLE *form, HA_CREATE_INFO *info);
int create_handler_files(const char *file, const char *old_name,
int action_flag, HA_CREATE_INFO *info);
int get_default_no_partitions(ulonglong max_rows);
int get_default_no_partitions(HA_CREATE_INFO *info);
bool get_no_parts(const char *name, uint *no_parts);
void set_auto_partitions(partition_info *part_info);
......
......@@ -1770,8 +1770,31 @@ ndb_binlog_thread_handle_schema_event(THD *thd, Ndb *ndb,
/* acknowledge this query _after_ epoch completion */
post_epoch_unlock= 1;
break;
case SOT_CREATE_TABLE:
case SOT_TRUNCATE_TABLE:
{
char key[FN_REFLEN];
build_table_filename(key, sizeof(key), schema->db, schema->name, "");
NDB_SHARE *share= get_share(key, 0, FALSE, FALSE);
// invalidation already handled by binlog thread
if (!share || !share->op)
{
{
injector_ndb->setDatabaseName(schema->db);
Ndb_table_guard ndbtab_g(injector_ndb->getDictionary(),
schema->name);
ndbtab_g.invalidate();
}
TABLE_LIST table_list;
bzero((char*) &table_list,sizeof(table_list));
table_list.db= schema->db;
table_list.alias= table_list.table_name= schema->name;
close_cached_tables(thd, 0, &table_list, FALSE);
}
if (share)
free_share(&share);
}
// fall through
case SOT_CREATE_TABLE:
pthread_mutex_lock(&LOCK_open);
if (ndb_create_table_from_engine(thd, schema->db, schema->name))
{
......
......@@ -1335,7 +1335,7 @@ public:
virtual const char *table_type() const =0;
virtual const char **bas_ext() const =0;
virtual int get_default_no_partitions(ulonglong max_rows) { return 1;}
virtual int get_default_no_partitions(HA_CREATE_INFO *info) { return 1;}
virtual void set_auto_partitions(partition_info *part_info) { return; }
virtual bool get_no_parts(const char *name,
uint *no_parts)
......
......@@ -153,7 +153,7 @@ char *partition_info::create_subpartition_name(uint subpart_no,
SYNOPSIS
set_up_default_partitions()
file A reference to a handler of the table
max_rows Maximum number of rows stored in the table
info Create info
start_no Starting partition number
RETURN VALUE
......@@ -169,7 +169,8 @@ char *partition_info::create_subpartition_name(uint subpart_no,
The external routine needing this code is check_partition_info
*/
bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows,
bool partition_info::set_up_default_partitions(handler *file,
HA_CREATE_INFO *info,
uint start_no)
{
uint i;
......@@ -188,7 +189,7 @@ bool partition_info::set_up_default_partitions(handler *file, ulonglong max_rows
goto end;
}
if (no_parts == 0)
no_parts= file->get_default_no_partitions(max_rows);
no_parts= file->get_default_no_partitions(info);
if (unlikely(no_parts > MAX_PARTITIONS))
{
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
......@@ -228,7 +229,7 @@ end:
SYNOPSIS
set_up_default_subpartitions()
file A reference to a handler of the table
max_rows Maximum number of rows stored in the table
info Create info
RETURN VALUE
TRUE Error, attempted default values not possible
......@@ -244,7 +245,7 @@ end:
*/
bool partition_info::set_up_default_subpartitions(handler *file,
ulonglong max_rows)
HA_CREATE_INFO *info)
{
uint i, j;
char *default_name, *name_ptr;
......@@ -254,7 +255,7 @@ bool partition_info::set_up_default_subpartitions(handler *file,
DBUG_ENTER("partition_info::set_up_default_subpartitions");
if (no_subparts == 0)
no_subparts= file->get_default_no_partitions(max_rows);
no_subparts= file->get_default_no_partitions(info);
if (unlikely((no_parts * no_subparts) > MAX_PARTITIONS))
{
my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));
......@@ -296,7 +297,7 @@ end:
SYNOPSIS
set_up_defaults_for_partitioning()
file A reference to a handler of the table
max_rows Maximum number of rows stored in the table
info Create info
start_no Starting partition number
RETURN VALUE
......@@ -309,7 +310,7 @@ end:
*/
bool partition_info::set_up_defaults_for_partitioning(handler *file,
ulonglong max_rows,
HA_CREATE_INFO *info,
uint start_no)
{
DBUG_ENTER("partition_info::set_up_defaults_for_partitioning");
......@@ -318,10 +319,10 @@ bool partition_info::set_up_defaults_for_partitioning(handler *file,
{
default_partitions_setup= TRUE;
if (use_default_partitions)
DBUG_RETURN(set_up_default_partitions(file, max_rows, start_no));
DBUG_RETURN(set_up_default_partitions(file, info, start_no));
if (is_sub_partitioned() &&
use_default_subpartitions)
DBUG_RETURN(set_up_default_subpartitions(file, max_rows));
DBUG_RETURN(set_up_default_subpartitions(file, info));
}
DBUG_RETURN(FALSE);
}
......@@ -692,7 +693,7 @@ end:
SYNOPSIS
check_partition_info()
file A reference to a handler of the table
max_rows Maximum number of rows stored in the table
info Create info
engine_type Return value for used engine in partitions
RETURN VALUE
......@@ -708,7 +709,7 @@ end:
*/
bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
handler *file, ulonglong max_rows)
handler *file, HA_CREATE_INFO *info)
{
handlerton **engine_array= NULL;
uint part_count= 0;
......@@ -743,7 +744,7 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type,
my_error(ER_SUBPARTITION_ERROR, MYF(0));
goto end;
}
if (unlikely(set_up_defaults_for_partitioning(file, max_rows, (uint)0)))
if (unlikely(set_up_defaults_for_partitioning(file, info, (uint)0)))
goto end;
tot_partitions= get_tot_partitions();
if (unlikely(tot_partitions > MAX_PARTITIONS))
......
......@@ -243,21 +243,21 @@ public:
return no_parts * (is_sub_partitioned() ? no_subparts : 1);
}
bool set_up_defaults_for_partitioning(handler *file, ulonglong max_rows,
bool set_up_defaults_for_partitioning(handler *file, HA_CREATE_INFO *info,
uint start_no);
char *has_unique_names();
static bool check_engine_mix(handlerton **engine_array, uint no_parts);
bool check_range_constants();
bool check_list_constants();
bool check_partition_info(THD *thd, handlerton **eng_type,
handler *file, ulonglong max_rows);
handler *file, HA_CREATE_INFO *info);
void print_no_partition_found(TABLE *table);
private:
static int list_part_cmp(const void* a, const void* b);
static int list_part_cmp_unsigned(const void* a, const void* b);
bool set_up_default_partitions(handler *file, ulonglong max_rows,
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
uint start_no);
bool set_up_default_subpartitions(handler *file, ulonglong max_rows);
bool set_up_default_subpartitions(handler *file, HA_CREATE_INFO *info);
char *create_default_partition_names(uint part_no, uint no_parts,
uint start_no);
char *create_subpartition_name(uint subpart_no, const char *part_name);
......
......@@ -3823,14 +3823,13 @@ uint prep_alter_part_table(THD *thd, TABLE *table, ALTER_INFO *alter_info,
if (alter_info->flags == ALTER_TABLE_REORG)
{
uint new_part_no, curr_part_no;
ulonglong max_rows= table->s->max_rows;
if (tab_part_info->part_type != HASH_PARTITION ||
tab_part_info->use_default_no_partitions)
{
my_error(ER_REORG_NO_PARAM_ERROR, MYF(0));
DBUG_RETURN(TRUE);
}
new_part_no= table->file->get_default_no_partitions(max_rows);
new_part_no= table->file->get_default_no_partitions(create_info);
curr_part_no= tab_part_info->no_parts;
if (new_part_no == curr_part_no)
{
......
......@@ -65,7 +65,7 @@ int get_part_for_delete(const byte *buf, const byte *rec0,
partition_info *part_info, uint32 *part_id);
void prune_partition_set(const TABLE *table, part_id_range *part_spec);
bool check_partition_info(partition_info *part_info,handlerton **eng_type,
TABLE *table, handler *file, ulonglong max_rows);
TABLE *table, handler *file, HA_CREATE_INFO *info);
bool fix_partition_func(THD *thd, TABLE *table, bool create_table_ind);
char *generate_partition_syntax(partition_info *part_info,
uint *buf_length, bool use_sql_alloc,
......
......@@ -3185,8 +3185,7 @@ bool mysql_create_table_internal(THD *thd,
}
DBUG_PRINT("info", ("db_type = %d",
ha_legacy_type(part_info->default_engine_type)));
if (part_info->check_partition_info(thd, &engine_type, file,
create_info->max_rows))
if (part_info->check_partition_info(thd, &engine_type, file, create_info))
goto err;
part_info->default_engine_type= engine_type;
......@@ -3224,7 +3223,8 @@ bool mysql_create_table_internal(THD *thd,
*/
if (part_info->use_default_no_partitions &&
part_info->no_parts &&
(int)part_info->no_parts != file->get_default_no_partitions(0ULL))
(int)part_info->no_parts !=
file->get_default_no_partitions(create_info))
{
uint i;
List_iterator<partition_element> part_it(part_info->partitions);
......@@ -3237,10 +3237,10 @@ bool mysql_create_table_internal(THD *thd,
part_info->use_default_no_subpartitions &&
part_info->no_subparts &&
(int)part_info->no_subparts !=
file->get_default_no_partitions(0ULL))
file->get_default_no_partitions(create_info))
{
DBUG_ASSERT(thd->lex->sql_command != SQLCOM_CREATE_TABLE);
part_info->no_subparts= file->get_default_no_partitions(0ULL);
part_info->no_subparts= file->get_default_no_partitions(create_info);
}
}
else if (create_info->db_type != engine_type)
......
......@@ -691,6 +691,8 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_BACKUP_FRAGMENT_REF 546
#define GSN_BACKUP_FRAGMENT_CONF 547
#define GSN_BACKUP_FRAGMENT_COMPLETE_REP 575
#define GSN_STOP_BACKUP_REQ 548
#define GSN_STOP_BACKUP_REF 549
#define GSN_STOP_BACKUP_CONF 550
......@@ -740,7 +742,7 @@ extern const GlobalSignalNumber NO_OF_SIGNAL_NAMES;
#define GSN_SUB_STOP_REQ 572
#define GSN_SUB_STOP_REF 573
#define GSN_SUB_STOP_CONF 574
/* 575 unused */
/* 575 used */
#define GSN_SUB_CREATE_REQ 576
#define GSN_SUB_CREATE_REF 577
#define GSN_SUB_CREATE_CONF 578
......
......@@ -31,7 +31,8 @@ private:
BUFFER_UNDERFLOW = 1,
BUFFER_FULL_SCAN = 2,
BUFFER_FULL_FRAG_COMPLETE = 3,
BUFFER_FULL_META = 4
BUFFER_FULL_META = 4,
BACKUP_FRAGMENT_INFO = 5
};
};
......
......@@ -252,15 +252,31 @@ class BackupFragmentConf {
friend bool printBACKUP_FRAGMENT_CONF(FILE *, const Uint32 *, Uint32, Uint16);
public:
STATIC_CONST( SignalLength = 6 );
STATIC_CONST( SignalLength = 8 );
private:
Uint32 backupId;
Uint32 backupPtr;
Uint32 tableId;
Uint32 fragmentNo;
Uint32 noOfRecords;
Uint32 noOfBytes;
Uint32 noOfRecordsLow;
Uint32 noOfBytesLow;
Uint32 noOfRecordsHigh;
Uint32 noOfBytesHigh;
};
class BackupFragmentCompleteRep {
public:
STATIC_CONST( SignalLength = 8 );
Uint32 backupId;
Uint32 backupPtr;
Uint32 tableId;
Uint32 fragmentNo;
Uint32 noOfTableRowsLow;
Uint32 noOfFragmentRowsLow;
Uint32 noOfTableRowsHigh;
Uint32 noOfFragmentRowsHigh;
};
class StopBackupReq {
......
......@@ -201,17 +201,19 @@ class BackupCompleteRep {
friend bool printBACKUP_COMPLETE_REP(FILE *, const Uint32 *, Uint32, Uint16);
public:
STATIC_CONST( SignalLength = 8 + NdbNodeBitmask::Size );
STATIC_CONST( SignalLength = 10 + NdbNodeBitmask::Size );
private:
Uint32 senderData;
Uint32 backupId;
Uint32 startGCP;
Uint32 stopGCP;
Uint32 noOfBytes;
Uint32 noOfRecords;
Uint32 noOfBytesLow;
Uint32 noOfRecordsLow;
Uint32 noOfLogBytes;
Uint32 noOfLogRecords;
NdbNodeBitmask nodes;
Uint32 noOfBytesHigh;
Uint32 noOfRecordsHigh;
};
/**
......
......@@ -193,6 +193,7 @@ struct CreateFileConf {
Uint32 senderData;
Uint32 senderRef;
Uint32 fileId;
Uint32 fileVersion;
};
#endif
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