Apache Lucene open-source search software
SOLR-7392: Fix SOLR_JAVA_MEM and SOLR_OPTS customizations in solr.in.sh being ignored
Ramkumar Aiyengar19e25c78b64e
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 198cb12ee5e..a5b92b1f5b7 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -135,6 +135,9 @@ Bug Fixes* SOLR-7420: Overseer stats are not reset on loss of ZK connection. (Jessica Cheng, shalin)+* SOLR-7392: Fix SOLR_JAVA_MEM and SOLR_OPTS customizations in solr.in.sh being ignored+ (Ramkumar Aiyengar, Ere Maijala)+Optimizations----------------------diff --git a/solr/bin/solr b/solr/bin/solrindex dd53a44a4c5..def681049dd 100755--- a/solr/bin/solr+++ b/solr/bin/solr@@ -780,7 +780,7 @@ fi# Run in foreground (default is to run in the background)FG="false"noprompt=false-SOLR_OPTS=()+SOLR_OPTS=($SOLR_OPTS)if [ $# -gt 0 ]; thenwhile true; do@@ -1070,10 +1070,11 @@ if [[ "$SCRIPT_CMD" == "stop" && -z "$SOLR_PORT" ]]; thenfirm -f "$PIDF"done- # TODO: This doesn't get reflected across the subshell- if $none_stopped; then- echo -e "\nNo Solr nodes found to stop.\n"- fi+ # TODO: none_stopped doesn't get reflected across the subshell+ # This can be uncommented once we find a clean way out of it+ # if $none_stopped; then+ # echo -e "\nNo Solr nodes found to stop.\n"+ # fielse# not stopping all and don't have a port, but if we can find the pid file for the default port 8983, then use thatnone_stopped=true@@ -1253,13 +1254,12 @@ elseREMOTE_JMX_OPTS=()fi-SOLR_JAVA_MEM=()-if [ "$SOLR_HEAP" != "" ]; then- SOLR_JAVA_MEM=("-Xms$SOLR_HEAP" "-Xmx$SOLR_HEAP")-fi--if [ -z "$SOLR_JAVA_MEM" ]; then- SOLR_JAVA_MEM=('-Xms512m' '-Xmx512m')+JAVA_MEM_OPTS=()+if [ -z "$SOLR_HEAP" ] && [ -n "$SOLR_JAVA_MEM" ]; then+ JAVA_MEM_OPTS=($SOLR_JAVA_MEM)+else+ SOLR_HEAP="${SOLR_HEAP:-512m}"+ JAVA_MEM_OPTS=("-Xms$SOLR_HEAP" "-Xmx$SOLR_HEAP")fiif [ -z "$SOLR_TIMEZONE" ]; then@@ -1305,7 +1305,7 @@ function launch_solr() {echo -e " SOLR_HOST = $SOLR_HOST"echo -e " SOLR_PORT = $SOLR_PORT"echo -e " STOP_PORT = $STOP_PORT"- echo -e " SOLR_JAVA_MEM = ${SOLR_JAVA_MEM[@]}"+ echo -e " JAVA_MEM_OPTS = ${JAVA_MEM_OPTS[@]}"echo -e " GC_TUNE = ${GC_TUNE[@]}"echo -e " GC_LOG_OPTS = ${GC_LOG_OPTS[@]}"echo -e " SOLR_TIMEZONE = $SOLR_TIMEZONE"@@ -1337,7 +1337,7 @@ function launch_solr() {exit 1fi- SOLR_START_OPTS=('-server' '-Xss256k' "${SOLR_JAVA_MEM[@]}" "${GC_TUNE[@]}" "${GC_LOG_OPTS[@]}" \+ SOLR_START_OPTS=('-server' '-Xss256k' "${JAVA_MEM_OPTS[@]}" "${GC_TUNE[@]}" "${GC_LOG_OPTS[@]}" \"${REMOTE_JMX_OPTS[@]}" "${CLOUD_MODE_OPTS[@]}" \"-Djetty.port=$SOLR_PORT" "-DSTOP.PORT=$stop_port" "-DSTOP.KEY=$STOP_KEY" \"${SOLR_HOST_ARG[@]}" "-Duser.timezone=$SOLR_TIMEZONE" \diff --git a/solr/bin/solr.in.sh b/solr/bin/solr.in.shindex ccaea12f37e..3526586abdf 100644--- a/solr/bin/solr.in.sh+++ b/solr/bin/solr.in.sh@@ -18,8 +18,12 @@# affecting other Java applications on your server/workstation.#SOLR_JAVA_HOME=""-# Increase Java Min/Max Heap as needed to support your indexing / query needs-SOLR_JAVA_MEM="-Xms512m -Xmx512m"+# Increase Java Heap as needed to support your indexing / query needs+SOLR_HEAP="512m"++# Expert: If you want finer control over memory options, specify them directly+# Comment out SOLR_HEAP if you are using this though, that takes precedence+#SOLR_JAVA_MEM="-Xms512m -Xmx512m"# Enable verbose GC loggingGC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \