diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 9e282f8f673..5e184b6438e 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -108,6 +108,14 @@ Changes in backwards compatibility policy * LUCENE-2600: Remove IndexReader.isDeleted in favor of IndexReader.getDeletedDocs(). (Mike McCandless) +Changes in Runtime Behavior + +* LUCENE-2650: The behavior of FSDirectory.open has changed. On 64-bit + Windows systems that support unmapping, FSDirectory.open returns + MMapDirectory. Additionally the behavior of MMapDirectory has been + changed to enable unmapping by default if supported by the JRE. + (Mike McCandless, Uwe Schindler, Robert Muir) + API Changes * LUCENE-2302, LUCENE-1458, LUCENE-2111, LUCENE-2514: Terms are no longer diff --git a/lucene/src/java/org/apache/lucene/store/FSDirectory.java b/lucene/src/java/org/apache/lucene/store/FSDirectory.java index 62c399028ba..07774cd8f87 100644 --- a/lucene/src/java/org/apache/lucene/store/FSDirectory.java +++ b/lucene/src/java/org/apache/lucene/store/FSDirectory.java @@ -183,8 +183,9 @@ public abstract class FSDirectory extends Directory { * The directory returned uses the {@link NativeFSLockFactory}. * *
Currently this returns {@link NIOFSDirectory} - * on non-Windows JREs and {@link SimpleFSDirectory} - * on Windows. It is highly recommended that you consult the + * on non-Windows JREs, {@link MMapDirectory} on 64-bit + * Sun Windows JREs, and {@link SimpleFSDirectory} for other + * JRes on Windows. It is highly recommended that you consult the * implementation's documentation for your platform before * using this method. * @@ -193,11 +194,8 @@ public abstract class FSDirectory extends Directory { * the event that higher performance defaults become * possible; if the precise implementation is important to * your application, please instantiate it directly, - * instead. On 64 bit systems, it may also good to - * return {@link MMapDirectory}, but this is disabled - * because of officially missing unmap support in Java. - * For optimal performance you should consider using - * this implementation on 64 bit JVMs. + * instead. For optimal performance you should consider using + * {@link MMapDirectory} on 64 bit JVMs. * *
See above */ public static FSDirectory open(File path) throws IOException { @@ -208,7 +206,10 @@ public abstract class FSDirectory extends Directory { * also specify a custom {@link LockFactory}. */ public static FSDirectory open(File path, LockFactory lockFactory) throws IOException { if (Constants.WINDOWS) { - return new SimpleFSDirectory(path, lockFactory); + if (MMapDirectory.UNMAP_SUPPORTED && Constants.JRE_IS_64BIT) + return new MMapDirectory(path, lockFactory); + else + return new SimpleFSDirectory(path, lockFactory); } else { return new NIOFSDirectory(path, lockFactory); } diff --git a/lucene/src/java/org/apache/lucene/store/MMapDirectory.java b/lucene/src/java/org/apache/lucene/store/MMapDirectory.java index 596ffd539b0..4e25766ac41 100644 --- a/lucene/src/java/org/apache/lucene/store/MMapDirectory.java +++ b/lucene/src/java/org/apache/lucene/store/MMapDirectory.java @@ -64,7 +64,7 @@ import org.apache.lucene.util.Constants; * an important limitation to be aware of. * *
This class supplies the workaround mentioned in the bug report
- * (disabled by default, see {@link #setUseUnmap}), which may fail on
+ * (see {@link #setUseUnmap}), which may fail on
* non-Sun JVMs. It forcefully unmaps the buffer on close by using
* an undocumented internal cleanup functionality.
* {@link #UNMAP_SUPPORTED} is true
, if the workaround
@@ -78,7 +78,7 @@ import org.apache.lucene.util.Constants;
*