*: solve the problem that test_stale_read_while_applying_snapshot is unstable
close tikv/tikv#13057
@@ -202,9 +202,10 @@ impl MiscExt for RocksEngine {
if let Some(n) = util::get_cf_num_files_at_level(self.as_inner(), handle, 0) {
let options = self.as_inner().get_options_cf(handle);
let slowdown_trigger = options.get_level_zero_slowdown_writes_trigger();
+ let compaction_trigger = options.get_level_zero_file_num_compaction_trigger() as u64;
// Leave enough buffer to tolerate heavy write workload,
// which may flush some memtables in a short time.
- if n > u64::from(slowdown_trigger) / 2 {
+ if n > u64::from(slowdown_trigger) / 2 && n >= compaction_trigger {
return Ok(true);
}
}
