| 1 |
SET PERSIST innodb_extend_and_initialize=FALSE; |
| 2 |
SELECT @@GLOBAL.innodb_extend_and_initialize; |
| 3 |
@@GLOBAL.innodb_extend_and_initialize |
| 4 |
0 |
| 5 |
# Scenario-1: posix_fallocate returns errors EINTR |
| 6 |
# or EINVAL |
| 7 |
DROP TABLE IF EXISTS ttext1; |
| 8 |
Warnings: |
| 9 |
Note 1051 Unknown table 'test.ttext1' |
| 10 |
CREATE TABLE ttext1(c1 INT, c2 TEXT); |
| 11 |
INSERT INTO ttext1 VALUES(1, REPEAT('abcdef', 10000)); |
| 12 |
INSERT INTO ttext1 VALUES(2, REPEAT('abcdef', 10000)); |
| 13 |
INSERT INTO ttext1 VALUES(3, REPEAT('abcdef', 10000)); |
| 14 |
SET SESSION debug='+d,ib_posix_fallocate_fail_eintr'; |
| 15 |
INSERT INTO ttext1 VALUES(4, REPEAT('abcdef', 10000)); |
| 16 |
SELECT COUNT(*) FROM ttext1; |
| 17 |
COUNT(*) |
| 18 |
4 |
| 19 |
DROP TABLE ttext1; |
| 20 |
SET SESSION debug='-d,ib_posix_fallocate_fail_eintr'; |
| 21 |
# Scenario-2: Server crashed while creating a table |
| 22 |
# just after writing the redo log record for space |
| 23 |
# extension |
| 24 |
DROP TABLE IF EXISTS t1; |
| 25 |
Warnings: |
| 26 |
Note 1051 Unknown table 'test.t1' |
| 27 |
SET SESSION debug='+d,ib_crash_after_writing_redo_extend_1'; |
| 28 |
CREATE TABLE t1(a char(1), b char(1), key(a, b)) ENGINE=innodb; |
| 29 |
# Restart after the crash |
| 30 |
INSERT INTO t1 VALUES('a','b'); |
| 31 |
ERROR 42S02: Table 'test.t1' doesn't exist |
| 32 |
# Scenario-3: Server crashed after writing the redo log |
| 33 |
# but before the transaction could commit |
| 34 |
CREATE TABLE ttext1(c1 INT, c2 TEXT); |
| 35 |
INSERT INTO ttext1 VALUES(1, REPEAT('abcdef',10000)); |
| 36 |
INSERT INTO ttext1 VALUES(2, REPEAT('abcdef',10000)); |
| 37 |
INSERT INTO ttext1 VALUES(3, REPEAT('abcdef',10000)); |
| 38 |
SET SESSION debug='+d,ib_crash_after_writing_redo_extend_1'; |
| 39 |
INSERT INTO ttext1 VALUES(4, REPEAT('abcdef',10000)); |
| 40 |
# Restart after the crash |
| 41 |
SELECT COUNT(*) FROM ttext1; |
| 42 |
COUNT(*) |
| 43 |
3 |
| 44 |
INSERT INTO ttext1 VALUES(5, REPEAT('abcdef',10000)); |
| 45 |
INSERT INTO ttext1 VALUES(6, REPEAT('abcdef',10000)); |
| 46 |
SELECT COUNT(*) FROM ttext1; |
| 47 |
COUNT(*) |
| 48 |
5 |
| 49 |
DROP TABLE ttext1; |
| 50 |
SET PERSIST innodb_extend_and_initialize=DEFAULT; |
| 51 |
SELECT @@GLOBAL.innodb_extend_and_initialize; |
| 52 |
@@GLOBAL.innodb_extend_and_initialize |
| 53 |
1 |
| 54 |
# Scenario-4: Server crashes before the checkpoint |
| 55 |
SET @@GLOBAL.INNODB_CHECKPOINT_DISABLED='ON'; |
| 56 |
DROP TABLE IF EXISTS ttext; |
| 57 |
Warnings: |
| 58 |
Note 1051 Unknown table 'test.ttext' |
| 59 |
CREATE TABLE ttext(c1 INT, c2 TEXT); |
| 60 |
INSERT INTO ttext VALUES(1, REPEAT('abcdef',10000)); |
| 61 |
INSERT INTO ttext VALUES(2, REPEAT('abcdef',10000)); |
| 62 |
INSERT INTO ttext VALUES(3, REPEAT('abcdef',10000)); |
| 63 |
INSERT INTO ttext VALUES(4, REPEAT('abcdef',10000)); |
| 64 |
SELECT COUNT(*) FROM ttext; |
| 65 |
COUNT(*) |
| 66 |
4 |
| 67 |
# Kill and restart |
| 68 |
SELECT @@GLOBAL.INNODB_CHECKPOINT_DISABLED; |
| 69 |
@@GLOBAL.INNODB_CHECKPOINT_DISABLED |
| 70 |
0 |
| 71 |
SELECT @@GLOBAL.innodb_extend_and_initialize; |
| 72 |
@@GLOBAL.innodb_extend_and_initialize |
| 73 |
1 |
| 74 |
SELECT COUNT(*) FROM ttext; |
| 75 |
COUNT(*) |
| 76 |
4 |
| 77 |
DROP TABLE ttext; |
| 78 |
SET PERSIST innodb_extend_and_initialize=DEFAULT; |
| 79 |
SELECT @@GLOBAL.innodb_extend_and_initialize; |
| 80 |
@@GLOBAL.innodb_extend_and_initialize |
| 81 |
1 |
| 82 |
# Scenario-5: Server crasheѕ before checkpoint |
| 83 |
# and restarted with innodb_extend_and_initialize=off |
| 84 |
SET @@GLOBAL.innodb_extend_and_initialize='OFF'; |
| 85 |
SELECT @@GLOBAL.innodb_extend_and_initialize; |
| 86 |
@@GLOBAL.innodb_extend_and_initialize |
| 87 |
0 |
| 88 |
SET @@GLOBAL.INNODB_CHECKPOINT_DISABLED='ON'; |
| 89 |
CREATE TABLE ttext(c1 INT, c2 TEXT); |
| 90 |
INSERT INTO ttext VALUES(1, REPEAT('abcdef',10000)); |
| 91 |
INSERT INTO ttext VALUES(2, REPEAT('abcdef',10000)); |
| 92 |
INSERT INTO ttext VALUES(3, REPEAT('abcdef',10000)); |
| 93 |
INSERT INTO ttext VALUES(4, REPEAT('abcdef',10000)); |
| 94 |
SELECT COUNT(*) FROM ttext; |
| 95 |
COUNT(*) |
| 96 |
4 |
| 97 |
# Kill and restart |
| 98 |
SELECT @@GLOBAL.INNODB_CHECKPOINT_DISABLED; |
| 99 |
@@GLOBAL.INNODB_CHECKPOINT_DISABLED |
| 100 |
0 |
| 101 |
SELECT @@GLOBAL.innodb_extend_and_initialize; |
| 102 |
@@GLOBAL.innodb_extend_and_initialize |
| 103 |
1 |
| 104 |
SELECT COUNT(*) FROM ttext; |
| 105 |
COUNT(*) |
| 106 |
4 |
| 107 |
DROP TABLE ttext; |
| 108 |
RESET PERSIST; |