1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
#
# Scenario 1. Test recovery when recovery starts and ends in the same block as checkpoint_lsn.
#
Pass: 0
# Initialization - create table, resets autoincrement value.
# 0. Move to the next log block.
include/assert.inc [We failed to create log records that would end at boundary between blocks]
# 1. Execute tiny mini-transaction in the current block [only pass 0]
# 2. Create checkpoint at the current lsn and block further checkpoints
# 3. Execute transaction to force non-trivial crash recovery: 103.
include/assert.inc [All must happen within the single log block (this was required for the bug)]
# 5. Crash when trying to insert B.
# 6. Recover 103, write new redo record X during recovery and crash just before flushing page with 103
# 7. Start recovery and ensure all is recovered - we must recover 103.
# If first_rec_group was pointing to X we would skip 103.
# The auto increment value should also be stored properly (with
# value of 5 in first pass, 4 in second).
SELECT * FROM t;
a b
100 1
101 2
102 3
103 4
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't';
AUTO_INCREMENT
5
Pass: 1
# Initialization - create table, resets autoincrement value.
# 0. Move to the next log block.
include/assert.inc [We failed to create log records that would end at boundary between blocks]
# 1. Execute tiny mini-transaction in the current block [only pass 0]
# 2. Create checkpoint at the current lsn and block further checkpoints
# 3. Execute transaction to force non-trivial crash recovery: 103.
include/assert.inc [All must happen within the single log block (this was required for the bug)]
# 5. Crash when trying to insert B.
# 6. Recover 103, write new redo record X during recovery and crash just before flushing page with 103
# 7. Start recovery and ensure all is recovered - we must recover 103.
# If first_rec_group was pointing to X we would skip 103.
# The auto increment value should also be stored properly (with
# value of 5 in first pass, 4 in second).
SELECT * FROM t;
a b
100 1
101 2
103 3
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't';
AUTO_INCREMENT
4
#
# Scenario 2. Restart after writing full log block with record ending at boundary,
# recovery should start in middle of the last written block (pass 0, 2)
# or at the beginning of that block (pass 1, 3) and end before the next
# block (pass 0, 1) or just 12 bytes after its beginning (pass 2, 3).
#
Pass: 0
# Initialization - create table, resets autoincrement value.
# 0. Move to the next log block
include/assert.inc [We failed to create log records that would end at boundary between blocks]
# 1. Execute tiny mini-transaction in the current block [pass 0, 2]
# 2. Write up to the end of the block.
# 3. Crash on writing next 12 bytes of incomplete block [pass 0, 1].
# 4. If we still haven't crashed, force mtr to crash.
# 5. Start MySQL after crash to see how it takes care of recovery
SELECT * FROM t;
a b
200 1
201 2
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't';
AUTO_INCREMENT
5
Pass: 1
# Initialization - create table, resets autoincrement value.
# 0. Move to the next log block
include/assert.inc [We failed to create log records that would end at boundary between blocks]
# 1. Execute tiny mini-transaction in the current block [pass 0, 2]
# 2. Write up to the end of the block.
# 3. Crash on writing next 12 bytes of incomplete block [pass 0, 1].
# 4. If we still haven't crashed, force mtr to crash.
# 5. Start MySQL after crash to see how it takes care of recovery
SELECT * FROM t;
a b
200 1
201 2
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't';
AUTO_INCREMENT
4
Pass: 2
# Initialization - create table, resets autoincrement value.
# 0. Move to the next log block
include/assert.inc [We failed to create log records that would end at boundary between blocks]
# 1. Execute tiny mini-transaction in the current block [pass 0, 2]
# 2. Write up to the end of the block.
# 3. Crash on writing next 12 bytes of incomplete block [pass 0, 1].
include/assert.inc [We failed to create log records that would end at boundary between blocks]
# 4. If we still haven't crashed, force mtr to crash.
# 5. Start MySQL after crash to see how it takes care of recovery
SELECT * FROM t;
a b
200 1
201 2
202 3
203 4
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't';
AUTO_INCREMENT
5
Pass: 3
# Initialization - create table, resets autoincrement value.
# 0. Move to the next log block
include/assert.inc [We failed to create log records that would end at boundary between blocks]
# 1. Execute tiny mini-transaction in the current block [pass 0, 2]
# 2. Write up to the end of the block.
# 3. Crash on writing next 12 bytes of incomplete block [pass 0, 1].
include/assert.inc [We failed to create log records that would end at boundary between blocks]
# 4. If we still haven't crashed, force mtr to crash.
# 5. Start MySQL after crash to see how it takes care of recovery
SELECT * FROM t;
a b
200 1
201 2
203 3
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't';
AUTO_INCREMENT
4
# Cleanup...
|