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


##########
be/src/io/cache/fs_file_cache_storage.cpp:
##########
@@ -700,22 +700,36 @@ void 
FSFileCacheStorage::load_blocks_directly_unlocked(BlockFileCache* mgr, cons
 }
 
 Status FSFileCacheStorage::clear(std::string& msg) {
+    LOG(INFO) << "clear file storage, path=" << _cache_base_path;
+    std::error_code ec;
+    std::filesystem::directory_iterator key_it {_cache_base_path, ec};
+    if (ec) {
+        LOG(WARNING) << "Failed to list directory: " << _cache_base_path
+                     << ", error: " << ec.message();
+        return Status::InternalError("Failed to list dir {}: {}", 
_cache_base_path, ec.message());
+    }
+    int failed = 0;
+    int total = 0;
+    auto t0 = std::chrono::steady_clock::now();
+    for (; key_it != std::filesystem::directory_iterator(); ++key_it) {

Review Comment:
   concurrency problem: what if more than one clear thread? this 
directory_iterator would crash



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to