mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-29 18:33:58 +00:00
DynamicCompactionOptions: relax the check bound a little
Summary: Increase the level size so that impact of a single file is smaller. Also relax the bound Test Plan: ran locally Reviewers: sdong, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D27939
This commit is contained in:
parent
5c82a8837e
commit
065766b8d2
|
@ -8638,7 +8638,7 @@ TEST(DBTest, DynamicMemtableOptions) {
|
|||
while (Put(Key(count), RandomString(&rnd, 1024), wo).ok() && count < 256) {
|
||||
count++;
|
||||
}
|
||||
ASSERT_TRUE(count > (128 * 0.9) && count < (128 * 1.1));
|
||||
ASSERT_TRUE(count > (128 * 0.8) && count < (128 * 1.2));
|
||||
|
||||
sleeping_task_low1.WakeUp();
|
||||
sleeping_task_low1.WaitUntilDone();
|
||||
|
@ -8657,7 +8657,7 @@ TEST(DBTest, DynamicMemtableOptions) {
|
|||
while (Put(Key(count), RandomString(&rnd, 1024), wo).ok() && count < 1024) {
|
||||
count++;
|
||||
}
|
||||
ASSERT_TRUE(count > (512 * 0.9) && count < (512 * 1.1));
|
||||
ASSERT_TRUE(count > (512 * 0.8) && count < (512 * 1.2));
|
||||
sleeping_task_low2.WakeUp();
|
||||
sleeping_task_low2.WaitUntilDone();
|
||||
|
||||
|
@ -8675,7 +8675,7 @@ TEST(DBTest, DynamicMemtableOptions) {
|
|||
while (Put(Key(count), RandomString(&rnd, 1024), wo).ok() && count < 1024) {
|
||||
count++;
|
||||
}
|
||||
ASSERT_TRUE(count > (256 * 0.9) && count < (256 * 1.1));
|
||||
ASSERT_TRUE(count > (256 * 0.8) && count < (256 * 1.2));
|
||||
sleeping_task_low3.WakeUp();
|
||||
sleeping_task_low3.WaitUntilDone();
|
||||
}
|
||||
|
@ -8685,7 +8685,7 @@ TEST(DBTest, DynamicCompactionOptions) {
|
|||
const uint64_t k32KB = 1 << 15;
|
||||
const uint64_t k64KB = 1 << 16;
|
||||
const uint64_t k128KB = 1 << 17;
|
||||
const uint64_t k256KB = 1 << 18;
|
||||
const uint64_t k1MB = 1 << 20;
|
||||
const uint64_t k4KB = 1 << 12;
|
||||
Options options;
|
||||
options.env = env_;
|
||||
|
@ -8763,19 +8763,19 @@ TEST(DBTest, DynamicCompactionOptions) {
|
|||
// fill L1 and L2. L1 size should be around 256KB while L2 size should be
|
||||
// around 256KB x 4.
|
||||
ASSERT_TRUE(dbfull()->SetOptions({
|
||||
{"max_bytes_for_level_base", std::to_string(k256KB) }
|
||||
{"max_bytes_for_level_base", std::to_string(k1MB) }
|
||||
}));
|
||||
|
||||
// writing 24 x 64KB => 6 * 256KB
|
||||
// (L1 + L2) = (1 + 4) * 256KB
|
||||
for (int i = 0; i < 24; ++i) {
|
||||
gen_l0_kb(i, 64, 32);
|
||||
// writing 96 x 64KB => 6 * 1024KB
|
||||
// (L1 + L2) = (1 + 4) * 1024KB
|
||||
for (int i = 0; i < 96; ++i) {
|
||||
gen_l0_kb(i, 64, 96);
|
||||
}
|
||||
dbfull()->TEST_WaitForCompact();
|
||||
ASSERT_TRUE(SizeAtLevel(1) > k256KB * 0.8 &&
|
||||
SizeAtLevel(1) < k256KB * 1.2);
|
||||
ASSERT_TRUE(SizeAtLevel(2) > 4 * k256KB * 0.8 &&
|
||||
SizeAtLevel(2) < 4 * k256KB * 1.2);
|
||||
ASSERT_TRUE(SizeAtLevel(1) > k1MB * 0.5 &&
|
||||
SizeAtLevel(1) < k1MB * 1.5);
|
||||
ASSERT_TRUE(SizeAtLevel(2) > 4 * k1MB * 0.5 &&
|
||||
SizeAtLevel(2) < 4 * k1MB * 1.5);
|
||||
|
||||
// Test max_bytes_for_level_multiplier and
|
||||
// max_bytes_for_level_base. Now, reduce both mulitplier and level base,
|
||||
|
@ -8792,9 +8792,9 @@ TEST(DBTest, DynamicCompactionOptions) {
|
|||
gen_l0_kb(i, 64, 32);
|
||||
}
|
||||
dbfull()->TEST_WaitForCompact();
|
||||
ASSERT_TRUE(SizeAtLevel(1) < k128KB * 1.2);
|
||||
ASSERT_TRUE(SizeAtLevel(2) < 2 * k128KB * 1.2);
|
||||
ASSERT_TRUE(SizeAtLevel(3) < 4 * k128KB * 1.2);
|
||||
uint64_t total_size =
|
||||
SizeAtLevel(1) + SizeAtLevel(2) + SizeAtLevel(3);
|
||||
ASSERT_TRUE(total_size < k128KB * 7 * 1.5);
|
||||
|
||||
// Test level0_stop_writes_trigger.
|
||||
// Clean up memtable and L0. Block compaction threads. If continue to write
|
||||
|
@ -8883,7 +8883,7 @@ TEST(DBTest, DynamicCompactionOptions) {
|
|||
// L1 - L3. Then thrink max_bytes_for_level_base and disable auto compaction
|
||||
// at the same time, we should see some level with score greater than 2.
|
||||
ASSERT_TRUE(dbfull()->SetOptions({
|
||||
{"max_bytes_for_level_base", std::to_string(k256KB) }
|
||||
{"max_bytes_for_level_base", std::to_string(k1MB) }
|
||||
}));
|
||||
// writing 40 x 64KB = 10 x 256KB
|
||||
// (L1 + L2 + L3) = (1 + 2 + 4) * 256KB
|
||||
|
@ -8891,12 +8891,12 @@ TEST(DBTest, DynamicCompactionOptions) {
|
|||
gen_l0_kb(i, 64, 32);
|
||||
}
|
||||
dbfull()->TEST_WaitForCompact();
|
||||
ASSERT_TRUE(SizeAtLevel(1) > k256KB * 0.8 &&
|
||||
SizeAtLevel(1) < k256KB * 1.2);
|
||||
ASSERT_TRUE(SizeAtLevel(2) > 2 * k256KB * 0.8 &&
|
||||
SizeAtLevel(2) < 2 * k256KB * 1.2);
|
||||
ASSERT_TRUE(SizeAtLevel(3) > 4 * k256KB * 0.8 &&
|
||||
SizeAtLevel(3) < 4 * k256KB * 1.2);
|
||||
ASSERT_TRUE((SizeAtLevel(1) > k1MB * 0.8 &&
|
||||
SizeAtLevel(1) < k1MB * 1.2) ||
|
||||
(SizeAtLevel(2) > 2 * k1MB * 0.8 &&
|
||||
SizeAtLevel(2) < 2 * k1MB * 1.2) ||
|
||||
(SizeAtLevel(3) > 4 * k1MB * 0.8 &&
|
||||
SizeAtLevel(3) < 4 * k1MB * 1.2));
|
||||
// Reduce max_bytes_for_level_base and disable compaction at the same time
|
||||
// This should cause score to increase
|
||||
ASSERT_TRUE(dbfull()->SetOptions({
|
||||
|
|
Loading…
Reference in a new issue