Commit 3eaae096 authored by Marko Mäkelä's avatar Marko Mäkelä

Extend the use of innodb_default_row_format.combinations

parent f454189c
......@@ -3,55 +3,22 @@ FLUSH TABLES;
# MDEV-11369: Instant ADD COLUMN for InnoDB
#
connect to_be_killed, localhost, root;
CREATE TABLE empty_REDUNDANT
(id INT PRIMARY KEY, c2 INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
CREATE TABLE once_REDUNDANT LIKE empty_REDUNDANT;
CREATE TABLE twice_REDUNDANT LIKE empty_REDUNDANT;
INSERT INTO once_REDUNDANT SET id=1,c2=1;
INSERT INTO twice_REDUNDANT SET id=1,c2=1;
ALTER TABLE empty_REDUNDANT ADD COLUMN (d1 INT DEFAULT 15);
ALTER TABLE once_REDUNDANT ADD COLUMN (d1 INT DEFAULT 20);
ALTER TABLE twice_REDUNDANT ADD COLUMN (d1 INT DEFAULT 20);
ALTER TABLE twice_REDUNDANT ADD COLUMN
(d2 INT NOT NULL DEFAULT 10,
d3 VARCHAR(15) NOT NULL DEFAULT 'var och en char');
CREATE TABLE empty_COMPACT
(id INT PRIMARY KEY, c2 INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=COMPACT;
CREATE TABLE once_COMPACT LIKE empty_COMPACT;
CREATE TABLE twice_COMPACT LIKE empty_COMPACT;
INSERT INTO once_COMPACT SET id=1,c2=1;
INSERT INTO twice_COMPACT SET id=1,c2=1;
ALTER TABLE empty_COMPACT ADD COLUMN (d1 INT DEFAULT 15);
ALTER TABLE once_COMPACT ADD COLUMN (d1 INT DEFAULT 20);
ALTER TABLE twice_COMPACT ADD COLUMN (d1 INT DEFAULT 20);
ALTER TABLE twice_COMPACT ADD COLUMN
(d2 INT NOT NULL DEFAULT 10,
d3 VARCHAR(15) NOT NULL DEFAULT 'var och en char');
CREATE TABLE empty_DYNAMIC
(id INT PRIMARY KEY, c2 INT UNIQUE) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
CREATE TABLE once_DYNAMIC LIKE empty_DYNAMIC;
CREATE TABLE twice_DYNAMIC LIKE empty_DYNAMIC;
INSERT INTO once_DYNAMIC SET id=1,c2=1;
INSERT INTO twice_DYNAMIC SET id=1,c2=1;
ALTER TABLE empty_DYNAMIC ADD COLUMN (d1 INT DEFAULT 15);
ALTER TABLE once_DYNAMIC ADD COLUMN (d1 INT DEFAULT 20);
ALTER TABLE twice_DYNAMIC ADD COLUMN (d1 INT DEFAULT 20);
ALTER TABLE twice_DYNAMIC ADD COLUMN
CREATE TABLE empty (id INT PRIMARY KEY, c2 INT UNIQUE) ENGINE=InnoDB;
CREATE TABLE once LIKE empty;
CREATE TABLE twice LIKE empty;
INSERT INTO once SET id=1,c2=1;
INSERT INTO twice SET id=1,c2=1;
ALTER TABLE empty ADD COLUMN (d1 INT DEFAULT 15);
ALTER TABLE once ADD COLUMN (d1 INT DEFAULT 20);
ALTER TABLE twice ADD COLUMN (d1 INT DEFAULT 20);
ALTER TABLE twice ADD COLUMN
(d2 INT NOT NULL DEFAULT 10,
d3 VARCHAR(15) NOT NULL DEFAULT 'var och en char');
BEGIN;
INSERT INTO empty_REDUNDANT set id=0,c2=42;
UPDATE once_REDUNDANT set c2=c2+1;
UPDATE twice_REDUNDANT set c2=c2+1;
INSERT INTO twice_REDUNDANT SET id=2,c2=0,d3='';
INSERT INTO empty_COMPACT set id=0,c2=42;
UPDATE once_COMPACT set c2=c2+1;
UPDATE twice_COMPACT set c2=c2+1;
INSERT INTO twice_COMPACT SET id=2,c2=0,d3='';
INSERT INTO empty_DYNAMIC set id=0,c2=42;
UPDATE once_DYNAMIC set c2=c2+1;
UPDATE twice_DYNAMIC set c2=c2+1;
INSERT INTO twice_DYNAMIC SET id=2,c2=0,d3='';
INSERT INTO empty set id=0,c2=42;
UPDATE once set c2=c2+1;
UPDATE twice set c2=c2+1;
INSERT INTO twice SET id=2,c2=0,d3='';
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
CREATE TABLE foo(a INT PRIMARY KEY) ENGINE=InnoDB;
......@@ -62,30 +29,12 @@ SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
DROP TABLE foo;
InnoDB 0 transactions not purged
SET GLOBAL innodb_purge_rseg_truncate_frequency=@saved_frequency;
SELECT * FROM empty_REDUNDANT;
id c2 d1
SELECT * FROM once_REDUNDANT;
id c2 d1
1 1 20
SELECT * FROM twice_REDUNDANT;
id c2 d1 d2 d3
1 1 20 10 var och en char
DROP TABLE empty_REDUNDANT, once_REDUNDANT, twice_REDUNDANT;
SELECT * FROM empty_COMPACT;
id c2 d1
SELECT * FROM once_COMPACT;
id c2 d1
1 1 20
SELECT * FROM twice_COMPACT;
id c2 d1 d2 d3
1 1 20 10 var och en char
DROP TABLE empty_COMPACT, once_COMPACT, twice_COMPACT;
SELECT * FROM empty_DYNAMIC;
SELECT * FROM empty;
id c2 d1
SELECT * FROM once_DYNAMIC;
SELECT * FROM once;
id c2 d1
1 1 20
SELECT * FROM twice_DYNAMIC;
SELECT * FROM twice;
id c2 d1 d2 d3
1 1 20 10 var och en char
DROP TABLE empty_DYNAMIC, once_DYNAMIC, twice_DYNAMIC;
DROP TABLE empty, once, twice;
......@@ -2,3 +2,5 @@
innodb_default_row_format=redundant
[dynamic]
innodb_default_row_format=dynamic
[compact]
innodb_default_row_format=compact
--source include/have_innodb.inc
--source innodb_default_row_format.inc
# The embedded server tests do not support restarting.
--source include/not_embedded.inc
......@@ -11,40 +12,24 @@ FLUSH TABLES;
connect to_be_killed, localhost, root;
let $format= 3;
while ($format) {
let $fmt= `SELECT CASE $format WHEN 1 THEN 'DYNAMIC' WHEN 2 THEN 'COMPACT'
ELSE 'REDUNDANT' END`;
let $engine= ENGINE=InnoDB ROW_FORMAT=$fmt;
eval CREATE TABLE empty_$fmt
(id INT PRIMARY KEY, c2 INT UNIQUE) $engine;
eval CREATE TABLE once_$fmt LIKE empty_$fmt;
eval CREATE TABLE twice_$fmt LIKE empty_$fmt;
eval INSERT INTO once_$fmt SET id=1,c2=1;
eval INSERT INTO twice_$fmt SET id=1,c2=1;
eval ALTER TABLE empty_$fmt ADD COLUMN (d1 INT DEFAULT 15);
eval ALTER TABLE once_$fmt ADD COLUMN (d1 INT DEFAULT 20);
eval ALTER TABLE twice_$fmt ADD COLUMN (d1 INT DEFAULT 20);
eval ALTER TABLE twice_$fmt ADD COLUMN
CREATE TABLE empty (id INT PRIMARY KEY, c2 INT UNIQUE) ENGINE=InnoDB;
CREATE TABLE once LIKE empty;
CREATE TABLE twice LIKE empty;
INSERT INTO once SET id=1,c2=1;
INSERT INTO twice SET id=1,c2=1;
ALTER TABLE empty ADD COLUMN (d1 INT DEFAULT 15);
ALTER TABLE once ADD COLUMN (d1 INT DEFAULT 20);
ALTER TABLE twice ADD COLUMN (d1 INT DEFAULT 20);
ALTER TABLE twice ADD COLUMN
(d2 INT NOT NULL DEFAULT 10,
d3 VARCHAR(15) NOT NULL DEFAULT 'var och en char');
dec $format;
}
BEGIN;
let $format= 3;
while ($format) {
let $fmt= `SELECT CASE $format WHEN 1 THEN 'DYNAMIC' WHEN 2 THEN 'COMPACT'
ELSE 'REDUNDANT' END`;
eval INSERT INTO empty_$fmt set id=0,c2=42;
eval UPDATE once_$fmt set c2=c2+1;
eval UPDATE twice_$fmt set c2=c2+1;
eval INSERT INTO twice_$fmt SET id=2,c2=0,d3='';
dec $format;
}
INSERT INTO empty set id=0,c2=42;
UPDATE once set c2=c2+1;
UPDATE twice set c2=c2+1;
INSERT INTO twice SET id=2,c2=0,d3='';
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
......@@ -60,14 +45,7 @@ DROP TABLE foo;
--source include/wait_all_purged.inc
SET GLOBAL innodb_purge_rseg_truncate_frequency=@saved_frequency;
let $format= 3;
while ($format) {
let $fmt= `SELECT CASE $format WHEN 1 THEN 'DYNAMIC' WHEN 2 THEN 'COMPACT'
ELSE 'REDUNDANT' END`;
eval SELECT * FROM empty_$fmt;
eval SELECT * FROM once_$fmt;
eval SELECT * FROM twice_$fmt;
eval DROP TABLE empty_$fmt, once_$fmt, twice_$fmt;
dec $format;
}
SELECT * FROM empty;
SELECT * FROM once;
SELECT * FROM twice;
DROP TABLE empty, once, twice;
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