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

jakevin 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 e4b894a318 [Bug](remote) Fix BE crash because of call the future's get 
method twice (#12357)
e4b894a318 is described below

commit e4b894a318680e3aba8c74da0e1bb9a17bfd3fc8
Author: zxealous <xealous0...@gmail.com>
AuthorDate: Wed Sep 7 10:11:27 2022 +0800

    [Bug](remote) Fix BE crash because of call the future's get method twice 
(#12357)
    
    call the future's get method once and save it.
---
 be/src/io/cache/sub_file_cache.cpp   | 5 +++--
 be/src/io/cache/whole_file_cache.cpp | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/be/src/io/cache/sub_file_cache.cpp 
b/be/src/io/cache/sub_file_cache.cpp
index ce1a8722a6..8cf2d693a9 100644
--- a/be/src/io/cache/sub_file_cache.cpp
+++ b/be/src/io/cache/sub_file_cache.cpp
@@ -174,8 +174,9 @@ Status SubFileCache::_generate_cache_reader(size_t offset, 
size_t req_size) {
         } else {
             return Status::InternalError("Failed to get download cache thread 
token");
         }
-        if (!future.get().ok()) {
-            return future.get();
+        auto st = future.get();
+        if (!st.ok()) {
+            return st;
         }
     }
     io::FileReaderSPtr cache_reader;
diff --git a/be/src/io/cache/whole_file_cache.cpp 
b/be/src/io/cache/whole_file_cache.cpp
index 5cc67928bc..0a33cbea0d 100644
--- a/be/src/io/cache/whole_file_cache.cpp
+++ b/be/src/io/cache/whole_file_cache.cpp
@@ -125,8 +125,9 @@ Status WholeFileCache::_generate_cache_reader(size_t 
offset, size_t req_size) {
         } else {
             return Status::InternalError("Failed to get download cache thread 
token");
         }
-        if (!future.get().ok()) {
-            return future.get();
+        auto st = future.get();
+        if (!st.ok()) {
+            return st;
         }
     }
     RETURN_IF_ERROR(io::global_local_filesystem()->open_file(cache_file, 
&_cache_file_reader));


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

Reply via email to