比较提交

...

1 次代码提交

作者 SHA1 备注 提交日期
  ArcueidType 28ae1b52c5 update new implementation 2 周前
共有 3 个文件被更改,包括 5 次插入9 次删除
  1. +1
    -1
      db/dbformat.h
  2. +3
    -5
      db/version_set.cc
  3. +1
    -3
      test/ttl_test.cc

+ 1
- 1
db/dbformat.h 查看文件

@ -22,7 +22,7 @@ namespace leveldb {
// Grouping of constants. We may want to make some of these
// parameters set via options.
namespace config {
static const int kNumLevels = 7;
static const int kNumLevels = 3;
// Level-0 compaction is started when we hit this many files.
static const int kL0_CompactionTrigger = 4;

+ 3
- 5
db/version_set.cc 查看文件

@ -1104,13 +1104,11 @@ int VersionSet::NumLevelFiles(int level) const {
const char* VersionSet::LevelSummary(LevelSummaryStorage* scratch) const {
// Update code if kNumLevels changes
static_assert(config::kNumLevels == 7, "");
static_assert(config::kNumLevels == 3, "");
std::snprintf(
scratch->buffer, sizeof(scratch->buffer), "files[ %d %d %d %d %d %d %d ]",
scratch->buffer, sizeof(scratch->buffer), "files[ %d %d %d ]",
int(current_->files_[0].size()), int(current_->files_[1].size()),
int(current_->files_[2].size()), int(current_->files_[3].size()),
int(current_->files_[4].size()), int(current_->files_[5].size()),
int(current_->files_[6].size()));
int(current_->files_[2].size()));
return scratch->buffer;
}

+ 1
- 3
test/ttl_test.cc 查看文件

@ -104,9 +104,7 @@ TEST(TestTTL, CompactionTTL) {
delete db;
}
// Time-consuming when kNumLevels is 7, so run this test when kNumLevels is set to 3,
// the codes on branch light_ver is a version with kNumLevels set to 3.
// In this case level 2 is the last level with files.
// Test handling last level with kNumLevels = 3
TEST(TestTTL, LastLevelCompaction) {
DB *db;

正在加载...
取消
保存