mirror of
https://github.com/apache/lucene.git
synced 2025-03-07 00:39:21 +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 MatchingDocs hits;
|
||||||
final OrdinalMap ordinalMap;
|
final OrdinalMap ordinalMap;
|
||||||
final int segOrd;
|
final int segOrd;
|
||||||
final Bits liveDocs;
|
|
||||||
|
|
||||||
public CountOneSegment(
|
public CountOneSegment(
|
||||||
LeafReader leafReader, MatchingDocs hits, OrdinalMap ordinalMap, int segOrd) {
|
LeafReader leafReader, MatchingDocs hits, OrdinalMap ordinalMap, int segOrd) {
|
||||||
@ -170,7 +169,6 @@ public class ConcurrentSortedSetDocValuesFacetCounts extends Facets {
|
|||||||
this.hits = hits;
|
this.hits = hits;
|
||||||
this.ordinalMap = ordinalMap;
|
this.ordinalMap = ordinalMap;
|
||||||
this.segOrd = segOrd;
|
this.segOrd = segOrd;
|
||||||
this.liveDocs = leafReader.getLiveDocs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -198,6 +196,10 @@ public class ConcurrentSortedSetDocValuesFacetCounts extends Facets {
|
|||||||
DocIdSetIterator it;
|
DocIdSetIterator it;
|
||||||
if (hits == null) {
|
if (hits == null) {
|
||||||
// count all
|
// 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;
|
it = (liveDocs != null) ? FacetUtils.liveDocsDISI(valuesIt, liveDocs) : valuesIt;
|
||||||
} else {
|
} else {
|
||||||
it = ConjunctionUtils.intersectIterators(Arrays.asList(hits.bits.iterator(), valuesIt));
|
it = ConjunctionUtils.intersectIterators(Arrays.asList(hits.bits.iterator(), valuesIt));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user