freemandealer commented on code in PR #64186:
URL: https://github.com/apache/doris/pull/64186#discussion_r3409497245


##########
be/src/io/cache/fs_file_cache_storage.cpp:
##########
@@ -672,13 +881,70 @@ bool FSFileCacheStorage::handle_already_loaded_block(
         return false;
     }
     auto block = cell_it->second.file_block;
+    if (is_tmp) {
+        return true;
+    }
+    bool accepted_storage_path = true;
+    if (!storage_file_exists(block->storage_key())) {
+        block->update_storage_expiration_time(context.storage_expiration());
+        block->update_storage_cache_type(context.cache_type);
+    } else if (block->storage_expiration_time() != 
context.storage_expiration()) {
+        remove_file_and_empty_dir(offset_path, key_path);
+        accepted_storage_path = false;
+    } else if (block->storage_cache_type() != context.cache_type) {
+        block->update_storage_cache_type(context.cache_type);
+    }
     size_t old_size = block->range().size();
-    if (old_size != new_size) {
+    if (accepted_storage_path && old_size != new_size) {
         mgr->reset_range(hash, offset, old_size, new_size, cache_lock);
     }
+    if (accepted_storage_path && (block->cache_type() != context.cache_type ||
+                                  block->expiration_time() != 
context.expiration_time)) {
+        mgr->update_hash_logical_meta(hash, context.cache_type, 
context.expiration_time,
+                                      cache_lock);
+    }
     return true;
 }
 
+void FSFileCacheStorage::load_blocks_from_dir_unlocked(
+        BlockFileCache* mgr, const UInt128Wrapper& hash, const KeyDir& key_dir,
+        const FileCacheKey* logical_key, std::lock_guard<std::mutex>& 
cache_lock) const {
+    CacheContext context_original;
+    context_original.query_id = TUniqueId();
+    context_original.expiration_time =
+            logical_key == nullptr ? key_dir.expiration_time : 
logical_key->meta.expiration_time;
+    context_original.storage_expiration_time = key_dir.expiration_time;

Review Comment:
   known limmitation,will be recovered in metadata sync.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to