Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-15410: Always use -Xverbosegclog for OpenJ9 (#131)

Colvin Cowieb113d36017b3
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 3474bf65629..9ff4c91a62b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -322,6 +322,8 @@ Bug Fixes
* SOLR-15449: Edismax sow incorrectly affect mm parameter in multi field search (Alessandro Benedetti, Michael Gibney, David Smiley)
+* SOLR-15410: Always use -Xverbosegclog for OpenJ9. (Colvin Cowie via Eric Pugh)
+
================== 8.10.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
diff --git a/solr/bin/solr b/solr/bin/solr
index be107b48dbb..86d911d7aa5 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -166,8 +166,9 @@ else
exit 1
fi
JAVA_VENDOR="Oracle"
- if [ "`echo $JAVA_VER | grep -i "IBM J9"`" != "" ]; then
- JAVA_VENDOR="IBM J9"
+ # OpenJ9 was previously known as IBM J9, this will match both
+ if [ "`echo $JAVA_VER | grep -i -E "OpenJ9|IBM J9"`" != "" ]; then
+ JAVA_VENDOR="OpenJ9"
fi
fi
@@ -2023,9 +2024,9 @@ fi
# if verbose gc logging enabled, setup the location of the log file and rotation
if [ "$GC_LOG_OPTS" != "" ]; then
- if [[ "$JAVA_VER_NUM" -lt "9" ]] ; then
+ if [[ "$JAVA_VER_NUM" -lt "9" ]] || [ "$JAVA_VENDOR" == "OpenJ9" ]; then
gc_log_flag="-Xloggc"
- if [ "$JAVA_VENDOR" == "IBM J9" ]; then
+ if [ "$JAVA_VENDOR" == "OpenJ9" ]; then
gc_log_flag="-Xverbosegclog"
fi
if [ -z ${JAVA8_GC_LOG_FILE_OPTS+x} ]; then
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index f06b50f2716..5dd67db38b0 100755
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -1224,7 +1224,7 @@ IF "%GC_TUNE%"=="" (
-XX:+ExplicitGCInvokesConcurrent
)
-if !JAVA_MAJOR_VERSION! GEQ 9 (
+if !JAVA_MAJOR_VERSION! GEQ 9 if NOT "%JAVA_VENDOR%" == "OpenJ9" (
IF NOT "%GC_LOG_OPTS%"=="" (
echo ERROR: On Java 9 you cannot set GC_LOG_OPTS, only default GC logging is available. Exiting
GOTO :eof
@@ -1241,7 +1241,7 @@ if !JAVA_MAJOR_VERSION! GEQ 9 (
-XX:+PrintTenuringDistribution ^
-XX:+PrintGCApplicationStoppedTime
)
- if "%JAVA_VENDOR%" == "IBM J9" (
+ if "%JAVA_VENDOR%" == "OpenJ9" (
set GC_LOG_OPTS=!GC_LOG_OPTS! "-Xverbosegclog:!SOLR_LOGS_DIR!\solr_gc.log" -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=9 -XX:GCLogFileSize=20M
) else (
set GC_LOG_OPTS=!GC_LOG_OPTS! "-Xloggc:!SOLR_LOGS_DIR!\solr_gc.log" -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=9 -XX:GCLogFileSize=20M
@@ -2049,7 +2049,6 @@ CALL :resolve_java_vendor
set JAVA_MAJOR_VERSION=0
set JAVA_VERSION_INFO=
-set JAVA_BUILD=0
FOR /f "usebackq tokens=3" %%a IN (`^""%JAVA%" -version 2^>^&1 ^| findstr "version"^"`) do (
set JAVA_VERSION_INFO=%%a
@@ -2066,20 +2065,14 @@ FOR /f "usebackq tokens=3" %%a IN (`^""%JAVA%" -version 2^>^&1 ^| findstr "versi
set JAVA_MAJOR_VERSION=%%b
)
)
-
- REM Don't look for "_{build}" if we're on IBM J9.
- if NOT "%JAVA_VENDOR%" == "IBM J9" (
- for /f "delims=_ tokens=2" %%a in ("!JAVA_VERSION_INFO!") do (
- set /a JAVA_BUILD=%%a
- )
- )
)
GOTO :eof
REM Set which JVM vendor we have
:resolve_java_vendor
-"%JAVA%" -version 2>&1 | findstr /i "IBM J9" > nul
-if %ERRORLEVEL% == 1 ( set "JAVA_VENDOR=Oracle" ) else ( set "JAVA_VENDOR=IBM J9" )
+REM OpenJ9 was previously known as IBM J9, this will match both
+"%JAVA%" -version 2>&1 | findstr /i /C:"IBM J9" /C:"OpenJ9" > nul
+if %ERRORLEVEL% == 1 ( set "JAVA_VENDOR=Oracle" ) else ( set "JAVA_VENDOR=OpenJ9" )
set JAVA_VENDOR_OUT=
GOTO :eof
diff --git a/solr/bin/solr.in.cmd b/solr/bin/solr.in.cmd
index 5a0f18a40a2..5ce8b339152 100755
--- a/solr/bin/solr.in.cmd
+++ b/solr/bin/solr.in.cmd
@@ -30,7 +30,7 @@ REM set SOLR_JAVA_MEM=-Xms512m -Xmx512m
REM Configure verbose GC logging:
REM For Java 8: if this is set, additional params will be added to specify the log file & rotation
-REM For Java 9 or higher: GC_LOG_OPTS is currently not supported. If you set it, the startup script will exit with failure.
+REM For Java 9 or higher: GC_LOG_OPTS is currently not supported unless you are using OpenJ9. Otherwise if you set it, the startup script will exit with failure.
REM set GC_LOG_OPTS=-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime
REM Various GC settings have shown to work well for a number of common Solr workloads.