浏览代码

update TEST LastLevelCompaction

main
ArcueidType 3 周前
父节点
当前提交
308af20f79
共有 1 个文件被更改,包括 16 次插入4 次删除
  1. +16
    -4
      test/ttl_test.cc

+ 16
- 4
test/ttl_test.cc 查看文件

@ -124,11 +124,23 @@ TEST(TestTTL, LastLevelCompaction) {
db->GetApproximateSizes(ranges, 1, sizes);
ASSERT_GT(sizes[0], 0);
std::string last_level_file_num;
std::string last_level = "2";
db->GetProperty("leveldb.num-files-at-level" + last_level, &last_level_file_num);
int last_level_file_num = 0;
std::string file_num;
int last_level = 0;
for (int level = 0; level < 7; level++) {
db->GetProperty("leveldb.num-files-at-level" + std::to_string(level), &file_num);
if (std::atoi(file_num.c_str()) > 0) {
last_level_file_num = std::atoi(file_num.c_str());
last_level = level;
}
else {
break;
}
}
std::cout << "Last level: " << last_level << std::endl;
std::cout << "File nums in last level: " << last_level_file_num << std::endl;
ASSERT_GT(std::atoi(last_level_file_num.c_str()), 0);
ASSERT_GT(last_level_file_num, 0);
Env::Default()->SleepForMicroseconds(ttl * 1000000);

正在加载...
取消
保存