1
0
mirror of https://github.com/MariaDB/server.git synced 2025-04-26 11:49:09 +03:00
mariadb/mysql-test/suite/innodb/t/default_row_format_compatibility.test
Alexander Barkov 36eba98817 MDEV-19123 Change default charset from latin1 to utf8mb4
Changing the default server character set from latin1 to utf8mb4.
2024-07-11 10:21:07 +04:00

178 lines
4.8 KiB
Plaintext

--source include/have_innodb.inc
--source include/test_db_charset_latin1.inc
call mtr.add_suppression("Index for table 'tab' is corrupt; try to repair it");
SET @row_format = @@GLOBAL.innodb_default_row_format;
# 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 original 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;
--move_file $MYSQLD_DATADIR/test/tab.cfg $MYSQLD_DATADIR/tab.cfg
--move_file $MYSQLD_DATADIR/test/tab.ibd $MYSQLD_DATADIR/tab.ibd
# Cleanup
DROP TABLE tab;
# 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
--copy_file $MYSQLD_DATADIR/tab.cfg $MYSQLD_DATADIR/test/tab.ibd
--move_file $MYSQLD_DATADIR/tab.cfg $MYSQLD_DATADIR/test/tab.cfg
call mtr.add_suppression("InnoDB: Tried to read .* bytes at offset 0");
--error ER_NOT_KEYFILE
ALTER TABLE tab IMPORT TABLESPACE;
--remove_file $MYSQLD_DATADIR/test/tab.ibd
--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;
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;
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SET GLOBAL innodb_read_only_compressed=ON;
--error ER_UNSUPPORTED_COMPRESSED_TABLE
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
SET GLOBAL innodb_read_only_compressed=OFF;
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
SET GLOBAL innodb_read_only_compressed=ON;
# Check by SELECT, no errors
SELECT * FROM tab;
ALTER TABLE tab ROW_FORMAT=Dynamic;
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
# Check no errors
--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;
--source include/test_db_charset_restore.inc