update unit tests.
This commit is contained in:
parent
f03dfc63e7
commit
19c4f3af6f
@ -393,17 +393,13 @@ class CompactionJobTestBase : public testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (check_get_priority) {
|
if (check_get_priority) {
|
||||||
CheckGetRateLimiterPriority(compaction_job);
|
CheckGetRateLimiterPriorityForWrite(compaction_job);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckGetRateLimiterPriority(CompactionJob& compaction_job) {
|
void CheckGetRateLimiterPriorityForWrite(CompactionJob& compaction_job) {
|
||||||
// When the state from WriteController is normal.
|
// When the state from WriteController is normal.
|
||||||
ASSERT_EQ(
|
ASSERT_EQ(compaction_job.GetRateLimiterPriorityForWrite(), Env::IO_LOW);
|
||||||
compaction_job.GetRateLimiterPriority(RateLimiter::OpType::kWrite),
|
|
||||||
Env::IO_LOW);
|
|
||||||
ASSERT_EQ(compaction_job.GetRateLimiterPriority(RateLimiter::OpType::kRead),
|
|
||||||
Env::IO_LOW);
|
|
||||||
|
|
||||||
WriteController* write_controller =
|
WriteController* write_controller =
|
||||||
compaction_job.versions_->GetColumnFamilySet()->write_controller();
|
compaction_job.versions_->GetColumnFamilySet()->write_controller();
|
||||||
@ -412,36 +408,21 @@ class CompactionJobTestBase : public testing::Test {
|
|||||||
// When the state from WriteController is CompactionPressure.
|
// When the state from WriteController is CompactionPressure.
|
||||||
std::unique_ptr<WriteControllerToken> compaction_pressure_token =
|
std::unique_ptr<WriteControllerToken> compaction_pressure_token =
|
||||||
write_controller->GetCompactionPressureToken();
|
write_controller->GetCompactionPressureToken();
|
||||||
ASSERT_EQ(
|
ASSERT_EQ(compaction_job.GetRateLimiterPriorityForWrite(), Env::IO_HIGH);
|
||||||
compaction_job.GetRateLimiterPriority(RateLimiter::OpType::kWrite),
|
|
||||||
Env::IO_HIGH);
|
|
||||||
ASSERT_EQ(
|
|
||||||
compaction_job.GetRateLimiterPriority(RateLimiter::OpType::kRead),
|
|
||||||
Env::IO_HIGH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// When the state from WriteController is Delayed.
|
// When the state from WriteController is Delayed.
|
||||||
std::unique_ptr<WriteControllerToken> delay_token =
|
std::unique_ptr<WriteControllerToken> delay_token =
|
||||||
write_controller->GetDelayToken(1000000);
|
write_controller->GetDelayToken(1000000);
|
||||||
ASSERT_EQ(
|
ASSERT_EQ(compaction_job.GetRateLimiterPriorityForWrite(), Env::IO_USER);
|
||||||
compaction_job.GetRateLimiterPriority(RateLimiter::OpType::kWrite),
|
|
||||||
Env::IO_USER);
|
|
||||||
ASSERT_EQ(
|
|
||||||
compaction_job.GetRateLimiterPriority(RateLimiter::OpType::kRead),
|
|
||||||
Env::IO_USER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// When the state from WriteController is Stopped.
|
// When the state from WriteController is Stopped.
|
||||||
std::unique_ptr<WriteControllerToken> stop_token =
|
std::unique_ptr<WriteControllerToken> stop_token =
|
||||||
write_controller->GetStopToken();
|
write_controller->GetStopToken();
|
||||||
ASSERT_EQ(
|
ASSERT_EQ(compaction_job.GetRateLimiterPriorityForWrite(), Env::IO_USER);
|
||||||
compaction_job.GetRateLimiterPriority(RateLimiter::OpType::kWrite),
|
|
||||||
Env::IO_USER);
|
|
||||||
ASSERT_EQ(
|
|
||||||
compaction_job.GetRateLimiterPriority(RateLimiter::OpType::kRead),
|
|
||||||
Env::IO_USER);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ TEST_F(FlushJobTest, Snapshots) {
|
|||||||
job_context.Clean();
|
job_context.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FlushJobTest, GetRateLimiterPriority) {
|
TEST_F(FlushJobTest, GetRateLimiterPriorityWrite) {
|
||||||
// Prepare a FlushJob that flush MemTables of Single Column Family.
|
// Prepare a FlushJob that flush MemTables of Single Column Family.
|
||||||
const size_t num_mems = 2;
|
const size_t num_mems = 2;
|
||||||
const size_t num_mems_to_flush = 1;
|
const size_t num_mems_to_flush = 1;
|
||||||
@ -574,10 +574,7 @@ TEST_F(FlushJobTest, GetRateLimiterPriority) {
|
|||||||
Env::Priority::USER, nullptr /*IOTracer*/);
|
Env::Priority::USER, nullptr /*IOTracer*/);
|
||||||
|
|
||||||
// When the state from WriteController is normal.
|
// When the state from WriteController is normal.
|
||||||
ASSERT_EQ(flush_job.GetRateLimiterPriority(RateLimiter::OpType::kWrite),
|
ASSERT_EQ(flush_job.GetRateLimiterPriorityWrite(), Env::IO_HIGH);
|
||||||
Env::IO_HIGH);
|
|
||||||
ASSERT_EQ(flush_job.GetRateLimiterPriority(RateLimiter::OpType::kRead),
|
|
||||||
Env::IO_USER);
|
|
||||||
|
|
||||||
WriteController* write_controller =
|
WriteController* write_controller =
|
||||||
flush_job.versions_->GetColumnFamilySet()->write_controller();
|
flush_job.versions_->GetColumnFamilySet()->write_controller();
|
||||||
@ -586,20 +583,14 @@ TEST_F(FlushJobTest, GetRateLimiterPriority) {
|
|||||||
// When the state from WriteController is Delayed.
|
// When the state from WriteController is Delayed.
|
||||||
std::unique_ptr<WriteControllerToken> delay_token =
|
std::unique_ptr<WriteControllerToken> delay_token =
|
||||||
write_controller->GetDelayToken(1000000);
|
write_controller->GetDelayToken(1000000);
|
||||||
ASSERT_EQ(flush_job.GetRateLimiterPriority(RateLimiter::OpType::kWrite),
|
ASSERT_EQ(flush_job.GetRateLimiterPriorityWrite(), Env::IO_USER);
|
||||||
Env::IO_USER);
|
|
||||||
ASSERT_EQ(flush_job.GetRateLimiterPriority(RateLimiter::OpType::kRead),
|
|
||||||
Env::IO_USER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// When the state from WriteController is Stopped.
|
// When the state from WriteController is Stopped.
|
||||||
std::unique_ptr<WriteControllerToken> stop_token =
|
std::unique_ptr<WriteControllerToken> stop_token =
|
||||||
write_controller->GetStopToken();
|
write_controller->GetStopToken();
|
||||||
ASSERT_EQ(flush_job.GetRateLimiterPriority(RateLimiter::OpType::kWrite),
|
ASSERT_EQ(flush_job.GetRateLimiterPriorityWrite(), Env::IO_USER);
|
||||||
Env::IO_USER);
|
|
||||||
ASSERT_EQ(flush_job.GetRateLimiterPriority(RateLimiter::OpType::kRead),
|
|
||||||
Env::IO_USER);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user