This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 15eb07b829 [BugFix](file cache) don't clean clone dir when doing 
_gc_unused_file_caches (#14194)
15eb07b829 is described below

commit 15eb07b82945db2397b4d9c4ba9e04745925cb41
Author: AlexYue <yj976240...@gmail.com>
AuthorDate: Mon Nov 14 11:35:08 2022 +0800

    [BugFix](file cache) don't clean clone dir when doing 
_gc_unused_file_caches (#14194)
    
    * use another file_size overload for noexcept
    
    * don't gc clone dir
    
    * use better status
---
 be/src/io/cache/file_cache_manager.cpp | 2 +-
 be/src/olap/task/engine_clone_task.cpp | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/be/src/io/cache/file_cache_manager.cpp 
b/be/src/io/cache/file_cache_manager.cpp
index 14161b8063..840c39f454 100644
--- a/be/src/io/cache/file_cache_manager.cpp
+++ b/be/src/io/cache/file_cache_manager.cpp
@@ -107,7 +107,7 @@ void 
FileCacheManager::_gc_unused_file_caches(std::list<FileCachePtr>& result) {
             for (Path seg_file : seg_file_paths) {
                 std::string seg_filename = seg_file.native();
                 // check if it is a dir name
-                if (ends_with(seg_filename, ".dat")) {
+                if (ends_with(seg_filename, ".dat") || ends_with(seg_filename, 
"clone")) {
                     continue;
                 }
                 // skip file cache already in memory
diff --git a/be/src/olap/task/engine_clone_task.cpp 
b/be/src/olap/task/engine_clone_task.cpp
index b015adfe87..e78095e097 100644
--- a/be/src/olap/task/engine_clone_task.cpp
+++ b/be/src/olap/task/engine_clone_task.cpp
@@ -18,6 +18,7 @@
 #include "olap/task/engine_clone_task.h"
 
 #include <set>
+#include <system_error>
 
 #include "env/env.h"
 #include "gen_cpp/BackendService.h"
@@ -413,8 +414,14 @@ Status EngineCloneTask::_download_files(DataDir* data_dir, 
const std::string& re
             client->set_timeout_ms(estimate_timeout * 1000);
             RETURN_IF_ERROR(client->download(local_file_path));
 
+            std::error_code ec;
             // Check file length
-            uint64_t local_file_size = 
std::filesystem::file_size(local_file_path);
+            uint64_t local_file_size = 
std::filesystem::file_size(local_file_path, ec);
+            if (ec) {
+                LOG(WARNING) << "download file error" << ec.message();
+                return Status::IOError("can't retrive file_size of {}, due to 
{}", local_file_path,
+                                       ec.message());
+            }
             if (local_file_size != file_size) {
                 LOG(WARNING) << "download file length error"
                              << ", remote_path=" << remote_file_url << ", 
file_size=" << file_size


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

Reply via email to