From 6dc3f09cb9bc219ddf91c8ebfa6a7e1336663325 Mon Sep 17 00:00:00 2001 From: chenyang8094 Date: Mon, 24 Jan 2022 20:55:24 +0800 Subject: [PATCH] Fix AOFRW limit test occasional failures on slower machines (#10164) --- tests/integration/aof-multi-part.tcl | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/integration/aof-multi-part.tcl b/tests/integration/aof-multi-part.tcl index 6957c3dd0..52877404c 100644 --- a/tests/integration/aof-multi-part.tcl +++ b/tests/integration/aof-multi-part.tcl @@ -1090,10 +1090,19 @@ tags {"external:skip"} { } test "AOF will trigger limit when AOFRW fails many times" { + # Clear all data and trigger a successful AOFRW, so we can let + # server.aof_current_size equal to 0 + r flushall + r bgrewriteaof + waitForBgrewriteaof r + r config set rdb-key-save-delay 10000000 # Let us trigger AOFRW easily r config set auto-aof-rewrite-percentage 1 - r config set auto-aof-rewrite-min-size 1mb + r config set auto-aof-rewrite-min-size 1kb + + # Set a key so that AOFRW can be delayed + r set k v # Let AOFRW fail two times, this will trigger AOFRW limit r bgrewriteaof @@ -1105,35 +1114,29 @@ tags {"external:skip"} { waitForBgrewriteaof r assert_aof_manifest_content $aof_manifest_file { - {file appendonly.aof.9.base.rdb seq 9 type b} - {file appendonly.aof.5.incr.aof seq 5 type i} + {file appendonly.aof.10.base.rdb seq 10 type b} {file appendonly.aof.6.incr.aof seq 6 type i} {file appendonly.aof.7.incr.aof seq 7 type i} + {file appendonly.aof.8.incr.aof seq 8 type i} } - - set orig_size [r dbsize] - set load_handle0 [start_write_load $master_host $master_port 10] - - wait_for_condition 50 100 { - [r dbsize] > $orig_size - } else { - fail "No write load detected." - } + + # Write 1KB data to trigger AOFRW + r set x [string repeat x 1024] # Make sure we have limit log - wait_for_condition 1000 10 { + wait_for_condition 1000 50 { [count_log_message 0 "triggered the limit"] == 1 } else { - fail "aof rewrite did trigger limit" + fail "aof rewrite did not trigger limit" } assert_equal [status r aof_rewrite_in_progress] 0 # No new INCR AOF be created assert_aof_manifest_content $aof_manifest_file { - {file appendonly.aof.9.base.rdb seq 9 type b} - {file appendonly.aof.5.incr.aof seq 5 type i} + {file appendonly.aof.10.base.rdb seq 10 type b} {file appendonly.aof.6.incr.aof seq 6 type i} {file appendonly.aof.7.incr.aof seq 7 type i} + {file appendonly.aof.8.incr.aof seq 8 type i} } # Turn off auto rewrite @@ -1151,16 +1154,13 @@ tags {"external:skip"} { waitForBgrewriteaof r # Can create New INCR AOF - assert_equal 1 [check_file_exist $aof_dirpath "${aof_basename}.8${::incr_aof_sufix}${::aof_format_suffix}"] + assert_equal 1 [check_file_exist $aof_dirpath "${aof_basename}.9${::incr_aof_sufix}${::aof_format_suffix}"] assert_aof_manifest_content $aof_manifest_file { - {file appendonly.aof.10.base.rdb seq 10 type b} - {file appendonly.aof.8.incr.aof seq 8 type i} + {file appendonly.aof.11.base.rdb seq 11 type b} + {file appendonly.aof.9.incr.aof seq 9 type i} } - stop_write_load $load_handle0 - wait_load_handlers_disconnected - set d1 [r debug digest] r debug loadaof set d2 [r debug digest]