Apache Solr open-source search software
SOLR-16500: Added --enable-preview for JDK 19 to enable MemorySegment support in MMapDirectory (#1142)
Kevin Risdendbb085ac57ff
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex cd0bca1e500..fb82b6060df 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -35,6 +35,8 @@ New Features* SOLR-16435: Add Request timeout to Http2SolrClient (Tomás Fernández Löbbe)+* SOLR-16500: Added --enable-preview for JDK 19 to enable MemorySegment support in MMapDirectory (Kevin Risden)+Improvements---------------------diff --git a/solr/bin/solr b/solr/bin/solrindex fd0a7d6a36f..704efcb724f 100755--- a/solr/bin/solr+++ b/solr/bin/solr@@ -2250,6 +2250,12 @@ function start_solr() {echo "Java $JAVA_VER_NUM detected. Enabled workaround for SOLR-16463"fi+ # Added --enable-preview for JDK 19 to enable MemorySegment support in MMapDirectory, see https://issues.apache.org/jira/browse/SOLR-16500+ if [[ "$JAVA_VER_NUM" -eq "19" ]] ; then+ SOLR_OPTS+=("--enable-preview")+ echo "Java $JAVA_VER_NUM detected. Added --enable-preview to enable MemorySegment support in MMapDirectory. See SOLR-16500"+ fi+SOLR_START_OPTS=('-server' "${JAVA_MEM_OPTS[@]}" "${GC_TUNE[@]}" "${GC_LOG_OPTS[@]}" "${IP_ACL_OPTS[@]}" \"${REMOTE_JMX_OPTS[@]}" "${CLOUD_MODE_OPTS[@]}" ${SOLR_LOG_LEVEL_OPT:-} -Dsolr.log.dir="$SOLR_LOGS_DIR" \"-Djetty.port=$SOLR_PORT" "-DSTOP.PORT=$stop_port" "-DSTOP.KEY=$STOP_KEY" \diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmdindex 17ccf4f83f0..7960e9065de 100755--- a/solr/bin/solr.cmd+++ b/solr/bin/solr.cmd@@ -1253,6 +1253,13 @@ if !JAVA_MAJOR_VERSION! GEQ 17 (echo Java %JAVA_MAJOR_VERSION% detected. Enabled workaround for SOLR-16463)+REM Added --enable-preview for JDK 19 to enable MemorySegment support in MMapDirectory. See https://issues.apache.org/jira/browse/SOLR-16500++if !JAVA_MAJOR_VERSION! EQU 19 (+ set SOLR_OPTS=%SOLR_OPTS% --enable-preview+ echo Java $JAVA_VER_NUM detected. Added --enable-preview to enable MemorySegment support in MMapDirectory. See SOLR-16500+)+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