Fix startup
This commit is contained in:
parent
200d7b5eb1
commit
8ff3381c72
@ -614,7 +614,14 @@ public class LuceneUtils {
|
|||||||
return Math.abs(StringHelper.murmurhash3_x86_32(id.getValueBytesRef(), 7) % totalShards);
|
return Math.abs(StringHelper.murmurhash3_x86_32(id.getValueBytesRef(), 7) % totalShards);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Directory createLuceneDirectory(LuceneDirectoryOptions directoryOptions,
|
public static CheckOutputDirectory createLuceneDirectory(LuceneDirectoryOptions directoryOptions,
|
||||||
|
String directoryName,
|
||||||
|
LuceneRocksDBManager rocksDBManager)
|
||||||
|
throws IOException {
|
||||||
|
return new CheckOutputDirectory(createLuceneDirectoryInternal(directoryOptions, directoryName, rocksDBManager));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Directory createLuceneDirectoryInternal(LuceneDirectoryOptions directoryOptions,
|
||||||
String directoryName,
|
String directoryName,
|
||||||
LuceneRocksDBManager rocksDBManager)
|
LuceneRocksDBManager rocksDBManager)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
@ -622,7 +629,7 @@ public class LuceneUtils {
|
|||||||
if (directoryOptions instanceof ByteBuffersDirectory) {
|
if (directoryOptions instanceof ByteBuffersDirectory) {
|
||||||
directory = new org.apache.lucene.store.ByteBuffersDirectory();
|
directory = new org.apache.lucene.store.ByteBuffersDirectory();
|
||||||
} else if (directoryOptions instanceof DirectIOFSDirectory directIOFSDirectory) {
|
} else if (directoryOptions instanceof DirectIOFSDirectory directIOFSDirectory) {
|
||||||
FSDirectory delegateDirectory = (FSDirectory) createLuceneDirectory(directIOFSDirectory.delegate(),
|
FSDirectory delegateDirectory = (FSDirectory) createLuceneDirectoryInternal(directIOFSDirectory.delegate(),
|
||||||
directoryName,
|
directoryName,
|
||||||
rocksDBManager
|
rocksDBManager
|
||||||
);
|
);
|
||||||
@ -648,7 +655,7 @@ public class LuceneUtils {
|
|||||||
} else if (directoryOptions instanceof RAFFSDirectory rafFsDirectory) {
|
} else if (directoryOptions instanceof RAFFSDirectory rafFsDirectory) {
|
||||||
directory = new RAFDirectory(rafFsDirectory.managedPath().resolve(directoryName + ".lucene.db"));
|
directory = new RAFDirectory(rafFsDirectory.managedPath().resolve(directoryName + ".lucene.db"));
|
||||||
} else if (directoryOptions instanceof NRTCachingDirectory nrtCachingDirectory) {
|
} else if (directoryOptions instanceof NRTCachingDirectory nrtCachingDirectory) {
|
||||||
var delegateDirectory = createLuceneDirectory(nrtCachingDirectory.delegate(), directoryName, rocksDBManager);
|
var delegateDirectory = createLuceneDirectoryInternal(nrtCachingDirectory.delegate(), directoryName, rocksDBManager);
|
||||||
directory = new org.apache.lucene.store.NRTCachingDirectory(delegateDirectory,
|
directory = new org.apache.lucene.store.NRTCachingDirectory(delegateDirectory,
|
||||||
toMB(nrtCachingDirectory.maxMergeSizeBytes()),
|
toMB(nrtCachingDirectory.maxMergeSizeBytes()),
|
||||||
toMB(nrtCachingDirectory.maxCachedBytes())
|
toMB(nrtCachingDirectory.maxCachedBytes())
|
||||||
@ -672,7 +679,7 @@ public class LuceneUtils {
|
|||||||
} else {
|
} else {
|
||||||
throw new UnsupportedOperationException("Unsupported directory: " + directoryName + ", " + directoryOptions);
|
throw new UnsupportedOperationException("Unsupported directory: " + directoryName + ", " + directoryOptions);
|
||||||
}
|
}
|
||||||
return new CheckOutputDirectory(directory);
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Optional<Path> getManagedPath(LuceneDirectoryOptions directoryOptions) {
|
public static Optional<Path> getManagedPath(LuceneDirectoryOptions directoryOptions) {
|
||||||
|
Loading…
Reference in New Issue
Block a user