Apache Solr open-source search software
LUCENE-3198: use MMapDir by default (in FSDir.open) on Linux, 64 bit JRE
Michael McCandless8170f598398f
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex c63c48811f8..d1b60b78479 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -482,6 +482,11 @@ Changes in runtime behavior* LUCENE-3146: IndexReader.setNorm throws IllegalStateException if the fielddoes not store norms. (Shai Erera, Mike McCandless)++* LUCENE-3198: On Linux, if the JRE is 64 bit and supports unmapping,+ FSDirectory.open now defaults to MMapDirectory instead of+ NIOFSDirectory since MMapDirectory gives better performance. (Mike+ McCandless)* LUCENE-3200: MMapDirectory now uses chunk sizes that are powers of 2.When setting the chunk size, it is rounded down to the next possiblediff --git a/lucene/src/java/org/apache/lucene/store/FSDirectory.java b/lucene/src/java/org/apache/lucene/store/FSDirectory.javaindex b8309f95752..64989542da2 100644--- a/lucene/src/java/org/apache/lucene/store/FSDirectory.java+++ b/lucene/src/java/org/apache/lucene/store/FSDirectory.java@@ -173,7 +173,7 @@ public abstract class FSDirectory extends Directory {/** Just like {@link #open(File)}, but allows you to* also specify a custom {@link LockFactory}. */public static FSDirectory open(File path, LockFactory lockFactory) throws IOException {- if ((Constants.WINDOWS || Constants.SUN_OS)+ if ((Constants.WINDOWS || Constants.SUN_OS || Constants.LINUX)&& Constants.JRE_IS_64BIT && MMapDirectory.UNMAP_SUPPORTED) {return new MMapDirectory(path, lockFactory);} else if (Constants.WINDOWS) {