mirror of
https://github.com/MariaDB/server.git
synced 2025-07-24 19:42:23 +03:00
This allows one to run the test suite even if any of the following options are changed: - character-set-server - collation-server - join-cache-level - log-basename - max-allowed-packet - optimizer-switch - query-cache-size and query-cache-type - skip-name-resolve - table-definition-cache - table-open-cache - Some innodb options etc Changes: - Don't print out the value of system variables as one can't depend on them to being constants. - Don't set global variables to 'default' as the default may not be the same as the test was started with if there was an additional option file. Instead save original value and reset it at end of test. - Test that depends on the latin1 character set should include default_charset.inc or set the character set to latin1 - Test that depends on the original optimizer switch, should include default_optimizer_switch.inc - Test that depends on the value of a specific system variable should set it in the test (like optimizer_use_condition_selectivity) - Split subselect3.test into subselect3.test and subselect3.inc to make it easier to set and reset system variables. - Added .opt files for test that required specfic options that could be changed by external configuration files. - Fixed result files in rockdsb & tokudb that had not been updated for a while.
151 lines
4.6 KiB
Plaintext
151 lines
4.6 KiB
Plaintext
#
|
|
# Bug#20015132 ALTER TABLE FAILS TO CHECK IF TABLE IS CORRUPTED
|
|
#
|
|
CREATE TABLE t1(c1 INT PRIMARY KEY, c2 CHAR(1), c3 INT UNSIGNED) ENGINE=InnoDB;
|
|
SET @saved_debug_dbug = @@SESSION.debug_dbug;
|
|
SET DEBUG_DBUG='+d,create_index_metadata_fail';
|
|
ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
|
|
ERROR HY000: The table 't1' is full
|
|
SET DEBUG_DBUG='+d,ib_create_table_fail_too_many_trx';
|
|
ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
|
|
ERROR HY000: Too many active concurrent transactions
|
|
SET DEBUG_DBUG=@saved_debug_dbug;
|
|
ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
|
|
SET DEBUG_DBUG='+d,dict_set_index_corrupted';
|
|
CHECK TABLE t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check Warning InnoDB: Index c2 is marked as corrupted
|
|
test.t1 check Warning InnoDB: Index c3 is marked as corrupted
|
|
test.t1 check error Corrupt
|
|
CHECK TABLE t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check Warning InnoDB: Index c2 is marked as corrupted
|
|
test.t1 check Warning InnoDB: Index c3 is marked as corrupted
|
|
test.t1 check error Corrupt
|
|
ALTER TABLE t1 DROP INDEX c2;
|
|
CHECK TABLE t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check Warning InnoDB: Index c3 is marked as corrupted
|
|
test.t1 check error Corrupt
|
|
ALTER TABLE t1 ADD INDEX (c2,c3);
|
|
ERROR HY000: Index c3 is corrupted
|
|
ALTER TABLE t1 CHANGE c3 c3 INT NOT NULL;
|
|
CHECK TABLE t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
ALTER TABLE t1 ADD INDEX (c2,c3);
|
|
DROP TABLE t1;
|
|
#
|
|
# Bug #14669848 CRASH DURING ALTER MAKES ORIGINAL TABLE INACCESSIBLE
|
|
#
|
|
# -- Scenario 1:
|
|
# Crash the server in ha_innobase::commit_inplace_alter_table()
|
|
# just after committing the dictionary changes.
|
|
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb;
|
|
INSERT INTO t1 VALUES (1,2),(3,4);
|
|
SET DEBUG_DBUG='+d,innodb_alter_commit_crash_after_commit';
|
|
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
|
|
ERROR HY000: Lost connection to MySQL server during query
|
|
# Restart mysqld after the crash and reconnect.
|
|
SELECT * FROM information_schema.innodb_sys_tables
|
|
WHERE table_id = ID;
|
|
TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
|
|
# Files in datadir after manual recovery.
|
|
db.opt
|
|
t1.frm
|
|
t1.ibd
|
|
SHOW TABLES;
|
|
Tables_in_test
|
|
t1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` int(11) NOT NULL,
|
|
PRIMARY KEY (`f2`,`f1`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
INSERT INTO t1 VALUES (5,6),(7,8);
|
|
SELECT * FROM t1;
|
|
f1 f2
|
|
1 2
|
|
3 4
|
|
5 6
|
|
7 8
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=InnoDB;
|
|
ALTER TABLE t1 ADD PRIMARY KEY (f2, f1);
|
|
DROP TABLE t1;
|
|
# -- Scenario 2:
|
|
# Crash the server in ha_innobase::commit_inplace_alter_table()
|
|
# just before committing the dictionary changes, but after
|
|
# writing the MLOG_FILE_RENAME records. As the mini-transaction
|
|
# is not committed, the renames will not be replayed.
|
|
CREATE TABLE t2 (f1 int not null, f2 int not null) ENGINE=InnoDB;
|
|
INSERT INTO t2 VALUES (1,2),(3,4);
|
|
SET DEBUG_DBUG='+d,innodb_alter_commit_crash_before_commit';
|
|
ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
|
|
ERROR HY000: Lost connection to MySQL server during query
|
|
# Startup the server after the crash
|
|
SELECT * FROM information_schema.innodb_sys_tables
|
|
WHERE name LIKE 'test/#sql-%';
|
|
TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
|
|
SHOW TABLES;
|
|
Tables_in_test
|
|
t2
|
|
INSERT INTO t2 VALUES (5,6),(7,8);
|
|
SELECT * from t2;
|
|
f1 f2
|
|
1 2
|
|
3 4
|
|
5 6
|
|
7 8
|
|
SHOW CREATE TABLE t2;
|
|
Table Create Table
|
|
t2 CREATE TABLE `t2` (
|
|
`f1` int(11) NOT NULL,
|
|
`f2` int(11) NOT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
DROP TABLE t2;
|
|
CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=InnoDB;
|
|
ALTER TABLE t2 ADD PRIMARY KEY (f2, f1);
|
|
DROP TABLE t2;
|
|
db.opt
|
|
# -------------------------
|
|
# End of Testing Scenario 2
|
|
# -------------------------
|
|
#
|
|
# Bug#19330255 WL#7142 - CRASH DURING ALTER TABLE LEADS TO
|
|
# DATA DICTIONARY INCONSISTENCY
|
|
#
|
|
CREATE TABLE t1(a int PRIMARY KEY, b varchar(255), c int NOT NULL)
|
|
ENGINE=InnoDB;
|
|
INSERT INTO t1 SET a=1,c=2;
|
|
SET DEBUG_DBUG='+d,innodb_alter_commit_crash_after_commit';
|
|
ALTER TABLE t1 ADD INDEX (b), CHANGE c d int, ALGORITHM=INPLACE;
|
|
ERROR HY000: Lost connection to MySQL server during query
|
|
# Restart mysqld after the crash and reconnect.
|
|
SELECT * FROM information_schema.innodb_sys_tables
|
|
WHERE table_id = ID;
|
|
TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
|
|
# Files in datadir after manual recovery.
|
|
db.opt
|
|
t1.frm
|
|
t1.ibd
|
|
SHOW TABLES;
|
|
Tables_in_test
|
|
t1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) NOT NULL,
|
|
`b` varchar(255) DEFAULT NULL,
|
|
`d` int(11) DEFAULT NULL,
|
|
PRIMARY KEY (`a`),
|
|
KEY `b` (`b`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
UPDATE t1 SET d=NULL;
|
|
SELECT * FROM t1;
|
|
a b d
|
|
1 NULL NULL
|
|
DROP TABLE t1;
|