Skip to content

Commit e34cc11

Browse files
authored
[DiskBBQ] avoid EsAcceptDocs bug by calling cost before building iterator (elastic#138127)
1 parent 93410cf commit e34cc11

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ public CentroidIterator getCentroidIterator(
120120
float visitRatio
121121
) throws IOException {
122122
final FieldEntry fieldEntry = fields.get(fieldInfo.number);
123-
final float approximateDocsPerCentroid = approximateCost / numCentroids;
123+
float approximateDocsPerCentroid = approximateCost / numCentroids;
124+
if (approximateDocsPerCentroid <= 1.25) {
125+
// TODO: we need to make this call to build the iterator, otherwise accept docs breaks all together
126+
approximateDocsPerCentroid = acceptDocs.cost();
127+
}
124128
final int bitsRequired = DirectWriter.bitsRequired(numCentroids);
125129
final long sizeLookup = directWriterSizeOnDisk(values.size(), bitsRequired);
126130
final long fp = centroids.getFilePointer();

0 commit comments

Comments
 (0)