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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 299b28b836 [Fix](multi-catalog) Fix crashed when hdfs get path info 
returning nullptr. (#18387)
299b28b836 is described below

commit 299b28b836ad569f30ba26b83484d965f456c43c
Author: Qi Chen <[email protected]>
AuthorDate: Wed Apr 5 09:07:25 2023 +0800

    [Fix](multi-catalog) Fix crashed when hdfs get path info returning nullptr. 
(#18387)
    
    only for 1.2
---
 be/src/io/hdfs_builder.cpp     | 3 ++-
 be/src/io/hdfs_file_reader.cpp | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/be/src/io/hdfs_builder.cpp b/be/src/io/hdfs_builder.cpp
index 4db04eb681..2b482a3514 100644
--- a/be/src/io/hdfs_builder.cpp
+++ b/be/src/io/hdfs_builder.cpp
@@ -31,7 +31,8 @@ namespace doris {
 Status HDFSCommonBuilder::init_hdfs_builder() {
     hdfs_builder = hdfsNewBuilder();
     if (hdfs_builder == nullptr) {
-        LOG(INFO) << "failed to init HDFSCommonBuilder, please check 
be/conf/hdfs-site.xml and be.out";
+        LOG(INFO) << "failed to init HDFSCommonBuilder, please check 
be/conf/hdfs-site.xml and "
+                     "be.out";
         return Status::InternalError(
                 "failed to init HDFSCommonBuilder, please check 
be/conf/hdfs-site.xml and be.out");
     }
diff --git a/be/src/io/hdfs_file_reader.cpp b/be/src/io/hdfs_file_reader.cpp
index 1bdd96cd2a..ad3e3ca299 100644
--- a/be/src/io/hdfs_file_reader.cpp
+++ b/be/src/io/hdfs_file_reader.cpp
@@ -178,6 +178,10 @@ int64_t HdfsFileReader::size() {
     if (_file_size == -1) {
         if (_hdfs_fs != nullptr) {
             hdfsFileInfo* file_info = hdfsGetPathInfo(_hdfs_fs, _path.c_str());
+            if (file_info == nullptr) {
+                return Status::IOError("failed to get path info, path: {}, 
error: {}", _path,
+                                       hdfsGetLastError());
+            }
             _file_size = file_info->mSize;
             hdfsFreeFileInfo(file_info, 1);
         }


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

Reply via email to