mirror of https://github.com/facebook/rocksdb.git
Check stop level trigger-0 before slowdown level-0 trigger
Summary: ... Test Plan: Can't repro the test failure, but let's see what jenkins says Reviewers: zagfox, sdong, ljin Reviewed By: sdong, ljin Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D23061
This commit is contained in:
parent
659d2d50c3
commit
2d57828d0e
|
@ -326,6 +326,13 @@ void ColumnFamilyData::RecalculateWriteStallConditions() {
|
|||
"[%s] Stopping writes because we have %d immutable memtables "
|
||||
"(waiting for flush)",
|
||||
name_.c_str(), imm()->size());
|
||||
} else if (current_->NumLevelFiles(0) >=
|
||||
options_.level0_stop_writes_trigger) {
|
||||
write_controller_token_ = write_controller->GetStopToken();
|
||||
internal_stats_->AddCFStats(InternalStats::LEVEL0_NUM_FILES, 1);
|
||||
Log(options_.info_log,
|
||||
"[%s] Stopping writes because we have %d level-0 files",
|
||||
name_.c_str(), current_->NumLevelFiles(0));
|
||||
} else if (options_.level0_slowdown_writes_trigger >= 0 &&
|
||||
current_->NumLevelFiles(0) >=
|
||||
options_.level0_slowdown_writes_trigger) {
|
||||
|
@ -338,13 +345,6 @@ void ColumnFamilyData::RecalculateWriteStallConditions() {
|
|||
"[%s] Stalling writes because we have %d level-0 files (%" PRIu64
|
||||
"us)",
|
||||
name_.c_str(), current_->NumLevelFiles(0), slowdown);
|
||||
} else if (current_->NumLevelFiles(0) >=
|
||||
options_.level0_stop_writes_trigger) {
|
||||
write_controller_token_ = write_controller->GetStopToken();
|
||||
internal_stats_->AddCFStats(InternalStats::LEVEL0_NUM_FILES, 1);
|
||||
Log(options_.info_log,
|
||||
"[%s] Stopping writes because we have %d level-0 files",
|
||||
name_.c_str(), current_->NumLevelFiles(0));
|
||||
} else if (options_.hard_rate_limit > 1.0 &&
|
||||
score > options_.hard_rate_limit) {
|
||||
uint64_t kHardLimitSlowdown = 1000;
|
||||
|
|
|
@ -7827,6 +7827,26 @@ TEST(DBTest, MTRandomTimeoutTest) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(DBTest, Level0StopWritesTest) {
|
||||
Options options = CurrentOptions();
|
||||
options.level0_slowdown_writes_trigger = 2;
|
||||
options.level0_stop_writes_trigger = 4;
|
||||
options.disable_auto_compactions = 4;
|
||||
options.max_mem_compaction_level = 0;
|
||||
Reopen(&options);
|
||||
|
||||
// create 4 level0 tables
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
Put("a", "b");
|
||||
Flush();
|
||||
}
|
||||
|
||||
WriteOptions woptions;
|
||||
woptions.timeout_hint_us = 30 * 1000; // 30 ms
|
||||
Status s = Put("a", "b", woptions);
|
||||
ASSERT_TRUE(s.IsTimedOut());
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue