123 lines
3.8 KiB
Plaintext
123 lines
3.8 KiB
Plaintext
SET GLOBAL innodb_file_per_table = 1;
|
|
SELECT @@innodb_file_per_table;
|
|
@@innodb_file_per_table
|
|
1
|
|
DROP DATABASE IF EXISTS testdb_wl6445;
|
|
CREATE DATABASE testdb_wl6445;
|
|
case # 1
|
|
SET GLOBAL innodb_file_per_table = 1;
|
|
USE testdb_wl6445;
|
|
CREATE TABLE t1 ( i int PRIMARY KEY , j blob, KEY k1(j(10)), KEY k2(j(20))) 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;
|
|
i LEFT(j,20)
|
|
1 aaaaaaaaaaaaaaaaaaaa
|
|
2 bbbbbbbbbbbbbbbbbbbb
|
|
3 cccccccccccccccccccc
|
|
SET GLOBAL innodb_fast_shutdown = 0;
|
|
# restart: --innodb-read-only
|
|
USE testdb_wl6445;
|
|
SELECT i FROM t1 ORDER BY i;
|
|
i
|
|
1
|
|
2
|
|
3
|
|
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200));
|
|
ERROR HY000: Can't lock file (errno: 165 - Table is read only)
|
|
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
|
|
i LEFT(j,20)
|
|
1 aaaaaaaaaaaaaaaaaaaa
|
|
2 bbbbbbbbbbbbbbbbbbbb
|
|
3 cccccccccccccccccccc
|
|
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200));
|
|
ERROR HY000: Can't lock file (errno: 165 - Table is read only)
|
|
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
|
|
i LEFT(j,20)
|
|
1 aaaaaaaaaaaaaaaaaaaa
|
|
2 bbbbbbbbbbbbbbbbbbbb
|
|
3 cccccccccccccccccccc
|
|
CREATE TABLE t2 ( i int , j blob) ENGINE = Innodb;
|
|
ERROR HY000: Running in read-only mode
|
|
UPDATE t1 SET i = i+1;
|
|
ERROR HY000: Can't lock file (errno: 165 - Table is read only)
|
|
FLUSH STATUS;
|
|
FLUSH LOGS;
|
|
FLUSH TABLES t1;
|
|
FLUSH TABLES WITH READ LOCK;
|
|
UNLOCK TABLES;
|
|
# restart
|
|
DROP DATABASE testdb_wl6445;
|
|
case # 2
|
|
CREATE DATABASE testdb_wl6445;
|
|
USE testdb_wl6445;
|
|
CREATE TABLE t1 ( i int PRIMARY KEY , j blob, KEY k1(j(10)), KEY k2(j(20))) 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;
|
|
i LEFT(j,20)
|
|
1 aaaaaaaaaaaaaaaaaaaa
|
|
2 bbbbbbbbbbbbbbbbbbbb
|
|
3 cccccccccccccccccccc
|
|
CREATE TABLE t2 ( i int PRIMARY KEY , j blob, KEY k1(j(10)), KEY k2(j(20))) 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;
|
|
i LEFT(j,20)
|
|
1 aaaaaaaaaaaaaaaaaaaa
|
|
2 bbbbbbbbbbbbbbbbbbbb
|
|
3 cccccccccccccccccccc
|
|
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
|
|
i LEFT(j,20)
|
|
1 aaaaaaaaaaaaaaaaaaaa
|
|
2 bbbbbbbbbbbbbbbbbbbb
|
|
3 cccccccccccccccccccc
|
|
UPDATE t2 SET i = i + 10;
|
|
SELECT i,LEFT(j,20) FROM t2 ORDER BY i;
|
|
i LEFT(j,20)
|
|
11 aaaaaaaaaaaaaaaaaaaa
|
|
12 bbbbbbbbbbbbbbbbbbbb
|
|
13 cccccccccccccccccccc
|
|
DELETE FROM t2;
|
|
SELECT i,LEFT(j,20) FROM t2 ORDER BY i;
|
|
i LEFT(j,20)
|
|
SET GLOBAL innodb_fast_shutdown = 0;
|
|
# restart: --innodb-read-only
|
|
USE testdb_wl6445;
|
|
SELECT i FROM t1 ORDER BY i;
|
|
i
|
|
1
|
|
2
|
|
3
|
|
SELECT i FROM t2 ORDER BY i;
|
|
i
|
|
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200));
|
|
ERROR HY000: Can't lock file (errno: 165 - Table is read only)
|
|
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
|
|
i LEFT(j,20)
|
|
1 aaaaaaaaaaaaaaaaaaaa
|
|
2 bbbbbbbbbbbbbbbbbbbb
|
|
3 cccccccccccccccccccc
|
|
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200));
|
|
ERROR HY000: Can't lock file (errno: 165 - Table is read only)
|
|
SELECT i,LEFT(j,20) FROM t1 ORDER BY i;
|
|
i LEFT(j,20)
|
|
1 aaaaaaaaaaaaaaaaaaaa
|
|
2 bbbbbbbbbbbbbbbbbbbb
|
|
3 cccccccccccccccccccc
|
|
CREATE TABLE t2 ( i int , j blob) ENGINE = Innodb;
|
|
ERROR 42S01: Table 't2' already exists
|
|
CREATE TABLE t3 ( i int , j blob) ENGINE = Innodb;
|
|
ERROR HY000: Running in read-only mode
|
|
UPDATE t1 SET i = i+1;
|
|
ERROR HY000: Can't lock file (errno: 165 - Table is read only)
|
|
FLUSH STATUS;
|
|
FLUSH LOGS;
|
|
FLUSH TABLES t1,t2;
|
|
FLUSH TABLES WITH READ LOCK;
|
|
UNLOCK TABLES;
|
|
case # 3
|
|
# Try to restart the server without --innodb-read-only after removing
|
|
# write permissions of system tablespace. Server should not start.
|
|
# This confirms server is not automatically started in read-only mode.
|
|
Pattern "The innodb_system data file 'ibdata1' must be writable" found
|
|
# restart
|
|
DROP DATABASE testdb_wl6445;
|