Skip to content

Commit

Permalink
fix frozen engine stats
Browse files Browse the repository at this point in the history
  • Loading branch information
jimczi committed Aug 9, 2024
1 parent a2b9e78 commit 61903dc
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public final class FrozenEngine extends ReadOnlyEngine {
);
private final SegmentsStats segmentsStats;
private final DocsStats docsStats;
private final DenseVectorStats denseVectorStats;
private final SparseVectorStats sparseVectorStats;
private volatile ElasticsearchDirectoryReader lastOpenedReader;
private final ElasticsearchDirectoryReader canMatchReader;
private final Object cacheIdentity = new Object();
Expand Down Expand Up @@ -95,8 +93,6 @@ public FrozenEngine(
fillSegmentStats(segmentReader, true, segmentsStats);
}
this.docsStats = docsStats(reader);
this.denseVectorStats = denseVectorStats(reader, null);
this.sparseVectorStats = sparseVectorStats(reader, null);
canMatchReader = ElasticsearchDirectoryReader.wrap(
new RewriteCachingDirectoryReader(directory, reader.leaves(), null),
config.getShardId()
Expand Down Expand Up @@ -335,12 +331,16 @@ public DocsStats docStats() {

@Override
public DenseVectorStats denseVectorStats(MappingLookup mappingLookup) {
return denseVectorStats;
// We could cache the result on first call but dense vectors on frozen tier
// are very unlikely, so we just don't count them in the stats.
return new DenseVectorStats(0);
}

@Override
public SparseVectorStats sparseVectorStats(MappingLookup mappingLookup) {
return sparseVectorStats;
// We could cache the result on first call but sparse vectors on frozen tier
// are very unlikely, so we just don't count them in the stats.
return new SparseVectorStats(0);
}

synchronized boolean isReaderOpen() {
Expand Down

0 comments on commit 61903dc

Please sign in to comment.