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

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


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 020a48a200c branch-3.1: [fix](filecache) warm up download data less 
than actual #54363 (#54421)
020a48a200c is described below

commit 020a48a200ce06b11cd86a8bf82387382d0b2f94
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Aug 7 17:34:53 2025 +0800

    branch-3.1: [fix](filecache) warm up download data less than actual #54363 
(#54421)
    
    Cherry-picked from #54363
    
    Co-authored-by: zhengyu <[email protected]>
---
 be/src/io/cache/block_file_cache_downloader.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/be/src/io/cache/block_file_cache_downloader.cpp 
b/be/src/io/cache/block_file_cache_downloader.cpp
index 96f507816a6..c7cc5476436 100644
--- a/be/src/io/cache/block_file_cache_downloader.cpp
+++ b/be/src/io/cache/block_file_cache_downloader.cpp
@@ -265,10 +265,12 @@ void 
FileCacheBlockDownloader::download_segment_file(const DownloadFileMeta& met
 
     std::unique_ptr<char[]> buffer(new char[one_single_task_size]);
 
+    size_t task_offset = 0;
     for (size_t i = 0; i < task_num; i++) {
-        size_t offset = meta.offset + i * one_single_task_size;
-        size_t size =
-                std::min(one_single_task_size, 
static_cast<size_t>(meta.download_size - offset));
+        size_t offset = meta.offset + task_offset;
+
+        size_t size = std::min(one_single_task_size,
+                               static_cast<size_t>(meta.download_size - 
task_offset));
         size_t bytes_read;
         VLOG_DEBUG << "download_segment_file, path=" << meta.path << ", 
read_at offset=" << offset
                    << ", size=" << size;
@@ -285,6 +287,7 @@ void FileCacheBlockDownloader::download_segment_file(const 
DownloadFileMeta& met
             g_file_cache_download_failed_num << 1;
             return;
         }
+        task_offset += size;
         g_file_cache_download_finished_size << size;
     }
 


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

Reply via email to