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

branch-3.0: [fix](java) should use JAVA_OPTS_FOR_JDK_17 instead of JAVA_OPTS #47913 #47946

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 4 additions & 3 deletions be/src/util/jni-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ const std::string GetDorisJNIClasspathOption() {
setenv("CLASSPATH", classpath.c_str(), 0);

// LIBHDFS_OPTS
const std::string java_opts = getenv("JAVA_OPTS") ? getenv("JAVA_OPTS") : "";
const std::string java_opts =
getenv("JAVA_OPTS_FOR_JDK_17") ? getenv("JAVA_OPTS_FOR_JDK_17") : "";
std::string libhdfs_opts =
fmt::format("{} -Djava.library.path={}/lib/hadoop_hdfs/native:{}", java_opts,
getenv("DORIS_HOME"), getenv("DORIS_HOME") + std::string("/lib"));
Expand All @@ -118,7 +119,7 @@ const std::string GetDorisJNIClasspathOption() {
if (rv == 0) {
std::vector<std::string> options;

char* java_opts = getenv("JAVA_OPTS");
char* java_opts = getenv("JAVA_OPTS_FOR_JDK_17");
if (java_opts == nullptr) {
options = {
GetDorisJNIClasspathOption(), fmt::format("-Xmx{}", "1g"),
Expand Down Expand Up @@ -210,7 +211,7 @@ Status JniLocalFrame::push(JNIEnv* env, int max_local_ref) {
}

void JniUtil::parse_max_heap_memory_size_from_jvm(JNIEnv* env) {
// The start_be.sh would set JAVA_OPTS inside LIBHDFS_OPTS
// The start_be.sh would set JAVA_OPTS_FOR_JDK_17 inside LIBHDFS_OPTS
std::string java_opts = getenv("LIBHDFS_OPTS") ? getenv("LIBHDFS_OPTS") : "";
std::istringstream iss(java_opts);
std::string opt;
Expand Down
5 changes: 3 additions & 2 deletions bin/start_be.sh
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ if [[ -f "${DORIS_HOME}/conf/hdfs-site.xml" ]]; then
export LIBHDFS3_CONF="${DORIS_HOME}/conf/hdfs-site.xml"
fi

# check java version and choose correct JAVA_OPTS
# check java version and choose correct JAVA_OPTS_FOR_JDK_17
java_version="$(
set -e
jdk_version "${JAVA_HOME}/bin/java"
Expand Down Expand Up @@ -397,12 +397,13 @@ if [[ "${MACHINE_OS}" == "Darwin" ]]; then
fi

if [[ -n "${JAVA_OPTS_FOR_JDK_17}" ]] && ! echo "${JAVA_OPTS_FOR_JDK_17}" | grep "${max_fd_limit/-/\\-}" >/dev/null; then
export JAVA_OPTS="${JAVA_OPTS_FOR_JDK_17} ${max_fd_limit}"
export JAVA_OPTS_FOR_JDK_17="${JAVA_OPTS_FOR_JDK_17} ${max_fd_limit}"
fi
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
5 changes: 3 additions & 2 deletions bin/start_fe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ export DORIS_HOME

# export env variables from fe.conf
#
# JAVA_OPTS
# JAVA_OPTS_FOR_JDK_17
# LOG_DIR
# PID_DIR
export JAVA_OPTS="-Xmx1024m"
export JAVA_OPTS_FOR_JDK_17="-Xmx1024m"
export LOG_DIR="${DORIS_HOME}/log"
PID_DIR="$(
cd "${curdir}"
Expand Down 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