mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
0aa021396b
A change in the default values of some config parameters caused this test to fail, adjust the test and make it more robust so it does not fail for the same reason in the future.
101 lines
3.8 KiB
Text
101 lines
3.8 KiB
Text
# Test Bug #54679 alter table causes compressed row_format to revert to compact
|
|
|
|
--source include/have_innodb.inc
|
|
|
|
let $file_format=`select @@innodb_file_format`;
|
|
let $file_format_max=`select @@innodb_file_format_max`;
|
|
let $file_per_table=`select @@innodb_file_per_table`;
|
|
SET GLOBAL innodb_file_format='Barracuda';
|
|
SET GLOBAL innodb_file_per_table=ON;
|
|
SET innodb_strict_mode=ON;
|
|
|
|
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
|
|
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
|
|
WHERE TABLE_NAME='bug54679';
|
|
|
|
# The ROW_FORMAT of the table should be preserved when it is not specified
|
|
# in ALTER TABLE.
|
|
ALTER TABLE bug54679 ADD COLUMN b INT;
|
|
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
|
|
WHERE TABLE_NAME='bug54679';
|
|
|
|
DROP TABLE bug54679;
|
|
|
|
# Check that the ROW_FORMAT conversion to/from COMPRESSED works.
|
|
|
|
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB;
|
|
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
|
|
WHERE TABLE_NAME='bug54679';
|
|
|
|
# KEY_BLOCK_SIZE implies COMPRESSED.
|
|
ALTER TABLE bug54679 KEY_BLOCK_SIZE=1;
|
|
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
|
|
WHERE TABLE_NAME='bug54679';
|
|
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
--error ER_CANT_CREATE_TABLE
|
|
ALTER TABLE bug54679 ROW_FORMAT=REDUNDANT;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
SHOW WARNINGS;
|
|
DROP TABLE bug54679;
|
|
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
|
|
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
|
|
WHERE TABLE_NAME='bug54679';
|
|
|
|
ALTER TABLE bug54679 KEY_BLOCK_SIZE=2;
|
|
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables
|
|
WHERE TABLE_NAME='bug54679';
|
|
|
|
# This prevents other than REDUNDANT or COMPACT ROW_FORMAT for new tables.
|
|
SET GLOBAL innodb_file_format=Antelope;
|
|
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
--error ER_CANT_CREATE_TABLE
|
|
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
SHOW WARNINGS;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
--error ER_CANT_CREATE_TABLE
|
|
ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
SHOW WARNINGS;
|
|
DROP TABLE bug54679;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
--error ER_CANT_CREATE_TABLE
|
|
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
SHOW WARNINGS;
|
|
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB;
|
|
|
|
SET GLOBAL innodb_file_format=Barracuda;
|
|
# This will prevent ROW_FORMAT=COMPRESSED, because the system tablespace
|
|
# cannot be compressed.
|
|
SET GLOBAL innodb_file_per_table=OFF;
|
|
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
--error ER_CANT_CREATE_TABLE
|
|
ALTER TABLE bug54679 KEY_BLOCK_SIZE=4;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
SHOW WARNINGS;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
--error ER_CANT_CREATE_TABLE
|
|
ALTER TABLE bug54679 ROW_FORMAT=DYNAMIC;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
SHOW WARNINGS;
|
|
DROP TABLE bug54679;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
--error ER_CANT_CREATE_TABLE
|
|
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
|
|
SHOW WARNINGS;
|
|
SET GLOBAL innodb_file_per_table=ON;
|
|
CREATE TABLE bug54679 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
|
|
DROP TABLE bug54679;
|
|
|
|
# restore original values, quietly so the test does not fail if those
|
|
# defaults are changed
|
|
-- disable_query_log
|
|
EVAL SET GLOBAL innodb_file_format=$file_format;
|
|
EVAL SET GLOBAL innodb_file_format_max=$file_format_max;
|
|
EVAL SET GLOBAL innodb_file_per_table=$file_per_table;
|
|
-- enable_query_log
|