This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 0d386f92688 branch-2.1: [fix](java) should use JAVA_OPTS_FOR_JDK_17 
instead of JAVA_OPTS #48170 (#48282)
0d386f92688 is described below

commit 0d386f926883cd94529a82a9889748a97b780e73
Author: Mingyu Chen (Rayner) <morning...@163.com>
AuthorDate: Tue Feb 25 18:23:18 2025 +0800

    branch-2.1: [fix](java) should use JAVA_OPTS_FOR_JDK_17 instead of 
JAVA_OPTS #48170 (#48282)
    
    bp #48170
    So that when user using jdk17 to run Doris 2.1, it will get the right
    JAVA_OPTS
---
 be/src/util/jni-util.cpp | 20 ++++----------------
 bin/start_be.sh          |  1 +
 bin/start_fe.sh          |  1 +
 3 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/be/src/util/jni-util.cpp b/be/src/util/jni-util.cpp
index df79ee15339..ea171d5d17c 100644
--- a/be/src/util/jni-util.cpp
+++ b/be/src/util/jni-util.cpp
@@ -96,23 +96,11 @@ const std::string GetKerb5ConfPath() {
 }
 
 [[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"));
-    libhdfs_opts += fmt::format("{} ", GetKerb5ConfPath());
-
+    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
diff --git a/bin/start_be.sh b/bin/start_be.sh
index 46aa924ca3b..aa5929ab34e 100755
--- a/bin/start_be.sh
+++ b/bin/start_be.sh
@@ -358,6 +358,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 1650145b798..3955d8d7577 100755
--- a/bin/start_fe.sh
+++ b/bin/start_fe.sh
@@ -207,6 +207,7 @@ elif [[ "${java_version}" -gt 8 ]]; then
 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: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to