Skip to content

Commit e2f3693

Browse files
committed
Specify buffer size
1 parent 9294c04 commit e2f3693

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

server/src/main/java/org/elasticsearch/index/codec/vectors/es818/DirectIODirectory.java renamed to server/src/main/java/org/elasticsearch/index/codec/vectors/es818/DirectIOIndexInputSupplier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
* A hook for {@link ES818FlatVectorsReader} to specify the input should be opened using DirectIO.
1919
* Remove when IOContext allows more extensible payloads to be specified.
2020
*/
21-
public interface DirectIODirectory {
21+
public interface DirectIOIndexInputSupplier {
2222
IndexInput openInputDirect(String name, IOContext context) throws IOException;
2323
}

server/src/main/java/org/elasticsearch/index/codec/vectors/es818/ES818FlatVectorsReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private static IndexInput openDataInput(
119119
IOContext context
120120
) throws IOException {
121121
String fileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, fileExtension);
122-
IndexInput in = state.directory instanceof DirectIODirectory did
122+
IndexInput in = state.directory instanceof DirectIOIndexInputSupplier did
123123
? did.openInputDirect(fileName, context)
124124
: state.directory.openInput(fileName, context);
125125
boolean success = false;

server/src/main/java/org/elasticsearch/index/store/FsDirectoryFactory.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.index.store;
1111

12+
import org.apache.lucene.misc.store.DirectIODirectory;
1213
import org.apache.lucene.store.Directory;
1314
import org.apache.lucene.store.FSDirectory;
1415
import org.apache.lucene.store.FileSwitchDirectory;
@@ -25,7 +26,7 @@
2526
import org.elasticsearch.core.IOUtils;
2627
import org.elasticsearch.index.IndexModule;
2728
import org.elasticsearch.index.IndexSettings;
28-
import org.elasticsearch.index.codec.vectors.es818.DirectIODirectory;
29+
import org.elasticsearch.index.codec.vectors.es818.DirectIOIndexInputSupplier;
2930
import org.elasticsearch.index.shard.ShardPath;
3031
import org.elasticsearch.logging.LogManager;
3132
import org.elasticsearch.logging.Logger;
@@ -115,17 +116,17 @@ public static boolean isHybridFs(Directory directory) {
115116
return unwrap instanceof HybridDirectory;
116117
}
117118

118-
static final class HybridDirectory extends NIOFSDirectory implements DirectIODirectory {
119+
static final class HybridDirectory extends NIOFSDirectory implements DirectIOIndexInputSupplier {
119120
private final MMapDirectory delegate;
120-
private final org.apache.lucene.misc.store.DirectIODirectory directIODelegate;
121+
private final DirectIODirectory directIODelegate;
121122

122123
HybridDirectory(LockFactory lockFactory, MMapDirectory delegate) throws IOException {
123124
super(delegate.getDirectory(), lockFactory);
124125
this.delegate = delegate;
125126

126-
org.apache.lucene.misc.store.DirectIODirectory directIO;
127+
DirectIODirectory directIO;
127128
try {
128-
directIO = new org.apache.lucene.misc.store.DirectIODirectory(delegate) {
129+
directIO = new DirectIODirectory(delegate, 8192, DirectIODirectory.DEFAULT_MIN_BYTES_DIRECT) {
129130
@Override
130131
protected boolean useDirectIO(String name, IOContext context, OptionalLong fileLength) {
131132
return true;

0 commit comments

Comments
 (0)