Skip to content

Commit 3c231ae

Browse files
authored
Update be/src/io/hdfs_util.cpp
1 parent 78e8a6e commit 3c231ae

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

be/src/io/hdfs_util.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ Status _create_hdfs_fs(const THdfsParams& hdfs_params, const std::string& fs_nam
4343
return Status::OK();
4444
}
4545

46-
bool is_bthread() {
47-
return (bthread_self() != 0);
48-
}
49-
46+
// https://brpc.apache.org/docs/server/basics/
47+
// According to the brpc doc, JNI code checks stack layout and cannot be run in
48+
// bthreads so create a pthread for creating hdfs connection if necessary.
5049
Status create_hdfs_fs(const THdfsParams& hdfs_params, const std::string& fs_name, hdfsFS* fs) {
51-
if (is_bthread()) {
50+
if (bthread_self() != 0) { // running in bthread
5251
Status st;
5352
std::thread t([&] { st = _create_hdfs_fs(hdfs_params, fs_name, fs); });
5453
if (t.joinable()) {

0 commit comments

Comments
 (0)