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