This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new dd2272bf0e4 branch-3.0: [fix](java) should use JAVA_OPTS_FOR_JDK_17
instead of JAVA_OPTS #48170 #48335 (#48284)
dd2272bf0e4 is described below
commit dd2272bf0e48cafbc416b2e3f167a59af9a164fa
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Wed Feb 26 17:46:51 2025 +0800
branch-3.0: [fix](java) should use JAVA_OPTS_FOR_JDK_17 instead of
JAVA_OPTS #48170 #48335 (#48284)
bp #48170 and #48335
and also pick part of #47299, only related to `jni-util.cpp`.
To pass the krb5.conf config to Jni env
---
be/src/util/jni-util.cpp | 26 ++++++++++----------------
bin/start_be.sh | 1 +
bin/start_fe.sh | 1 +
3 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/be/src/util/jni-util.cpp b/be/src/util/jni-util.cpp
index eb71bb449b4..d5483a7874c 100644
--- a/be/src/util/jni-util.cpp
+++ b/be/src/util/jni-util.cpp
@@ -93,23 +93,16 @@ const std::string GetDorisJNIClasspathOption() {
}
}
-[[maybe_unused]] void SetEnvIfNecessary() {
- const auto* doris_home = getenv("DORIS_HOME");
- DCHECK(doris_home) << "Environment variable DORIS_HOME is not set.";
-
- // CLASSPATH
- const std::string original_classpath = getenv("CLASSPATH") ?
getenv("CLASSPATH") : "";
- static const std::string classpath = fmt::format(
- "{}/conf:{}:{}", doris_home, GetDorisJNIDefaultClasspath(),
original_classpath);
- setenv("CLASSPATH", classpath.c_str(), 0);
-
- // LIBHDFS_OPTS
- const std::string java_opts = getenv("JAVA_OPTS") ? getenv("JAVA_OPTS") :
"";
- std::string libhdfs_opts =
- fmt::format("{} -Djava.library.path={}/lib/hadoop_hdfs/native:{}",
java_opts,
- getenv("DORIS_HOME"), getenv("DORIS_HOME") +
std::string("/lib"));
+const std::string GetKerb5ConfPath() {
+ return "-Djava.security.krb5.conf=" + config::kerberos_krb5_conf_path;
+}
- setenv("LIBHDFS_OPTS", libhdfs_opts.c_str(), 0);
+[[maybe_unused]] void SetEnvIfNecessary() {
+ std::string libhdfs_opts = getenv("LIBHDFS_OPTS") ? getenv("LIBHDFS_OPTS")
: "";
+ CHECK(libhdfs_opts != "") << "LIBHDFS_OPTS is not set";
+ libhdfs_opts += fmt::format(" {} ", GetKerb5ConfPath());
+ setenv("LIBHDFS_OPTS", libhdfs_opts.c_str(), 1);
+ LOG(INFO) << "set final LIBHDFS_OPTS: " << libhdfs_opts;
}
// Only used on non-x86 platform
@@ -139,6 +132,7 @@ const std::string GetDorisJNIClasspathOption() {
std::istream_iterator<std::string>());
options.push_back(GetDorisJNIClasspathOption());
}
+ options.push_back(GetKerb5ConfPath());
std::unique_ptr<JavaVMOption[]> jvm_options(new
JavaVMOption[options.size()]);
for (int i = 0; i < options.size(); ++i) {
jvm_options[i] = {const_cast<char*>(options[i].c_str()), nullptr};
diff --git a/bin/start_be.sh b/bin/start_be.sh
index 4ccb38e5a05..06024d42384 100755
--- a/bin/start_be.sh
+++ b/bin/start_be.sh
@@ -403,6 +403,7 @@ fi
# set LIBHDFS_OPTS for hadoop libhdfs
export LIBHDFS_OPTS="${final_java_opt}"
+export JAVA_OPTS="${final_java_opt}"
# log "CLASSPATH: ${CLASSPATH}"
# log "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
diff --git a/bin/start_fe.sh b/bin/start_fe.sh
index b089596a9cd..76ac682ef51 100755
--- a/bin/start_fe.sh
+++ b/bin/start_fe.sh
@@ -204,6 +204,7 @@ else
fi
log "Using Java version ${java_version}"
log "${final_java_opt}"
+export JAVA_OPTS="${final_java_opt}"
# add libs to CLASSPATH
DORIS_FE_JAR=
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]