fix seen readers counter
since clear can be called on percolator as well, we need to make sure we inc the counter even for non segment readers
This commit is contained in:
parent
31d1e6cfe7
commit
10a76ad5d8
|
@ -162,9 +162,12 @@ public class WeightedFilterCache extends AbstractIndexComponent implements Filte
|
|||
if (cacheValue == null) {
|
||||
if (!cache.seenReaders.containsKey(context.reader().getCoreCacheKey())) {
|
||||
Boolean previous = cache.seenReaders.putIfAbsent(context.reader().getCoreCacheKey(), Boolean.TRUE);
|
||||
if (previous == null && (context.reader() instanceof SegmentReader)) {
|
||||
((SegmentReader) context.reader()).addCoreClosedListener(cache);
|
||||
if (previous == null) {
|
||||
cache.seenReadersCount.inc();
|
||||
// we add a core closed listener only, for non core IndexReaders we rely on clear being called (percolator for example)
|
||||
if (context.reader() instanceof SegmentReader) {
|
||||
((SegmentReader) context.reader()).addCoreClosedListener(cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue