Commit aa6539cb authored by Christian Rober's avatar Christian Rober

refs #4870 Added test cases to verify that row format ALTER statements are hot and non-blocking.

git-svn-id: file:///svn/mysql/tests/mysql-test@45010 c7de825b-a66e-492c-adef-691d508d4ae1
parent b6074f6c
SET STORAGE_ENGINE='tokudb';
DROP TABLE IF EXISTS foo;
set session tokudb_disable_slow_alter=ON;
CREATE TABLE foo(a int auto_increment, b int, primary key(a))engine=TokuDB;
INSERT INTO foo (b)
VALUES (11), (21), (32);
SELECT * FROM foo;
a b
1 11
2 21
3 32
ALTER TABLE foo row_format=TOKUDB_LZMA;
SHOW CREATE TABLE foo;
Table Create Table
foo CREATE TABLE `foo` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 ROW_FORMAT=TOKUDB_LZMA
ALTER TABLE foo row_format=TOKUDB_QUICKLZ;
SHOW CREATE TABLE foo;
Table Create Table
foo CREATE TABLE `foo` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 ROW_FORMAT=TOKUDB_QUICKLZ
ALTER TABLE foo row_format=TOKUDB_UNCOMPRESSED;
SHOW CREATE TABLE foo;
Table Create Table
foo CREATE TABLE `foo` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 ROW_FORMAT=TOKUDB_UNCOMPRESSED
ALTER TABLE foo row_format=TOKUDB_ZLIB;
SHOW CREATE TABLE foo;
Table Create Table
foo CREATE TABLE `foo` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 ROW_FORMAT=TOKUDB_ZLIB
ALTER TABLE foo row_format=TOKUDB_FAST;
SHOW CREATE TABLE foo;
Table Create Table
foo CREATE TABLE `foo` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 ROW_FORMAT=TOKUDB_FAST
ALTER TABLE foo row_format=TOKUDB_SMALL;
SHOW CREATE TABLE foo;
Table Create Table
foo CREATE TABLE `foo` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=TokuDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 ROW_FORMAT=TOKUDB_SMALL
ALTER TABLE foo row_format=TOKUDB_LZMA, add column c int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
ALTER TABLE foo row_format=TOKUDB_LZMA, drop column b;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
ALTER TABLE foo row_format=TOKUDB_LZMA, add key b(b);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
ALTER TABLE foo row_format=TOKUDB_LZMA, change b b bigint;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
ALTER TABLE foo row_format=TOKUDB_LZMA, change b c int;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
ALTER TABLE foo auto_increment=100000, ROW_FORMAT=TOKUDB_LZMA;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MySQL version
DROP TABLE foo;
#--source include/have_tokudb.inc
#
# Verify that row format changes are non-blocking, hot operations.
#
SET STORAGE_ENGINE='tokudb';
--disable_warnings
DROP TABLE IF EXISTS foo;
--enable_warnings
set session tokudb_disable_slow_alter=ON;
CREATE TABLE foo(a int auto_increment, b int, primary key(a))engine=TokuDB;
INSERT INTO foo (b)
VALUES (11), (21), (32);
SELECT * FROM foo;
#
# Verify each compression type change is hot/non-blocking.
#
ALTER TABLE foo row_format=TOKUDB_LZMA;
SHOW CREATE TABLE foo;
ALTER TABLE foo row_format=TOKUDB_QUICKLZ;
SHOW CREATE TABLE foo;
ALTER TABLE foo row_format=TOKUDB_UNCOMPRESSED;
SHOW CREATE TABLE foo;
ALTER TABLE foo row_format=TOKUDB_ZLIB;
SHOW CREATE TABLE foo;
ALTER TABLE foo row_format=TOKUDB_FAST;
SHOW CREATE TABLE foo;
ALTER TABLE foo row_format=TOKUDB_SMALL;
SHOW CREATE TABLE foo;
#
# Trying to change row format along with another
# option should NOT be hot/non-blocking.
#
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE foo row_format=TOKUDB_LZMA, add column c int;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE foo row_format=TOKUDB_LZMA, drop column b;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE foo row_format=TOKUDB_LZMA, add key b(b);
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE foo row_format=TOKUDB_LZMA, change b b bigint;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE foo row_format=TOKUDB_LZMA, change b c int;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE foo auto_increment=100000, ROW_FORMAT=TOKUDB_LZMA;
DROP TABLE foo;
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