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

w41ter pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 95fe7f08096 branch-3.0: [fix](clone) Fix wrong clone file path #44746 
(#44772)
95fe7f08096 is described below

commit 95fe7f08096020bd962b186d71bcb506d7ddb393
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Nov 29 14:07:01 2024 +0800

    branch-3.0: [fix](clone) Fix wrong clone file path #44746 (#44772)
    
    Cherry-picked from #44746
    
    Co-authored-by: walter <[email protected]>
---
 be/src/olap/task/engine_clone_task.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/be/src/olap/task/engine_clone_task.cpp 
b/be/src/olap/task/engine_clone_task.cpp
index 75cbcf68e95..bea1d3b1a91 100644
--- a/be/src/olap/task/engine_clone_task.cpp
+++ b/be/src/olap/task/engine_clone_task.cpp
@@ -82,8 +82,9 @@ namespace {
 /// if not equal, then return error
 /// return value: if binlog file not exist, then return to binlog file path
 Result<std::string> check_dest_binlog_valid(const std::string& tablet_dir,
+                                            const std::string& clone_dir,
                                             const std::string& clone_file, 
bool* skip_link_file) {
-    std::string to;
+    std::string from, to;
     std::string new_clone_file = clone_file;
     if (clone_file.ends_with(".binlog")) {
         // change clone_file suffix from .binlog to .dat
@@ -92,6 +93,7 @@ Result<std::string> check_dest_binlog_valid(const 
std::string& tablet_dir,
         // change clone_file suffix from .binlog-index to .idx
         new_clone_file.replace(clone_file.size() - 13, 13, ".idx");
     }
+    from = fmt::format("{}/{}", clone_dir, clone_file);
     to = fmt::format("{}/_binlog/{}", tablet_dir, new_clone_file);
 
     // check to to file exist
@@ -106,10 +108,10 @@ Result<std::string> check_dest_binlog_valid(const 
std::string& tablet_dir,
     }
 
     LOG(WARNING) << "binlog file already exist. "
-                 << "tablet_dir=" << tablet_dir << ", clone_file=" << 
clone_file;
+                 << "tablet_dir=" << tablet_dir << ", clone_file=" << from << 
", to=" << to;
 
     std::string clone_file_md5sum;
-    status = io::global_local_filesystem()->md5sum(clone_file, 
&clone_file_md5sum);
+    status = io::global_local_filesystem()->md5sum(from, &clone_file_md5sum);
     if (!status.ok()) {
         return ResultError(std::move(status));
     }
@@ -697,7 +699,6 @@ Status EngineCloneTask::_finish_clone(Tablet* tablet, const 
std::string& clone_d
             continue;
         }
 
-        auto from = fmt::format("{}/{}", clone_dir, clone_file);
         std::string to;
         if (clone_file.ends_with(".binlog") || 
clone_file.ends_with(".binlog-index")) {
             if (!contain_binlog) {
@@ -706,7 +707,8 @@ Status EngineCloneTask::_finish_clone(Tablet* tablet, const 
std::string& clone_d
                 break;
             }
 
-            if (auto&& result = check_dest_binlog_valid(tablet_dir, 
clone_file, &skip_link_file);
+            if (auto&& result =
+                        check_dest_binlog_valid(tablet_dir, clone_dir, 
clone_file, &skip_link_file);
                 result) {
                 to = std::move(result.value());
             } else {
@@ -718,6 +720,7 @@ Status EngineCloneTask::_finish_clone(Tablet* tablet, const 
std::string& clone_d
         }
 
         if (!skip_link_file) {
+            auto from = fmt::format("{}/{}", clone_dir, clone_file);
             status = io::global_local_filesystem()->link_file(from, to);
             if (!status.ok()) {
                 return status;


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

Reply via email to