Commit b3027d40 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-11369: Test ROW_FORMAT=COMPRESSED

innodb.instant_alter: Demonstrate that instant ADD COLUMN
is not supported for ROW_FORMAT=COMPRESSED but is for
ROW_FORMAT=DYNAMIC. Test adding NOT NULL columns without
explict DEFAULT using both ALGORITHM=COPY and ALGORITHM=INPLACE
(so that implicit DEFAULT will be used).
parent 9a10e7fc
--- instant_alter.result
+++ instant_alter,32k.result
@@ -317,7 +317,7 @@
@@ -1,7 +1,7 @@
#
# MDEV-11369: Instant ADD COLUMN for InnoDB
#
-CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t VALUES(1);
SET @old_instant=
(SELECT variable_value FROM information_schema.global_status
@@ -31,12 +31,12 @@
`c` int(11) NOT NULL,
`d` int(11) NOT NULL,
UNIQUE KEY `a` (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-0
+1
DROP TABLE t;
connect analyze, localhost, root;
connection default;
@@ -355,7 +355,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -9,7 +33,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
@@ -340,7 +340,7 @@
@@ -378,7 +378,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -18,16 +42,16 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
@@ -353,7 +353,7 @@
@@ -391,7 +391,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+1
connection default;
DROP TABLE big;
CREATE TABLE t1
@@ -668,7 +668,7 @@
InnoDB 0 transactions not purged
DROP TABLE t1,t2,t3,big;
@@ -703,7 +703,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -36,7 +60,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
@@ -691,7 +691,7 @@
@@ -726,7 +726,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -45,16 +69,16 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
@@ -704,7 +704,7 @@
@@ -739,7 +739,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+1
connection default;
DROP TABLE big;
CREATE TABLE t1
@@ -1019,7 +1019,7 @@
InnoDB 0 transactions not purged
DROP TABLE t1,t2,t3,big;
@@ -1051,7 +1051,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -63,7 +87,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
@@ -1042,7 +1042,7 @@
@@ -1074,7 +1074,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -72,12 +96,12 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
@@ -1055,7 +1055,7 @@
@@ -1087,7 +1087,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+1
connection default;
DROP TABLE big;
disconnect analyze;
InnoDB 0 transactions not purged
DROP TABLE t1,t2,t3,big;
--- instant_alter.result
+++ instant_alter,64k.result
@@ -317,7 +317,7 @@
@@ -1,7 +1,7 @@
#
# MDEV-11369: Instant ADD COLUMN for InnoDB
#
-CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
+CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
INSERT INTO t VALUES(1);
SET @old_instant=
(SELECT variable_value FROM information_schema.global_status
@@ -31,12 +31,12 @@
`c` int(11) NOT NULL,
`d` int(11) NOT NULL,
UNIQUE KEY `a` (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-0
+1
DROP TABLE t;
connect analyze, localhost, root;
connection default;
@@ -355,7 +355,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -9,7 +33,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
@@ -340,7 +340,7 @@
@@ -378,7 +378,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -18,16 +42,16 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
@@ -353,7 +353,7 @@
@@ -391,7 +391,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+1
connection default;
DROP TABLE big;
CREATE TABLE t1
@@ -668,7 +668,7 @@
InnoDB 0 transactions not purged
DROP TABLE t1,t2,t3,big;
@@ -703,7 +703,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -36,7 +60,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
@@ -691,7 +691,7 @@
@@ -726,7 +726,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -45,16 +69,16 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
@@ -704,7 +704,7 @@
@@ -739,7 +739,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+1
connection default;
DROP TABLE big;
CREATE TABLE t1
@@ -1019,7 +1019,7 @@
InnoDB 0 transactions not purged
DROP TABLE t1,t2,t3,big;
@@ -1051,7 +1051,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -63,7 +87,7 @@
connection default;
ALTER TABLE big ADD COLUMN
(d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
@@ -1042,7 +1042,7 @@
@@ -1074,7 +1074,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
......@@ -72,12 +96,12 @@
connection default;
ROLLBACK;
CHECKSUM TABLE big;
@@ -1055,7 +1055,7 @@
@@ -1087,7 +1087,7 @@
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/big';
clust_index_size
-3
+1
connection default;
DROP TABLE big;
disconnect analyze;
InnoDB 0 transactions not purged
DROP TABLE t1,t2,t3,big;
......@@ -4,12 +4,29 @@
--echo # MDEV-11369: Instant ADD COLUMN for InnoDB
--echo #
# FIXME: Test that instant ADD is not allowed on ROW_FORMAT=COMPRESSED
# (create a table with SPATIAL INDEX, ROW_FORMAT=COMPACT, and
# show that ALTER TABLE…ADD COLUMN…LOCK=NONE is refused.
# This does not work yet for any table, because
# check_if_supported_inplace_alter()
# does not check if instant ADD is possible.)
let $format= `SELECT CASE WHEN @@GLOBAL.innodb_page_size>16384
THEN 'DYNAMIC' ELSE 'COMPRESSED' END`;
eval CREATE TABLE t(a INT UNIQUE)ENGINE=InnoDB ROW_FORMAT=$format;
INSERT INTO t VALUES(1);
SET @old_instant=
(SELECT variable_value FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column');
--enable_info
ALTER TABLE t ADD b INT NOT NULL, ALGORITHM=COPY;
ALTER TABLE t ADD c INT NOT NULL, FORCE;
--disable_info
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
--enable_info
ALTER TABLE t ADD d INT NOT NULL;
--disable_info
SELECT * FROM t;
SHOW CREATE TABLE t;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
DROP TABLE t;
connect analyze, localhost, root;
connection default;
......
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