bytedance / terarkdb

A RocksDB compatible KV storage engine with better performance
Apache License 2.0
2.05k stars 202 forks source link

version_set_test (Failed) #196

Open yapple opened 2 years ago

yapple commented 2 years ago

[BUG]

Expected behavior

test passed

Actual behavior

[  FAILED  ] 4 tests, listed below:
[  FAILED  ] VersionStorageInfoTest.MaxBytesForLevelDynamic
[  FAILED  ] VersionStorageInfoTest.MaxBytesForLevelDynamicLotsOfData
[  FAILED  ] VersionStorageInfoTest.MaxBytesForLevelDynamicLargeLevel
[  FAILED  ] VersionStorageInfoTest.MaxBytesForLevelDynamicWithLargeL0_1

Steps to reproduce the behavior

./version_set_test

[Enhancement]

Problem

Solution

yapple commented 2 years ago
/data00/wangyi/github-terarkdb/db/version_set_test.cc:218: Failure
Expected equality of these values:
  vstorage_.MaxBytesForLevel(4)
    Which is: 1000
  1005U
    Which is: 1005
[  FAILED  ] VersionStorageInfoTest.MaxBytesForLevelDynamic (0 ms)
[ RUN      ] VersionStorageInfoTest.MaxBytesForLevelDynamicLotsOfData
/data00/wangyi/github-terarkdb/db/version_set_test.cc:246: Failure
Expected equality of these values:
  vstorage_.MaxBytesForLevel(4)
    Which is: 836
  800U
    Which is: 800
[  FAILED  ] VersionStorageInfoTest.MaxBytesForLevelDynamicLotsOfData (0 ms)
[ RUN      ] VersionStorageInfoTest.MaxBytesForLevelDynamicLargeLevel
/data00/wangyi/github-terarkdb/db/version_set_test.cc:265: Failure
Expected equality of these values:
  vstorage_.MaxBytesForLevel(5)
    Which is: 2999999999889
  3000U * kOneGB
    Which is: 3000000000000
[  FAILED  ] VersionStorageInfoTest.MaxBytesForLevelDynamicLargeLevel (0 ms)
[ RUN      ] VersionStorageInfoTest.MaxBytesForLevelDynamicWithLargeL0_1
/data00/wangyi/github-terarkdb/db/version_set_test.cc:292: Failure
Expected equality of these values:
  vstorage_.level_multiplier()
    Which is: 3.5
  5.0
    Which is: 5
[  FAILED  ] VersionStorageInfoTest.MaxBytesForLevelDynamicWithLargeL0_1 (0 ms)
yapple commented 2 years ago

we do more aggresive lsm-tree shape adjust through remove the adjust trigger

if (l0_size > base_level_size &&
          (l0_size > options.max_bytes_for_level_base ||
           static_cast<int>(files_[0].size() / 2) >=
               options.level0_file_num_compaction_trigger)) {
        // We adjust the base level according to actual L0 size, and adjust
        // the level multiplier accordingly, when:
        //   1. the L0 size is larger than level size base, or
        //   2. number of L0 files reaches twice the L0->L1 compaction trigger
        // We don't do this otherwise to keep the LSM-tree structure stable
        // unless the L0 compaction is backlogged.
        base_level_size = l0_size;
        if (base_level_ == num_levels_ - 1) {
          level_multiplier_ = 1.0;
        } else {
          level_multiplier_ = std::pow(
              static_cast<double>(max_level_size) /
                  static_cast<double>(base_level_size),
              1.0 / static_cast<double>(num_levels_ - base_level_ - 1));
        }
      }