mirror of https://github.com/apache/lucene.git
SOLR-12141: Fix "bin/solr" shell scripts (Windows/Linux/Mac) to correctly detect major Java version and use numerical version comparison to enforce minimum requirements. Also remove obsolete "UseParNewGC" option. This allows to start Solr with Java 10 or later.
This commit is contained in:
parent
08686038e1
commit
ade2cf2e74
|
@ -373,6 +373,10 @@ Bug Fixes
|
|||
|
||||
* SOLR-12129: After the core is reloaded, term of the core will not be watched (Cao Manh Dat)
|
||||
|
||||
* SOLR-12141: Fix "bin/solr" shell scripts (Windows/Linux/Mac) to correctly detect major Java version
|
||||
and use numerical version comparison to enforce minimum requirements. Also remove obsolete "UseParNewGC" option.
|
||||
This allows to start Solr with Java 10 or later. (Uwe Schindler)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ verbose=false
|
|||
THIS_OS=`uname -s`
|
||||
|
||||
# What version of Java is required to run this version of Solr.
|
||||
JAVA_VER_REQ="1.8"
|
||||
JAVA_VER_REQ="8"
|
||||
|
||||
stop_all=false
|
||||
|
||||
|
@ -138,10 +138,10 @@ if [[ $? -ne 0 ]] ; then
|
|||
echo >&2 "${PATH}"
|
||||
exit 1
|
||||
else
|
||||
JAVA_VER_NUM=$(echo $JAVA_VER | head -1 | awk -F '"' '/version/ {print $2}')
|
||||
if [[ "$JAVA_VER_NUM" < "$JAVA_VER_REQ" ]] ; then
|
||||
echo >&2 "Your current version of Java is too old to run this version of Solr"
|
||||
echo >&2 "We found version $JAVA_VER_NUM, using command '${JAVA} -version', with response:"
|
||||
JAVA_VER_NUM=$(echo $JAVA_VER | head -1 | awk -F '"' '/version/ {print $2}' | sed -e's/^1\.//' | sed -e's/[._-].*$//')
|
||||
if [[ "$JAVA_VER_NUM" -lt "$JAVA_VER_REQ" ]] ; then
|
||||
echo >&2 "Your current version of Java is too old to run this version of Solr."
|
||||
echo >&2 "We found major version $JAVA_VER_NUM, using command '${JAVA} -version', with response:"
|
||||
echo >&2 "${JAVA_VER}"
|
||||
echo >&2
|
||||
echo >&2 "Please install latest version of Java $JAVA_VER_REQ or set JAVA_HOME properly."
|
||||
|
@ -1828,7 +1828,7 @@ fi
|
|||
|
||||
# Establish default GC logging opts if no env var set (otherwise init to sensible default)
|
||||
if [ -z ${GC_LOG_OPTS+x} ]; then
|
||||
if [[ "$JAVA_VER_NUM" < "9" ]] ; then
|
||||
if [[ "$JAVA_VER_NUM" -lt "9" ]] ; then
|
||||
GC_LOG_OPTS=('-verbose:gc' '-XX:+PrintHeapAtGC' '-XX:+PrintGCDetails' \
|
||||
'-XX:+PrintGCDateStamps' '-XX:+PrintGCTimeStamps' '-XX:+PrintTenuringDistribution' \
|
||||
'-XX:+PrintGCApplicationStoppedTime')
|
||||
|
@ -1841,7 +1841,7 @@ fi
|
|||
|
||||
# if verbose gc logging enabled, setup the location of the log file and rotation
|
||||
if [ "$GC_LOG_OPTS" != "" ]; then
|
||||
if [[ "$JAVA_VER_NUM" < "9" ]] ; then
|
||||
if [[ "$JAVA_VER_NUM" -lt "9" ]] ; then
|
||||
gc_log_flag="-Xloggc"
|
||||
if [ "$JAVA_VENDOR" == "IBM J9" ]; then
|
||||
gc_log_flag="-Xverbosegclog"
|
||||
|
@ -1953,7 +1953,6 @@ function launch_solr() {
|
|||
'-XX:TargetSurvivorRatio=90' \
|
||||
'-XX:MaxTenuringThreshold=8' \
|
||||
'-XX:+UseConcMarkSweepGC' \
|
||||
'-XX:+UseParNewGC' \
|
||||
'-XX:ConcGCThreads=4' '-XX:ParallelGCThreads=4' \
|
||||
'-XX:+CMSScavengeBeforeRemark' \
|
||||
'-XX:PretenureSizeThreshold=64m' \
|
||||
|
|
|
@ -178,7 +178,7 @@ IF NOT EXIST "%JAVA_HOME%\bin\java.exe" (
|
|||
set "JAVA=%JAVA_HOME%\bin\java"
|
||||
CALL :resolve_java_info
|
||||
IF !JAVA_MAJOR_VERSION! LSS 8 (
|
||||
set "SCRIPT_ERROR=Java 1.8 or later is required to run Solr. Current Java version is: !JAVA_VERSION_INFO!"
|
||||
set "SCRIPT_ERROR=Java 1.8 or later is required to run Solr. Current Java version is: !JAVA_VERSION_INFO! (detected major: !JAVA_MAJOR_VERSION!)"
|
||||
goto err
|
||||
)
|
||||
|
||||
|
@ -1057,11 +1057,15 @@ IF ERRORLEVEL 1 (
|
|||
set IS_JDK=true
|
||||
set "SERVEROPT=-server"
|
||||
)
|
||||
"%JAVA%" -d64 -version > nul 2>&1
|
||||
IF ERRORLEVEL 1 (
|
||||
set "IS_64BIT=false"
|
||||
@echo WARNING: 32-bit Java detected. Not recommended for production. Point your JAVA_HOME to a 64-bit JDK
|
||||
@echo.
|
||||
if !JAVA_MAJOR_VERSION! LSS 9 (
|
||||
"%JAVA%" -d64 -version > nul 2>&1
|
||||
IF ERRORLEVEL 1 (
|
||||
set "IS_64BIT=false"
|
||||
@echo WARNING: 32-bit Java detected. Not recommended for production. Point your JAVA_HOME to a 64-bit JDK
|
||||
@echo.
|
||||
) ELSE (
|
||||
set IS_64bit=true
|
||||
)
|
||||
) ELSE (
|
||||
set IS_64bit=true
|
||||
)
|
||||
|
@ -1126,7 +1130,6 @@ IF "%GC_TUNE%"=="" (
|
|||
-XX:TargetSurvivorRatio=90 ^
|
||||
-XX:MaxTenuringThreshold=8 ^
|
||||
-XX:+UseConcMarkSweepGC ^
|
||||
-XX:+UseParNewGC ^
|
||||
-XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 ^
|
||||
-XX:+CMSScavengeBeforeRemark ^
|
||||
-XX:PretenureSizeThreshold=64m ^
|
||||
|
@ -1913,8 +1916,8 @@ FOR /f "usebackq tokens=3" %%a IN (`^""%JAVA%" -version 2^>^&1 ^| findstr "versi
|
|||
set JAVA_VERSION_INFO=!JAVA_VERSION_INFO:"=!
|
||||
|
||||
REM Extract the major Java version, e.g. 7, 8, 9, 10 ...
|
||||
for /f "tokens=1,2 delims=." %%a in ("!JAVA_VERSION_INFO!") do (
|
||||
if "%%a" GEQ "9" (
|
||||
for /f "tokens=1,2 delims=._-" %%a in ("!JAVA_VERSION_INFO!") do (
|
||||
if %%a GEQ 9 (
|
||||
set JAVA_MAJOR_VERSION=%%a
|
||||
) else (
|
||||
set JAVA_MAJOR_VERSION=%%b
|
||||
|
|
Loading…
Reference in New Issue