mirror of https://github.com/apache/lucene.git
SOLR-10158: Add support for "preload" option in MMapDirectoryFactory
This commit is contained in:
parent
6f3f6a2d66
commit
ea37b9ae87
|
@ -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
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue