You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gs...@apache.org on 2021/10/04 22:36:11 UTC

[lucene-solr] branch branch_8x updated: LUCENE-10134: ConcurrentSortedSetDocValuesFacetCounts shouldn't share liveDocs Bits across threads (#2587)

This is an automated email from the ASF dual-hosted git repository.

gsmiller pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 2d2e717  LUCENE-10134: ConcurrentSortedSetDocValuesFacetCounts shouldn't share liveDocs Bits across threads (#2587)
2d2e717 is described below

commit 2d2e7179bc8e3e68de15096f9fa7d23c90bfa6f8
Author: Greg Miller <gs...@gmail.com>
AuthorDate: Mon Oct 4 15:35:52 2021 -0700

    LUCENE-10134: ConcurrentSortedSetDocValuesFacetCounts shouldn't share liveDocs Bits across threads (#2587)
---
 lucene/CHANGES.txt                                                  | 3 +++
 .../facet/sortedset/ConcurrentSortedSetDocValuesFacetCounts.java    | 6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 0b94f83..12392f0 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -37,6 +37,9 @@ Bug Fixes
 
 * LUCENE-10070 Skip deleted docs when accumulating facet counts for all docs. (Ankur Goel, Greg Miller)
 
+* LUCENE-10134: ConcurrentSortedSetDocValuesFacetCounts shouldn't share liveDocs Bits across threads.
+  (Ankur Goel)
+
 * LUCENE-10126: Sort optimization with a chunked bulk scorer
   can wrongly skip documents (Nhat Nguyen, Mayya Sharipova)
 
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/sortedset/ConcurrentSortedSetDocValuesFacetCounts.java b/lucene/facet/src/java/org/apache/lucene/facet/sortedset/ConcurrentSortedSetDocValuesFacetCounts.java
index 0745797..9c773a5 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/sortedset/ConcurrentSortedSetDocValuesFacetCounts.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/sortedset/ConcurrentSortedSetDocValuesFacetCounts.java
@@ -159,7 +159,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) {
       assert leafReader != null;
@@ -167,7 +166,6 @@ public class ConcurrentSortedSetDocValuesFacetCounts extends Facets {
       this.hits = hits;
       this.ordinalMap = ordinalMap;
       this.segOrd = segOrd;
-      this.liveDocs = leafReader.getLiveDocs();
     }
                            
     @Override
@@ -195,6 +193,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 = ConjunctionDISI.intersectIterators(Arrays.asList(hits.bits.iterator(), valuesIt));