mirror of
https://github.com/apache/lucene.git
synced 2025-03-06 16:29:30 +00:00
LUCENE-10134: Move initialization of liveDocs bits outside the constructor to avoid AssertionError (#345)
Co-authored-by: Ankur Goel <goankur@amazon.com>
This commit is contained in:
parent
4c97b9e3f2
commit
cb366d04d4
@ -161,7 +161,6 @@ public class ConcurrentSortedSetDocValuesFacetCounts extends Facets {
|
||||
final MatchingDocs hits;
|
||||
final OrdinalMap ordinalMap;
|
||||
final int segOrd;
|
||||
final Bits liveDocs;
|
||||
|
||||
public CountOneSegment(
|
||||
LeafReader leafReader, MatchingDocs hits, OrdinalMap ordinalMap, int segOrd) {
|
||||
@ -170,7 +169,6 @@ public class ConcurrentSortedSetDocValuesFacetCounts extends Facets {
|
||||
this.hits = hits;
|
||||
this.ordinalMap = ordinalMap;
|
||||
this.segOrd = segOrd;
|
||||
this.liveDocs = leafReader.getLiveDocs();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -198,6 +196,10 @@ public class ConcurrentSortedSetDocValuesFacetCounts extends Facets {
|
||||
DocIdSetIterator it;
|
||||
if (hits == null) {
|
||||
// count all
|
||||
// Initializing liveDocs bits in the constructor leads to a situation where liveDocs bits
|
||||
// get initialized in the calling thread but get used in a different thread leading to an
|
||||
// AssertionError. See LUCENE-10134
|
||||
final Bits liveDocs = leafReader.getLiveDocs();
|
||||
it = (liveDocs != null) ? FacetUtils.liveDocsDISI(valuesIt, liveDocs) : valuesIt;
|
||||
} else {
|
||||
it = ConjunctionUtils.intersectIterators(Arrays.asList(hits.bits.iterator(), valuesIt));
|
||||
|
Loading…
x
Reference in New Issue
Block a user