| 1 |
SET GLOBAL innodb_file_per_table = 1; |
| 2 |
SELECT @@innodb_file_per_table; |
| 3 |
@@innodb_file_per_table |
| 4 |
1 |
| 5 |
DROP DATABASE IF EXISTS testdb_wl6445; |
| 6 |
CREATE DATABASE testdb_wl6445; |
| 7 |
case # 1 |
| 8 |
SET GLOBAL innodb_file_per_table = 1; |
| 9 |
USE testdb_wl6445; |
| 10 |
CREATE TABLE t1 ( i int PRIMARY KEY , j blob, KEY k1(j(10)), KEY k2(j(20))) ENGINE = InnoDB; |
| 11 |
INSERT INTO t1 VALUES (1,repeat('a',200)),(2,repeat('b',200)),(3,repeat('c',200)); |
| 12 |
SELECT i,LEFT(j,20) FROM t1 ORDER BY i; |
| 13 |
i LEFT(j,20) |
| 14 |
1 aaaaaaaaaaaaaaaaaaaa |
| 15 |
2 bbbbbbbbbbbbbbbbbbbb |
| 16 |
3 cccccccccccccccccccc |
| 17 |
SET GLOBAL innodb_fast_shutdown = 0; |
| 18 |
# restart: --innodb-read-only |
| 19 |
USE testdb_wl6445; |
| 20 |
SELECT i FROM t1 ORDER BY i; |
| 21 |
i |
| 22 |
1 |
| 23 |
2 |
| 24 |
3 |
| 25 |
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200)); |
| 26 |
ERROR HY000: Can't lock file (errno: 165 - Table is read only) |
| 27 |
SELECT i,LEFT(j,20) FROM t1 ORDER BY i; |
| 28 |
i LEFT(j,20) |
| 29 |
1 aaaaaaaaaaaaaaaaaaaa |
| 30 |
2 bbbbbbbbbbbbbbbbbbbb |
| 31 |
3 cccccccccccccccccccc |
| 32 |
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200)); |
| 33 |
ERROR HY000: Can't lock file (errno: 165 - Table is read only) |
| 34 |
SELECT i,LEFT(j,20) FROM t1 ORDER BY i; |
| 35 |
i LEFT(j,20) |
| 36 |
1 aaaaaaaaaaaaaaaaaaaa |
| 37 |
2 bbbbbbbbbbbbbbbbbbbb |
| 38 |
3 cccccccccccccccccccc |
| 39 |
CREATE TABLE t2 ( i int , j blob) ENGINE = Innodb; |
| 40 |
ERROR HY000: Running in read-only mode |
| 41 |
UPDATE t1 SET i = i+1; |
| 42 |
ERROR HY000: Can't lock file (errno: 165 - Table is read only) |
| 43 |
FLUSH STATUS; |
| 44 |
FLUSH LOGS; |
| 45 |
FLUSH TABLES t1; |
| 46 |
FLUSH TABLES WITH READ LOCK; |
| 47 |
UNLOCK TABLES; |
| 48 |
# restart |
| 49 |
DROP DATABASE testdb_wl6445; |
| 50 |
case # 2 |
| 51 |
CREATE DATABASE testdb_wl6445; |
| 52 |
USE testdb_wl6445; |
| 53 |
CREATE TABLE t1 ( i int PRIMARY KEY , j blob, KEY k1(j(10)), KEY k2(j(20))) ENGINE = InnoDB; |
| 54 |
INSERT INTO t1 VALUES (1,repeat('a',200)),(2,repeat('b',200)),(3,repeat('c',200)); |
| 55 |
SELECT i,LEFT(j,20) FROM t1 ORDER BY i; |
| 56 |
i LEFT(j,20) |
| 57 |
1 aaaaaaaaaaaaaaaaaaaa |
| 58 |
2 bbbbbbbbbbbbbbbbbbbb |
| 59 |
3 cccccccccccccccccccc |
| 60 |
CREATE TABLE t2 ( i int PRIMARY KEY , j blob, KEY k1(j(10)), KEY k2(j(20))) ENGINE = InnoDB; |
| 61 |
INSERT INTO t2 VALUES (1,repeat('a',200)),(2,repeat('b',200)),(3,repeat('c',200)); |
| 62 |
SELECT i,LEFT(j,20) FROM t2 ORDER BY i; |
| 63 |
i LEFT(j,20) |
| 64 |
1 aaaaaaaaaaaaaaaaaaaa |
| 65 |
2 bbbbbbbbbbbbbbbbbbbb |
| 66 |
3 cccccccccccccccccccc |
| 67 |
SELECT i,LEFT(j,20) FROM t1 ORDER BY i; |
| 68 |
i LEFT(j,20) |
| 69 |
1 aaaaaaaaaaaaaaaaaaaa |
| 70 |
2 bbbbbbbbbbbbbbbbbbbb |
| 71 |
3 cccccccccccccccccccc |
| 72 |
UPDATE t2 SET i = i + 10; |
| 73 |
SELECT i,LEFT(j,20) FROM t2 ORDER BY i; |
| 74 |
i LEFT(j,20) |
| 75 |
11 aaaaaaaaaaaaaaaaaaaa |
| 76 |
12 bbbbbbbbbbbbbbbbbbbb |
| 77 |
13 cccccccccccccccccccc |
| 78 |
DELETE FROM t2; |
| 79 |
SELECT i,LEFT(j,20) FROM t2 ORDER BY i; |
| 80 |
i LEFT(j,20) |
| 81 |
SET GLOBAL innodb_fast_shutdown = 0; |
| 82 |
# restart: --innodb-read-only |
| 83 |
USE testdb_wl6445; |
| 84 |
SELECT i FROM t1 ORDER BY i; |
| 85 |
i |
| 86 |
1 |
| 87 |
2 |
| 88 |
3 |
| 89 |
SELECT i FROM t2 ORDER BY i; |
| 90 |
i |
| 91 |
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200)); |
| 92 |
ERROR HY000: Can't lock file (errno: 165 - Table is read only) |
| 93 |
SELECT i,LEFT(j,20) FROM t1 ORDER BY i; |
| 94 |
i LEFT(j,20) |
| 95 |
1 aaaaaaaaaaaaaaaaaaaa |
| 96 |
2 bbbbbbbbbbbbbbbbbbbb |
| 97 |
3 cccccccccccccccccccc |
| 98 |
INSERT INTO t1 VALUES (11,repeat('a',200)),(12,repeat('b',200)),(13,repeat('c',200)); |
| 99 |
ERROR HY000: Can't lock file (errno: 165 - Table is read only) |
| 100 |
SELECT i,LEFT(j,20) FROM t1 ORDER BY i; |
| 101 |
i LEFT(j,20) |
| 102 |
1 aaaaaaaaaaaaaaaaaaaa |
| 103 |
2 bbbbbbbbbbbbbbbbbbbb |
| 104 |
3 cccccccccccccccccccc |
| 105 |
CREATE TABLE t2 ( i int , j blob) ENGINE = Innodb; |
| 106 |
ERROR 42S01: Table 't2' already exists |
| 107 |
CREATE TABLE t3 ( i int , j blob) ENGINE = Innodb; |
| 108 |
ERROR HY000: Running in read-only mode |
| 109 |
UPDATE t1 SET i = i+1; |
| 110 |
ERROR HY000: Can't lock file (errno: 165 - Table is read only) |
| 111 |
FLUSH STATUS; |
| 112 |
FLUSH LOGS; |
| 113 |
FLUSH TABLES t1,t2; |
| 114 |
FLUSH TABLES WITH READ LOCK; |
| 115 |
UNLOCK TABLES; |
| 116 |
case # 3 |
| 117 |
# Try to restart the server without --innodb-read-only after removing |
| 118 |
# write permissions of system tablespace. Server should not start. |
| 119 |
# This confirms server is not automatically started in read-only mode. |
| 120 |
Pattern "The innodb_system data file 'ibdata1' must be writable" found |
| 121 |
# restart |
| 122 |
DROP DATABASE testdb_wl6445; |