Commit dbaa8dda authored by Alice Sherepa's avatar Alice Sherepa

tests merged 10.0 with mysql 5.6.37

parent 19d21b93
--source include/have_innodb.inc
--echo #
--echo # Bug #19471516 SERVER CRASHES WHEN EXECUTING ALTER TABLE ADD
--echo # FOREIGN KEY
--echo #
CREATE TABLE `parent` (`parent_id` INT, PRIMARY KEY (`parent_id`));
CREATE TABLE `child1` (`id` INT ,`child1_fk1` INT, `child1_fk2` INT,
PRIMARY KEY (`id`));
CREATE TABLE `child2` (`id` INT, `child2_fk1` INT, `child2_fk2` INT,
PRIMARY KEY (`id`));
CREATE TABLE `child3` (`id` INT , `child3_fk1` INT, PRIMARY KEY (`id`));
ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk1`) REFERENCES `parent`
(`parent_id`);
ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk1`) REFERENCES
`parent` (`parent_id`);
ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk2`) REFERENCES `parent`
(`parent_id`);
ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk1`) REFERENCES `parent`
(`parent_id`);
ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk2`) REFERENCES `parent`
(`parent_id`);
ALTER TABLE `child3` ADD FOREIGN KEY (`child3_fk1`) REFERENCES `parent`
(`parent_id`);
ALTER TABLE `child1` ADD FOREIGN KEY (`child1_fk2`) REFERENCES
`parent` (`parent_id`);
ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk1`) REFERENCES
`parent` (`parent_id`);
ALTER TABLE `child2` ADD FOREIGN KEY (`child2_fk2`) REFERENCES
`parent` (`parent_id`);
ALTER TABLE `child3` ADD FOREIGN KEY (`child3_fk1`) REFERENCES
`parent` (`parent_id`);
drop table child3, child2, child1, parent;
#
# BUG#22385442 - INNODB: DIFFICULT TO FIND FREE BLOCKS IN THE BUFFER POOL
#
--source include/have_innodb.inc
--source include/big_test.inc
DELIMITER |;
CREATE PROCEDURE populate_t1()
BEGIN
DECLARE i int DEFAULT 1;
START TRANSACTION;
WHILE (i <= 1000000) DO
INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
SET i = i + 1;
END WHILE;
COMMIT;
END|
DELIMITER ;|
CREATE TABLE t1(
class INT,
id INT,
title VARCHAR(100)
) ENGINE=InnoDB;
-- disable_query_log
CALL populate_t1();
-- enable_query_log
SELECT COUNT(*) FROM t1;
SET GLOBAL innodb_stats_persistent_sample_pages=2000;
ANALYZE TABLE t1;
DROP TABLE t1;
DROP PROCEDURE populate_t1;
SET GLOBAL innodb_stats_persistent_sample_pages=default;
--innodb-log-files-in-group=12 --innodb-log-file-size=5M
--source include/not_embedded.inc
--source include/not_crashrep.inc
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
--echo #
--echo # Bug #19498877 LIMITATION ON BLOB SIZE IS TOO STRICT, BLOB CAN
--echo # BE 10% OF TOTAL REDO LOG SIZE
--echo #
# Save the initial number of concurrent sessions.
--source include/count_sessions.inc
call mtr.add_suppression("InnoDB: Resizing redo log from");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files.");
call mtr.add_suppression("InnoDB: New log files created, LSN=");
SET GLOBAL max_allowed_packet = 100*1024*1024;
--echo # Connection big_packets:
connect(big_packets,localhost,root,,);
connection big_packets;
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b LONGBLOB) ENGINE=InnoDB;
# Insert a few rows (it doesn't really matter how many). These transactions
# are committed once they are acked, so they should not be lost.
INSERT INTO t1 (a, b) VALUES (1, '1');
INSERT INTO t1 (a, b) VALUES (2, '2');
INSERT INTO t1 (a, b) VALUES (3, '3');
INSERT INTO t1 (a, b) VALUES (4, '4');
INSERT INTO t1 (a, b) VALUES (5, '5');
start transaction;
INSERT INTO t1 (a, b) VALUES (6, REPEAT('a', 6*1024*1024));
--echo # Connection default:
connection default;
# We expect a restart.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--echo # Quick shutdown and restart server
--shutdown_server 0
# Wait for the server to come back up, and reconnect.
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
--echo # Connection default:
connection default;
--disconnect big_packets
# We should see (1,2,3,4,5) here.
SELECT a, b FROM t1;
SET GLOBAL max_allowed_packet = 100*1024*1024;
--echo # Connection big_packets:
connect(big_packets,localhost,root,,);
start transaction;
UPDATE t1 SET b = REPEAT('a', 6*1024*1024) WHERE a = 1;
--echo # Connection default:
connection default;
# We expect a restart.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--echo # Quick shutdown and restart server
--shutdown_server 0
# Wait for the server to come back up, and reconnect.
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
--echo # Connection default:
connection default;
--disconnect big_packets
# We should see (1,2,3,4,5) here.
SELECT a, b FROM t1;
# Clean up.
DROP TABLE t1;
--source include/wait_until_count_sessions.inc
--source include/not_embedded.inc
--source include/have_innodb.inc
--source suite/innodb/include/checksum_not_strict.inc
--echo #
--echo # Bug#19500258 ZERO CAN BE A VALID INNODB CHECKSUM,
--echo # BUT VALIDATION WILL FAIL LATER
--echo #
--let $old_checksum_algorithm= `SELECT @@GLOBAL.innodb_checksum_algorithm`
SET GLOBAL innodb_checksum_algorithm = 'CRC32';
CREATE TABLE t1 (a INT PRIMARY KEY, b VARBINARY(512)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, X'666F72636520637263333220a0be0639');
--source include/restart_mysqld.inc
SELECT count(*) FROM t1;
--eval SET GLOBAL innodb_checksum_algorithm = '$old_checksum_algorithm';
drop table t1;
--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/not_windows.inc
--disable_query_log
CALL mtr.add_suppression("\\[Warning\\] InnoDB: Failed to set O_DIRECT on file ./ibdata1: OPEN: Invalid argument, continuing anyway. O_DIRECT is known to result in 'Invalid argument' on Linux on tmpfs, see MySQL Bug#26662.");
# The below mtr suppression to avoid failure in solaris platform.
CALL mtr.add_suppression("\\[ERROR\\] InnoDB: Failed to set DIRECTIO_ON on file.*");
--enable_query_log
SHOW VARIABLES LIKE 'innodb_flush_method';
let MYSQLD_DATADIR=`SELECT @@datadir`;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
# Create a table with explicit data directory option.
EVAL CREATE TABLE t1 (x INT) ENGINE=INNODB, DATA DIRECTORY='$MYSQL_TMP_DIR';
--echo # Contents of tmp/test directory containing .ibd file
--list_files $MYSQL_TMP_DIR/test
--echo # Contents of the 'test' database directory containing .isl and .frm files
--list_files $MYSQLD_DATADIR/test
DROP TABLE t1;
##############################################################################
#
# List the test cases that are to be disabled temporarily.
#
# Separate the test case name and the comment with ':'.
#
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
#
# Do not use any TAB characters for whitespace.
#
##############################################################################
--source include/have_innodb.inc
--source include/not_embedded.inc
--source include/big_test.inc
--echo # Bug #23481444 OPTIMISER CALL ROW_SEARCH_MVCC() AND READ
--echo # THE INDEX APPLIED BY UNCOMMITTED ROWS.
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
f2 INT NOT NULL, f3 INT NOT NULL,
KEY(f2, f3))ENGINE=INNODB;
DELIMITER |;
CREATE PROCEDURE populate_t1(IN BASE INT, IN SIZE INT)
BEGIN
DECLARE i INT DEFAULT BASE;
WHILE (i <= SIZE) DO
INSERT INTO t1(f2, f3) values (i, i);
SET i = i + 1;
END WHILE;
END|
DELIMITER ;|
CALL populate_t1(1, 10000);
INSERT INTO t1(f2, f3) VALUES(10000, 10000);
BEGIN;
CALL populate_t1(10001, 20000);
connect (con1,localhost,root,,);
connection con1;
SELECT SQL_NO_CACHE f2, f3 FROM t1 WHERE f2=10000 and f3 between 9999 and 10000;
connection default;
DROP TABLE t1;
CREATE TABLE t1(f2 INT NOT NULL, f3 INT NOT NULL,
PRIMARY KEY(f2, f3))ENGINE=INNODB;
CALL populate_t1(1, 10000);
BEGIN;
CALL populate_t1(10001, 20000);
connection con1;
SELECT SQL_NO_CACHE f2, f3 FROM t1 WHERE f2=10000 and f3 between 9999 and 10000;
connection default;
DROP TABLE t1;
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
f2 INT NOT NULL, f3 INT NOT NULL,
KEY(f2), KEY(f3))ENGINE=INNODB;
CALL populate_t1(1, 10000);
BEGIN;
CALL populate_t1(10001, 20000);
connection con1;
SELECT count(*) FROM t1 FORCE INDEX(f2, f3) WHERE f2 < 10000 or f3 < 10000;
connection default;
DROP TABLE t1;
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
f2 INT NOT NULL, f3 INT NOT NULL,
KEY(f2, f3))ENGINE=INNODB;
CALL populate_t1(1, 10000);
CALL populate_t1(100000, 100200);
BEGIN;
CALL populate_t1(10001, 20000);
connection con1;
SELECT SQL_NO_CACHE COUNT(*) FROM t1
WHERE f2 BETWEEN 9999 AND 10000 OR f2 >= 100000;
disconnect con1;
connection default;
DROP TABLE t1;
DROP PROCEDURE populate_t1;
--echo #
--echo #Bug #21133329 HANGING "SYSTEM LOCK" WHEN EXECUTING "FLUSH TABLE ... FOR EXPORT"
--echo #
--source include/not_embedded.inc
--source include/have_debug.inc
--source include/have_innodb.inc
CREATE TABLE t1 (
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 BIGINT,
c3 VARCHAR(2048),
c4 VARCHAR(2048),
INDEX idx1(c2),
INDEX idx2(c3(512)),
INDEX idx3(c4(512))) Engine=InnoDB;
CREATE TABLE t2 ( f1 int PRIMARY KEY) engine=innodb;
# Stop purge so that it doesn't remove the delete marked entries.
SET GLOBAL INNODB_PURGE_STOP_NOW=ON;
# Disable change buffer merge from the master thread, additionally
# enable aggressive flushing so that more changes are buffered.
SET GLOBAL innodb_disable_background_merge=ON;
SET GLOBAL innodb_stats_persistent=OFF;
show variables like '%innodb_stats_persistent%';
INSERT INTO t1(c2, c3, c4) VALUES
(1, REPEAT('a', 2048), REPEAT('a', 2048)),
(2, REPEAT('b', 2048), REPEAT('b', 2048)),
(3, REPEAT('c', 2048), REPEAT('c', 2048)),
(4, REPEAT('d', 2048), REPEAT('d', 2048));
INSERT INTO t1(c2, c3, c4) SELECT c2, c3, c4 FROM t1;
INSERT INTO t1(c2, c3, c4) SELECT c2, c3, c4 FROM t1;
INSERT INTO t1(c2, c3, c4) SELECT c2, c3, c4 FROM t1;
INSERT INTO t1(c2, c3, c4) SELECT c2, c3, c4 FROM t1;
INSERT INTO t1(c2, c3, c4) SELECT c2, c3, c4 FROM t1;
INSERT INTO t1(c2, c3, c4) SELECT c2, c3, c4 FROM t1;
FLUSH TABLES t2 FOR EXPORT;
UNLOCK TABLES;
SET GLOBAL innodb_disable_background_merge=OFF;
SET GLOBAL INNODB_PURGE_RUN_NOW=ON;
SET GLOBAL innodb_stats_persistent=ON;
DROP TABLE t1,t2;
--source include/have_innodb.inc
--echo #
--echo # Bug #19027905 ASSERT RET.SECOND DICT_CREATE_FOREIGN_CONSTRAINTS_LOW
--echo # DICT_CREATE_FOREIGN_CONSTR
--echo #
create table t1 (f1 int primary key) engine=InnoDB;
--error ER_CANNOT_ADD_FOREIGN
create table t2 (f1 int primary key,
constraint c1 foreign key (f1) references t1(f1),
constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB;
create table t2 (f1 int primary key,
constraint c1 foreign key (f1) references t1(f1)) engine=innodb;
--replace_regex /#sql-[0-9a-f_]*'/#sql-temporary'/
--error ER_DUP_KEY
alter table t2 add constraint c1 foreign key (f1) references t1(f1);
set foreign_key_checks = 0;
--error ER_FK_DUP_NAME
alter table t2 add constraint c1 foreign key (f1) references t1(f1);
drop table t2, t1;
--echo #
--echo # Bug #20031243 CREATE TABLE FAILS TO CHECK IF FOREIGN KEY COLUMN
--echo # NULL/NOT NULL MISMATCH
--echo #
set foreign_key_checks = 1;
show variables like 'foreign_key_checks';
CREATE TABLE t1
(a INT NOT NULL,
b INT NOT NULL,
INDEX idx(a)) ENGINE=InnoDB;
CREATE TABLE t2
(a INT KEY,
b INT,
INDEX ind(b),
FOREIGN KEY (b) REFERENCES t1(a) ON DELETE CASCADE ON UPDATE CASCADE)
ENGINE=InnoDB;
show create table t1;
show create table t2;
INSERT INTO t1 VALUES (1, 80);
INSERT INTO t1 VALUES (2, 81);
INSERT INTO t1 VALUES (3, 82);
INSERT INTO t1 VALUES (4, 83);
INSERT INTO t1 VALUES (5, 84);
INSERT INTO t2 VALUES (51, 1);
INSERT INTO t2 VALUES (52, 2);
INSERT INTO t2 VALUES (53, 3);
INSERT INTO t2 VALUES (54, 4);
INSERT INTO t2 VALUES (55, 5);
SELECT a, b FROM t1 ORDER BY a;
SELECT a, b FROM t2 ORDER BY a;
--error ER_NO_REFERENCED_ROW_2
INSERT INTO t2 VALUES (56, 6);
ALTER TABLE t1 CHANGE a id INT;
SELECT id, b FROM t1 ORDER BY id;
SELECT a, b FROM t2 ORDER BY a;
--echo # Operations on child table
--error ER_NO_REFERENCED_ROW_2
INSERT INTO t2 VALUES (56, 6);
--error ER_NO_REFERENCED_ROW_2
UPDATE t2 SET b = 99 WHERE a = 51;
DELETE FROM t2 WHERE a = 53;
SELECT id, b FROM t1 ORDER BY id;
SELECT a, b FROM t2 ORDER BY a;
--echo # Operations on parent table
DELETE FROM t1 WHERE id = 1;
UPDATE t1 SET id = 50 WHERE id = 5;
SELECT id, b FROM t1 ORDER BY id;
SELECT a, b FROM t2 ORDER BY a;
DROP TABLE t2, t1;
--source include/have_innodb.inc
# innodb_change_buffering_debug option is debug only
--source include/have_debug.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'".*".".*"\' in the cache');
call mtr.add_suppression('InnoDB: Allocated tablespace [0-9]+, old maximum was [0-9]+');
CREATE TABLE t1(
a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR(1),
c INT,
INDEX(b))
ENGINE=InnoDB STATS_PERSISTENT=0;
# The flag innodb_change_buffering_debug is only available in debug builds.
# It instructs InnoDB to try to evict pages from the buffer pool when
# change buffering is possible, so that the change buffer will be used
# whenever possible.
SET GLOBAL innodb_change_buffering_debug = 1;
# Create enough rows for the table, so that the change buffer will be
# used for modifying the secondary index page. There must be multiple
# index pages, because changes to the root page are never buffered.
INSERT INTO t1 VALUES(0,'x',1);
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1;
# Restart the server in force recovery mode
--echo # Stop server
# Write file to make mysql-test-run.pl wait for the server to stop
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Request shutdown
-- send_shutdown
# Call script that will poll the server waiting for it to disapear
-- source include/wait_until_disconnected.inc
--echo # Restart server.
# Write file to make mysql-test-run.pl start up the server again, ensure
# that no background threads are started, so that we can check that it
# shuts down properly.
--exec echo "restart:--innodb-force-recovery=6" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Turn on reconnect
--enable_reconnect
# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc
# Turn off reconnect again
--disable_reconnect
--error ER_CANT_LOCK
insert into t1 values(0,'y',1);
# Restart the server in force recovery mode
--echo # Stop server
# Write file to make mysql-test-run.pl wait for the server to stop
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Request shutdown
-- send_shutdown
# Call script that will poll the server waiting for it to disapear
-- source include/wait_until_disconnected.inc
--echo # Restart server.
# Write file to make mysql-test-run.pl start up the server again, ensure
# that no background threads are started, so that we can check that it
# shuts down properly.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Turn on reconnect
--enable_reconnect
# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc
# Turn off reconnect again
--disable_reconnect
# Cleanup
DROP TABLE t1;
# Test "ALTER TABLE ... IMPORT TABLESPACE" in InnoDB
--source include/have_innodb.inc
--echo #
--echo # Bug#20977779 CANNOT IMPORT TABLES CONTAINING PREFIX INDEXES
--echo #
CREATE TABLE t1 (c1 VARCHAR(32), c2 VARCHAR(32), c3 VARCHAR(32),
PRIMARY KEY (c1, c2, c3))
ENGINE=InnoDB;
ALTER TABLE t1 ADD INDEX ind1(c1(5), c2, c3);
ALTER TABLE t1 ADD INDEX ind2(c3, c1(10), c2);
ALTER TABLE t1 ADD INDEX ind3(c2, c3, c1(20));
INSERT INTO t1 VALUES ('Test Data -1', 'Test Data -2', 'Test Data -3');
--echo # Test with 2ndary index having prefix
--source suite/innodb/include/import.inc
--echo # Test with PK & 2ndary index with prefix
ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(c1(5), c2(10), c3(20));
--source suite/innodb/include/import.inc
DROP TABLE t1;
#
# BUG#20125349 - PERSISTANT STATS IS NOT UPDATED WHEN TTS IS IMPORTED.
#
--source include/not_embedded.inc
--source include/have_innodb.inc
let MYSQLD_DATADIR =`SELECT @@datadir`;
SET @old_innodb_file_per_table = @@innodb_file_per_table;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
CREATE TABLE t1 (
col_1 CHAR (255),
col_2 VARCHAR (255)
) ENGINE = InnoDB;
CREATE INDEX idx1 ON t1(col_1);
CREATE INDEX idx2 ON t1(col_2);
SHOW INDEXES FROM t1;
INSERT INTO t1 VALUES ("col1_00001", "col2_00001"), ("col1_00002", "col2_00002");
SHOW INDEXES FROM t1;
ANALYZE TABLE t1;
SHOW INDEXES FROM t1;
FLUSH TABLES t1 FOR EXPORT;
perl;
do 'include/innodb-util.inc';
ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1 (
col_1 CHAR (255),
col_2 VARCHAR (255)
) ENGINE = InnoDB;
CREATE INDEX idx1 ON t1(col_1);
CREATE INDEX idx2 ON t1(col_2);
SHOW INDEXES FROM t1;
INSERT INTO t1 VALUES ("col1_00001", "col2_00001");
SHOW INDEXES FROM t1;
ANALYZE TABLE t1;
SHOW INDEXES FROM t1;
ALTER TABLE t1 DISCARD TABLESPACE;
perl;
do 'include/innodb-util.inc';
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
SHOW INDEXES FROM t1;
ANALYZE TABLE t1;
SHOW INDEXES FROM t1;
DROP TABLE t1;
SET GLOBAL innodb_file_per_table = @old_innodb_file_per_table;
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.ibd
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*.cfg
--character-sets-dir=$MYSQL_TEST_DIR/std_data/
# Test for InnoDB support of 2 bytes (15 bits) collation ID
# Some of the example and test setup are adopted from ctype_ldml.test
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_ucs2.inc
--source include/have_utf8mb4.inc
--source include/have_utf16.inc
--source include/have_utf32.inc
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
show variables like 'character_sets_dir%';
set names utf8;
# Test that the "ID" column in I_S and SHOW queries can handle two bytes
select * from information_schema.collations where id>256 order by id;
show collation like '%test%';
# Test that two-byte collation ID is correctly transfered to the client side.
show collation like 'ucs2_vn_ci';
create table 2byte_collation (c1 char(1) character set ucs2 collate ucs2_vn_ci)
engine = InnoDB;
insert into 2byte_collation values (0x0061);
--enable_metadata
set @@character_set_results=NULL;
select * from 2byte_collation;
--disable_metadata
drop table 2byte_collation;
#
# Check maximum collation ID (2047 as of MySQL-6.0.9)
#
CREATE TABLE 2byte_collation (s1 char(10) character set utf8 collate utf8_maxuserid_ci) engine = innodb;
INSERT INTO 2byte_collation VALUES ('a'),('b');
SELECT * FROM 2byte_collation WHERE s1='a' ORDER BY BINARY s1;
DROP TABLE 2byte_collation;
# Excercise some change buffer code with the help of
# "innodb_change_buffering_debug"
-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
SET @innodb_change_buffering_debug_orig = @@innodb_change_buffering_debug;
-- error 0,ER_UNKNOWN_SYSTEM_VARIABLE
SET GLOBAL innodb_change_buffering_debug = 1;
-- enable_query_log
set names utf8;
show collation like 'utf8_maxuserid_ci';
CREATE TABLE 2byte_collation(
a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR(100) character set utf8 collate utf8_maxuserid_ci,
c INT,
z INT,
INDEX(b))
ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO 2byte_collation VALUES(0,'x',1, 1);
CREATE UNIQUE INDEX idx3 ON 2byte_collation(c, b);
INSERT INTO 2byte_collation SELECT 0,b,c+1,z+1 FROM 2byte_collation;
INSERT INTO 2byte_collation SELECT 0,b,c+10,z+10 FROM 2byte_collation;
INSERT INTO 2byte_collation SELECT 0,b,c+20,z+20 FROM 2byte_collation;
INSERT INTO 2byte_collation SELECT 0,b,c+50,z+50 FROM 2byte_collation;
INSERT INTO 2byte_collation SELECT 0,b,c+100,z+100 FROM 2byte_collation;
INSERT INTO 2byte_collation SELECT 0,b,c+200,z+200 FROM 2byte_collation;
INSERT INTO 2byte_collation SELECT 0,b,c+400,z+400 FROM 2byte_collation;
INSERT INTO 2byte_collation SELECT 0,b,c+800,z+800 FROM 2byte_collation;
INSERT INTO 2byte_collation SELECT 0,b,c+1600,z+1600 FROM 2byte_collation;
INSERT INTO 2byte_collation SELECT 0,b,c+4000,z+4000 FROM 2byte_collation;
CREATE INDEX idx5 ON 2byte_collation(b, c);
SELECT b FROM 2byte_collation LIMIT 10;
INSERT INTO 2byte_collation VALUES (10001, "a", 20001, 20001);
UPDATE 2byte_collation set b = "aaa" where c = 20001;
DROP TABLE 2byte_collation;
-- error 0, ER_UNKNOWN_SYSTEM_VARIABLE
SET GLOBAL innodb_change_buffering_debug = 0;
# DEBUG_SYNC must be compiled in.
--source include/have_debug_sync.inc
--source include/have_innodb.inc
CREATE TABLE t1 (c1 INT , c2 CHAR(10), PRIMARY KEY (c1)) ENGINE = InnoDB;
INSERT INTO t1 VALUES(0, "0");
INSERT INTO t1 VALUES(1, "1");
INSERT INTO t1 VALUES(2, "2");
INSERT INTO t1 VALUES(3, "3");
--connect (con1,localhost,root,,)
--connect (con2,localhost,root,,)
--connect (con3,localhost,root,,)
--connect (con4,localhost,root,,)
--connect (con5,localhost,root,,)
--connect (con6,localhost,root,,)
connection default;
# Disable query log to avoid non-deterministic output conflicts
SET AUTOCOMMIT=0;
BEGIN;
# Lock all the records
SELECT * FROM t1 FOR UPDATE;
--disable_query_log
connection con1;
SET AUTOCOMMIT=1;
# Test if locking autocommit selects end up in the trx_sys_t::trx_list.
# We check this via the INFORMATION_SCHEMA.INNODB_TRX.
# This should block and show up in the I_S.
SET DEBUG_SYNC='lock_wait_suspend_thread_enter SIGNAL waiting1';
--send
SELECT COUNT(*) FROM t1 LOCK IN SHARE MODE;
connection con2;
SET AUTOCOMMIT=1;
# Test if non-locking autocommit selects end up in the trx_sys_t::trx_list.
# We check this via the INFORMATION_SCHEMA.INNODB_TRX.
# This should not block and should not show up in the I_S.
--send
SELECT COUNT(*) FROM t1;
connection con3;
SET AUTOCOMMIT=1;
# Note: autocommit non-locking selects are not converted to locking selects
# Therefore this should not block;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
--send
SELECT COUNT(*) FROM t1;
connection con4;
SET AUTOCOMMIT=0;
# Note: Non-locking selects are converted to locking selects
# therefore this should block;
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SET DEBUG_SYNC='now WAIT_FOR waiting1';
SET DEBUG_SYNC='lock_wait_suspend_thread_enter SIGNAL waiting4';
--send
SELECT COUNT(*) FROM t1 WHERE c1 >= 0;
connection con5;
SET AUTOCOMMIT=1;
# This should not block
BEGIN;
--send
SELECT COUNT(*) FROM t1;
connection con6;
SET AUTOCOMMIT=1;
# This will ignore the auto-commit setting but wont block because it is
# a non-locking select.
XA START '1';
--enable_query_log
SELECT * FROM t1 WHERE c1 <= 3;
connection default;
# Wait for SELECTs to get into the lock wait queue
SET DEBUG_SYNC='now WAIT_FOR waiting4';
# Check the number of non-locking transactions
let $wait_condition =
SELECT COUNT(*) = 5
FROM INFORMATION_SCHEMA.INNODB_TRX
WHERE trx_autocommit_non_locking = 0;
--source include/wait_condition.inc
# Check the waiting transactions
SELECT trx_state, trx_query, trx_autocommit_non_locking
FROM INFORMATION_SCHEMA.INNODB_TRX
WHERE trx_state = 'LOCK WAIT'
ORDER BY trx_query;
INSERT INTO t1 VALUES(4, '4');
COMMIT;
connection con6;
SELECT * FROM t1 WHERE c1 <= 4;
XA END '1';
XA PREPARE '1';
XA ROLLBACK '1';
connection default;
disconnect con2;
disconnect con3;
disconnect con5;
disconnect con6;
connection con1;
reap;
disconnect con1;
connection con4;
reap;
disconnect con4;
connection default;
DROP TABLE t1;
# Clean up resources used in this test case.
--disable_warnings
SET DEBUG_SYNC= 'RESET';
--enable_warnings
--default-storage-engine=MyISAM
--innodb-strict-mode=0
--innodb-file-per-table=0
CREATE TABLE worklog5743 (col_1_CHAR CHAR(255) , col_2_CHAR CHAR(255) ,
PRIMARY KEY (col_1_CHAR)) engine = innodb;
INSERT INTO worklog5743 VALUES(repeat("a", 200) , repeat("o", 200));
SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
worklog5743;
--echo "In connection 1"
--connect (con1,localhost,root,,)
SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
worklog5743;
SELECT COUNT(*) FROM worklog5743;
--echo "In connection 2"
--connect (con2,localhost,root,,)
START TRANSACTION;
INSERT INTO worklog5743 VALUES(repeat("b", 200) , repeat("o", 200));
UPDATE worklog5743 SET col_1_CHAR = repeat("d", 200) WHERE col_1_CHAR =
repeat("a", 200) AND col_2_CHAR = repeat("o", 200);
SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
worklog5743;
--echo "In connection 1"
--connection con1
SELECT col_1_CHAR = repeat("b", 200) , col_2_CHAR = repeat("o", 200) FROM
worklog5743;
START TRANSACTION;
SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
worklog5743;
SELECT COUNT(*) FROM worklog5743;
--echo "In connection 2"
--connection con2
COMMIT;
SELECT sleep(5);
--echo "In connection 1"
--connection con1
SELECT col_1_CHAR = repeat("b", 200) , col_2_CHAR = repeat("o", 200) FROM
worklog5743;
SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
worklog5743;
SELECT COUNT(*) FROM worklog5743;
COMMIT;
--connection default
DROP TABLE worklog5743;
# ==== Purpose ====
#
# Verify that ADD PRIMARY KEY can report duplicate key value
#
# ==== References ====
#
# Bug #14219515 DUPLICATE VALUE NOT REPORTED FOR ADD PRIMARY KEY
#
--source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1(a INT NOT NULL, b INT) ENGINE = INNODB;
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4);
--ERROR ER_DUP_ENTRY
ALTER TABLE t1 ADD PRIMARY KEY(b), ADD UNIQUE INDEX(a);
DROP TABLE t1;
This diff is collapsed.
--innodb-sort-buffer-size=64k --innodb-online-alter-log-max-size=64k --innodb-buffer-pool-size=5M --innodb-log-buffer-size=256k
--echo #
--echo # Bug #21025880 DUPLICATE UK VALUES IN READ-COMMITTED(AGAIN)
--echo #
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
let i=0;
while ($i <=1 )
{
CREATE TABLE t1 (
a INT NOT NULL,
b INT NOT NULL,
PRIMARY KEY(b),
UNIQUE KEY(a))
ENGINE=INNODB;
SET @old_innodb_stats_auto_recalc = @@innodb_stats_auto_recalc;
SET GLOBAL innodb_stats_auto_recalc = OFF;
# Block purge
SET GLOBAL innodb_purge_stop_now = ON;
SET @old_tx_isolation = @@tx_isolation;
SET GLOBAL tx_isolation = 'READ-COMMITTED';
SET @old_innodb_lock_wait_timeout = @@innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout = 1;
--connect(con1,localhost,root,,)
--connect(con2,localhost,root,,)
--connection con1
# Create and delete-mark an index record
INSERT INTO t1 VALUES (1,1),(2,2);
DELETE FROM t1;
SET debug_sync = 'row_ins_sec_index_entry_dup_locks_created SIGNAL
con1_locks_done WAIT_FOR con1_go';
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL
con1_insert_done WAIT_FOR con1_finish';
--send
if ($i == 0)
{
REPLACE INTO t1 VALUES (1,2);
}
if ( $i == 1)
{
INSERT INTO t1 values (1,2) ON DUPLICATE KEY UPDATE a=2;
}
--connection con2
SET debug_sync = 'now WAIT_FOR con1_locks_done';
SET debug_sync = 'lock_wait_suspend_thread_enter SIGNAL con2_blocked
WAIT_FOR con2_go';
SET debug_sync = 'ha_commit_trans_after_acquire_commit_lock SIGNAL
con2_insert_done WAIT_FOR con2_finish';
SET debug_sync = 'ib_after_row_insert SIGNAL con2_insert_done';
--send
REPLACE INTO t1 VALUES (1,3);
--connection default
SET debug_sync = 'now WAIT_FOR con2_blocked';
SET GLOBAL innodb_purge_run_now=ON;
# Wait for purge to delete the delete-marked record
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='INNODB_PURGE_TRX_ID_AGE' AND VARIABLE_VALUE=2;
--source include/wait_condition.inc
SET debug_sync = 'now SIGNAL con2_go WAIT_FOR con2_insert_done';
SET debug_sync = 'now SIGNAL con1_go WAIT_FOR con1_insert_done';
SET debug_sync = 'now SIGNAL con1_finish';
SET debug_sync = 'now SIGNAL con2_finish';
--connection con1
--reap
--connection con2
--error 0,ER_LOCK_WAIT_TIMEOUT
--reap
--connection default
--disconnect con1
--disconnect con2
SELECT * FROM t1;
CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL innodb_stats_auto_recalc = @old_innodb_stats_auto_recalc;
SET GLOBAL tx_isolation = @old_tx_isolation;
SET GLOBAL innodb_lock_wait_timeout = @old_innodb_lock_wait_timeout;
# Clean up resources used in this test case.
--disable_warnings
SET DEBUG_SYNC= 'RESET';
--enable_warnings
--inc $i
}
This diff is collapsed.
# Test resizing the InnoDB redo log.
--source include/have_innodb.inc
--source include/have_debug.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc
# Embedded server does not support crashing
--source include/not_embedded.inc
# Avoid CrashReporter popup on Mac
--source include/not_crashrep.inc
if (`SELECT @@innodb_log_file_size = 1048576`) {
--skip Test requires innodb_log_file_size>1M.
}
call mtr.add_suppression("InnoDB: Resizing redo log");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
call mtr.add_suppression("InnoDB: New log files created");
call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles");
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
SET DEBUG='+d,crash_commit_before';
# Write file to make mysql-test-run.pl restart the server
--exec echo "restart: --innodb-log-file-size=6M" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
INSERT INTO t1 VALUES (42);
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
SELECT * FROM t1;
INSERT INTO t1 VALUES (42);
SET DEBUG='+d,crash_commit_before';
# Write file to make mysql-test-run.pl restart the server
--exec echo "restart: --innodb-log-files-in-group=3 --innodb-log-file-size=5M" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
DELETE FROM t1;
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
SELECT * FROM t1;
INSERT INTO t1 VALUES (123);
let MYSQLD_DATADIR= `select @@datadir`;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
let $args=--loose-console > $SEARCH_FILE 2>&1;
let crash=$args --innodb-force-recovery-crash;
SET DEBUG='+d,crash_commit_before';
# Write file to make mysql-test-run.pl restart the server
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--error 2013
DELETE FROM t1;
--error 1
--exec $MYSQLD_CMD $args --innodb-log-group-home-dir=foo\;bar
let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--error 1
--exec $MYSQLD_CMD $args --innodb-mirrored-log-groups=2
let SEARCH_PATTERN= innodb_mirrored_log_groups is an unimplemented feature and the variable will be completely removed in a future version. Using values other than 1 is not supported.;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
# On Windows, DBUG_SUICIDE() does exit(3) instead of SIGKILL (128+9).
--echo --innodb-force-recovery-crash=1
--error 3
--exec $MYSQLD_CMD $crash=1
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=2
--error 3
--exec $MYSQLD_CMD $crash=2
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
--echo --innodb-force-recovery-crash=3
--error 3
--exec $MYSQLD_CMD $crash=3
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--error 1
--exec $MYSQLD_CMD $args --innodb-read-only
let SEARCH_PATTERN= InnoDB: Recovery skipped, --innodb-read-only set!;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Can.t initiate database recovery, running in read-only-mode;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=4
--error 3
--exec $MYSQLD_CMD $crash=4
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=5
--error 3
--exec $MYSQLD_CMD $crash=5
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--error 1
--exec $MYSQLD_CMD $args --innodb-read-only
let SEARCH_PATTERN= InnoDB: Can.t initiate database recovery, running in read-only-mode;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=6
--error 3
--exec $MYSQLD_CMD $crash=6
let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=7
--error 3
--exec $MYSQLD_CMD $crash=7
# this crashes right after deleting all log files
--remove_file $SEARCH_FILE
--error 1
--exec $MYSQLD_CMD $args --innodb-read-only
let SEARCH_PATTERN= InnoDB: Cannot create log files in read-only mode;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=8
--error 3
--exec $MYSQLD_CMD $crash=8
let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--echo --innodb-force-recovery-crash=9
--error 3
--exec $MYSQLD_CMD $crash=9
let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
# We should have perfectly synced files here.
# Rename the log files, and trigger an error in recovery.
--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0
--move_file $MYSQLD_DATADIR/ib_logfile1 $MYSQLD_DATADIR/ib_logfile1_hidden
--error 1
--exec $MYSQLD_CMD $args
let SEARCH_PATTERN= InnoDB: Only one log file found;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
perl;
die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile0");
print FILE "garbage";
close(FILE);
EOF
--error 1
--exec $MYSQLD_CMD $args
let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of innodb_page_size;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--remove_file $MYSQLD_DATADIR/ib_logfile0
--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0
perl;
die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile1");
print FILE "junkfill" x 131072;
close(FILE);
EOF
--error 1
--exec $MYSQLD_CMD $args
let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--remove_file $MYSQLD_DATADIR/ib_logfile1
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
--move_file $MYSQLD_DATADIR/ib_logfile1_hidden $MYSQLD_DATADIR/ib_logfile1
--echo --innodb-force-recovery-crash=10
--error 3
--exec $MYSQLD_CMD $crash=10
let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: Renaming log file .*ib_logfile101 to .*ib_logfile0;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
SELECT * FROM t1;
DROP TABLE t1;
This diff is collapsed.
# DEBUG_SYNC must be compiled in.
--source include/have_debug_sync.inc
# We need to test the use case:
# a. Create a transaction T1 that will be promoted to RW.
# b. Create a transaction T2 that will be promoted to RW.
# a. Create a RO transaction T3
# d. T3 does a select - creates a read view that doesn't include T1 and T2
# e. T1 & T2 do some updates - this promotes T1 & T2 to RW transactions
# f. T1 & T2 Commit
# g. T3 Does a select - it should not see the changes of T1 & T2
--source include/have_innodb.inc
CREATE TABLE t1 (c1 INT , c2 CHAR(10), PRIMARY KEY (c1)) ENGINE = InnoDB;
INSERT INTO t1 VALUES(0, "0");
INSERT INTO t1 VALUES(1, "1");
INSERT INTO t1 VALUES(2, "2");
INSERT INTO t1 VALUES(3, "3");
CREATE TABLE t2 (c1 INT , c2 CHAR(10), PRIMARY KEY (c1)) ENGINE = InnoDB;
INSERT INTO t2 VALUES(0, "a");
INSERT INTO t2 VALUES(1, "b");
INSERT INTO t2 VALUES(2, "c");
INSERT INTO t2 VALUES(3, "d");
--connect (con1,localhost,root,,)
--connect (con2,localhost,root,,)
connection con1;
--echo 'T1'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t2;
connection default;
--echo 'T2'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t1;
connection con2;
--echo 'T3'
SET AUTOCOMMIT=0;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t1;
SELECT * FROM t2;
connection default;
--echo 'T1'
UPDATE t2 SET c1 = c1 + 100;
SELECT * FROM t2;
COMMIT;
connection default;
--echo 'T2'
UPDATE t1 SET c1 = c1 + 100;
SELECT * FROM t1;
COMMIT;
connection con2;
--echo 'T3'
SET DEBUG_SYNC='row_select_wait WAIT_FOR waiting1';
--send SELECT * FROM t1;
connection default;
--echo 'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
--echo 'Signalled T3'
connection con2;
--echo 'T3'
reap;
connection con2;
--echo 'T3'
SET DEBUG_SYNC='row_select_wait WAIT_FOR waiting1';
--send SELECT * FROM t2;
connection default;
--echo 'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
--echo 'Signalled T3'
connection con2;
--echo 'T3'
reap;
connection default;
disconnect con1;
disconnect con2;
# We need to test the use case:
# a. Create a transaction T1 that will be promoted to RW.
# b. Create a transaction T2 that will be promoted to RW.
# c. T2 does some updates - this promotes T2 to RW transactions
# d. T2 Commits
# e. Create a RO transaction T3
# f. T3 does a select - creates a read view that doesn't include T1
# g. T1 does some updates - this promotes T1 to RW transactions
# h. T1 Commits
# i. T3 Does a select - it should not see the changes made by T1 but should
# see the changes by T2
--connect (con1,localhost,root,,)
--connect (con2,localhost,root,,)
connection con1;
--echo 'T1'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t1;
connection default;
--echo 'T2'
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM t2;
UPDATE t2 SET c1 = c1 + 100;
SELECT * FROM t2;
COMMIT;
connection con2;
--echo 'T3'
SET AUTOCOMMIT=0;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t1;
SELECT * FROM t2;
connection con1;
--echo 'T1'
UPDATE t1 SET c1 = c1 + 100;
SELECT * FROM t1;
COMMIT;
connection con2;
--echo 'T3'
SET DEBUG_SYNC='row_select_wait WAIT_FOR waiting1';
--send SELECT * FROM t1;
connection con1;
--echo 'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
--echo 'Signalled T3'
connection con2;
--echo 'T3'
reap;
connection con2;
--echo 'T3'
SET DEBUG_SYNC='row_select_wait WAIT_FOR waiting1';
--send SELECT * FROM t2;
connection default;
--echo 'T2'
SET DEBUG_SYNC='now SIGNAL waiting1';
--echo 'Signalled T3'
connection con2;
--echo 'T3'
reap;
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
DROP TABLE t2;
# Clean up resources used in this test case.
--disable_warnings
SET DEBUG_SYNC= 'RESET';
--enable_warnings
--source include/have_innodb.inc
# This restarts the server and waits a long time for output.
--source include/big_test.inc
# Embedded server does not support restarting.
--source include/not_embedded.inc
# Test the deprecation messages and connection to the flags.
CREATE TABLE innodb_monitor(a SERIAL) ENGINE=InnoDB;
SHOW VARIABLES LIKE 'innodb_status_output%';
DROP TABLE innodb_monitor;
SHOW VARIABLES LIKE 'innodb_status_output%';
CREATE TABLE innodb_lock_monitor(a SERIAL) ENGINE=InnoDB;
SHOW VARIABLES LIKE 'innodb_status_output%';
DROP TABLE innodb_lock_monitor;
SHOW VARIABLES LIKE 'innodb_status_output%';
CREATE TABLE innodb_tablespace_monitor(a SERIAL) ENGINE=InnoDB;
DROP TABLE innodb_tablespace_monitor;
CREATE TABLE innodb_table_monitor(a SERIAL) ENGINE=InnoDB;
DROP TABLE innodb_table_monitor;
CREATE TABLE t(a SERIAL) ENGINE=InnoDB;
INSERT INTO t VALUES(42);
# Restart, writing the error log to a different file.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/innodb-status-output.err;
--error 0,1
--remove_file $SEARCH_FILE
# Test that the output appears.
--exec echo "restart: --log-error=$SEARCH_FILE" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
BEGIN;
SELECT * FROM t FOR UPDATE;
# Enable full output.
SET GLOBAL innodb_status_output_locks=ON;
SET GLOBAL innodb_status_output=ON;
SELECT SLEEP(30);
COMMIT;
# Restart, check the log output
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
let SEARCH_PATTERN= INNODB MONITOR OUTPUT;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= SELECT SLEEP.*\nTABLE LOCK.*\nRECORD LOCKS space id;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--exec echo "restart: --log-error=$SEARCH_FILE" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
BEGIN;
SELECT * FROM t FOR UPDATE;
# This alone should not enable any output.
SET GLOBAL innodb_status_output_locks=ON;
SELECT SLEEP(30);
COMMIT;
# Restart, check the log output
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
# We should not see any extra output.
let SEARCH_PATTERN= ready for connections.*\nVersion:.*\n.*Normal shutdown;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--exec echo "restart: --log-error=$SEARCH_FILE" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
BEGIN;
SELECT * FROM t FOR UPDATE;
# Enable some output.
SET GLOBAL innodb_status_output=ON;
SELECT SLEEP(30);
COMMIT;
# Restart, check the log output
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
# We should have some extra output.
let SEARCH_PATTERN= INNODB MONITOR OUTPUT;
--source include/search_pattern_in_file.inc
# No RECORD LOCKS output expected
let SEARCH_PATTERN= SELECT SLEEP.*\n------;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
# Clean up.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
DROP TABLE t;
# This is the test for Information Schema System Table View
# that displays the InnoDB system table content through
# information schema tables.
--source include/have_innodb.inc
--disable_query_log
SET default_storage_engine=InnoDB;
let $MYSQLD_DATADIR= `select @@datadir`;
# These values can change during the test
LET $innodb_file_format_orig=`select @@innodb_file_format`;
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
--enable_query_log
# The IDs of mysql.innodb_table_stats and mysql.innodb_index_stats are
# unpredictable, probably they depend on whether mtr has created the
# database for this test from scratch or is using a previously created
# database where those tables have been dropped and recreated. If we can
# force mtr to use a freshly created database for this test then the following
# complications can be removed and the test be reverted to the version
# it was before the patch that adds this comment.
--let $table_stats_id = `SELECT table_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/innodb_table_stats'`
--let $index_stats_id = `SELECT table_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/innodb_index_stats'`
--let $rep_table_1 = `SELECT table_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/slave_master_info'`
--let $rep_table_2 = `SELECT table_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/slave_relay_log_info'`
--let $rep_table_3 = `SELECT table_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/slave_worker_info'`
--disable_query_log
--eval SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE table_id NOT IN ($table_stats_id, $index_stats_id, $rep_table_1, $rep_table_2, $rep_table_3) ORDER BY table_id;
--eval SELECT table_id,pos,mtype,prtype,len,name FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE table_id NOT IN ($table_stats_id, $index_stats_id, $rep_table_1, $rep_table_2, $rep_table_3) ORDER BY table_id, pos;
# The SELECT * version of the query below has been moved to innodb_4k,
# innodb_8k & innodb_16k since the root page number changes with page size.
--eval SELECT index_id,table_id,type,n_fields,space,name FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE table_id NOT IN ($table_stats_id, $index_stats_id, $rep_table_1, $rep_table_2, $rep_table_3) ORDER BY index_id;
--enable_query_log
SELECT index_id,pos,name FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS
WHERE name NOT IN ('database_name', 'table_name', 'index_name', 'stat_name', 'id', 'host', 'port')
ORDER BY index_id, pos;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
SET GLOBAL innodb_file_format=`Barracuda`;
SET GLOBAL innodb_file_per_table=ON;
--disable_warnings
DROP TABLE IF EXISTS t_redundant, t_compact, t_compressed, t_dynamic;
--enable_warnings
CREATE TABLE t_redundant (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb;
CREATE TABLE t_compact (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb;
CREATE TABLE t_compressed (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb;
CREATE TABLE t_dynamic (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
--sorted_result
SELECT name, n_cols, file_format, row_format
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE space > 0;
--sorted_result
SELECT name, file_format, row_format
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES
WHERE name LIKE 'test%';
--replace_result ./ MYSQLD_DATADIR/ $MYSQLD_DATADIR MYSQLD_DATADIR
--sorted_result
SELECT path FROM INFORMATION_SCHEMA.INNODB_SYS_DATAFILES
WHERE path LIKE '%test%';
DROP TABLE t_redundant, t_compact, t_compressed, t_dynamic;
--disable_query_log
EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
--enable_query_log
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
# Create a foreign key constraint, and verify the information
# in INFORMATION_SCHEMA.INNODB_SYS_FOREIGN and
# INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS
CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE CASCADE) ENGINE=INNODB;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
# Insert a row in the table "parent", and see whether that reflected in
# INNODB_SYS_TABLESTATS
INSERT INTO parent VALUES(1);
--sorted_result
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
--sorted_result
SELECT NAME, FLAG, N_COLS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
--sorted_result
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%parent%");
--sorted_result
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
--sorted_result
SELECT name, pos, mtype, len
from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
DROP TABLE child;
DROP TABLE parent;
# Create table with 2 columns in the foreign key constraint
CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL,
PRIMARY KEY (id, newid)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid)
ON DELETE CASCADE) ENGINE=INNODB;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
INSERT INTO parent VALUES(1, 9);
# Nested query will open the table handle twice
--sorted_result
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
--sorted_result
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
DROP TABLE child;
DROP TABLE parent;
--disable_query_log
EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
--enable_query_log
This diff is collapsed.
--innodb-use-sys-malloc=true
--innodb-large-prefix=true
-- source include/have_innodb.inc
#display current value of innodb_use_sys_malloc
SELECT @@GLOBAL.innodb_use_sys_malloc;
--echo 1 Expected
#try changing it. Should fail.
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@GLOBAL.innodb_use_sys_malloc=0;
--echo Expected error 'Read only variable'
SELECT @@GLOBAL.innodb_use_sys_malloc;
--echo 1 Expected
# Do some stuff to see if it works.
# Also, test the code paths of
# Bug #12699505 MEMORY LEAK IN ROW_CREATE_INDEX_FOR_MYSQL()
# (the leak would only be triggered if
# ha_innobase::max_supported_key_part_length() were set
# higher than the limit used in row_create_index_for_mysql())
--error ER_DUP_FIELDNAME
create table t1(a int not null,key(a,a)) engine=innodb DEFAULT CHARSET=latin1;
# thanks to --innodb-large-prefix=1 this will not be truncated to b(767)
-- error ER_INDEX_COLUMN_TOO_LONG
create table t1(a int,b text,key(b(768))) engine=innodb DEFAULT CHARSET=latin1;
create table t1(a int not null,b text) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');
--error ER_DUP_FIELDNAME
create index t1aa on t1(a,a);
-- error ER_INDEX_COLUMN_TOO_LONG
create index t1b on t1(b(768));
SHOW CREATE TABLE t1;
select * from t1;
drop table t1;
CREATE TABLE t2(a int primary key, b text) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES (1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');
--error ER_DUP_FIELDNAME
CREATE INDEX t2aa on t2(a,a);
-- error ER_INDEX_COLUMN_TOO_LONG
CREATE INDEX t2b on t2(b(768));
SELECT * FROM t2;
DROP TABLE t2;
#
# This testcase is to check the various debug injection points
# to make sure error conditions react corectly and acheive
# better code coverage.
#
# Not supported in embedded
--source include/not_embedded.inc
# the DBUG_EXECUTE_IF() macro needs a debug server.
--source include/have_debug.inc
-- source include/have_innodb.inc
--disable_query_log
# These values can change during the test
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
# These messages are expected in the log
call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache");
call mtr.add_suppression("Cannot rename table 'test/t1' to 'test/t2' since the dictionary cache already contains 'test/t2'.");
# Set up some variables
LET $MYSQL_DATA_DIR = `select @@datadir`;
LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
--enable_query_log
SET GLOBAL innodb_file_per_table=ON;
--echo #
--echo # WL5980 Remote tablespace debug error injection tests.
--echo #
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb $data_directory_clause ;
INSERT INTO t1 VALUES (1, "tablespace");
SELECT * FROM t1;
--echo #
--echo # Test the first injection point in fil_rename_tablespace().
--echo # Make sure the table is useable after this failure.
--echo #
SET SESSION debug="+d,fil_rename_tablespace_failure_1";
--disable_result_log
--error ER_ERROR_ON_RENAME
RENAME TABLE t1 TO t2;
--enable_result_log
SET SESSION debug="-d,fil_rename_tablespace_failure_1";
INSERT INTO t1 VALUES (2, "tablespace");
SELECT * FROM t1;
--echo #
--echo # Test the second injection point in fil_rename_tablespace().
--echo # Make sure the table is useable after this failure.
--echo #
SET SESSION debug="+d,fil_rename_tablespace_failure_2";
--disable_result_log
--error ER_ERROR_ON_RENAME
RENAME TABLE t1 TO t2;
--enable_result_log
SET SESSION debug="-d,fil_rename_tablespace_failure_2";
INSERT INTO t1 VALUES (3, "tablespace");
SELECT * FROM t1;
--echo #
--echo # Test the injection point in dict_table_rename_in_cache().
--echo # Make sure the table is useable after this failure.
--echo #
SET SESSION debug="+d,dict_table_rename_in_cache_failure";
--disable_result_log
--error ER_ERROR_ON_RENAME
RENAME TABLE t1 TO t2;
--enable_result_log
SET SESSION debug="-d,dict_table_rename_in_cache_failure";
INSERT INTO t1 VALUES (4, "tablespace");
SELECT * FROM t1;
--echo #
--echo # Cleanup
--echo #
DROP TABLE t1;
--rmdir $MYSQL_TMP_DIR/alt_dir/test
--rmdir $MYSQL_TMP_DIR/alt_dir
-- disable_query_log
eval set global innodb_file_per_table=$innodb_file_per_table_orig;
-- enable_query_log
This diff is collapsed.
#
# This testcase is related to WL5980, to test the portability feature.
# Create a DB & tables with all kinds Non-Partition & partition on
# Windows platform. Zip the entire DB and tablespaces on Windows.
# Bring the zip file to Linux. Unzip the DB and modify the *.isl files
# with the proper path of the *.ibd files. Restart the DB & check the
# DB with a few DML operations. Test and validate the Windows DB on
# Linux platform.
# Prerequisite : portability_wl5980_linux.zip
# should exist in "suite/innodb/t"
--source include/have_innodb_16k.inc
--source include/not_embedded.inc
--echo # Skip this test other platfoms and run only on Linux.
if (`select convert(@@version_compile_os using latin1) IN ("Linux") = 0`)
{
skip Need Linux;
}
--echo # Set the environmental variables
let MYSQL_BASEDIR= `select @@basedir`;
--echo # Stop server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 30
-- source include/wait_until_disconnected.inc
--echo # Copy the remote tablespace & DB zip files from suite location to working location.
#--copy_file $MYSQLTEST_VARDIR/../mysql-test/suite/innodb/t/portability_wl5980_linux.zip $MYSQL_TMP_DIR/portability_wl5980_linux.zip
perl;
use File::Find;
use File::Copy;
sub find_zip () {
if (/portability_wl5980_linux\.zip/) {
my $dest_dir = $ENV{'MYSQL_TMP_DIR'};
my $src_file = $File::Find::name;
my $srcfile = File::Spec->catfile("$src_file") ;
my $destfile = File::Spec->catfile("$dest_dir", "portability_wl5980_linux.zip");
if (! -e $destfile) {
copy($srcfile,$destfile) or die "copy @args failed: $!";
}
}
}
my $search_dir = $ENV{'MYSQL_BASEDIR'};
find(\&find_zip,"$search_dir");
EOF
--echo # Check that the file exists in the working folder.
--file_exists $MYSQL_TMP_DIR/portability_wl5980_linux.zip
--echo # Unzip the zip file.
--exec unzip -qo $MYSQL_TMP_DIR/portability_wl5980_linux.zip -d $MYSQL_TMP_DIR
--echo # Remove the DOS based *.isl files from the MySql Data directory.
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p1.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p2.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp3.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p1.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p2.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s0.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s1.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s2.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s3.isl
--echo # Check that the *.ibd files are in the required location.
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab1/test/emp2#p#p1.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab2/test/emp2#p#p2.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab3/test/emp3.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab4/test/emp4#p#p1.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab5/test/emp4#p#p2.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part0/test/purchase#p#p0#sp#s0.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part1/test/purchase#p#p0#sp#s1.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part2/test/purchase#p#p1#sp#s2.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part3/test/purchase#p#p1#sp#s3.ibd
--echo # Create new *.isl files with the correct path to the *.ibd files,
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab1/test/emp2#p#p1.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p1.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab2/test/emp2#p#p2.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p2.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab3/test/emp3.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp3.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab4/test/emp4#p#p1.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p1.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab5/test/emp4#p#p2.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p2.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part0/test/purchase#p#p0#sp#s0.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s0.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part1/test/purchase#p#p0#sp#s1.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s1.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part2/test/purchase#p#p1#sp#s2.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s2.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part3/test/purchase#p#p1#sp#s3.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s3.isl
--echo # Restart the DB server from unzip location Data Dir.
--echo # Note that lower case option is required because the
--echo # partition tables will be stored in mixed (Upper & Lower) format on Linux,
--echo # but on Windows the partition table names are stored in lower case only.
-- exec echo "restart:--lower_case_table_names=1 --datadir=$MYSQL_TMP_DIR/mysqld.5980/data/ " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
--echo # Check the DB & tables with DML statements.
use test;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp1;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp2;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp3;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp4;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE purchase;
SELECT COUNT(*) FROM emp1;
SELECT COUNT(*) FROM emp2;
SELECT COUNT(*) FROM emp3;
SELECT COUNT(*) FROM emp4;
SELECT COUNT(*) FROM purchase;
DELETE FROM emp1;
DELETE FROM emp2;
DELETE FROM emp3;
DELETE FROM emp4;
DELETE FROM purchase;
SELECT COUNT(*) FROM emp1;
SELECT COUNT(*) FROM emp2;
SELECT COUNT(*) FROM emp3;
SELECT COUNT(*) FROM emp4;
SELECT COUNT(*) FROM purchase;
--echo # Check the system tables have the proper entry of the tables.
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables
WHERE name LIKE '%emp%' ORDER BY name;
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables
WHERE name LIKE '%purchase%' ORDER BY name;
--echo #
--echo # Cleanup
--echo #
DROP TABLE emp1;
DROP TABLE emp2;
DROP TABLE emp3;
DROP TABLE emp4;
DROP TABLE purchase;
# The following lines of code just to dupe the MTR frame work nothing to do with WL,
# As MTR thinks that it was a failure, When the server logs contains error/warnings
# even though there are no result mismatch.It is an expected behavior of the server.
CREATE DATABASE mtr;
DELIMITER |;
CREATE PROCEDURE mtr.check_warnings(OUT result INT)
BEGIN
SELECT 0 INTO RESULT;
END|
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab1/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab2/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab3/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab4/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab5/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part0/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part1/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part2/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part3/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab1
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab2
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab3
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab4
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab5
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part0
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part1
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part2
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part3
#
# This testcase is related to WL5980, to test the portability feature.
# Create a DB & tables with all kinds Non-Partition & partition on
# Linux platform. Zip the entire DB and tablespaces on Windows.
# Bring the zip file to Windows. Unzip the DB and modify the *.isl files
# with the proper path of the *.ibd files. Restart the DB & check the
# DB with a few DML operations. Test and validate the Linux DB on
# Windows platform.
# Prerequisite : portability_wl5980_windows.zip
# should exist in "suite/innodb/t"
# Windows-specific tests
--source include/windows.inc
--source include/have_innodb_16k.inc
--source include/not_embedded.inc
--echo #Check whether unzip is installed on the system
--echo #Store the command output into a temp file.
perl;
my $dir = $ENV{'MYSQLTEST_VARDIR'};
my $cmd = system('unzip --help > NUL 2>&1');
open ( OUTPUT, ">$dir/tmp/tar.inc") ;
print OUTPUT "let \$stat = $cmd;\n";
close (OUTPUT);
EOF
--echo #Get the value of the $stat variable from perl, to MTR
--source $MYSQLTEST_VARDIR/tmp/tar.inc
--echo #Check the status is non-zero
if ($stat != 0)
{
--skip Test requires Unzip on Windows
}
--echo #Remove the temp file tar.inc
--remove_file $MYSQLTEST_VARDIR/tmp/tar.inc
--echo # Set the environmental variables
let $MYSQL_BASEDIR= `select @@basedir`;
--echo # Stop server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 30
-- source include/wait_until_disconnected.inc
--echo # Copy the remote tablespace & DB zip files from suite location to working location.
--copy_file $MYSQL_BASEDIR/mysql-test/suite/innodb/t/portability_wl5980_windows.zip $MYSQL_TMP_DIR/portability_wl5980_windows.zip
--echo # Check that the file exists in the working folder.
--file_exists $MYSQL_TMP_DIR/portability_wl5980_windows.zip
--echo # Unzip the zip file.
--exec unzip -q $MYSQL_TMP_DIR/portability_wl5980_windows.zip -d $MYSQL_TMP_DIR
--echo # Remove the DOS based *.isl files from the MySql Data directory.
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p1.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p2.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp3.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p1.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p2.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s0.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s1.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s2.isl
--remove_file $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s3.isl
--echo # Check that the *.ibd files are in the required location.
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab1/test/emp2#p#p1.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab2/test/emp2#p#p2.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab3/test/emp3.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab4/test/emp4#p#p1.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/tab5/test/emp4#p#p2.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part0/test/purchase#p#p0#sp#s0.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part1/test/purchase#p#p0#sp#s1.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part2/test/purchase#p#p1#sp#s2.ibd
--file_exists $MYSQL_TMP_DIR/mysqld.5980/part3/test/purchase#p#p1#sp#s3.ibd
--echo # Create new *.isl files with the correct path to the *.ibd files,
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab1/test/emp2#p#p1.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p1.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab2/test/emp2#p#p2.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp2#p#p2.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab3/test/emp3.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp3.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab4/test/emp4#p#p1.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p1.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/tab5/test/emp4#p#p2.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/emp4#p#p2.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part0/test/purchase#p#p0#sp#s0.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s0.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part1/test/purchase#p#p0#sp#s1.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p0#sp#s1.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part2/test/purchase#p#p1#sp#s2.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s2.isl
--exec echo $MYSQL_TMP_DIR/mysqld.5980/part3/test/purchase#p#p1#sp#s3.ibd > $MYSQL_TMP_DIR/mysqld.5980/data/test/purchase#p#p1#sp#s3.isl
--exec echo #change path separator Linux "/" format to windows "\" format by Perl script,
--exec echo #in the *.ISL files , in the Mysql data directory
--perl EOF
use File::Copy;
#use strict;
#use warnings;
my $dir= $ENV{'MYSQL_TMP_DIR'}."/mysqld.5980/data/test";
opendir(DIR, $dir) or die $!;
while (my $file = readdir(DIR)) {
# Read files only in the Directory
next unless (-f "$dir/$file");
# Use a regular expression to find files ending in .isl
next unless ($file =~ m/\.isl$/);
# open file in write mode
open IN_FILE,"<", "$dir/$file" or die $!;
open OUT_FILE, ">", "$dir/tmp" or die $!;
while(<IN_FILE>) {
#change the path separator "/" to "\" in the file
$_=~ s/"$//g;
$_=~ s/\//\\/g;
print OUT_FILE $_;
}
close(IN_FILE);
close(OUT_FILE);
#move the new content from tmp file to the orginal file.
move("$dir/tmp", "$dir/$file");
print "$file\n";
}
closedir(DIR);
exit 0;
EOF
--echo # Restarting the server with skip-grant-tables option and updating
--echo # mysql.user table. This is to deal with the restriction imposed on
--echo # plugin field for users in WL6982.
--echo # Restart the DB server from unzip location of MySQL Data Dir
-- exec echo "restart: --datadir=$MYSQL_TMP_DIR/mysqld.5980/data/ --skip-grant-tables" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
-- exec $MYSQL -e "UPDATE mysql.user SET plugin = 'mysql_native_password'"
-- echo # Stop server
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 30
-- source include/wait_until_disconnected.inc
--echo # Restart the DB server from unzip location of MySQL Data Dir
-- exec echo "restart: --datadir=$MYSQL_TMP_DIR/mysqld.5980/data/ " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
--echo # Check the DB & tables with DML statements.
use test;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp1;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp2;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp3;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE emp4;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE purchase;
SELECT COUNT(*) FROM emp1;
SELECT COUNT(*) FROM emp2;
SELECT COUNT(*) FROM emp3;
SELECT COUNT(*) FROM emp4;
SELECT COUNT(*) FROM purchase;
DELETE FROM emp1;
DELETE FROM emp2;
DELETE FROM emp3;
DELETE FROM emp4;
DELETE FROM purchase;
SELECT COUNT(*) FROM emp1;
SELECT COUNT(*) FROM emp2;
SELECT COUNT(*) FROM emp3;
SELECT COUNT(*) FROM emp4;
SELECT COUNT(*) FROM purchase;
--echo # Check the system tables have the proper entry of the tables.
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables
WHERE name LIKE '%emp%' ORDER BY name;
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables
WHERE name LIKE '%purchase%' ORDER BY name;
--echo #
--echo # Cleanup
--echo #
DROP TABLE emp1;
DROP TABLE emp2;
DROP TABLE emp3;
DROP TABLE emp4;
DROP TABLE purchase;
# The following lines of code just to dupe the MTR frame work nothing to do with WL,
# As MTR thinks that it was a failure, When the server logs contains error/warnings
# even though there are no result mismatch.It is an expected behavior of the server.
CREATE DATABASE mtr;
DELIMITER |;
CREATE PROCEDURE mtr.check_warnings(OUT result INT)
BEGIN
SELECT 0 INTO RESULT;
END|
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab1/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab2/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab3/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab4/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab5/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part0/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part1/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part2/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part3/test
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab1
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab2
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab3
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab4
--rmdir $MYSQL_TMP_DIR/mysqld.5980/tab5
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part0
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part1
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part2
--rmdir $MYSQL_TMP_DIR/mysqld.5980/part3
This diff is collapsed.
######## suite/innodb/t/innodb-wl6445-2 ##########
# #
# Testcase for worklog WL#6445: InnoDB should be able to work with #
# read-only tables
# All sub-test in this file focus on changinf file permission and #
# restarting server in read only. It verifies necessary operations #
# are blocked #
# #
# #
# Creation: #
# 2011-09-06 Implemented this test as part of WL#6445 #
# #
######################################################################
# Don't test this under valgrind, memory leaks will occur due restart
--source include/not_valgrind.inc
# Not supported in embedded
--source include/not_embedded.inc
-- source include/have_innodb.inc
# *nix specific command to remove write permission
# wanted to use perl to save original permission of file and restore back after
# chnage but could not find way to do.(with perl we could run test on windows too)
-- source include/not_windows.inc
let MYSQLD_DATADIR =`SELECT @@datadir`;
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
let $innodb_large_prefix_orig = `select @@innodb_large_prefix`;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;
set global innodb_large_prefix=1;
SELECT @@innodb_large_prefix;
let $MYSQLD_DATADIR = `SELECT @@datadir`;
--disable_warnings
DROP DATABASE IF EXISTS testdb_wl6445;
--enable_warnings
CREATE DATABASE testdb_wl6445;
#------------------------------------------------------------------------------
# Testcase covers
# a) Create table/data ,
# b) remove write permission of ibdata , ib_logfile0
# c) restart server in --innodb-read-only mode and verfiy DDL/DML/DCL in read only mode
#------------------------------------------------------------------------------
--echo case # 1
SET GLOBAL innodb_file_per_table = 1;
SET GLOBAL innodb_file_format = `Barracuda`;
USE testdb_wl6445;
CREATE TABLE t1 ( i int PRIMARY KEY , j blob) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1,repeat('a',200)),(2,repeat('b',200)),(3,repeat('c',200));
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
# remove write permissions
--exec chmod a-w $MYSQLD_DATADIR/ibdata1
--exec chmod a-w $MYSQLD_DATADIR/testdb_wl6445/t1.ibd
--exec chmod a-w $MYSQLD_DATADIR/ib_logfile0
#
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
# Do something while server is down
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart: --innodb-read-only " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
USE testdb_wl6445;
SELECT i FROM t1 ORDER BY i;
--ERROR ER_CANT_LOCK
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200));
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
--ERROR ER_CANT_LOCK
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200));
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
--ERROR ER_INNODB_READ_ONLY
CREATE TABLE t2 ( i int , j blob) ENGINE = Innodb;
--ERROR ER_CANT_LOCK
UPDATE t1 SET i = i+1;
# Fix in next revision - known ( no data returned)
# SHOW ENGINE INNODB STATUS;
FLUSH STATUS;
FLUSH LOGS;
FLUSH TABLES t1;
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
#------------------------------------------------------------------------------
#clenaup
#------------------------------------------------------------------------------
#
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
# Do something while server is down
--exec chmod 0644 $MYSQLD_DATADIR/ibdata1
--exec chmod 0644 $MYSQLD_DATADIR/ib_logfile0
--exec chmod 0660 $MYSQLD_DATADIR/testdb_wl6445/t1.ibd
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
DROP DATABASE IF EXISTS testdb_wl6445;
#------------------------------------------------------------------------------
# Testcase covers
# a) Create table/data ,
# b) remove write permission of ibdata , ib_logfile0 when server is running
# c) restart server in --innodb-read-only mode and verfiy DDL/DML/DCL in read only mode
#------------------------------------------------------------------------------
--echo case # 2
--disable_warnings
DROP DATABASE IF EXISTS testdb_wl6445;
--enable_warnings
CREATE DATABASE testdb_wl6445;
USE testdb_wl6445;
CREATE TABLE t1 ( i int PRIMARY KEY , j blob) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1,repeat('a',200)),(2,repeat('b',200)),(3,repeat('c',200));
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
# remove write permissions
--exec chmod a-w $MYSQLD_DATADIR/ibdata1
--exec chmod a-w $MYSQLD_DATADIR/testdb_wl6445/t1.ibd
--exec chmod a-w $MYSQLD_DATADIR/ib_logfile0
#
# check dml/ddl after removing write permission
CREATE TABLE t2 ( i int PRIMARY KEY , j blob) ENGINE = InnoDB;
INSERT INTO t2 VALUES (1,repeat('a',200)),(2,repeat('b',200)),(3,repeat('c',200));
SELECT i,LEFT(j,20) FROM t2 ORDER BY i;
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
UPDATE t2 SET i = i + 10;
SELECT i,LEFT(j,20) FROM t2 ORDER BY i;
DELETE FROM t2;
SELECT i,LEFT(j,20) FROM t2 ORDER BY i;
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
# Do something while server is down
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart: --innodb-read-only " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
USE testdb_wl6445;
SELECT i FROM t1 ORDER BY i;
SELECT i FROM t2 ORDER BY i;
--ERROR ER_CANT_LOCK
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200));
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
--ERROR ER_CANT_LOCK
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200));
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
--ERROR ER_TABLE_EXISTS_ERROR
CREATE TABLE t2 ( i int , j blob) ENGINE = Innodb;
--ERROR ER_INNODB_READ_ONLY
CREATE TABLE t3 ( i int , j blob) ENGINE = Innodb;
--ERROR ER_CANT_LOCK
UPDATE t1 SET i = i+1;
# Fix in next revision - known ( no data returned)
# SHOW ENGINE INNODB STATUS;
FLUSH STATUS;
FLUSH LOGS;
FLUSH TABLES t1,t2;
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
#------------------------------------------------------------------------------
# Testcase covers
# a) Create table/data ,
# b) remove write permission of ibdata , ib_logfile0
# c) try to restart server without --innodb-read-only mode
#------------------------------------------------------------------------------
# Note : write permission is already removed in previous case so we just
# start server without --innodb-read-only option
--echo case # 3
# We let our server restart attempts write to the file $error_log.
let $error_log= $MYSQLTEST_VARDIR/log/my_restart.err;
--error 0,1
--remove_file $error_log
# $error_log has to be processed by include/search_pattern_in_file.inc which
# contains Perl code requiring that the environment variable SEARCH_FILE points
# to this file.
let SEARCH_FILE= $error_log;
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server 10
--source include/wait_until_disconnected.inc
--echo # Try to restart the server without --innodb-read-only after removing
--echo # write permissions of system tablespace. Server should not start.
--echo # This confirms server is not automatically started in read-only mode.
#----------------------------------------------------------------------------------
# Detailed explanations of what happens are placed nearby the checks.
--error 1
--exec $MYSQLD_CMD --loose-console > $error_log 2>&1
# We get depending on the platform either "./ibdata1" or ".\ibdata1".
let SEARCH_PATTERN=InnoDB: The system tablespace must be writable;
--source include/search_pattern_in_file.inc
#------------------------------------------------------------------------------
#clenaup
#------------------------------------------------------------------------------
#
# Do something while server is down
--exec chmod 0644 $MYSQLD_DATADIR/ibdata1
--exec chmod 0644 $MYSQLD_DATADIR/ib_logfile0
--exec chmod 0660 $MYSQLD_DATADIR/testdb_wl6445/t1.ibd
--error 0,1
--remove_file $error_log
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
USE testdb_wl6445;
DROP DATABASE testdb_wl6445;
eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
eval SET GLOBAL innodb_large_prefix = $innodb_large_prefix_orig;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# Test for bug #11789106: FAILING ASSERTION: templ->mbmaxlen > templ->mbminlen
# templ->mysql_col_len == len
-- source include/have_innodb.inc
create table table_11789106(`a` point,`b` int,`c` char(2),
primary key (`a`(1),`c`(1)), key (`b`))
character set latin2 engine=innodb;
insert into table_11789106 values (geomfromtext('point(1 1)'),'','');
# This will trigger the assertion failure in
# row_sel_field_store_in_mysql_format_func()
select `a` from table_11789106 where `b` < '1' for update;
drop table table_11789106;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
--no-console --log-error=$MYSQLTEST_VARDIR/tmp/innodb_file_limit.err
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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