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:16:59 UTC

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

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x a4e08399c -> 68eb20c5d


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

# Conflicts:
#	solr/CHANGES.txt


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

Branch: refs/heads/branch_6x
Commit: 68eb20c5d0d026e6ce486b4fb09fa812ee738ca9
Parents: a4e0839
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:16:45 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/68eb20c5/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 87fe880..e389d11 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -78,6 +78,9 @@ New Features
   SOLR_HOME on every node. Editing config through API is supported but affects only that one node.
   This feature should be considered experimental for this release and may not work with SSL yet. (janhoy)
 
+* 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/68eb20c5/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;
   }