gavinchou commented on code in PR #54363:
URL: https://github.com/apache/doris/pull/54363#discussion_r2257336701


##########
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));

Review Comment:
   seems cannot use `meta.download_size` here, should use `download_size` 
initiated at line 263?



##########
be/src/io/cache/block_file_cache_downloader.cpp:
##########
@@ -285,6 +287,7 @@ void FileCacheBlockDownloader::download_segment_file(const 
DownloadFileMeta& met
             g_file_cache_download_failed_num << 1;
             return;
         }
+        task_offset += size;

Review Comment:
   it actually should be `bytes_read`? make a `DCHECK_EQ(bytes_read, size)` and 
return if it is not true.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to