Skip to content

Commit

Permalink
Fix assertion in ContextIndexSearcherTests (elastic#101366)
Browse files Browse the repository at this point in the history
If the random index writer commits before we run deletes, then it's possible
that a query bitset will match all documents in a segment, and so will be realised
as a MatchAllBitSet implementation. This commit adds checking for this
scenario to doTestContextIndexSearcher.

Fixes elastic#94615
  • Loading branch information
romseygeek authored Oct 26, 2023
1 parent 3e2f17f commit d52f74f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import org.elasticsearch.index.cache.bitset.BitsetFilterCache;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.lucene.util.CombinedBitSet;
import org.elasticsearch.lucene.util.MatchAllBitSet;
import org.elasticsearch.search.aggregations.BucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.test.ESTestCase;
Expand All @@ -96,6 +97,7 @@
import static org.elasticsearch.search.internal.ExitableDirectoryReader.ExitableLeafReader;
import static org.elasticsearch.search.internal.ExitableDirectoryReader.ExitablePointValues;
import static org.elasticsearch.search.internal.ExitableDirectoryReader.ExitableTerms;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.instanceOf;
Expand Down Expand Up @@ -279,7 +281,6 @@ public void testContextIndexSearcherSparseWithDeletions() throws IOException {
doTestContextIndexSearcher(true, true);
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/94615")
public void testContextIndexSearcherDenseWithDeletions() throws IOException {
doTestContextIndexSearcher(false, true);
}
Expand Down Expand Up @@ -332,7 +333,7 @@ public void onRemoval(ShardId shardId, Accountable accountable) {
if (sparse) {
assertThat(bitSet, instanceOf(SparseFixedBitSet.class));
} else {
assertThat(bitSet, instanceOf(FixedBitSet.class));
assertThat(bitSet, anyOf(instanceOf(FixedBitSet.class), instanceOf(MatchAllBitSet.class)));
}

DocumentSubsetDirectoryReader filteredReader = new DocumentSubsetDirectoryReader(reader, cache, roleQuery);
Expand Down

0 comments on commit d52f74f

Please sign in to comment.