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

This commit is contained in:
Uwe Schindler 2017-02-25 21:15:09 +01:00
parent 6f3f6a2d66
commit ea37b9ae87
2 changed files with 7 additions and 0 deletions

View File

@ -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
----------------------

View File

@ -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;
}