mirror of https://github.com/apache/lucene.git
SOLR-7506: Roll over GC logs by default via bin/solr scripts
This commit is contained in:
parent
61e180b7ef
commit
ef5737466e
|
@ -234,6 +234,7 @@ Optimizations
|
|||
|
||||
* SOLR-9506: cache IndexFingerprint for each segment (Pushkar Raste, yonik, noble)
|
||||
|
||||
* SOLR-7506: Roll over GC logs by default via bin/solr scripts (shalin, janhoy)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
|
|
@ -1411,13 +1411,14 @@ if [ -z ${GC_LOG_OPTS+x} ]; then
|
|||
else
|
||||
GC_LOG_OPTS=($GC_LOG_OPTS)
|
||||
fi
|
||||
# if verbose gc logging enabled, setup the location of the log file
|
||||
|
||||
# if verbose gc logging enabled, setup the location of the log file and rotation
|
||||
if [ "$GC_LOG_OPTS" != "" ]; then
|
||||
gc_log_flag="-Xloggc"
|
||||
if [ "$JAVA_VENDOR" == "IBM J9" ]; then
|
||||
gc_log_flag="-Xverbosegclog"
|
||||
fi
|
||||
GC_LOG_OPTS+=("$gc_log_flag:$SOLR_LOGS_DIR/solr_gc.log")
|
||||
GC_LOG_OPTS+=("$gc_log_flag:$SOLR_LOGS_DIR/solr_gc.log" -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=9 -XX:GCLogFileSize=20M)
|
||||
fi
|
||||
|
||||
# If ZK_HOST is defined, the assume SolrCloud mode
|
||||
|
|
|
@ -1013,23 +1013,23 @@ IF NOT EXIST "%SOLR_SERVER_DIR%\tmp" (
|
|||
)
|
||||
|
||||
IF "%JAVA_VENDOR%" == "IBM J9" (
|
||||
set "GCLOG_OPT=-Xverbosegclog"
|
||||
set GCLOG_OPT="-Xverbosegclog:!SOLR_LOGS_DIR!\solr_gc.log" -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=9 -XX:GCLogFileSize=20M
|
||||
) else (
|
||||
set "GCLOG_OPT=-Xloggc"
|
||||
set GCLOG_OPT="-Xloggc:!SOLR_LOGS_DIR!\solr_gc.log" -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=9 -XX:GCLogFileSize=20M
|
||||
)
|
||||
|
||||
IF "%FG%"=="1" (
|
||||
REM run solr in the foreground
|
||||
title "Solr-%SOLR_PORT%"
|
||||
echo %SOLR_PORT%>"%SOLR_TIP%"\bin\solr-%SOLR_PORT%.port
|
||||
"%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS% %GCLOG_OPT%:"!SOLR_LOGS_DIR!/solr_gc.log" ^
|
||||
"%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS% %GCLOG_OPT% ^
|
||||
-Dlog4j.configuration="%LOG4J_CONFIG%" -DSTOP.PORT=!STOP_PORT! -DSTOP.KEY=%STOP_KEY% ^
|
||||
-Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" ^
|
||||
-Djetty.host=%SOLR_JETTY_HOST% -Djetty.port=%SOLR_PORT% -Djetty.home="%SOLR_SERVER_DIR%" ^
|
||||
-Djava.io.tmpdir="%SOLR_SERVER_DIR%\tmp" -jar start.jar "%SOLR_JETTY_CONFIG%"
|
||||
) ELSE (
|
||||
START /B "Solr-%SOLR_PORT%" /D "%SOLR_SERVER_DIR%" ^
|
||||
"%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS% %GCLOG_OPT%:"!SOLR_LOGS_DIR!/solr_gc.log" ^
|
||||
"%JAVA%" %SERVEROPT% %SOLR_JAVA_MEM% %START_OPTS% %GCLOG_OPT% ^
|
||||
-Dlog4j.configuration="%LOG4J_CONFIG%" -DSTOP.PORT=!STOP_PORT! -DSTOP.KEY=%STOP_KEY% ^
|
||||
-Dsolr.log.muteconsole ^
|
||||
-Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" ^
|
||||
|
|
|
@ -3444,13 +3444,13 @@ public class SolrCLI {
|
|||
Files.createDirectories(archivePath);
|
||||
}
|
||||
List<Path> archived = Files.find(archivePath, 1, (f, a)
|
||||
-> a.isRegularFile() && String.valueOf(f.getFileName()).startsWith("solr_gc_"))
|
||||
-> a.isRegularFile() && String.valueOf(f.getFileName()).matches("^solr_gc[_.].+"))
|
||||
.collect(Collectors.toList());
|
||||
for (Path p : archived) {
|
||||
Files.delete(p);
|
||||
}
|
||||
List<Path> files = Files.find(logsPath, 1, (f, a)
|
||||
-> a.isRegularFile() && String.valueOf(f.getFileName()).startsWith("solr_gc_"))
|
||||
-> a.isRegularFile() && String.valueOf(f.getFileName()).matches("^solr_gc[_.].+"))
|
||||
.collect(Collectors.toList());
|
||||
if (files.size() > 0) {
|
||||
out("Archiving " + files.size() + " old GC log files to " + archivePath);
|
||||
|
|
|
@ -55,6 +55,10 @@ public class UtilsToolTest extends SolrTestCaseJ4 {
|
|||
"solr_log_20160304",
|
||||
"solr-8983-console.log",
|
||||
"solr_gc_log_20160102",
|
||||
"solr_gcnotremove",
|
||||
"solr_gc.log",
|
||||
"solr_gc.log.0",
|
||||
"solr_gc.log.0.current",
|
||||
"solr_gc_log_2");
|
||||
|
||||
@Before
|
||||
|
@ -136,7 +140,7 @@ public class UtilsToolTest extends SolrTestCaseJ4 {
|
|||
String[] args = {"utils", "-archive_gc_logs", "-l", dir.toString()};
|
||||
assertEquals(files.size(), fileCount());
|
||||
assertEquals(0, runTool(args));
|
||||
assertEquals(files.size()-2, fileCount());
|
||||
assertEquals(files.size()-5, fileCount());
|
||||
assertFalse(listFiles().contains("solr_gc_log_2"));
|
||||
assertTrue(Files.exists(dir.resolve("archived").resolve("solr_gc_log_2")));
|
||||
assertEquals(0, runTool(args));
|
||||
|
|
Loading…
Reference in New Issue