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

gavinchou 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 533a117aa4f [fix](filecache) warm up download data less than actual 
(#54363)
533a117aa4f is described below

commit 533a117aa4f69c135bf8a7beb0c9c038ef26de56
Author: zhengyu <[email protected]>
AuthorDate: Thu Aug 7 11:33:11 2025 +0800

    [fix](filecache) warm up download data less than actual (#54363)
    
    the offset calculation here is buggy. we should use task-level offset to
    calculate download size other than file-level offset. otherwise, when
    offset is not zero, file download size is incorrect, causing data
    download is less than actual.
---
 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 d7ed5392ad6..000308a7e2d 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