1--echo Bug #18412598  UNCLEAN SYSTEM SHUTDOWN RECOVERY FAILS
2--echo		      FOR SCHEMA WITH CAPITAL LETTERS
3
4--source include/have_innodb.inc
5--source include/not_embedded.inc
6--source include/have_case_insensitive_file_system.inc
7
8# Start the server with innodb-fast-shutdown=2,so that
9# during next invocation of server it enters crash
10# recovery mode
11
12create database MYDB;
13USE MYDB;
14CREATE TABLE mytable (id int primary key) ENGINE=innodb;
15CREATE TABLE FOO (id int,constraint FOREIGN KEY (id) REFERENCES mytable(id) ON DELETE CASCADE) ENGINE=innodb;
16CREATE TABLE mytable_ref (id int,constraint FOREIGN KEY (id) REFERENCES FOO(id) ON DELETE CASCADE) ENGINE=innodb;
17
18INSERT INTO mytable VALUES (10),(20),(30),(40);
19INSERT INTO FOO VALUES (20),(10);
20INSERT INTO mytable_ref VALUES (20),(10);
21
22SHOW VARIABLES LIKE 'innodb_fast_shutdown';
23
24START TRANSACTION;
25
26INSERT INTO mytable VALUES (50);
27INSERT INTO FOO VALUES (50);
28INSERT INTO mytable_ref VALUES (50);
29
30# Stop the server
31--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
32--shutdown_server
33--source include/wait_until_disconnected.inc
34
35--echo # Restart the server. This will go into crash recovery mode
36--exec echo "restart: --innodb-fast-shutdown=0 " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
37--enable_reconnect
38--source include/wait_until_connected_again.inc
39
40USE MYDB;
41SELECT * FROM mytable;
42SELECT * FROM FOO;
43SELECT * FROM mytable_ref;
44
45DELETE FROM mytable WHERE id =10;
46
47SELECT * FROM FOO;
48SELECT * FROM mytable_ref;
49
50# Create table with mixed names,this should
51# fail in case insensitive systems
52
53--error ER_TABLE_EXISTS_ERROR
54CREATE TABLE MYtable (id int) ENGINE=innodb;
55
56--error ER_TABLE_EXISTS_ERROR
57CREATE TABLE Foo (id int) ENGINE=innodb;
58
59DROP TABLE mytable_ref,FOO;
60DROP TABLE mytable;
61use test;
62DROP DATABASE MYDB;
63
64