Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](java) should use JAVA_OPTS_FOR_JDK_17 instead of JAVA_OPTS #48170

Merged
merged 5 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions be/src/util/jni-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,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
Expand Down
1 change: 1 addition & 0 deletions bin/start_be.sh
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,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}"
Expand Down
1 change: 1 addition & 0 deletions bin/start_fe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
3 changes: 0 additions & 3 deletions conf/be.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ CUR_DATE=`date +%Y%m%d-%H%M%S`
# Log dir
LOG_DIR="${DORIS_HOME}/log/"

# For jdk 8
JAVA_OPTS="-Dfile.encoding=UTF-8 -Xmx2048m -DlogPath=$LOG_DIR/jni.log -Xloggc:$LOG_DIR/be.gc.log.$CUR_DATE -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=50M -Djavax.security.auth.useSubjectCredsOnly=false -Dsun.security.krb5.debug=true -Dsun.java.command=DorisBE -XX:-CriticalJNINatives"

# For jdk 17, this JAVA_OPTS will be used as default JVM options
JAVA_OPTS_FOR_JDK_17="-Dfile.encoding=UTF-8 -Djol.skipHotspotSAAttach=true -Xmx2048m -DlogPath=$LOG_DIR/jni.log -Xlog:gc*:$LOG_DIR/be.gc.log.$CUR_DATE:time,uptime:filecount=10,filesize=50M -Djavax.security.auth.useSubjectCredsOnly=false -Dsun.security.krb5.debug=true -Dsun.java.command=DorisBE -XX:-CriticalJNINatives -XX:+IgnoreUnrecognizedVMOptions --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/sun.nio.cs=ALL-UNNAMED --add-opens=java.base/sun.security.action=ALL-UNNAMED --add-opens=java.base/sun.util.calendar=ALL-UNNAMED --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED -Darrow.enable_null_check_for_get=false"

Expand Down
3 changes: 0 additions & 3 deletions conf/fe.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ CUR_DATE=`date +%Y%m%d-%H%M%S`
# Log dir
LOG_DIR = ${DORIS_HOME}/log

# For jdk 8
JAVA_OPTS="-Dfile.encoding=UTF-8 -Djavax.security.auth.useSubjectCredsOnly=false -Xss4m -Xmx8192m -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintClassHistogramAfterFullGC -Xloggc:$LOG_DIR/log/fe.gc.log.$CUR_DATE -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=50M -Dlog4j2.formatMsgNoLookups=true"

# For jdk 17, this JAVA_OPTS will be used as default JVM options
JAVA_OPTS_FOR_JDK_17="-Dfile.encoding=UTF-8 -Djavax.security.auth.useSubjectCredsOnly=false -Xmx8192m -Xms8192m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$LOG_DIR -Xlog:gc*,classhisto*=trace:$LOG_DIR/fe.gc.log.$CUR_DATE:time,uptime:filecount=10,filesize=50M --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens java.base/jdk.internal.ref=ALL-UNNAMED"

Expand Down
Loading