Commit 8ef727b3 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-14904 Backport innodb_default_row_format

InnoDB in Debian uses utf8mb4 as default character set since
version 10.0.20-2. This leads to major pain due to keys longer
than 767 bytes.

MariaDB 10.2 (and MySQL 5.7) introduced the setting
innodb_default_row_format that is DYNAMIC by default. These
versions also changed the default values of the parameters
innodb_large_prefix=ON and innodb_file_format=Barracuda.
This would allow longer column index prefixes to be created.
The original purpose of these parameters was to allow InnoDB
to be downgraded to MySQL 5.1, which is long out of support.

Every InnoDB version since MySQL 5.5 does support operation
with the relaxed limits.

We backport the parameter innodb_default_row_format to
MariaDB 10.1, but we will keep its default value at COMPACT.
This allows MariaDB 10.1 to be configured so that CREATE TABLE
is less likely to encounter a problem with the limitation:

	loose_innodb_large_prefix=ON
	loose_innodb_default_row_format=DYNAMIC

(Note that the setting innodb_large_prefix was deprecated in
MariaDB 10.2 and removed in MariaDB 10.3.)

The only observable difference in the behaviour with the default
settings should be that ROW_FORMAT=DYNAMIC tables can be created
both in the system tablespace and in .ibd files, no matter what
innodb_file_format has been assigned to. Unlike MariaDB 10.2,
we are not changing the default value of innodb_file_format,
so ROW_FORMAT=COMPRESSED tables cannot be created without
changing the parameter.
parent 176d603c
[redundant]
innodb_default_row_format=redundant
[compact]
innodb_default_row_format=compact
[dynamic]
innodb_default_row_format=dynamic
# The goal of including this file is to enable innodb_default_row_format
# combinations (see include/innodb_row_format.combinations)
--source include/have_innodb.inc
...@@ -10,9 +10,6 @@ CHAR(255) NOT NULL, f13 CHAR(255) NOT NULL, f14 CHAR(255) NOT NULL,f15 ...@@ -10,9 +10,6 @@ CHAR(255) NOT NULL, f13 CHAR(255) NOT NULL, f14 CHAR(255) NOT NULL,f15
CHAR(255) NOT NULL, f16 CHAR(255) NOT NULL, f17 CHAR(255) NOT NULL,f18 CHAR(255) NOT NULL, f16 CHAR(255) NOT NULL, f17 CHAR(255) NOT NULL,f18
CHAR(255) NOT NULL) CHAR(255) NOT NULL)
ENGINE=INNODB ROW_FORMAT=DYNAMIC; ENGINE=INNODB ROW_FORMAT=DYNAMIC;
Warnings:
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
INSERT INTO t1 INSERT INTO t1
VALUES('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r'); VALUES('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r');
INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1;
......
SET @row_format = @@GLOBAL.innodb_default_row_format;
####################################
# Check if table rebuilding alter isn't affect if table is created
# with explicit row_format
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 'abc');
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPACT
SET GLOBAL innodb_default_row_format=DYNAMIC;
ALTER TABLE t1 DROP PRIMARY KEY, ADD COLUMN c INT PRIMARY KEY;
# Here we expect COMPACT because it was explicitly specified at CREATE
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPACT
DROP TABLE t1;
####################################
# Check if table rebuilding alter is affected when there is no
# row_format specified at CREATE TABLE.
SET GLOBAL innodb_default_row_format = COMPACT;
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 'abc');
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
SET GLOBAL innodb_default_row_format = DYNAMIC;
ALTER TABLE t1 DROP PRIMARY KEY, ADD COLUMN c INT PRIMARY KEY;
# Here we expect DYNAMIC because there is no explicit ROW_FORMAT and the
# default_row_format is changed to DYNAMIC just before ALTER
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
DROP TABLE t1;
####################################
# Check the row_format effect on ALTER, ALGORITHM=COPY
SET GLOBAL innodb_default_row_format = REDUNDANT;
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
SET GLOBAL innoDB_default_row_format = COMPACT;
ALTER TABLE t1 ADD COLUMN c2 BLOB, ALGORITHM=COPY;
# Because of ALGORITHM=COPY, there is TABLE REBUILD and the table isn't
# created with explicit row_format, so we expect ROW_FORMAT=COMPACT
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
DROP TABLE t1;
###################################
# Check the row_format effect on ALTER, ALGORITH=COPY on
# create table with explicit row_format
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=INNODB;
INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=REDUNDANT
SET GLOBAL innoDB_default_row_format = COMPACT;
ALTER TABLE t1 ADD COLUMN c2 BLOB, ALGORITHM=COPY;
# Because of ALGORITHM=COPY, there is TABLE REBUILD and the table is
# created with explicit row_format, so we expect original
# ROW_FORMAT=REDUNDANT
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=REDUNDANT
DROP TABLE t1;
##################################
# Check row_format on ALTER ALGORITHM=INPLACE
SET GLOBAL innodb_default_row_format=COMPACT;
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT, KEY k1(b(10))) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
SET GLOBAL innodb_default_row_format=DYNAMIC;
ALTER TABLE t1 DROP INDEX k1;
# Because it is in-place operation, there is no rebuild, so the
# original format has to be retained.
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
DROP TABLE t1;
SET GLOBAL innodb_default_row_format = @row_format;
SET @row_format = @@GLOBAL.innodb_default_row_format;
SET @large_prefix = @@GLOBAL.innodb_large_prefix;
SET @file_format = @@GLOBAL.innodb_file_format;
SET GLOBAL innodb_file_format = barracuda;
# ###########################################################
# Check with Import/Export tablespace with Default_row_format
SET GLOBAL innodb_default_row_format=Compact;
SELECT @@innodb_default_row_format;
@@innodb_default_row_format
compact
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
CREATE TABLE tab(a INT) ENGINE=InnoDB;
SHOW TABLE STATUS LIKE 'tab';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
INSERT INTO tab VALUES(1);
INSERT INTO tab VALUES(2);
SELECT * FROM tab;
a
1
2
FLUSH TABLE tab FOR EXPORT;
UNLOCK TABLES;
DROP TABLE tab;
SET GLOBAL innodb_default_row_format=Dynamic;
CREATE TABLE tab(a INT) ENGINE=InnoDB;
ALTER TABLE tab DISCARD TABLESPACE;
ALTER TABLE tab IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1)
DROP TABLE tab;
SET GLOBAL innodb_default_row_format=Compact;
SELECT @@innodb_default_row_format;
@@innodb_default_row_format
compact
CREATE TABLE tab(a INT) ENGINE=InnoDB;
SHOW TABLE STATUS LIKE 'tab';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
ALTER TABLE tab DISCARD TABLESPACE;
ALTER TABLE tab IMPORT TABLESPACE;
SELECT * FROM tab;
a
1
2
DROP TABLE tab;
# ###########################################################
SET GLOBAL innodb_default_row_format=Dynamic;
SET GLOBAL innodb_large_prefix=ON;
SELECT @@innodb_default_row_format;
@@innodb_default_row_format
dynamic
CREATE TABLE tab(a INT PRIMARY KEY, b VARCHAR(5000), KEY idx1(b(3070))) ENGINE= InnoDB;
SHOW TABLE STATUS LIKE 'tab';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
INSERT INTO tab(a,b) VALUES(1,'Check with max column size');
SELECT * FROM tab;
a b
1 Check with max column size
SET GLOBAL innodb_default_row_format=COMPACT;
ALTER TABLE tab ROW_FORMAT=COMPACT;
ERROR HY000: Index column size too large. The maximum column size is 767 bytes.
DROP TABLE tab;
SET GLOBAL innodb_default_row_format=Default;
SELECT @@innodb_default_row_format;
@@innodb_default_row_format
compact
SET GLOBAL innodb_default_row_format=Dynamic;
SELECT @@innodb_default_row_format;
@@innodb_default_row_format
dynamic
CREATE TABLE tab(a INT PRIMARY KEY, b VARCHAR(5000), KEY idx1(b(767))) ENGINE= InnoDB;
SHOW TABLE STATUS LIKE 'tab';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
INSERT INTO tab(a,b) VALUES(1,'Check with max column size');
SELECT * FROM tab;
a b
1 Check with max column size
ALTER TABLE tab ROW_FORMAT=COMPACT;
SHOW TABLE STATUS LIKE 'tab';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPACT
SELECT * FROM tab;
a b
1 Check with max column size
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
SELECT * FROM tab;
a b
1 Check with max column size
ALTER TABLE tab ROW_FORMAT=Dynamic;
SHOW TABLE STATUS LIKE 'tab';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC
DROP TABLE tab;
SET GLOBAL innodb_default_row_format = @row_format;
SET GLOBAL innodb_large_prefix = @large_prefix;
SET GLOBAL innodb_file_format = @file_format;
--- default_row_format_create.result
+++ default_row_format_create,dynamic.result
@@ -1,7 +1,7 @@
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
+t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
SHOW TABLE STATUS LIKE 't1';
--- default_row_format_create.result
+++ default_row_format_create,redundant.result
@@ -1,7 +1,7 @@
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
+t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
SHOW TABLE STATUS LIKE 't1';
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPACT
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Redundant # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=REDUNDANT
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
Warnings:
Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope.
Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1.
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=COMPRESSED key_block_size=1
DROP TABLE t1;
SELECT @@innodb_strict_mode;
@@innodb_strict_mode
0
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SET @file_format = @@GLOBAL.innodb_file_format;
SET GLOBAL innodb_large_prefix=ON;
SET SQL_MODE=strict_all_tables;
CREATE TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
Warnings:
Warning 1071 Specified key was too long; max key length is 3072 bytes
SHOW CREATE TABLE tab0;
Table Create Table
tab0 CREATE TABLE `tab0` (
`c1` varchar(65530) DEFAULT NULL,
KEY `c1` (`c1`(3072))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
DROP TABLE tab0;
CREATE TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB KEY_BLOCK_SIZE=2;
ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
SET GLOBAL innodb_file_format=Antelope;
CREATE TABLE tab0(c1 INT,c2 LONGBLOB ) ENGINE=InnoDB ROW_FORMAT=Dynamic;
DROP TABLE tab0;
SET GLOBAL innodb_file_format=Default;
SELECT @@innodb_file_format;
@@innodb_file_format
Antelope
SET GLOBAL innodb_strict_mode=OFF;
SET GLOBAL innodb_strict_mode=Default;
SELECT @@innodb_strict_mode;
@@innodb_strict_mode
0
SET GLOBAL innodb_large_prefix=OFF;
SELECT @@innodb_large_prefix;
@@innodb_large_prefix
0
SET GLOBAL innodb_large_prefix=Default;
SELECT @@innodb_large_prefix;
@@innodb_large_prefix
0
SET GLOBAL innodb_file_format_max=Default;
SELECT @@innodb_file_format_max;
@@innodb_file_format_max
Antelope
CREATE TABLE tab1(c1 int ) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
Warnings:
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
SELECT @@innodb_file_format_max;
@@innodb_file_format_max
Antelope
SET GLOBAL innodb_file_format_max=Default;
SET GLOBAL innodb_large_prefix=off;
SET GLOBAL innodb_file_format = @file_format;
DROP TABLE tab1;
--source include/have_innodb.inc
SET @row_format = @@GLOBAL.innodb_default_row_format;
--echo ####################################
--echo # Check if table rebuilding alter isn't affect if table is created
--echo # with explicit row_format
eval CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 'abc');
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
SET GLOBAL innodb_default_row_format=DYNAMIC;
ALTER TABLE t1 DROP PRIMARY KEY, ADD COLUMN c INT PRIMARY KEY;
--echo # Here we expect COMPACT because it was explicitly specified at CREATE
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
--echo ####################################
--echo # Check if table rebuilding alter is affected when there is no
--echo # row_format specified at CREATE TABLE.
SET GLOBAL innodb_default_row_format = COMPACT;
eval CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 'abc');
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
SET GLOBAL innodb_default_row_format = DYNAMIC;
ALTER TABLE t1 DROP PRIMARY KEY, ADD COLUMN c INT PRIMARY KEY;
--echo # Here we expect DYNAMIC because there is no explicit ROW_FORMAT and the
--echo # default_row_format is changed to DYNAMIC just before ALTER
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
--echo ####################################
--echo # Check the row_format effect on ALTER, ALGORITHM=COPY
SET GLOBAL innodb_default_row_format = REDUNDANT;
eval CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
SET GLOBAL innoDB_default_row_format = COMPACT;
ALTER TABLE t1 ADD COLUMN c2 BLOB, ALGORITHM=COPY;
--echo # Because of ALGORITHM=COPY, there is TABLE REBUILD and the table isn't
--echo # created with explicit row_format, so we expect ROW_FORMAT=COMPACT
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
--echo
--echo ###################################
--echo # Check the row_format effect on ALTER, ALGORITH=COPY on
--echo # create table with explicit row_format
eval CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=INNODB;
INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
SET GLOBAL innoDB_default_row_format = COMPACT;
ALTER TABLE t1 ADD COLUMN c2 BLOB, ALGORITHM=COPY;
--echo # Because of ALGORITHM=COPY, there is TABLE REBUILD and the table is
--echo # created with explicit row_format, so we expect original
--echo # ROW_FORMAT=REDUNDANT
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
--echo
--echo ##################################
--echo # Check row_format on ALTER ALGORITHM=INPLACE
SET GLOBAL innodb_default_row_format=COMPACT;
eval CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT, KEY k1(b(10))) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, REPEAT('abc',1000));
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
SET GLOBAL innodb_default_row_format=DYNAMIC;
ALTER TABLE t1 DROP INDEX k1;
--echo # Because it is in-place operation, there is no rebuild, so the
--echo # original format has to be retained.
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
SET GLOBAL innodb_default_row_format = @row_format;
--source include/have_innodb.inc
SET @row_format = @@GLOBAL.innodb_default_row_format;
SET @large_prefix = @@GLOBAL.innodb_large_prefix;
SET @file_format = @@GLOBAL.innodb_file_format;
SET GLOBAL innodb_file_format = barracuda;
# set the variables
let $MYSQLD_DATADIR = `SELECT @@datadir`;
--echo # ###########################################################
--echo # Check with Import/Export tablespace with Default_row_format
# Set row_format=Compact
SET GLOBAL innodb_default_row_format=Compact;
# Check row_format=Compact
SELECT @@innodb_default_row_format;
# Check file_per_table=1
SELECT @@innodb_file_per_table;
CREATE TABLE tab(a INT) ENGINE=InnoDB;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 'tab';
INSERT INTO tab VALUES(1);
INSERT INTO tab VALUES(2);
# Check the rows
SELECT * FROM tab;
FLUSH TABLE tab FOR EXPORT;
# Take the backup of the ibd and cfg files
--copy_file $MYSQLD_DATADIR/test/tab.cfg $MYSQLD_DATADIR/tab.cfg
--copy_file $MYSQLD_DATADIR/test/tab.ibd $MYSQLD_DATADIR/tab.ibd
UNLOCK TABLES;
# Cleanup
DROP TABLE tab;
# Set the default_row_format=Dynamic
SET GLOBAL innodb_default_row_format=Dynamic;
CREATE TABLE tab(a INT) ENGINE=InnoDB;
# Remove the *.ibd file
ALTER TABLE tab DISCARD TABLESPACE;
# Move the *.ibd,*.cfg file into orginal location
--move_file $MYSQLD_DATADIR/tab.cfg $MYSQLD_DATADIR/test/tab.cfg
--move_file $MYSQLD_DATADIR/tab.ibd $MYSQLD_DATADIR/test/tab.ibd
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE tab IMPORT TABLESPACE;
# Take the backup of the ibd and cfg files
--copy_file $MYSQLD_DATADIR/test/tab.cfg $MYSQLD_DATADIR/tab.cfg
--copy_file $MYSQLD_DATADIR/test/tab.ibd $MYSQLD_DATADIR/tab.ibd
# Cleanup
DROP TABLE tab;
# Remove orphan files
--remove_file $MYSQLD_DATADIR/test/tab.cfg
--remove_file $MYSQLD_DATADIR/test/tab.ibd
# Set the default_row_format=Compact
SET GLOBAL innodb_default_row_format=Compact;
# Check row_format=Compact
SELECT @@innodb_default_row_format;
CREATE TABLE tab(a INT) ENGINE=InnoDB;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 'tab';
# Remove the *.ibd file
ALTER TABLE tab DISCARD TABLESPACE;
# Move the *ibd,*.cfg file into orginal location
--move_file $MYSQLD_DATADIR/tab.cfg $MYSQLD_DATADIR/test/tab.cfg
--move_file $MYSQLD_DATADIR/tab.ibd $MYSQLD_DATADIR/test/tab.ibd
# Check import is successful (because same row_format)
ALTER TABLE tab IMPORT TABLESPACE;
# Check the rows
SELECT * FROM tab;
# Cleanup
DROP TABLE tab;
--echo # ###########################################################
# Check when Index Column size (3070 bytes) is too long, Change row_format
# Check when Index Column size (767 bytes), Change row_format
# Dynamic to Compact to Dynamic
# Set the default_row_format=Dynamic
SET GLOBAL innodb_default_row_format=Dynamic;
SET GLOBAL innodb_large_prefix=ON;
SELECT @@innodb_default_row_format;
CREATE TABLE tab(a INT PRIMARY KEY, b VARCHAR(5000), KEY idx1(b(3070))) ENGINE= InnoDB;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 'tab';
INSERT INTO tab(a,b) VALUES(1,'Check with max column size');
# Check by SELECT, no errors
SELECT * FROM tab;
# Change row_format to Compact
SET GLOBAL innodb_default_row_format=COMPACT;
# Check error ERROR 1709 (HY000): Index column size too large
-- error ER_INDEX_COLUMN_TOO_LONG
ALTER TABLE tab ROW_FORMAT=COMPACT;
# Cleanup
DROP TABLE tab;
# Change the default_row_format to default
SET GLOBAL innodb_default_row_format=Default;
SELECT @@innodb_default_row_format;
SET GLOBAL innodb_default_row_format=Dynamic;
# Change row_format to Dynamic
SELECT @@innodb_default_row_format;
CREATE TABLE tab(a INT PRIMARY KEY, b VARCHAR(5000), KEY idx1(b(767))) ENGINE= InnoDB;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 'tab';
INSERT INTO tab(a,b) VALUES(1,'Check with max column size');
# Check by SELECT, no errors
SELECT * FROM tab;
# Check no errors because Compact allows 767 bytes
ALTER TABLE tab ROW_FORMAT=COMPACT;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 'tab';
# Check by SELECT, no errors
SELECT * FROM tab;
# Check no errors
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
# Check by SELECT, no errors
SELECT * FROM tab;
# Check no errors
ALTER TABLE tab ROW_FORMAT=Dynamic;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 'tab';
# Cleanup
DROP TABLE tab;
SET GLOBAL innodb_default_row_format = @row_format;
SET GLOBAL innodb_large_prefix = @large_prefix;
SET GLOBAL innodb_file_format = @file_format;
--source include/have_innodb.inc
--source include/innodb_row_format.inc
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1;
--innodb_large_prefix=OFF --innodb_file_format=barracuda --innodb-file-format-check=off --innodb-file-format-max=antelope
#***********************************************************
# WL#7703:
# Check the max key length 3072 when innodb_large_prefix=ON
# Check boundary value of max key length 3073
# When innodb_file_format=Antelope, compress DDLs fails
# Check file_format_max becomes Barracuda on DDL operation
# on compression table.
#***********************************************************
-- source include/have_innodb.inc
-- source include/have_innodb_16k.inc
# Check some default settings
SELECT @@innodb_strict_mode;
SELECT @@innodb_file_per_table;
SET @file_format = @@GLOBAL.innodb_file_format;
SET GLOBAL innodb_large_prefix=ON;
SET SQL_MODE=strict_all_tables;
CREATE TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
SHOW CREATE TABLE tab0;
DROP TABLE tab0;
--error ER_TOO_BIG_ROWSIZE
CREATE TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB KEY_BLOCK_SIZE=2;
SET GLOBAL innodb_file_format=Antelope;
# WL#8307 Make ROW_FORMAT=DYNAMIC the default
# will allow ROW_FORMAT=DYNAMIC even if innodb_file_format=Antelope.
CREATE TABLE tab0(c1 INT,c2 LONGBLOB ) ENGINE=InnoDB ROW_FORMAT=Dynamic;
DROP TABLE tab0;
SET GLOBAL innodb_file_format=Default;
SELECT @@innodb_file_format;
SET GLOBAL innodb_strict_mode=OFF;
# Check with default value
SET GLOBAL innodb_strict_mode=Default;
SELECT @@innodb_strict_mode;
SET GLOBAL innodb_large_prefix=OFF;
SELECT @@innodb_large_prefix;
SET GLOBAL innodb_large_prefix=Default;
# Check with default value
SELECT @@innodb_large_prefix;
SET GLOBAL innodb_file_format_max=Default;
# Check with default value
SELECT @@innodb_file_format_max;
CREATE TABLE tab1(c1 int ) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
# Check file format changed to Barracuda, on DDL operation
SELECT @@innodb_file_format_max;
SET GLOBAL innodb_file_format_max=Default;
# Restore to the value that we explicitly used at startup.
SET GLOBAL innodb_large_prefix=off;
SET GLOBAL innodb_file_format = @file_format;
DROP TABLE tab1;
...@@ -282,12 +282,12 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelop ...@@ -282,12 +282,12 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelop
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") TABLE_NAME ROW_FORMAT CREATE_OPTIONS
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB t1 Dynamic row_format=DYNAMIC
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT; CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
...@@ -318,13 +318,10 @@ Level Code Message ...@@ -318,13 +318,10 @@ Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT' Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
ALTER TABLE t1 ROW_FORMAT=DYNAMIC; ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
SET GLOBAL innodb_file_format=Barracuda; SET GLOBAL innodb_file_format=Barracuda;
DROP TABLE IF EXISTS t1; DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SET GLOBAL innodb_file_format=Antelope; SET GLOBAL innodb_file_format=Antelope;
ALTER TABLE t1 ADD COLUMN f1 INT; ALTER TABLE t1 ADD COLUMN f1 INT;
...@@ -369,12 +366,12 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. ...@@ -369,12 +366,12 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options") TABLE_NAME ROW_FORMAT CREATE_OPTIONS
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB t1 Dynamic row_format=DYNAMIC
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT; CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
...@@ -405,11 +402,11 @@ Level Code Message ...@@ -405,11 +402,11 @@ Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT' Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
ALTER TABLE t1 ROW_FORMAT=DYNAMIC; ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT'
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ROW_FORMAT' TABLE_NAME ROW_FORMAT CREATE_OPTIONS
t1 Dynamic row_format=DYNAMIC
ALTER TABLE t1 ROW_FORMAT=COMPACT; ALTER TABLE t1 ROW_FORMAT=COMPACT;
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
...@@ -789,16 +786,11 @@ TABLE_NAME ROW_FORMAT CREATE_OPTIONS ...@@ -789,16 +786,11 @@ TABLE_NAME ROW_FORMAT CREATE_OPTIONS
t1 Dynamic row_format=DYNAMIC t1 Dynamic row_format=DYNAMIC
SET GLOBAL innodb_file_format=Antelope; SET GLOBAL innodb_file_format=Antelope;
ALTER TABLE t1 ADD COLUMN f1 INT; ALTER TABLE t1 ADD COLUMN f1 INT;
Warnings:
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
TABLE_NAME ROW_FORMAT CREATE_OPTIONS TABLE_NAME ROW_FORMAT CREATE_OPTIONS
t1 Compact row_format=DYNAMIC t1 Dynamic row_format=DYNAMIC
SET GLOBAL innodb_file_format=Barracuda; SET GLOBAL innodb_file_format=Barracuda;
ALTER TABLE t1 ADD COLUMN f2 INT; ALTER TABLE t1 ADD COLUMN f2 INT;
SHOW WARNINGS; SHOW WARNINGS;
......
...@@ -22,9 +22,6 @@ Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. ...@@ -22,9 +22,6 @@ Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4.
Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
create table t1(a int primary key) engine=innodb row_format=dynamic; create table t1(a int primary key) engine=innodb row_format=dynamic;
Warnings:
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
create table t2(a int primary key) engine=innodb row_format=redundant; create table t2(a int primary key) engine=innodb row_format=redundant;
create table t3(a int primary key) engine=innodb row_format=compact; create table t3(a int primary key) engine=innodb row_format=compact;
create table t4(a int primary key) engine=innodb key_block_size=9; create table t4(a int primary key) engine=innodb key_block_size=9;
...@@ -75,7 +72,7 @@ SELECT table_schema, table_name, row_format, data_length, index_length FROM info ...@@ -75,7 +72,7 @@ SELECT table_schema, table_name, row_format, data_length, index_length FROM info
table_schema table_name row_format data_length index_length table_schema table_name row_format data_length index_length
mysqltest_innodb_zip t0 Compact {valid} 0 mysqltest_innodb_zip t0 Compact {valid} 0
mysqltest_innodb_zip t00 Compact {valid} 0 mysqltest_innodb_zip t00 Compact {valid} 0
mysqltest_innodb_zip t1 Compact {valid} 0 mysqltest_innodb_zip t1 Dynamic {valid} 0
mysqltest_innodb_zip t10 Dynamic {valid} 0 mysqltest_innodb_zip t10 Dynamic {valid} 0
mysqltest_innodb_zip t11 Compressed 1024 0 mysqltest_innodb_zip t11 Compressed 1024 0
mysqltest_innodb_zip t12 Compressed 1024 0 mysqltest_innodb_zip t12 Compressed 1024 0
...@@ -295,19 +292,16 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. ...@@ -295,19 +292,16 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.
Error 1005 Can't create table `mysqltest_innodb_zip`.`t6` (errno: 140 "Wrong create options") Error 1005 Can't create table `mysqltest_innodb_zip`.`t6` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
create table t7 (id int primary key) engine = innodb row_format = dynamic; create table t7 (id int primary key) engine = innodb row_format = dynamic;
ERROR HY000: Can't create table `mysqltest_innodb_zip`.`t7` (errno: 140 "Wrong create options")
show warnings; show warnings;
Level Code Message Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table.
Error 1005 Can't create table `mysqltest_innodb_zip`.`t7` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
create table t8 (id int primary key) engine = innodb row_format = compact; create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant; create table t9 (id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql'; SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format data_length index_length table_schema table_name row_format data_length index_length
mysqltest_innodb_zip t7 Dynamic {valid} 0
mysqltest_innodb_zip t8 Compact {valid} 0 mysqltest_innodb_zip t8 Compact {valid} 0
mysqltest_innodb_zip t9 Redundant {valid} 0 mysqltest_innodb_zip t9 Redundant {valid} 0
drop table t8, t9; drop table t7, t8, t9;
set global innodb_file_per_table = on; set global innodb_file_per_table = on;
set global innodb_file_format = `0`; set global innodb_file_format = `0`;
create table t1 (id int primary key) engine = innodb key_block_size = 1; create table t1 (id int primary key) engine = innodb key_block_size = 1;
...@@ -339,19 +333,16 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelop ...@@ -339,19 +333,16 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelop
Error 1005 Can't create table `mysqltest_innodb_zip`.`t6` (errno: 140 "Wrong create options") Error 1005 Can't create table `mysqltest_innodb_zip`.`t6` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
create table t7 (id int primary key) engine = innodb row_format = dynamic; create table t7 (id int primary key) engine = innodb row_format = dynamic;
ERROR HY000: Can't create table `mysqltest_innodb_zip`.`t7` (errno: 140 "Wrong create options")
show warnings; show warnings;
Level Code Message Level Code Message
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Error 1005 Can't create table `mysqltest_innodb_zip`.`t7` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
create table t8 (id int primary key) engine = innodb row_format = compact; create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant; create table t9 (id int primary key) engine = innodb row_format = redundant;
SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql'; SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql';
table_schema table_name row_format data_length index_length table_schema table_name row_format data_length index_length
mysqltest_innodb_zip t7 Dynamic {valid} 0
mysqltest_innodb_zip t8 Compact {valid} 0 mysqltest_innodb_zip t8 Compact {valid} 0
mysqltest_innodb_zip t9 Redundant {valid} 0 mysqltest_innodb_zip t9 Redundant {valid} 0
drop table t8, t9; drop table t7, t8, t9;
set global innodb_file_per_table=1; set global innodb_file_per_table=1;
set global innodb_file_format=Antelope; set global innodb_file_format=Antelope;
set global innodb_file_per_table=on; set global innodb_file_per_table=on;
......
...@@ -244,10 +244,10 @@ CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED; ...@@ -244,10 +244,10 @@ CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
--replace_regex / - .*[0-9]*[)]/)/ --replace_regex / - .*[0-9]*[)]/)/
SHOW WARNINGS; SHOW WARNINGS;
--replace_regex / - .*[0-9]*[)]/)/ --replace_regex / - .*[0-9]*[)]/)/
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
--replace_regex / - .*[0-9]*[)]/)/
SHOW WARNINGS; SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT; CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
SHOW WARNINGS; SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
...@@ -264,11 +264,10 @@ SHOW WARNINGS; ...@@ -264,11 +264,10 @@ SHOW WARNINGS;
--error ER_ILLEGAL_HA_CREATE_OPTION --error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=COMPRESSED; ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
SHOW WARNINGS; SHOW WARNINGS;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=DYNAMIC; ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
SHOW WARNINGS; SHOW WARNINGS;
SET GLOBAL innodb_file_format=Barracuda; SET GLOBAL innodb_file_format=Barracuda;
DROP TABLE IF EXISTS t1; DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SET GLOBAL innodb_file_format=Antelope; SET GLOBAL innodb_file_format=Antelope;
ALTER TABLE t1 ADD COLUMN f1 INT; ALTER TABLE t1 ADD COLUMN f1 INT;
...@@ -296,11 +295,10 @@ SHOW WARNINGS; ...@@ -296,11 +295,10 @@ SHOW WARNINGS;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED; CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
--replace_regex / - .*[0-9]*[)]/)/ --replace_regex / - .*[0-9]*[)]/)/
SHOW WARNINGS; SHOW WARNINGS;
--replace_regex / - .*[0-9]*[)]/)/
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC; CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
--replace_regex / - .*[0-9]*[)]/)/
SHOW WARNINGS; SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT; CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
SHOW WARNINGS; SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
...@@ -317,9 +315,9 @@ SHOW WARNINGS; ...@@ -317,9 +315,9 @@ SHOW WARNINGS;
--error ER_ILLEGAL_HA_CREATE_OPTION --error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=COMPRESSED; ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
SHOW WARNINGS; SHOW WARNINGS;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=DYNAMIC; ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
SHOW WARNINGS; SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
ALTER TABLE t1 ROW_FORMAT=COMPACT; ALTER TABLE t1 ROW_FORMAT=COMPACT;
SHOW WARNINGS; SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1'; SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
......
...@@ -275,16 +275,14 @@ create table t6 (id int primary key) engine = innodb row_format = compressed; ...@@ -275,16 +275,14 @@ create table t6 (id int primary key) engine = innodb row_format = compressed;
--replace_regex / - .*[0-9]*[)]/)/ --replace_regex / - .*[0-9]*[)]/)/
show warnings; show warnings;
--replace_regex / - .*[0-9]*[)]/)/ --replace_regex / - .*[0-9]*[)]/)/
--error ER_CANT_CREATE_TABLE
create table t7 (id int primary key) engine = innodb row_format = dynamic; create table t7 (id int primary key) engine = innodb row_format = dynamic;
--replace_regex / - .*[0-9]*[)]/)/
show warnings; show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact; create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant; create table t9 (id int primary key) engine = innodb row_format = redundant;
--replace_result 16384 {valid} 8192 {valid} 4096 {valid} --replace_result 16384 {valid} 8192 {valid} 4096 {valid}
--eval $query_i_s --eval $query_i_s
drop table t8, t9; drop table t7, t8, t9;
#test valid values with innodb_file_format unset #test valid values with innodb_file_format unset
set global innodb_file_per_table = on; set global innodb_file_per_table = on;
...@@ -312,17 +310,14 @@ show warnings; ...@@ -312,17 +310,14 @@ show warnings;
create table t6 (id int primary key) engine = innodb row_format = compressed; create table t6 (id int primary key) engine = innodb row_format = compressed;
--replace_regex / - .*[0-9]*[)]/)/ --replace_regex / - .*[0-9]*[)]/)/
show warnings; show warnings;
--replace_regex / - .*[0-9]*[)]/)/
--error ER_CANT_CREATE_TABLE
create table t7 (id int primary key) engine = innodb row_format = dynamic; create table t7 (id int primary key) engine = innodb row_format = dynamic;
--replace_regex / - .*[0-9]*[)]/)/
show warnings; show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact; create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant; create table t9 (id int primary key) engine = innodb row_format = redundant;
--replace_result 16384 {valid} 8192 {valid} 4096 {valid} --replace_result 16384 {valid} 8192 {valid} 4096 {valid}
--eval $query_i_s --eval $query_i_s
drop table t8, t9; drop table t7, t8, t9;
eval set global innodb_file_per_table=$per_table; eval set global innodb_file_per_table=$per_table;
eval set global innodb_file_format=$format; eval set global innodb_file_format=$format;
......
...@@ -12,15 +12,6 @@ SUBPARTITION BY HASH ( id2 ) ...@@ -12,15 +12,6 @@ SUBPARTITION BY HASH ( id2 )
SUBPARTITIONS 2 ( SUBPARTITIONS 2 (
PARTITION test_jfg_partition_name_with_60_chars_1234567890123456789012 VALUES LESS THAN (1000) ENGINE = InnoDB, PARTITION test_jfg_partition_name_with_60_chars_1234567890123456789012 VALUES LESS THAN (1000) ENGINE = InnoDB,
PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB); PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB);
Warnings:
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope.
Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
select database_name, table_name, length(table_name) from mysql.innodb_table_stats where database_name = 'mysqltest1'; select database_name, table_name, length(table_name) from mysql.innodb_table_stats where database_name = 'mysqltest1';
database_name table_name length(table_name) database_name table_name length(table_name)
CREATE TABLE mysqltest1.éééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé ( CREATE TABLE mysqltest1.éééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé (
......
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
compact
SET GLOBAL innodb_default_row_format = 'redundant';
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
redundant
SET GLOBAL innodb_default_row_format = 'dynamic';
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
dynamic
SET GLOBAL innodb_default_row_format = 'compact';
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
compact
SET GLOBAL innodb_default_row_format = 'compressed';
ERROR 42000: Variable 'innodb_default_row_format' can't be set to the value of 'compressed'
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
compact
SET GLOBAL innodb_default_row_format = 'foobar';
ERROR 42000: Variable 'innodb_default_row_format' can't be set to the value of 'foobar'
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
compact
SET GLOBAL innodb_default_row_format = 0;
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
redundant
SET GLOBAL innodb_default_row_format = 1;
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
compact
SET GLOBAL innodb_default_row_format = 2;
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
dynamic
SET GLOBAL innodb_default_row_format = 3;
ERROR 42000: Variable 'innodb_default_row_format' can't be set to the value of '3'
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
dynamic
SET GLOBAL innodb_default_row_format = 123;
ERROR 42000: Variable 'innodb_default_row_format' can't be set to the value of '123'
SELECT @@global.innodb_default_row_format;
@@global.innodb_default_row_format
dynamic
SET GLOBAL innodb_default_row_format = default;
...@@ -635,6 +635,20 @@ NUMERIC_BLOCK_SIZE 0 ...@@ -635,6 +635,20 @@ NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_DEFAULT_ROW_FORMAT
SESSION_VALUE NULL
GLOBAL_VALUE compact
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE compact
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM
VARIABLE_COMMENT The default ROW FORMAT for all innodb tables created without explicit ROW_FORMAT. Possible values are REDUNDANT, COMPACT, and DYNAMIC. The ROW_FORMAT value COMPRESSED is not allowed
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST redundant,compact,dynamic
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_DEFRAGMENT VARIABLE_NAME INNODB_DEFRAGMENT
SESSION_VALUE NULL SESSION_VALUE NULL
GLOBAL_VALUE OFF GLOBAL_VALUE OFF
......
--source include/have_innodb.inc
# Check the default value
SELECT @@global.innodb_default_row_format;
SET GLOBAL innodb_default_row_format = 'redundant';
SELECT @@global.innodb_default_row_format;
SET GLOBAL innodb_default_row_format = 'dynamic';
SELECT @@global.innodb_default_row_format;
SET GLOBAL innodb_default_row_format = 'compact';
SELECT @@global.innodb_default_row_format;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL innodb_default_row_format = 'compressed';
SELECT @@global.innodb_default_row_format;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL innodb_default_row_format = 'foobar';
SELECT @@global.innodb_default_row_format;
SET GLOBAL innodb_default_row_format = 0;
SELECT @@global.innodb_default_row_format;
SET GLOBAL innodb_default_row_format = 1;
SELECT @@global.innodb_default_row_format;
SET GLOBAL innodb_default_row_format = 2;
SELECT @@global.innodb_default_row_format;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL innodb_default_row_format = 3;
SELECT @@global.innodb_default_row_format;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL innodb_default_row_format = 123;
SELECT @@global.innodb_default_row_format;
SET GLOBAL innodb_default_row_format = default;
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -326,10 +327,8 @@ dict_build_table_def_step( ...@@ -326,10 +327,8 @@ dict_build_table_def_step(
mtr_commit(&mtr); mtr_commit(&mtr);
} else { } else {
/* Create in the system tablespace: disallow Barracuda /* Create in the system tablespace */
features by keeping only the first bit which says whether ut_ad(table->space == TRX_SYS_SPACE);
the row format is redundant or compact */
table->flags &= DICT_TF_COMPACT;
} }
row = dict_create_sys_tables_tuple(table, node->heap); row = dict_create_sys_tables_tuple(table, node->heap);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2017, MariaDB Corporation. Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc. Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
...@@ -314,6 +314,23 @@ static TYPELIB innodb_lock_schedule_algorithm_typelib = { ...@@ -314,6 +314,23 @@ static TYPELIB innodb_lock_schedule_algorithm_typelib = {
NULL NULL
}; };
/** Possible values for system variable "innodb_default_row_format". */
static const char* innodb_default_row_format_names[] = {
"redundant",
"compact",
"dynamic",
NullS
};
/** Used to define an enumerate type of the system variable
innodb_default_row_format. */
static TYPELIB innodb_default_row_format_typelib = {
array_elements(innodb_default_row_format_names) - 1,
"innodb_default_row_format_typelib",
innodb_default_row_format_names,
NULL
};
/* The following counter is used to convey information to InnoDB /* The following counter is used to convey information to InnoDB
about server activity: in case of normal DML ops it is not about server activity: in case of normal DML ops it is not
sensible to call srv_active_wake_master_thread after each sensible to call srv_active_wake_master_thread after each
...@@ -334,6 +351,35 @@ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = { ...@@ -334,6 +351,35 @@ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = {
"all" /* IBUF_USE_ALL */ "all" /* IBUF_USE_ALL */
}; };
/** Note we cannot use rec_format_enum because we do not allow
COMPRESSED row format for innodb_default_row_format option. */
enum default_row_format_enum {
DEFAULT_ROW_FORMAT_REDUNDANT = 0,
DEFAULT_ROW_FORMAT_COMPACT = 1,
DEFAULT_ROW_FORMAT_DYNAMIC = 2
};
/** Convert an InnoDB ROW_FORMAT value.
@param[in] row_format row_format from "innodb_default_row_format"
@return converted ROW_FORMAT */
static rec_format_t get_row_format(ulong row_format)
{
switch (row_format) {
case DEFAULT_ROW_FORMAT_REDUNDANT:
return REC_FORMAT_REDUNDANT;
case DEFAULT_ROW_FORMAT_COMPACT:
return REC_FORMAT_COMPACT;
case DEFAULT_ROW_FORMAT_DYNAMIC:
return REC_FORMAT_DYNAMIC;
default:
ut_ad(0);
return REC_FORMAT_COMPACT;
}
}
static ulong innodb_default_row_format;
/* Call back function array defined by MySQL and used to /* Call back function array defined by MySQL and used to
retrieve FTS results. */ retrieve FTS results. */
const struct _ft_vft ft_vft_result = {NULL, const struct _ft_vft ft_vft_result = {NULL,
...@@ -11326,8 +11372,6 @@ create_options_are_invalid( ...@@ -11326,8 +11372,6 @@ create_options_are_invalid(
CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE; CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE;
break; break;
case ROW_TYPE_DYNAMIC: case ROW_TYPE_DYNAMIC:
CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE(use_tablespace);
CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE;
/* ROW_FORMAT=DYNAMIC also shuns KEY_BLOCK_SIZE */ /* ROW_FORMAT=DYNAMIC also shuns KEY_BLOCK_SIZE */
/* fall through */ /* fall through */
case ROW_TYPE_COMPACT: case ROW_TYPE_COMPACT:
...@@ -11561,7 +11605,8 @@ innobase_table_flags( ...@@ -11561,7 +11605,8 @@ innobase_table_flags(
bool zip_allowed = true; bool zip_allowed = true;
ulint zip_ssize = 0; ulint zip_ssize = 0;
enum row_type row_format; enum row_type row_format;
rec_format_t innodb_row_format = REC_FORMAT_COMPACT; rec_format_t innodb_row_format =
get_row_format(innodb_default_row_format);
bool use_data_dir; bool use_data_dir;
ha_table_option_struct *options= form->s->option_struct; ha_table_option_struct *options= form->s->option_struct;
...@@ -11708,37 +11753,29 @@ innobase_table_flags( ...@@ -11708,37 +11753,29 @@ innobase_table_flags(
/* Validate the row format. Correct it if necessary */ /* Validate the row format. Correct it if necessary */
switch (row_format) { switch (row_format) {
case ROW_TYPE_DEFAULT:
break;
case ROW_TYPE_REDUNDANT: case ROW_TYPE_REDUNDANT:
innodb_row_format = REC_FORMAT_REDUNDANT; innodb_row_format = REC_FORMAT_REDUNDANT;
break; break;
case ROW_TYPE_COMPRESSED:
case ROW_TYPE_DYNAMIC: case ROW_TYPE_DYNAMIC:
innodb_row_format = REC_FORMAT_DYNAMIC;
break;
case ROW_TYPE_COMPRESSED:
if (!use_tablespace) { if (!use_tablespace) {
push_warning_printf( push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN, thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION, ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ROW_FORMAT=%s requires" "InnoDB: ROW_FORMAT=COMPRESSED requires"
" innodb_file_per_table.", " innodb_file_per_table.");
get_row_format_name(row_format));
} else if (file_format_allowed == UNIV_FORMAT_A) { } else if (file_format_allowed == UNIV_FORMAT_A) {
push_warning_printf( push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN, thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION, ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ROW_FORMAT=%s requires" "InnoDB: ROW_FORMAT=COMPRESSED requires"
" innodb_file_format > Antelope.", " innodb_file_format > Antelope.");
get_row_format_name(row_format));
} else { } else {
switch(row_format) { innodb_row_format = REC_FORMAT_COMPRESSED;
case ROW_TYPE_COMPRESSED:
innodb_row_format = REC_FORMAT_COMPRESSED;
break;
case ROW_TYPE_DYNAMIC:
innodb_row_format = REC_FORMAT_DYNAMIC;
break;
default:
/* Not possible, avoid compiler warning */
break;
}
break; /* Correct row_format */ break; /* Correct row_format */
} }
zip_allowed = FALSE; zip_allowed = FALSE;
...@@ -11752,10 +11789,8 @@ innobase_table_flags( ...@@ -11752,10 +11789,8 @@ innobase_table_flags(
ER_ILLEGAL_HA_CREATE_OPTION, ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: assuming ROW_FORMAT=COMPACT."); "InnoDB: assuming ROW_FORMAT=COMPACT.");
/* fall through */ /* fall through */
case ROW_TYPE_DEFAULT:
/* If we fell through, set row format to Compact. */
row_format = ROW_TYPE_COMPACT;
case ROW_TYPE_COMPACT: case ROW_TYPE_COMPACT:
innodb_row_format = REC_FORMAT_COMPACT;
break; break;
} }
...@@ -19805,6 +19840,14 @@ static MYSQL_SYSVAR_BOOL(cmp_per_index_enabled, srv_cmp_per_index_enabled, ...@@ -19805,6 +19840,14 @@ static MYSQL_SYSVAR_BOOL(cmp_per_index_enabled, srv_cmp_per_index_enabled,
"may have negative impact on performance (off by default)", "may have negative impact on performance (off by default)",
NULL, innodb_cmp_per_index_update, FALSE); NULL, innodb_cmp_per_index_update, FALSE);
static MYSQL_SYSVAR_ENUM(default_row_format, innodb_default_row_format,
PLUGIN_VAR_RQCMDARG,
"The default ROW FORMAT for all innodb tables created without explicit"
" ROW_FORMAT. Possible values are REDUNDANT, COMPACT, and DYNAMIC."
" The ROW_FORMAT value COMPRESSED is not allowed",
NULL, NULL, DEFAULT_ROW_FORMAT_COMPACT,
&innodb_default_row_format_typelib);
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug, static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_NOCMDOPT, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_NOCMDOPT,
...@@ -20174,6 +20217,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { ...@@ -20174,6 +20217,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(sync_array_size), MYSQL_SYSVAR(sync_array_size),
MYSQL_SYSVAR(compression_failure_threshold_pct), MYSQL_SYSVAR(compression_failure_threshold_pct),
MYSQL_SYSVAR(compression_pad_pct_max), MYSQL_SYSVAR(compression_pad_pct_max),
MYSQL_SYSVAR(default_row_format),
MYSQL_SYSVAR(simulate_comp_failures), MYSQL_SYSVAR(simulate_comp_failures),
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
MYSQL_SYSVAR(trx_rseg_n_slots_debug), MYSQL_SYSVAR(trx_rseg_n_slots_debug),
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation. Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -327,10 +327,8 @@ dict_build_table_def_step( ...@@ -327,10 +327,8 @@ dict_build_table_def_step(
mtr_commit(&mtr); mtr_commit(&mtr);
} else { } else {
/* Create in the system tablespace: disallow Barracuda /* Create in the system tablespace */
features by keeping only the first bit which says whether ut_ad(table->space == TRX_SYS_SPACE);
the row format is redundant or compact */
table->flags &= DICT_TF_COMPACT;
} }
row = dict_create_sys_tables_tuple(table, node->heap); row = dict_create_sys_tables_tuple(table, node->heap);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2017, MariaDB Corporation. Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc. Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
...@@ -367,6 +367,23 @@ static TYPELIB innodb_lock_schedule_algorithm_typelib = { ...@@ -367,6 +367,23 @@ static TYPELIB innodb_lock_schedule_algorithm_typelib = {
}; };
/** Possible values for system variable "innodb_default_row_format". */
static const char* innodb_default_row_format_names[] = {
"redundant",
"compact",
"dynamic",
NullS
};
/** Used to define an enumerate type of the system variable
innodb_default_row_format. */
static TYPELIB innodb_default_row_format_typelib = {
array_elements(innodb_default_row_format_names) - 1,
"innodb_default_row_format_typelib",
innodb_default_row_format_names,
NULL
};
/* The following counter is used to convey information to InnoDB /* The following counter is used to convey information to InnoDB
about server activity: in case of normal DML ops it is not about server activity: in case of normal DML ops it is not
sensible to call srv_active_wake_master_thread after each sensible to call srv_active_wake_master_thread after each
...@@ -387,6 +404,35 @@ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = { ...@@ -387,6 +404,35 @@ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = {
"all" /* IBUF_USE_ALL */ "all" /* IBUF_USE_ALL */
}; };
/** Note we cannot use rec_format_enum because we do not allow
COMPRESSED row format for innodb_default_row_format option. */
enum default_row_format_enum {
DEFAULT_ROW_FORMAT_REDUNDANT = 0,
DEFAULT_ROW_FORMAT_COMPACT = 1,
DEFAULT_ROW_FORMAT_DYNAMIC = 2
};
/** Convert an InnoDB ROW_FORMAT value.
@param[in] row_format row_format from "innodb_default_row_format"
@return converted ROW_FORMAT */
static rec_format_t get_row_format(ulong row_format)
{
switch (row_format) {
case DEFAULT_ROW_FORMAT_REDUNDANT:
return REC_FORMAT_REDUNDANT;
case DEFAULT_ROW_FORMAT_COMPACT:
return REC_FORMAT_COMPACT;
case DEFAULT_ROW_FORMAT_DYNAMIC:
return REC_FORMAT_DYNAMIC;
default:
ut_ad(0);
return REC_FORMAT_COMPACT;
}
}
static ulong innodb_default_row_format;
/* Call back function array defined by MySQL and used to /* Call back function array defined by MySQL and used to
retrieve FTS results. */ retrieve FTS results. */
const struct _ft_vft ft_vft_result = {NULL, const struct _ft_vft ft_vft_result = {NULL,
...@@ -11896,8 +11942,6 @@ create_options_are_invalid( ...@@ -11896,8 +11942,6 @@ create_options_are_invalid(
CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE; CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE;
break; break;
case ROW_TYPE_DYNAMIC: case ROW_TYPE_DYNAMIC:
CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE(use_tablespace);
CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE;
/* ROW_FORMAT=DYNAMIC also shuns KEY_BLOCK_SIZE */ /* ROW_FORMAT=DYNAMIC also shuns KEY_BLOCK_SIZE */
/* fall through */ /* fall through */
case ROW_TYPE_COMPACT: case ROW_TYPE_COMPACT:
...@@ -12132,7 +12176,8 @@ innobase_table_flags( ...@@ -12132,7 +12176,8 @@ innobase_table_flags(
bool zip_allowed = true; bool zip_allowed = true;
ulint zip_ssize = 0; ulint zip_ssize = 0;
enum row_type row_format; enum row_type row_format;
rec_format_t innodb_row_format = REC_FORMAT_COMPACT; rec_format_t innodb_row_format =
get_row_format(innodb_default_row_format);
bool use_data_dir; bool use_data_dir;
ha_table_option_struct *options= form->s->option_struct; ha_table_option_struct *options= form->s->option_struct;
...@@ -12274,38 +12319,29 @@ innobase_table_flags( ...@@ -12274,38 +12319,29 @@ innobase_table_flags(
/* Validate the row format. Correct it if necessary */ /* Validate the row format. Correct it if necessary */
switch (row_format) { switch (row_format) {
case ROW_TYPE_DEFAULT:
break;
case ROW_TYPE_REDUNDANT: case ROW_TYPE_REDUNDANT:
innodb_row_format = REC_FORMAT_REDUNDANT; innodb_row_format = REC_FORMAT_REDUNDANT;
break; break;
case ROW_TYPE_COMPRESSED:
case ROW_TYPE_DYNAMIC: case ROW_TYPE_DYNAMIC:
innodb_row_format = REC_FORMAT_DYNAMIC;
break;
case ROW_TYPE_COMPRESSED:
if (!use_tablespace) { if (!use_tablespace) {
push_warning_printf( push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN, thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION, ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ROW_FORMAT=%s requires" "InnoDB: ROW_FORMAT=COMPRESSED requires"
" innodb_file_per_table.", " innodb_file_per_table.");
get_row_format_name(row_format));
} else if (file_format_allowed == UNIV_FORMAT_A) { } else if (file_format_allowed == UNIV_FORMAT_A) {
push_warning_printf( push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN, thd, Sql_condition::WARN_LEVEL_WARN,
ER_ILLEGAL_HA_CREATE_OPTION, ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: ROW_FORMAT=%s requires" "InnoDB: ROW_FORMAT=COMPRESSED requires"
" innodb_file_format > Antelope.", " innodb_file_format > Antelope.");
get_row_format_name(row_format));
} else { } else {
switch(row_format) { innodb_row_format = REC_FORMAT_COMPRESSED;
case ROW_TYPE_COMPRESSED:
innodb_row_format = REC_FORMAT_COMPRESSED;
break;
case ROW_TYPE_DYNAMIC:
innodb_row_format = REC_FORMAT_DYNAMIC;
break;
default:
/* Not possible, avoid compiler warning */
break;
}
break; /* Correct row_format */ break; /* Correct row_format */
} }
zip_allowed = FALSE; zip_allowed = FALSE;
...@@ -12320,11 +12356,8 @@ innobase_table_flags( ...@@ -12320,11 +12356,8 @@ innobase_table_flags(
ER_ILLEGAL_HA_CREATE_OPTION, ER_ILLEGAL_HA_CREATE_OPTION,
"InnoDB: assuming ROW_FORMAT=COMPACT."); "InnoDB: assuming ROW_FORMAT=COMPACT.");
/* fall through */ /* fall through */
case ROW_TYPE_DEFAULT:
/* If we fell through, set row format to Compact. */
row_format = ROW_TYPE_COMPACT;
/* fall through */
case ROW_TYPE_COMPACT: case ROW_TYPE_COMPACT:
innodb_row_format = REC_FORMAT_COMPACT;
break; break;
} }
...@@ -21115,6 +21148,14 @@ static MYSQL_SYSVAR_BOOL(cmp_per_index_enabled, srv_cmp_per_index_enabled, ...@@ -21115,6 +21148,14 @@ static MYSQL_SYSVAR_BOOL(cmp_per_index_enabled, srv_cmp_per_index_enabled,
"may have negative impact on performance (off by default)", "may have negative impact on performance (off by default)",
NULL, innodb_cmp_per_index_update, FALSE); NULL, innodb_cmp_per_index_update, FALSE);
static MYSQL_SYSVAR_ENUM(default_row_format, innodb_default_row_format,
PLUGIN_VAR_RQCMDARG,
"The default ROW FORMAT for all innodb tables created without explicit"
" ROW_FORMAT. Possible values are REDUNDANT, COMPACT, and DYNAMIC."
" The ROW_FORMAT value COMPRESSED is not allowed",
NULL, NULL, DEFAULT_ROW_FORMAT_COMPACT,
&innodb_default_row_format_typelib);
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug, static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_NOCMDOPT, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_NOCMDOPT,
...@@ -21558,6 +21599,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { ...@@ -21558,6 +21599,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(sync_array_size), MYSQL_SYSVAR(sync_array_size),
MYSQL_SYSVAR(compression_failure_threshold_pct), MYSQL_SYSVAR(compression_failure_threshold_pct),
MYSQL_SYSVAR(compression_pad_pct_max), MYSQL_SYSVAR(compression_pad_pct_max),
MYSQL_SYSVAR(default_row_format),
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
MYSQL_SYSVAR(trx_rseg_n_slots_debug), MYSQL_SYSVAR(trx_rseg_n_slots_debug),
MYSQL_SYSVAR(limit_optimistic_insert_debug), MYSQL_SYSVAR(limit_optimistic_insert_debug),
......
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