mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-26 07:30:54 +00:00
Remove ThreadStatusMultiCompaction test
Summary: Remove ThreadStatusMultiCompaction test as it's currently written in a way that depends on some randomness, while the flush / compaction status of a single thread is also covered in ThreadStatusFlush and ThreadStatusSingleCompaction tests. Test Plan: ./db_test Reviewers: igor, sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D33537
This commit is contained in:
parent
f0c36da6ee
commit
12753130ec
|
@ -9822,87 +9822,6 @@ TEST(DBTest, ThreadStatusSingleCompaction) {
|
||||||
rocksdb::SyncPoint::GetInstance()->DisableProcessing();
|
rocksdb::SyncPoint::GetInstance()->DisableProcessing();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DBTest, ThreadStatusMultipleCompaction) {
|
|
||||||
const int kTestKeySize = 16;
|
|
||||||
const int kTestValueSize = 984;
|
|
||||||
const int kEntrySize = kTestKeySize + kTestValueSize;
|
|
||||||
const int kEntriesPerBuffer = 10;
|
|
||||||
const int kNumL0Files = 4;
|
|
||||||
|
|
||||||
const int kHighPriCount = 3;
|
|
||||||
const int kLowPriCount = 5;
|
|
||||||
env_->SetBackgroundThreads(kHighPriCount, Env::HIGH);
|
|
||||||
env_->SetBackgroundThreads(kLowPriCount, Env::LOW);
|
|
||||||
|
|
||||||
Options options;
|
|
||||||
options.create_if_missing = true;
|
|
||||||
options.write_buffer_size = kEntrySize * kEntriesPerBuffer;
|
|
||||||
options.compaction_style = kCompactionStyleLevel;
|
|
||||||
options.target_file_size_base = options.write_buffer_size;
|
|
||||||
options.max_bytes_for_level_base =
|
|
||||||
options.target_file_size_base * kNumL0Files;
|
|
||||||
options.compression = kNoCompression;
|
|
||||||
options = CurrentOptions(options);
|
|
||||||
options.env = env_;
|
|
||||||
options.enable_thread_tracking = true;
|
|
||||||
options.level0_file_num_compaction_trigger = kNumL0Files;
|
|
||||||
options.max_bytes_for_level_multiplier = 2;
|
|
||||||
options.max_background_compactions = kLowPriCount;
|
|
||||||
|
|
||||||
TryReopen(options);
|
|
||||||
Random rnd(301);
|
|
||||||
|
|
||||||
std::vector<ThreadStatus> thread_list;
|
|
||||||
// Delay both flush and compaction
|
|
||||||
rocksdb::SyncPoint::GetInstance()->LoadDependency({
|
|
||||||
{"FlushJob::Run:Start",
|
|
||||||
"CompactionJob::Run:Start"},
|
|
||||||
{"CompactionJob::Run:Start",
|
|
||||||
"DBTest::ThreadStatusMultipleCompaction:GetThreadList"},
|
|
||||||
{"DBTest::ThreadStatusMultipleCompaction:VerifyStatus",
|
|
||||||
"CompactionJob::Run:End"},
|
|
||||||
{"CompactionJob::Run:End",
|
|
||||||
"FlushJob::Run:End"}});
|
|
||||||
|
|
||||||
// Make rocksdb busy
|
|
||||||
int key = 0;
|
|
||||||
int max_operation_count[ThreadStatus::NUM_OP_TYPES] = {0};
|
|
||||||
for (int file = 0; file < 64 * kNumL0Files; ++file) {
|
|
||||||
for (int k = 0; k < kEntriesPerBuffer; ++k) {
|
|
||||||
ASSERT_OK(Put(ToString(key++), RandomString(&rnd, kTestValueSize)));
|
|
||||||
}
|
|
||||||
|
|
||||||
// check how many threads are doing compaction using GetThreadList
|
|
||||||
int operation_count[ThreadStatus::NUM_OP_TYPES] = {0};
|
|
||||||
TEST_SYNC_POINT(
|
|
||||||
"DBTest::ThreadStatusMultipleCompaction:GetThreadList");
|
|
||||||
Status s = env_->GetThreadList(&thread_list);
|
|
||||||
TEST_SYNC_POINT(
|
|
||||||
"DBTest::ThreadStatusMultipleCompaction:VerifyStatus");
|
|
||||||
for (auto thread : thread_list) {
|
|
||||||
operation_count[thread.operation_type]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Record the max number of compactions at a time.
|
|
||||||
for (int i = 0; i < ThreadStatus::NUM_OP_TYPES; ++i) {
|
|
||||||
if (max_operation_count[i] < operation_count[i]) {
|
|
||||||
max_operation_count[i] = operation_count[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Speed up the test
|
|
||||||
if (max_operation_count[ThreadStatus::OP_FLUSH] > 1 &&
|
|
||||||
max_operation_count[ThreadStatus::OP_COMPACTION] >
|
|
||||||
0.6 * options.max_background_compactions) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT_GE(max_operation_count[ThreadStatus::OP_FLUSH], 1);
|
|
||||||
// Expect rocksdb to at least utilize 60% of the compaction threads.
|
|
||||||
ASSERT_GE(1.0 * max_operation_count[ThreadStatus::OP_COMPACTION],
|
|
||||||
0.6 * options.max_background_compactions);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // ROCKSDB_USING_THREAD_STATUS
|
#endif // ROCKSDB_USING_THREAD_STATUS
|
||||||
|
|
||||||
TEST(DBTest, DynamicCompactionOptions) {
|
TEST(DBTest, DynamicCompactionOptions) {
|
||||||
|
|
Loading…
Reference in a new issue