You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/06/30 10:34:24 UTC
[doris] branch branch-1.2-lts updated: [branch-1.2][fix](kerberos) fix kerberos renew issue (#21266)
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 06aa240222 [branch-1.2][fix](kerberos) fix kerberos renew issue (#21266)
06aa240222 is described below
commit 06aa240222b4d997a3361cfdd0e55cd24af0b62f
Author: Mingyu Chen <mo...@163.com>
AuthorDate: Fri Jun 30 18:34:17 2023 +0800
[branch-1.2][fix](kerberos) fix kerberos renew issue (#21266)
---
be/src/io/hdfs_builder.cpp | 1 +
be/src/io/hdfs_file_reader.cpp | 45 ++++++++++++++++--------------------------
2 files changed, 18 insertions(+), 28 deletions(-)
diff --git a/be/src/io/hdfs_builder.cpp b/be/src/io/hdfs_builder.cpp
index ebed8b8c5b..1503d9eb2e 100644
--- a/be/src/io/hdfs_builder.cpp
+++ b/be/src/io/hdfs_builder.cpp
@@ -70,6 +70,7 @@ Status HDFSCommonBuilder::run_kinit() {
#endif
hdfsBuilderConfSetStr(hdfs_builder, "hadoop.security.kerberos.ticket.cache.path",
ticket_path.c_str());
+ LOG(INFO) << "finish to run kinit: " << fmt::to_string(kinit_command);
return Status::OK();
}
diff --git a/be/src/io/hdfs_file_reader.cpp b/be/src/io/hdfs_file_reader.cpp
index a07d577f33..8310927116 100644
--- a/be/src/io/hdfs_file_reader.cpp
+++ b/be/src/io/hdfs_file_reader.cpp
@@ -75,13 +75,6 @@ Status HdfsFileReader::open() {
RETURN_IF_ERROR(HdfsFsCache::instance()->get_connection(_hdfs_params, &_fs_handle));
_hdfs_fs = _fs_handle->hdfs_fs;
if (hdfsExists(_hdfs_fs, _path.c_str()) != 0) {
-#ifdef USE_HADOOP_HDFS
- char* root_cause = hdfsGetLastExceptionRootCause();
- if (root_cause != nullptr) {
- return Status::InternalError("fail to check path exist {}, reason: {}", _path,
- root_cause);
- }
-#endif
if (_fs_handle->from_cache) {
// hdfsFS may be disconnected if not used for a long time or kerberos token is expired
_fs_handle->set_invalid();
@@ -91,7 +84,7 @@ Status HdfsFileReader::open() {
_hdfs_fs = _fs_handle->hdfs_fs;
if (hdfsExists(_hdfs_fs, _path.c_str()) != 0) {
#ifdef USE_HADOOP_HDFS
- root_cause = hdfsGetLastExceptionRootCause();
+ char* root_cause = hdfsGetLastExceptionRootCause();
if (root_cause != nullptr) {
return Status::InternalError("fail to check path exist {}, reason: {}", _path,
root_cause);
@@ -279,30 +272,26 @@ Status HdfsFsCache::get_connection(THdfsParams& hdfs_params, HdfsFsHandle** fs_h
auto it = _cache.find(hash_code);
if (it != _cache.end()) {
HdfsFsHandle* handle = it->second.get();
- if (handle->invalid()) {
- hdfsFS hdfs_fs = nullptr;
- RETURN_IF_ERROR(_create_fs(hdfs_params, &hdfs_fs));
- *fs_handle = new HdfsFsHandle(hdfs_fs, false);
- } else {
+ if (!handle->invalid()) {
handle->inc_ref();
*fs_handle = handle;
+ return Status::OK();
}
+ }
+
+ hdfsFS hdfs_fs = nullptr;
+ RETURN_IF_ERROR(_create_fs(hdfs_params, &hdfs_fs));
+ if (_cache.size() >= MAX_CACHE_HANDLE) {
+ _clean_invalid();
+ _clean_oldest();
+ }
+ if (_cache.size() < MAX_CACHE_HANDLE) {
+ std::unique_ptr<HdfsFsHandle> handle = std::make_unique<HdfsFsHandle>(hdfs_fs, true);
+ handle->inc_ref();
+ *fs_handle = handle.get();
+ _cache[hash_code] = std::move(handle);
} else {
- hdfsFS hdfs_fs = nullptr;
- RETURN_IF_ERROR(_create_fs(hdfs_params, &hdfs_fs));
- if (_cache.size() >= MAX_CACHE_HANDLE) {
- _clean_invalid();
- _clean_oldest();
- }
- if (_cache.size() < MAX_CACHE_HANDLE) {
- std::unique_ptr<HdfsFsHandle> handle =
- std::make_unique<HdfsFsHandle>(hdfs_fs, true);
- handle->inc_ref();
- *fs_handle = handle.get();
- _cache[hash_code] = std::move(handle);
- } else {
- *fs_handle = new HdfsFsHandle(hdfs_fs, false);
- }
+ *fs_handle = new HdfsFsHandle(hdfs_fs, false);
}
}
return Status::OK();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org