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