Skip to content

Commit 0b1c428

Browse files
committed
clean code
Signed-off-by: zhengyu <[email protected]>
1 parent c36043e commit 0b1c428

File tree

1 file changed

+1
-52
lines changed

1 file changed

+1
-52
lines changed

be/test/io/cache/block_file_cache_test_meta_store.cpp

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ TEST_F(BlockFileCacheTest, clear_retains_meta_directory_and_clears_meta_entries)
498498
}
499499
}
500500

501-
TEST_F(BlockFileCacheTest, HandleAlreadyLoadedBlockUpdatesSizeAndTablet) {
501+
TEST_F(BlockFileCacheTest, handle_already_loaded_block_updates_size_and_tablet) {
502502
config::enable_evict_file_cache_in_advance = false;
503503
if (fs::exists(cache_base_path)) {
504504
fs::remove_all(cache_base_path);
@@ -568,57 +568,6 @@ TEST_F(BlockFileCacheTest, HandleAlreadyLoadedBlockUpdatesSizeAndTablet) {
568568
}
569569
}
570570

571-
TEST_F(BlockFileCacheTest, estimate_file_count_skips_removed_directory) {
572-
std::string test_dir = cache_base_path + "/estimate_file_count_removed_dir";
573-
if (fs::exists(test_dir)) {
574-
fs::remove_all(test_dir);
575-
}
576-
auto keep_dir = fs::path(test_dir) / "keep";
577-
auto remove_dir = fs::path(test_dir) / "remove";
578-
fs::create_directories(keep_dir);
579-
fs::create_directories(remove_dir);
580-
581-
auto keep_file = keep_dir / "data.bin";
582-
std::string one_mb(1024 * 1024, 'd');
583-
{
584-
std::ofstream ofs(keep_file, std::ios::binary);
585-
ASSERT_TRUE(ofs.good());
586-
for (int i = 0; i < 3; ++i) {
587-
ofs.write(one_mb.data(), one_mb.size());
588-
ASSERT_TRUE(ofs.good());
589-
}
590-
}
591-
592-
FSFileCacheStorage storage;
593-
storage._cache_base_path = test_dir;
594-
595-
const std::string sync_point_name =
596-
"FSFileCacheStorage::estimate_file_count_from_statfs::OnDirectory";
597-
auto* sync_point = doris::SyncPoint::get_instance();
598-
doris::SyncPoint::CallbackGuard guard(sync_point_name);
599-
sync_point->set_call_back(
600-
sync_point_name,
601-
[remove_dir](std::vector<std::any>&& args) {
602-
auto* path = doris::try_any_cast<std::filesystem::path*>(args[0]);
603-
if (*path == remove_dir) {
604-
fs::remove_all(remove_dir);
605-
}
606-
},
607-
&guard);
608-
sync_point->enable_processing();
609-
610-
size_t estimated_files = storage.estimate_file_count_from_statfs();
611-
612-
sync_point->disable_processing();
613-
614-
ASSERT_EQ(3, estimated_files);
615-
ASSERT_FALSE(fs::exists(remove_dir));
616-
617-
if (fs::exists(test_dir)) {
618-
fs::remove_all(test_dir);
619-
}
620-
}
621-
622571
//TODO(zhengyu): check lazy load
623572
//TODO(zhengyu): check version2 start
624573
//TODO(zhengyu): check version2 version3 mixed start

0 commit comments

Comments
 (0)