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


##########
be/src/io/hdfs_util.cpp:
##########
@@ -41,6 +43,29 @@ Status create_hdfs_fs(const THdfsParams& hdfs_params, const 
std::string& fs_name
     return Status::OK();
 }
 
+// https://brpc.apache.org/docs/server/basics/
+// According to the brpc doc, JNI code checks stack layout and cannot be run in
+// bthreads so create a pthread for creating hdfs connection if necessary.
+Status create_hdfs_fs(const THdfsParams& hdfs_params, const std::string& 
fs_name, hdfsFS* fs) {
+    if (bthread_self() != 0) { // running in bthread
+        Status st;
+        auto btx = butex_create();
+        std::atomic_bool done = false;
+        std::thread t([&] {
+            st = _create_hdfs_fs(hdfs_params, fs_name, fs);
+            done = true;
+            butex_wake(btx);
+        });
+        if (!done) butex_wait(btx);

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
           if (!done) { butex_wait(btx);
   }
   ```
   



-- 
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