| 1 |
# Scenario "too_fast and empty flush list" - no-redo dirtied page inserted |
| 2 |
# too quickly, and the flush list is empty when it happens. |
| 3 |
# |
| 4 |
|
| 5 |
let $i = $n_conn; |
| 6 |
while ($i > 1) { |
| 7 |
connect(con$i, localhost, root,,); |
| 8 |
dec $i; |
| 9 |
} |
| 10 |
|
| 11 |
--connection default |
| 12 |
|
| 13 |
--echo # |
| 14 |
--echo # 0. Block log.recent_closed.tail() from advancing by stopping single mtr |
| 15 |
--echo # just before it inserts its dirty pages to flush list. |
| 16 |
--echo # |
| 17 |
|
| 18 |
let $recent_closed_freeze_empty_flush_list = 1; |
| 19 |
--source ../include/log_recent_closed_freeze.inc |
| 20 |
let $recent_closed_freeze_empty_flush_list = 0; |
| 21 |
|
| 22 |
--echo # |
| 23 |
--echo # 1. Frozen recent_closed. |
| 24 |
--echo # |
| 25 |
|
| 26 |
--source ../include/log_read_dirty_pages_added_up_to_lsn.inc |
| 27 |
|
| 28 |
if ($debug_test) { |
| 29 |
--source ../include/log_read_current_lsn.inc |
| 30 |
--echo Dirty pages added up to lsn: $dirty_pages_added_up_to_lsn |
| 31 |
--echo Current LSN: $current_lsn |
| 32 |
} |
| 33 |
|
| 34 |
--echo # |
| 35 |
--echo # 2. Optionally modify no-redo dirtied page (in which case next time we remodify it) |
| 36 |
--echo # Note it will be flushed meanwhile anyway. |
| 37 |
--echo # |
| 38 |
|
| 39 |
BEGIN; |
| 40 |
DELETE FROM tmp_t WHERE a < 0; |
| 41 |
|
| 42 |
if ($noredo_remodify) { |
| 43 |
CALL mtr_noredo_generate_single(); |
| 44 |
CALL mtr_noredo_generate_single(); |
| 45 |
} |
| 46 |
|
| 47 |
--echo # |
| 48 |
--echo # 3. Start transactions and open tables. |
| 49 |
--echo # |
| 50 |
|
| 51 |
let $i = $n_conn; |
| 52 |
while ($i > 1) { |
| 53 |
--connection con$i |
| 54 |
BEGIN; |
| 55 |
eval DELETE FROM t$i WHERE a < 0; |
| 56 |
dec $i; |
| 57 |
} |
| 58 |
|
| 59 |
--connection default |
| 60 |
|
| 61 |
--echo # |
| 62 |
--echo # 4. Keep modifying pages, stop just before we reach limit in recent_closed. |
| 63 |
--echo # |
| 64 |
|
| 65 |
CALL mtr_redo_generate_multi(1, 1800, 800); |
| 66 |
|
| 67 |
let $wait_lsn = $dirty_pages_added_up_to_lsn + 2*1024*1024 - 2000; |
| 68 |
|
| 69 |
let $stop = 0; |
| 70 |
while ($stop == 0) { |
| 71 |
|
| 72 |
CALL mtr_redo_generate_single(1, 100); |
| 73 |
--source ../include/log_read_current_lsn.inc |
| 74 |
|
| 75 |
--let $cond = SELECT $current_lsn >= $wait_lsn; |
| 76 |
|
| 77 |
let $stop = `$cond`; |
| 78 |
} |
| 79 |
|
| 80 |
if ($debug_test) { |
| 81 |
--source ../include/log_read_dirty_pages_added_up_to_lsn.inc |
| 82 |
--source ../include/log_read_current_lsn.inc |
| 83 |
--echo Dirty pages added up to lsn: $dirty_pages_added_up_to_lsn |
| 84 |
--echo Current LSN: $current_lsn |
| 85 |
} |
| 86 |
|
| 87 |
--echo # |
| 88 |
--echo # 5. Flush all dirty pages to make flush list empty. |
| 89 |
--echo # |
| 90 |
|
| 91 |
SET GLOBAL DEBUG = "+d,buf_flush_list_ignore_recent_closed"; |
| 92 |
SET GLOBAL innodb_buf_flush_list_now = 1; |
| 93 |
SET GLOBAL DEBUG = "-d,buf_flush_list_ignore_recent_closed"; |
| 94 |
|
| 95 |
--echo # |
| 96 |
--echo # 6. Execute multiple mtr, stopping them before they add any pages... |
| 97 |
--echo # |
| 98 |
|
| 99 |
let $i = $n_conn; |
| 100 |
while ($i > 1) { |
| 101 |
|
| 102 |
--connection con$i |
| 103 |
|
| 104 |
SET DEBUG = "+d,btr_ins_pause_on_mtr_redo_before_add_dirty_blocks"; |
| 105 |
|
| 106 |
eval SET @q = CONCAT("CALL mtr_redo_generate_single(", $i, ", 500)"); |
| 107 |
PREPARE stmt FROM @q; |
| 108 |
--send EXECUTE stmt; |
| 109 |
|
| 110 |
dec $i; |
| 111 |
} |
| 112 |
--connection default |
| 113 |
|
| 114 |
--echo # |
| 115 |
--echo # 7. Wait until we run out of free space in recent_closed... |
| 116 |
--echo # |
| 117 |
|
| 118 |
let $wait_lsn = $dirty_pages_added_up_to_lsn + 2*1024*1024 + 10; |
| 119 |
|
| 120 |
if ($debug_test) { |
| 121 |
--echo Wait LSN: $wait_lsn |
| 122 |
} |
| 123 |
|
| 124 |
--source ../include/log_wait_for_current_lsn.inc |
| 125 |
|
| 126 |
--echo # |
| 127 |
--echo # 8. Execute mini-transactions with no-redo dirtied pages (MTR_LOG_NO_REDO). |
| 128 |
--echo # When bug was present, such mtr inserted pages with too big lsn using |
| 129 |
--echo # current lsn, which does not fit space in log.recent_closed, bypassing |
| 130 |
--echo # required wait for space there (thanks to MTR_LOG_NO_REDO). |
| 131 |
--echo # |
| 132 |
|
| 133 |
if ($noredo_remodify == 1) { |
| 134 |
CALL mtr_noredo_update_all(); |
| 135 |
} |
| 136 |
|
| 137 |
if ($noredo_remodify == 0) { |
| 138 |
CALL mtr_noredo_generate_single(); |
| 139 |
CALL mtr_noredo_generate_single(); |
| 140 |
} |
| 141 |
|
| 142 |
--echo # |
| 143 |
--echo # 9. Resume log.recent_closed |
| 144 |
--echo # |
| 145 |
|
| 146 |
--source ../include/log_recent_closed_unfreeze.inc |
| 147 |
|
| 148 |
--echo # |
| 149 |
--echo # 10. Finish pending mini-transactions |
| 150 |
--echo # |
| 151 |
|
| 152 |
COMMIT; |
| 153 |
|
| 154 |
SET DEBUG_SYNC = "now SIGNAL btr_ins_resume"; |
| 155 |
|
| 156 |
let $i = $n_conn; |
| 157 |
while ($i > 1) { |
| 158 |
--connection con$i |
| 159 |
reap; |
| 160 |
SET DEBUG = "-d,btr_ins_pause_on_mtr_redo_before_add_dirty_blocks"; |
| 161 |
SET DEBUG_SYNC = "mtr_redo_before_add_dirty_blocks CLEAR"; |
| 162 |
COMMIT; |
| 163 |
disconnect con$i; |
| 164 |
dec $i; |
| 165 |
} |
| 166 |
|
| 167 |
--connection default |
| 168 |
|
| 169 |
# Just to clear the signal btr_ins_resume: |
| 170 |
SET DEBUG_SYNC = "now WAIT_FOR btr_ins_resume"; |
| 171 |
|
| 172 |
--echo # |
| 173 |
--echo # 11. Perform standard mtrs, just to ensure all is fine. |
| 174 |
--echo # |
| 175 |
|
| 176 |
CALL mtr_redo_generate_single(1, 1000); |
| 177 |
CALL mtr_noredo_generate_single(); |
| 178 |
CALL mtr_redo_generate_single(2, 1000); |