From 68308f1438614786a71c01d56477ba3feaae8781 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 12 Jun 2015 16:22:36 +0000 Subject: [PATCH] LUCENE-6538: improve per-segment diagnostics for IBM's J9 JVM git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1685121 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 3 +++ lucene/core/src/java/org/apache/lucene/index/IndexWriter.java | 4 ++++ .../core/src/test/org/apache/lucene/index/TestCheckIndex.java | 3 +++ 3 files changed, 10 insertions(+) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 6b8c7bc0efe..2eec4cb7d85 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -137,6 +137,9 @@ Changes in Runtime Behavior spans that were previously discarded in preference to shorter overlapping ones. (Alan Woodward, Adrien Grand, Paul Elschot) +* LUCENE-6538: Also include java.vm.version and java.runtime.version + in per-segment diagnostics (Robert Muir, Mike McCandless) + Build * LUCENE-6518: Don't report false thread leaks from IBM J9 diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java index 7c7fe7c86bf..c9617a8d37e 100644 --- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java +++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java @@ -3778,6 +3778,10 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable { diagnostics.put("os.version", Constants.OS_VERSION); diagnostics.put("java.version", Constants.JAVA_VERSION); diagnostics.put("java.vendor", Constants.JAVA_VENDOR); + // On IBM J9 JVM this is better than java.version which is just 1.7.0 (no update level): + diagnostics.put("java.runtime.version", System.getProperty("java.runtime.version", "undefined")); + // Hotspot version, e.g. 2.8 for J9: + diagnostics.put("java.vm.version", System.getProperty("java.vm.version", "undefined")); diagnostics.put("timestamp", Long.toString(new Date().getTime())); if (details != null) { diagnostics.putAll(details); diff --git a/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java b/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java index 0a2c6497c4b..5d201ded633 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java @@ -93,6 +93,9 @@ public class TestCheckIndex extends LuceneTestCase { assertEquals(18, seg.termVectorStatus.docCount); assertEquals(18, seg.termVectorStatus.totVectors); + assertNotNull(seg.diagnostics.get("java.vm.version")); + assertNotNull(seg.diagnostics.get("java.runtime.version")); + assertTrue(seg.diagnostics.size() > 0); final List onlySegments = new ArrayList<>(); onlySegments.add("_0");