Skip to content

Commit 494bfa9

Browse files
committed
fix compilation after rebase
Signed-off-by: zhengyu <zhangzhengyu@selectdb.com>
1 parent 102f486 commit 494bfa9

File tree

1 file changed

+3
-46
lines changed

1 file changed

+3
-46
lines changed

be/src/io/cache/fs_file_cache_storage.cpp

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ Status FSFileCacheStorage::remove(const FileCacheKey& key) {
244244
// return OK not means the file is deleted, it may be not exist
245245

246246
{ // try to detect the file with old v2 format
247-
std::string dir = get_path_in_local_cache_v2(key.hash, key.meta.expiration_time);
248-
std::string file = get_path_in_local_cache_v2(dir, key.offset, key.meta.type);
247+
dir = get_path_in_local_cache_v2(key.hash, key.meta.expiration_time);
248+
file = get_path_in_local_cache_v2(dir, key.offset, key.meta.type);
249249
RETURN_IF_ERROR(fs->delete_file(file));
250250
}
251251

@@ -657,7 +657,6 @@ void FSFileCacheStorage::load_cache_info_into_memory_from_fs(BlockFileCache* _mg
657657
if (key_prefix_it->path().filename().native().size() != KEY_PREFIX_LENGTH) {
658658
LOG(WARNING) << "Unknown directory " << key_prefix_it->path().native()
659659
<< ", try to remove it";
660-
std::error_code ec;
661660
std::filesystem::remove(key_prefix_it->path(), ec);
662661
if (ec) {
663662
LOG(WARNING) << "failed to remove=" << key_prefix_it->path()
@@ -867,7 +866,7 @@ void FSFileCacheStorage::load_cache_info_into_memory(BlockFileCache* _mgr) const
867866
} else {
868867
LOG(INFO) << "DB and FS counts are consistent, difference ratio: "
869868
<< difference_ratio * 100 << "%, skipping FS load.";
870-
if (auto st = write_file_cache_version(); !st.ok()) {
869+
if (st = write_file_cache_version(); !st.ok()) {
871870
LOG(WARNING) << "Failed to write version hints for file cache, err="
872871
<< st.to_string();
873872
}
@@ -878,64 +877,22 @@ void FSFileCacheStorage::load_cache_info_into_memory(BlockFileCache* _mgr) const
878877

879878
void FSFileCacheStorage::load_blocks_directly_unlocked(BlockFileCache* mgr, const FileCacheKey& key,
880879
std::lock_guard<std::mutex>& cache_lock) {
881-
<<<<<<< HEAD
882-
// async load, can't find key, need to check exist.
883-
auto key_path = get_path_in_local_cache_v2(key.hash,
884-
key.meta.expiration_time); //TODO(zhengyu): need v3?
885-
bool exists = false;
886-
if (auto st = fs->exists(key_path, &exists); !exists && st.ok()) {
887-
=======
888880
BlockMetaKey mkey(key.meta.tablet_id, UInt128Wrapper(key.hash), key.offset);
889881
auto block_meta = _meta_store->get(mkey);
890882
if (!block_meta.has_value()) {
891-
>>>>>>> a4779a691e (cache lazy load)
892883
// cache miss
893884
return;
894885
}
895886

896887
CacheContext context_original;
897888
context_original.query_id = TUniqueId();
898-
<<<<<<< HEAD
899-
context_original.expiration_time = key.meta.expiration_time;
900-
std::error_code ec;
901-
std::filesystem::directory_iterator check_it(key_path, ec);
902-
if (ec) [[unlikely]] {
903-
LOG(WARNING) << "fail to directory_iterator " << ec.message();
904-
return;
905-
}
906-
for (; check_it != std::filesystem::directory_iterator(); ++check_it) {
907-
size_t size = check_it->file_size(ec);
908-
size_t offset = 0;
909-
bool is_tmp = false;
910-
FileCacheType cache_type = FileCacheType::NORMAL;
911-
if (!parse_filename_suffix_to_cache_type(fs, check_it->path().filename().native(),
912-
context_original.expiration_time, size, &offset,
913-
&is_tmp, &cache_type)) {
914-
continue;
915-
}
916-
if (!mgr->_files.contains(key.hash) || !mgr->_files[key.hash].contains(offset)) {
917-
// if the file is tmp, it means it is the old file and it should be removed
918-
if (is_tmp) {
919-
std::filesystem::remove(check_it->path(), ec);
920-
if (ec) {
921-
LOG(WARNING) << fmt::format("cannot remove {}: {}", check_it->path().native(),
922-
ec.message());
923-
}
924-
} else {
925-
context_original.cache_type = cache_type;
926-
mgr->add_cell(key.hash, context_original, offset, size,
927-
FileBlock::State::DOWNLOADED, cache_lock);
928-
}
929-
}
930-
=======
931889
context_original.expiration_time = block_meta->ttl;
932890
context_original.cache_type = static_cast<FileCacheType>(block_meta->type);
933891
context_original.tablet_id = key.meta.tablet_id;
934892

935893
if (!mgr->_files.contains(key.hash) || !mgr->_files[key.hash].contains(key.offset)) {
936894
mgr->add_cell(key.hash, context_original, key.offset, block_meta->size,
937895
FileBlock::State::DOWNLOADED, cache_lock);
938-
>>>>>>> a4779a691e (cache lazy load)
939896
}
940897
}
941898

0 commit comments

Comments
 (0)