Commit 86633428 authored by unknown's avatar unknown

Bug#24667 After ALTER TABLE operation ndb_dd table becomes regular ndb, Bug...

Bug#24667  After ALTER TABLE operation ndb_dd table becomes regular ndb, Bug #25296  Truncate table converts NDB disk based tables to in-memory tables: Added more checks in tests


parent 2b432383
......@@ -77,6 +77,16 @@ t1 CREATE TABLE `t1` (
`a10` blob,
PRIMARY KEY (`a1`)
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
a1 Smallint PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
a2 Int NOT NULL AT=FIXED ST=DISK
a3 Bigint NOT NULL AT=FIXED ST=DISK
a4 Char(10;latin1_swedish_ci) NULL AT=FIXED ST=DISK
a5 Decimal(5,1) NULL AT=FIXED ST=DISK
a6 Time NULL AT=FIXED ST=DISK
a7 Date NULL AT=FIXED ST=DISK
a8 Datetime NULL AT=FIXED ST=DISK
a9 Varchar(255;latin1_swedish_ci) NULL AT=FIXED ST=DISK
a10 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
SELECT * FROM test.t1 ORDER BY a1;
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
......@@ -166,6 +176,16 @@ t1 CREATE TABLE `t1` (
`a10` blob,
PRIMARY KEY (`a1`)
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
a1 Smallint PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
a2 Int NOT NULL AT=FIXED ST=DISK
a3 Bigint NOT NULL AT=FIXED ST=DISK
a4 Char(10;latin1_swedish_ci) NULL AT=FIXED ST=DISK
a5 Decimal(5,1) NULL AT=FIXED ST=DISK
a6 Time NULL AT=FIXED ST=DISK
a7 Date NULL AT=FIXED ST=DISK
a8 Datetime NULL AT=FIXED ST=DISK
a9 Varchar(255;latin1_swedish_ci) NULL AT=FIXED ST=DISK
a10 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
SELECT * FROM test.t1 ORDER BY a1;
a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
1 2 2000000001 aaa1 34.2 04:03:02 2006-01-01 1971-05-28 16:55:03 bbbbbbbbbbbbb1 binary data
......@@ -242,6 +262,16 @@ t1 CREATE TABLE `t1` (
`a10` blob,
PRIMARY KEY (`a1`)
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
a1 Smallint PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
a2 Int NOT NULL AT=FIXED ST=DISK
a3 Bigint NOT NULL AT=FIXED ST=DISK
a4 Char(10;latin1_swedish_ci) NULL AT=FIXED ST=DISK
a5 Decimal(5,1) NULL AT=FIXED ST=DISK
a6 Time NULL AT=FIXED ST=DISK
a7 Date NULL AT=FIXED ST=DISK
a8 Datetime NULL AT=FIXED ST=DISK
a9 Varchar(255;latin1_swedish_ci) NULL AT=FIXED ST=DISK
a10 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
ALTER TABLE test.t1 ENGINE=MyISAM;
SHOW CREATE TABLE test.t1;
Table Create Table
......@@ -335,6 +365,39 @@ a1 a2 a3 hex(a4) a5 a6 a7 a8
19 20.2345 20000019 0 1 23475 2006-01-01 07:04:00
20 21.2345 20000020 0 1 23476 2006-01-01 07:04:00
ALTER TABLE test.t1 ADD a9 DATETIME, ADD a10 TINYTEXT, ADD a11 MEDIUMTEXT, ADD a12 LONGTEXT, ADD a13 TEXT, ADD a14 BLOB;
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a1` int(11) NOT NULL,
`a2` float DEFAULT NULL,
`a3` double DEFAULT NULL,
`a4` bit(1) DEFAULT NULL,
`a5` tinyint(4) DEFAULT NULL,
`a6` bigint(20) DEFAULT NULL,
`a7` date DEFAULT NULL,
`a8` time DEFAULT NULL,
`a9` datetime DEFAULT NULL,
`a10` tinytext,
`a11` mediumtext,
`a12` longtext,
`a13` text,
`a14` blob,
PRIMARY KEY (`a1`)
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
a1 Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
a2 Float NULL AT=FIXED ST=DISK
a3 Double NULL AT=FIXED ST=DISK
a4 Bit(1) NULL AT=FIXED ST=DISK
a5 Tinyint NULL AT=FIXED ST=DISK
a6 Bigint NULL AT=FIXED ST=DISK
a7 Date NULL AT=FIXED ST=DISK
a8 Time NULL AT=FIXED ST=DISK
a9 Datetime NULL AT=FIXED ST=DISK
a10 Text(256,0;0;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a11 Text(256,4000;8;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a12 Text(256,8000;4;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a13 Text(256,2000;16;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a14 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
SELECT a1, a2,a3,hex(a4),a5,a6,a7,a8,a9,a10,a11,a12,a13 FROM test.t1 ORDER BY a1;
a1 a2 a3 hex(a4) a5 a6 a7 a8 a9 a10 a11 a12 a13
1 2.2345 20000001 0 1 23457 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
......@@ -357,25 +420,6 @@ a1 a2 a3 hex(a4) a5 a6 a7 a8 a9 a10 a11 a12 a13
18 19.2345 20000018 0 1 23474 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
19 20.2345 20000019 0 1 23475 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
20 21.2345 20000020 0 1 23476 2006-01-01 07:04:00 1971-05-28 16:55:03 abc abcdefg LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL Text Field
SHOW CREATE TABLE test.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a1` int(11) NOT NULL,
`a2` float DEFAULT NULL,
`a3` double DEFAULT NULL,
`a4` bit(1) DEFAULT NULL,
`a5` tinyint(4) DEFAULT NULL,
`a6` bigint(20) DEFAULT NULL,
`a7` date DEFAULT NULL,
`a8` time DEFAULT NULL,
`a9` datetime DEFAULT NULL,
`a10` tinytext,
`a11` mediumtext,
`a12` longtext,
`a13` text,
`a14` blob,
PRIMARY KEY (`a1`)
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
ALTER TABLE test.t1 ADD INDEX a2_i (a2), ADD INDEX a3_i (a3);
SHOW CREATE TABLE test.t1;
Table Create Table
......@@ -398,6 +442,20 @@ t1 CREATE TABLE `t1` (
KEY `a2_i` (`a2`),
KEY `a3_i` (`a3`)
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
a1 Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
a2 Float NULL AT=FIXED ST=MEMORY
a3 Double NULL AT=FIXED ST=MEMORY
a4 Bit(1) NULL AT=FIXED ST=DISK
a5 Tinyint NULL AT=FIXED ST=DISK
a6 Bigint NULL AT=FIXED ST=DISK
a7 Date NULL AT=FIXED ST=DISK
a8 Time NULL AT=FIXED ST=DISK
a9 Datetime NULL AT=FIXED ST=DISK
a10 Text(256,0;0;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a11 Text(256,4000;8;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a12 Text(256,8000;4;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a13 Text(256,2000;16;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a14 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
ALTER TABLE test.t1 DROP INDEX a2_i;
SHOW CREATE TABLE test.t1;
Table Create Table
......@@ -419,6 +477,20 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a1`),
KEY `a3_i` (`a3`)
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
a1 Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
a2 Float NULL AT=FIXED ST=DISK
a3 Double NULL AT=FIXED ST=MEMORY
a4 Bit(1) NULL AT=FIXED ST=DISK
a5 Tinyint NULL AT=FIXED ST=DISK
a6 Bigint NULL AT=FIXED ST=DISK
a7 Date NULL AT=FIXED ST=DISK
a8 Time NULL AT=FIXED ST=DISK
a9 Datetime NULL AT=FIXED ST=DISK
a10 Text(256,0;0;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a11 Text(256,4000;8;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a12 Text(256,8000;4;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a13 Text(256,2000;16;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a14 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
TRUNCATE TABLE test.t1;
SHOW CREATE TABLE test.t1;
Table Create Table
......@@ -440,6 +512,20 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a1`),
KEY `a3_i` (`a3`)
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
a1 Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
a2 Float NULL AT=FIXED ST=DISK
a3 Double NULL AT=FIXED ST=MEMORY
a4 Bit(1) NULL AT=FIXED ST=DISK
a5 Tinyint NULL AT=FIXED ST=DISK
a6 Bigint NULL AT=FIXED ST=DISK
a7 Date NULL AT=FIXED ST=DISK
a8 Time NULL AT=FIXED ST=DISK
a9 Datetime NULL AT=FIXED ST=DISK
a10 Text(256,0;0;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a11 Text(256,4000;8;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a12 Text(256,8000;4;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a13 Text(256,2000;16;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
a14 Blob(256,2000;16) NULL AT=FIXED ST=MEMORY
ALTER TABLE test.t1 DROP a14;
ALTER TABLE test.t1 DROP a13;
ALTER TABLE test.t1 DROP a12;
......@@ -460,6 +546,12 @@ t1 CREATE TABLE `t1` (
`a5` tinyint(4) DEFAULT NULL,
KEY `a3_i` (`a3`)
) /*!50100 TABLESPACE ts STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1
a1 Int NOT NULL AT=FIXED ST=DISK
a2 Float NULL AT=FIXED ST=DISK
a3 Double NULL AT=FIXED ST=MEMORY
a4 Bit(1) NULL AT=FIXED ST=DISK
a5 Tinyint NULL AT=FIXED ST=DISK
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
DROP TABLE test.t1;
ALTER TABLESPACE ts
DROP DATAFILE './table_space/datafile.dat'
......
......@@ -93,6 +93,8 @@ SHOW CREATE TABLE test.t1;
SELECT * FROM test.t1 ORDER BY a1;
ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
SHOW CREATE TABLE test.t1;
# Check column storage
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep 'ST='
SELECT * FROM test.t1 ORDER BY a1;
DROP TABLE test.t1;
......@@ -125,6 +127,8 @@ SHOW CREATE TABLE test.t1;
SELECT * FROM test.t1 ORDER BY a1;
ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
SHOW CREATE TABLE test.t1;
# Check column storage
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep 'ST='
SELECT * FROM test.t1 ORDER BY a1;
#### Try to ALTER from Cluster Disk Data to InnoDB
......@@ -133,10 +137,12 @@ ALTER TABLE test.t1 ENGINE=InnoDB;
SHOW CREATE TABLE test.t1;
SELECT * FROM test.t1 ORDER BY a1;
ALTER TABLE test.t1 TABLESPACE ts STORAGE DISK ENGINE=NDB;
SHOW CREATE TABLE test.t1;
# Check column storage
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep 'ST='
#### Try to ALTER from Cluster Disk Data to MyISAM
SHOW CREATE TABLE test.t1;
ALTER TABLE test.t1 ENGINE=MyISAM;
SHOW CREATE TABLE test.t1;
DROP TABLE test.t1;
......@@ -188,6 +194,9 @@ enable_query_log;
SELECT a1,a2,a3,hex(a4), a5,a6,a7,a8 FROM test.t1 ORDER BY a1;
ALTER TABLE test.t1 ADD a9 DATETIME, ADD a10 TINYTEXT, ADD a11 MEDIUMTEXT, ADD a12 LONGTEXT, ADD a13 TEXT, ADD a14 BLOB;
SHOW CREATE TABLE test.t1;
# Check column storage
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep 'ST='
disable_query_log;
set @d2 = 'dd2';
......@@ -209,7 +218,6 @@ while ($1)
enable_query_log;
SELECT a1, a2,a3,hex(a4),a5,a6,a7,a8,a9,a10,a11,a12,a13 FROM test.t1 ORDER BY a1;
SHOW CREATE TABLE test.t1;
#### Try to ALTER DD Tables and add Indexes
......@@ -217,14 +225,23 @@ ALTER TABLE test.t1 ADD INDEX a2_i (a2), ADD INDEX a3_i (a3);
SHOW CREATE TABLE test.t1;
# Check column storage
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep 'ST='
ALTER TABLE test.t1 DROP INDEX a2_i;
SHOW CREATE TABLE test.t1;
# Check column storage
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep 'ST='
TRUNCATE TABLE test.t1;
SHOW CREATE TABLE test.t1;
# Check column storage
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep 'ST='
#### Try to ALTER DD Tables and drop columns
......@@ -241,6 +258,9 @@ ALTER TABLE test.t1 DROP PRIMARY KEY;
SHOW CREATE TABLE test.t1;
# Check column storage
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t1 | grep 'ST='
DROP TABLE test.t1;
ALTER TABLESPACE ts
......
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