LUCENE-6069: Lucene Core now gets compiled with Java 8 "compact1" profile, all other modules with "compact2".

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1659347 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2015-02-12 18:19:38 +00:00
parent 08bc225ad8
commit 0f7b913b07
6 changed files with 14 additions and 72 deletions

View File

@ -10,6 +10,9 @@ System Requirements
* LUCENE-5950: Move to Java 8 as minimum Java version. * LUCENE-5950: Move to Java 8 as minimum Java version.
(Ryan Ernst, Uwe Schindler) (Ryan Ernst, Uwe Schindler)
* LUCENE-6069: Lucene Core now gets compiled with Java 8 "compact1" profile,
all other modules with "compact2". (Robert Muir, Uwe Schindler)
New Features New Features
* LUCENE-5735: NumberRangePrefixTreeStrategy now includes interval/range faceting * LUCENE-5735: NumberRangePrefixTreeStrategy now includes interval/range faceting

View File

@ -165,6 +165,7 @@
<property name="javac.source" value="1.8"/> <property name="javac.source" value="1.8"/>
<property name="javac.target" value="1.8"/> <property name="javac.target" value="1.8"/>
<property name="javac.args" value="-Xlint -Xlint:-deprecation -Xlint:-serial -Xlint:-options"/> <property name="javac.args" value="-Xlint -Xlint:-deprecation -Xlint:-serial -Xlint:-options"/>
<property name="javac.profile.args" value="-profile compact2"/>
<property name="javadoc.link" value="http://download.oracle.com/javase/8/docs/api/"/> <property name="javadoc.link" value="http://download.oracle.com/javase/8/docs/api/"/>
<property name="javadoc.link.junit" value="http://junit.sourceforge.net/javadoc/"/> <property name="javadoc.link.junit" value="http://junit.sourceforge.net/javadoc/"/>
<property name="javadoc.packagelist.dir" location="${common.dir}/tools/javadoc"/> <property name="javadoc.packagelist.dir" location="${common.dir}/tools/javadoc"/>
@ -1861,8 +1862,8 @@ ${ant.project.name}.test.dependencies=${test.classpath.list}
<nested/> <nested/>
<!-- <compilerarg line="-Xmaxwarns 10000000"/> <!-- <compilerarg line="-Xmaxwarns 10000000"/>
<compilerarg line="-Xmaxerrs 10000000"/> --> <compilerarg line="-Xmaxerrs 10000000"/> -->
<!-- for generics in Java 1.5: -->
<compilerarg line="${javac.args}"/> <compilerarg line="${javac.args}"/>
<compilerarg line="${javac.profile.args}"/>
<compilerarg line="${javac.doclint.args}"/> <compilerarg line="${javac.doclint.args}"/>
</javac> </javac>
</sequential> </sequential>

View File

@ -35,6 +35,8 @@
org/apache/lucene/index/TestIndexWriterOnJRECrash.class org/apache/lucene/index/TestIndexWriterOnJRECrash.class
"/> "/>
<!-- lucene core can use the minimal JDK profile -->
<property name="javac.profile.args" value="-profile compact1"/>
<import file="../common-build.xml"/> <import file="../common-build.xml"/>
<property name="moman.commit-hash" value="5c5c2a1e4dea" /> <property name="moman.commit-hash" value="5c5c2a1e4dea" />

View File

@ -17,17 +17,7 @@ package org.apache.lucene.util;
* limitations under the License. * limitations under the License.
*/ */
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryUsage;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import org.junit.Ignore;
/** /**
* Estimates how {@link RamUsageEstimator} estimates physical memory consumption * Estimates how {@link RamUsageEstimator} estimates physical memory consumption
@ -47,45 +37,19 @@ public class StressRamUsageEstimator extends LuceneTestCase {
} }
} }
// This shows an easy stack overflow because we're counting recursively.
@Ignore
public void testChainedEstimation() {
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
Random rnd = random();
Entry first = new Entry();
try {
while (true) {
// Check the current memory consumption and provide the estimate.
long jvmUsed = memoryMXBean.getHeapMemoryUsage().getUsed();
long estimated = RamUsageTester.sizeOf(first);
System.out.println(String.format(Locale.ROOT, "%10d, %10d",
jvmUsed, estimated));
// Make a batch of objects.
for (int i = 0; i < 5000; i++) {
first.createNext(new byte[rnd.nextInt(1024)]);
}
}
} catch (OutOfMemoryError e) {
// Release and quit.
}
}
volatile Object guard; volatile Object guard;
// This shows an easy stack overflow because we're counting recursively. // This shows an easy stack overflow because we're counting recursively.
public void testLargeSetOfByteArrays() { public void testLargeSetOfByteArrays() {
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
causeGc(); System.gc();
long before = memoryMXBean.getHeapMemoryUsage().getUsed(); long before = Runtime.getRuntime().totalMemory();
Object [] all = new Object [1000000]; Object [] all = new Object [1000000];
for (int i = 0; i < all.length; i++) { for (int i = 0; i < all.length; i++) {
all[i] = new byte[random().nextInt(3)]; all[i] = new byte[random().nextInt(3)];
} }
causeGc(); System.gc();
long after = memoryMXBean.getHeapMemoryUsage().getUsed(); long after = Runtime.getRuntime().totalMemory();
System.out.println("mx: " + RamUsageEstimator.humanReadableUnits(after - before)); System.out.println("mx: " + RamUsageEstimator.humanReadableUnits(after - before));
System.out.println("rue: " + RamUsageEstimator.humanReadableUnits(shallowSizeOf(all))); System.out.println("rue: " + RamUsageEstimator.humanReadableUnits(shallowSizeOf(all)));
@ -112,24 +76,16 @@ public class StressRamUsageEstimator extends LuceneTestCase {
} }
public void testSimpleByteArrays() { public void testSimpleByteArrays() {
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
Object [][] all = new Object [0][]; Object [][] all = new Object [0][];
try { try {
while (true) { while (true) {
// Check the current memory consumption and provide the estimate. // Check the current memory consumption and provide the estimate.
causeGc(); System.gc();
MemoryUsage mu = memoryMXBean.getHeapMemoryUsage();
long estimated = shallowSizeOf(all); long estimated = shallowSizeOf(all);
if (estimated > 50 * RamUsageEstimator.ONE_MB) { if (estimated > 50 * RamUsageEstimator.ONE_MB) {
break; break;
} }
System.out.println(String.format(Locale.ROOT, "%10s\t%10s\t%10s",
RamUsageEstimator.humanReadableUnits(mu.getUsed()),
RamUsageEstimator.humanReadableUnits(mu.getMax()),
RamUsageEstimator.humanReadableUnits(estimated)));
// Make another batch of objects. // Make another batch of objects.
Object[] seg = new Object[10000]; Object[] seg = new Object[10000];
all = Arrays.copyOf(all, all.length + 1); all = Arrays.copyOf(all, all.length + 1);
@ -142,24 +98,4 @@ public class StressRamUsageEstimator extends LuceneTestCase {
// Release and quit. // Release and quit.
} }
} }
/**
* Very hacky, very crude, but (sometimes) works.
* Don't look, it will burn your eyes out.
*/
private void causeGc() {
List<GarbageCollectorMXBean> garbageCollectorMXBeans = ManagementFactory.getGarbageCollectorMXBeans();
List<Long> ccounts = new ArrayList<>();
for (GarbageCollectorMXBean g : garbageCollectorMXBeans) {
ccounts.add(g.getCollectionCount());
}
List<Long> ccounts2 = new ArrayList<>();
do {
System.gc();
ccounts.clear();
for (GarbageCollectorMXBean g : garbageCollectorMXBeans) {
ccounts2.add(g.getCollectionCount());
}
} while (ccounts2.equals(ccounts));
}
} }

View File

@ -17,14 +17,13 @@ package org.apache.lucene.queryparser.flexible.spans;
* limitations under the License. * limitations under the License.
*/ */
import javax.management.Query;
import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler; import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler;
import org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode; import org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode;
import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode; import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;
import org.apache.lucene.queryparser.flexible.core.parser.SyntaxParser; import org.apache.lucene.queryparser.flexible.core.parser.SyntaxParser;
import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorPipeline; import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorPipeline;
import org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser; import org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.spans.SpanQuery; import org.apache.lucene.search.spans.SpanQuery;
import org.apache.lucene.search.spans.SpanTermQuery; import org.apache.lucene.search.spans.SpanTermQuery;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;

View File

@ -29,6 +29,7 @@
<property name="javac.source" value="1.8"/> <property name="javac.source" value="1.8"/>
<property name="javac.target" value="1.8"/> <property name="javac.target" value="1.8"/>
<property name="javac.args" value=""/> <property name="javac.args" value=""/>
<property name="javac.profile.args" value=""/>
<property name="dest" location="${common-solr.dir}/build" /> <property name="dest" location="${common-solr.dir}/build" />
<property name="build.dir" location="${dest}/${ant.project.name}"/> <property name="build.dir" location="${dest}/${ant.project.name}"/>