Skip to content

Commit

Permalink
SOLR-15410: Always use -Xverbosegclog for OpenJ9 (apache#131)
Browse files Browse the repository at this point in the history
* SOLR-15410: Always use -Xverbosegclog for OpenJ9

* Update solr.in.cmd

* SOLR-15410: Match OpenJ9 and IBM J9 explicitly

* SOLR-15410: Remove unused JAVA_BUILD var in solr.cmd

* Document SOLR-15410 change

Co-authored-by: Colvin Cowie <[email protected]>
Co-authored-by: [email protected] <>
  • Loading branch information
colvinco and Colvin-Cowie-i2 authored Jun 9, 2021
1 parent 9791057 commit b113d36
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
2 changes: 2 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions solr/bin/solr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
17 changes: 5 additions & 12 deletions solr/bin/solr.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion solr/bin/solr.in.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b113d36

Please sign in to comment.