Skip to content

Commit 50beb8c

Browse files
committed
Check the version, not the directIO value
1 parent 450a8a6 commit 50beb8c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/org/elasticsearch/index/codec/vectors/diskbbq/IVFVectorsWriter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public abstract class IVFVectorsWriter extends KnnVectorsWriter {
5353
private final IndexOutput ivfCentroids, ivfClusters;
5454
private final IndexOutput ivfMeta;
5555
private final String rawVectorFormatName;
56+
private final int writeVersion;
5657
private final Boolean useDirectIOReads;
5758
private final FlatVectorsWriter rawVectorDelegate;
5859

@@ -70,6 +71,7 @@ protected IVFVectorsWriter(
7071
);
7172

7273
this.rawVectorFormatName = rawVectorFormatName;
74+
this.writeVersion = writeVersion;
7375
this.useDirectIOReads = useDirectIOReads;
7476
this.rawVectorDelegate = rawVectorDelegate;
7577
final String metaFileName = IndexFileNames.segmentFileName(
@@ -509,7 +511,7 @@ private void writeMeta(
509511
) throws IOException {
510512
ivfMeta.writeInt(field.number);
511513
ivfMeta.writeString(rawVectorFormatName);
512-
if (useDirectIOReads != null) {
514+
if (writeVersion >= ES920DiskBBQVectorsFormat.VERSION_DIRECT_IO) {
513515
ivfMeta.writeByte(useDirectIOReads ? (byte) 1 : 0);
514516
}
515517
ivfMeta.writeInt(field.getVectorEncoding().ordinal());

0 commit comments

Comments
 (0)