1# Scenario "too_fast" - no-redo dirtied page inserted too quickly. 2# 3 4let $i = $n_conn; 5while ($i > 0) { 6 connect(con$i, localhost, root,,); 7 dec $i; 8} 9 10--echo # 11--echo # 0. Block log.recent_closed.tail() from advancing by stopping single mtr 12--echo # just before it inserts its dirty pages to flush list. 13--echo # 14 15--source ../include/log_recent_closed_freeze.inc 16 17--source ../include/log_read_dirty_pages_added_up_to_lsn.inc 18--source ../include/log_read_current_lsn.inc 19 20if ($debug_test) { 21 --echo Dirty pages added up to lsn: $dirty_pages_added_up_to_lsn 22 --echo Current LSN: $current_lsn 23} 24 25--echo # 26--echo # 1. Optionally modify no-redo dirtied page (then it is later remodified). 27--echo # 28 29BEGIN; 30DELETE FROM tmp_t WHERE a < 0; 31 32if ($noredo_remodify) { 33 CALL mtr_noredo_generate_single(); 34 CALL mtr_noredo_generate_single(); 35} 36 37let $init_lsn = $current_lsn; 38 39--echo # 40--echo # 2. Gather threads that try to insert dirtied pages with underlying redo 41--echo # records that protect the changes. 42--echo # 43 44let $i = $n_conn; 45while ($i > 0) { 46 --connection con$i 47 BEGIN; 48 eval DELETE FROM t$i WHERE a < 0; 49 dec $i; 50} 51 52let $i = $n_conn; 53while ($i > 0) { 54 --connection con$i 55 eval SET @q = CONCAT("CALL mtr_redo_generate_multi(", $i, ", 1800, 120)"); 56 PREPARE stmt FROM @q; 57 --send EXECUTE stmt; 58 dec $i; 59} 60--connection default 61 62--echo # 63--echo # 3. Wait gathering such threads until more data is written to log buffer. 64--echo # Wait until current lsn is greater than log.recent_closed.tail() by 65--echo # more than capacity of log.recent_closed. 66--echo # 67 68let $wait_lsn = $init_lsn + 2*1024*1024 + 10; 69 70if ($debug_test) { 71 --echo Wait LSN: $wait_lsn... 72} 73 74--source ../include/log_wait_for_current_lsn.inc 75 76--source ../include/log_read_dirty_pages_added_up_to_lsn.inc 77--source ../include/log_read_current_lsn.inc 78 79if ($debug_test) { 80 --echo Dirty pages added up to lsn: $dirty_pages_added_up_to_lsn 81 --echo Current LSN: $current_lsn 82} 83 84--let $assert_cond = $current_lsn - $dirty_pages_added_up_to_lsn > 2*1024*1024 85--let $assert_text = We must advance current lsn by more than maximum flush order lag. 86--source include/assert.inc 87 88--echo # 89--echo # 4. Execute mini transactions with no-redo dirtied pages (MTR_LOG_NO_REDO). 90--echo # 91--echo # When bug was present, such mtr inserted pages with too big lsn using 92--echo # current lsn, which does not fit space in log.recent_closed, bypassing 93--echo # required wait for space there (thanks to MTR_LOG_NO_REDO). 94--echo # 95 96if ($noredo_remodify == 1) { 97 CALL mtr_noredo_update_all(); 98} 99if ($noredo_remodify == 0) { 100 CALL mtr_noredo_generate_single(); 101 CALL mtr_noredo_generate_single(); 102} 103 104--echo # 105--echo # 5. Resume the old mtr which blocked the log.recent_closed.tail() from advancing. 106--echo # 107 108--source ../include/log_recent_closed_unfreeze.inc 109 110--echo # 111--echo # 6. Disconnect pending connections. 112--echo # 113 114COMMIT; 115let $i = $n_conn; 116while ($i > 0) { 117 --connection con$i 118 reap; 119 COMMIT; 120 disconnect con$i; 121 dec $i; 122} 123--connection default 124 125--echo # 126--echo # 7. Perform standard mtrs, just to ensure all is fine. 127--echo # 128 129CALL mtr_redo_generate_single(1, 1000); 130CALL mtr_noredo_generate_single(); 131CALL mtr_redo_generate_single(2, 1000); 132