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