|
|
@ -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); |
|
|
|
|
|
|
|