You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2017/02/25 20:15:24 UTC

lucene-solr:master: SOLR-10158: Add support for "preload" option in MMapDirectoryFactory

Repository: lucene-solr
Updated Branches:
  refs/heads/master 6f3f6a2d6 -> ea37b9ae8


SOLR-10158: Add support for "preload" option in MMapDirectoryFactory


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ea37b9ae
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ea37b9ae
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ea37b9ae

Branch: refs/heads/master
Commit: ea37b9ae870257c943bdc8c2896f1238a4dc94b6
Parents: 6f3f6a2
Author: Uwe Schindler <us...@apache.org>
Authored: Sat Feb 25 21:15:09 2017 +0100
Committer: Uwe Schindler <us...@apache.org>
Committed: Sat Feb 25 21:15:09 2017 +0100

----------------------------------------------------------------------
 solr/CHANGES.txt                                                 | 3 +++
 .../core/src/java/org/apache/solr/core/MMapDirectoryFactory.java | 4 ++++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ea37b9ae/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2b0044c..e06603c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -134,6 +134,9 @@ New Features
   field must both be stored=false, indexed=false, docValues=true. (Ishan Chattopadhyaya, hossman, noble,
   shalin, yonik)
 
+* SOLR-10158: Add support for "preload" option in MMapDirectoryFactory.
+  (Amrit Sarkar via Uwe Schindler)
+
 Bug Fixes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ea37b9ae/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
index c68ae62..e9fbce7 100644
--- a/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/MMapDirectoryFactory.java
@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
  * Can set the following parameters:
  * <ul>
  *  <li>unmap -- See {@link MMapDirectory#setUseUnmap(boolean)}</li>
+ *  <li>preload -- See {@link MMapDirectory#setPreload(boolean)}</li>
  *  <li>maxChunkSize -- The Max chunk size.  See {@link MMapDirectory#MMapDirectory(Path, LockFactory, int)}</li>
  * </ul>
  *
@@ -42,6 +43,7 @@ import org.slf4j.LoggerFactory;
 public class MMapDirectoryFactory extends StandardDirectoryFactory {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   boolean unmapHack;
+  boolean preload;
   private int maxChunk;
 
   @Override
@@ -53,6 +55,7 @@ public class MMapDirectoryFactory extends StandardDirectoryFactory {
       throw new IllegalArgumentException("maxChunk must be greater than 0");
     }
     unmapHack = params.getBool("unmap", true);
+    preload = params.getBool("preload", false); //default turn-off
   }
 
   @Override
@@ -64,6 +67,7 @@ public class MMapDirectoryFactory extends StandardDirectoryFactory {
     } catch (IllegalArgumentException e) {
       log.warn("Unmap not supported on this JVM, continuing on without setting unmap", e);
     }
+    mapDirectory.setPreload(preload);
     return mapDirectory;
   }