github-actions[bot] commented on code in PR #42629:
URL: https://github.com/apache/doris/pull/42629#discussion_r1818723288


##########
be/src/io/hdfs_util.cpp:
##########
@@ -41,6 +44,54 @@ Status create_hdfs_fs(const THdfsParams& hdfs_params, const 
std::string& fs_name
     return Status::OK();
 }
 
+Status create_hdfs_fs_async(const THdfsParams& hdfs_params, const std::string& 
fs_name,
+                            hdfsFS* fs) {
+    std::promise<std::pair<Status, hdfsFS>> prom;
+    std::future<std::pair<Status, hdfsFS>> fut = prom.get_future();
+
+    std::thread t(
+            [&](std::promise<std::pair<Status, hdfsFS>> prom) {
+                HDFSCommonBuilder builder;
+                Status status = create_hdfs_builder(hdfs_params, fs_name, 
&builder);
+                if (status != Status::OK()) {
+                    prom.set_value(std::make_pair(status, nullptr));
+                    return;
+                }
+                hdfsFS hdfs_fs = hdfsBuilderConnect(builder.get());
+                if (hdfs_fs == nullptr) {
+                    prom.set_value(std::make_pair(
+                            Status::InternalError("failed to connect to hdfs 
{}: {}, in bthread",
+                                                  fs_name, hdfs_error()),
+                            nullptr));
+                    return;
+                }
+                prom.set_value(std::make_pair(Status::OK(), hdfs_fs));
+                return;
+            },
+            std::move(prom));
+
+    auto [status, hdfs_fs] = fut.get();
+    if (t.joinable()) {
+        t.join();
+    }
+
+    if (status == Status::OK()) {
+        *fs = hdfs_fs;
+    }
+    return status;
+}
+
+inline bool is_bthread() {

Review Comment:
   warning: 'is_bthread' is a static definition in anonymous namespace; static 
is redundant here [readability-static-definition-in-anonymous-namespace]
   
   ```suggestion
   inline bool is_bthread() {
   ```
   



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to