Skip to content

Commit d8df2e0

Browse files
authored
SOLR-17182: Remove solr.useExitableDirectoryReader property and always use EDR. (#3748)
1 parent 4bcdf2c commit d8df2e0

File tree

5 files changed

+17
-56
lines changed

5 files changed

+17
-56
lines changed

solr/CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ Deprecation Removals
189189

190190
* SOLR-17935: Remove deprecated NoOpResponseParser. (Eric Pugh, David Smiley)
191191

192+
* SOLR-17182: Remove `solr.useExitableDirectoryReader` property. (Andrzej Bialecki)
193+
192194
Dependency Upgrades
193195
---------------------
194196

@@ -266,6 +268,10 @@ Other Changes
266268

267269
* SOLR-17929: Remove obsolete overseer internal work queue. This queue was read-only since Solr 8. (Pierre Salagnac)
268270

271+
* SOLR-17182: Remove `solr.useExitableDirectoryReader` property. Using `ExitableDirectoryReader`
272+
apparently has negligible impact on search performance so it's used now for all queries regardless of
273+
their query limits params. (Andrzej Bialecki)
274+
269275
================== 9.10.0 ==================
270276
New Features
271277
---------------------

solr/benchmark/src/java/org/apache/solr/bench/search/ExitableDirectoryReaderSearch.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.apache.solr.common.SolrInputDocument;
3232
import org.apache.solr.common.params.ModifiableSolrParams;
3333
import org.apache.solr.search.CallerSpecificQueryLimit;
34-
import org.apache.solr.search.SolrIndexSearcher;
3534
import org.apache.solr.util.TestInjection;
3635
import org.openjdk.jmh.annotations.Benchmark;
3736
import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -109,9 +108,6 @@ public void setupTrial(MiniClusterState.MiniClusterBenchState miniClusterState)
109108
miniClusterState.dumpCoreInfo();
110109
}
111110

112-
@Param({"false", "true"})
113-
boolean useEDR;
114-
115111
// this adds significant processing time to the checking of query limits
116112
// both to verify that it's actually used and to illustrate the impact of limit checking
117113
@Param({"false", "true"})
@@ -121,7 +117,6 @@ public void setupTrial(MiniClusterState.MiniClusterBenchState miniClusterState)
121117

122118
@Setup(Level.Iteration)
123119
public void setupQueries(MiniClusterState.MiniClusterBenchState state) throws Exception {
124-
System.setProperty(SolrIndexSearcher.EXITABLE_READER_PROPERTY, String.valueOf(useEDR));
125120
if (verifyEDRInUse) {
126121
TestInjection.queryTimeout = new CallerSpecificQueryLimit(Set.of(matchExpression));
127122
}
@@ -139,7 +134,7 @@ public void setupQueries(MiniClusterState.MiniClusterBenchState state) throws Ex
139134

140135
@TearDown(Level.Iteration)
141136
public void tearDownTrial() throws Exception {
142-
if (useEDR && verifyEDRInUse) {
137+
if (verifyEDRInUse) {
143138
CallerSpecificQueryLimit queryLimit = (CallerSpecificQueryLimit) TestInjection.queryTimeout;
144139
if (queryLimit == null) {
145140
throw new RuntimeException("Missing setup!");

solr/benchmark/src/java/org/apache/solr/bench/search/JsonFaceting.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.apache.solr.client.solrj.request.QueryRequest;
2929
import org.apache.solr.common.params.ModifiableSolrParams;
3030
import org.apache.solr.common.util.NamedList;
31-
import org.apache.solr.search.SolrIndexSearcher;
3231
import org.openjdk.jmh.annotations.Benchmark;
3332
import org.openjdk.jmh.annotations.BenchmarkMode;
3433
import org.openjdk.jmh.annotations.Fork;
@@ -76,9 +75,6 @@ public static class BenchState {
7675
@Param({"false", "true"})
7776
boolean useTimeLimit;
7877

79-
@Param({"false", "true"})
80-
boolean useExitableDirectoryReader;
81-
8278
// DV, // DocValues, collect into ordinal array
8379
// UIF, // UnInvertedField, collect into ordinal array
8480
// DVHASH, // DocValues, collect into hash
@@ -109,11 +105,6 @@ public void setup(
109105

110106
System.setProperty("maxMergeAtOnce", "50");
111107
System.setProperty("segmentsPerTier", "50");
112-
if (useExitableDirectoryReader) {
113-
System.setProperty(SolrIndexSearcher.EXITABLE_READER_PROPERTY, "true");
114-
} else {
115-
System.setProperty(SolrIndexSearcher.EXITABLE_READER_PROPERTY, "false");
116-
}
117108

118109
miniClusterState.startMiniCluster(nodeCount);
119110

solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ public class SolrIndexSearcher extends IndexSearcher implements Closeable, SolrI
135135
public static final String STATS_SOURCE = "org.apache.solr.stats_source";
136136
public static final String STATISTICS_KEY = "searcher";
137137

138-
public static final String EXITABLE_READER_PROPERTY = "solr.useExitableDirectoryReader";
139-
140138
// These should *only* be used for debugging or monitoring purposes
141139
public static final AtomicLong numOpens = new AtomicLong();
142140
public static final AtomicLong numCloses = new AtomicLong();
@@ -225,10 +223,8 @@ private static DirectoryReader wrapReader(SolrCore core, DirectoryReader reader)
225223
throws IOException {
226224
assert reader != null;
227225
reader = UninvertingReader.wrap(reader, core.getLatestSchema().getUninversionMapper());
228-
// see SOLR-16693 and SOLR-17831 for more details
229-
if (EnvUtils.getPropertyAsBool(EXITABLE_READER_PROPERTY, Boolean.FALSE)) {
230-
reader = ExitableDirectoryReader.wrap(reader, QueryLimitsTimeout.INSTANCE);
231-
}
226+
// see SOLR-16693, SOLR-17831 and SOLR-17182 for more details
227+
reader = ExitableDirectoryReader.wrap(reader, QueryLimitsTimeout.INSTANCE);
232228
return reader;
233229
}
234230

solr/core/src/test/org/apache/solr/core/ExitableDirectoryReaderTest.java

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.Set;
2121
import org.apache.solr.SolrTestCaseJ4;
2222
import org.apache.solr.search.CallerSpecificQueryLimit;
23-
import org.apache.solr.search.SolrIndexSearcher;
2423
import org.apache.solr.util.TestInjection;
2524
import org.junit.After;
2625
import org.junit.Test;
@@ -51,19 +50,7 @@ public void tearDownCore() {
5150
}
5251

5352
@Test
54-
public void testWithExitableDirectoryReader() throws Exception {
55-
doTestWithExitableDirectoryReader(true);
56-
}
57-
58-
@Test
59-
public void testWithoutExitableDirectoryReader() throws Exception {
60-
doTestWithExitableDirectoryReader(false);
61-
}
62-
63-
private void doTestWithExitableDirectoryReader(boolean withExitableDirectoryReader)
64-
throws Exception {
65-
System.setProperty(
66-
SolrIndexSearcher.EXITABLE_READER_PROPERTY, String.valueOf(withExitableDirectoryReader));
53+
public void testExitableDirectoryReader() throws Exception {
6754
initCore("solrconfig-delaying-component.xml", "schema_latest.xml");
6855
createIndex();
6956

@@ -75,14 +62,9 @@ private void doTestWithExitableDirectoryReader(boolean withExitableDirectoryRead
7562
String q = "name:a*";
7663
assertJQ(req("q", q), assertionString);
7764
Map<String, Integer> callCounts = queryLimit.getCallerMatcher().getCallCounts();
78-
if (withExitableDirectoryReader) {
79-
assertTrue(
80-
"there should be some calls from ExitableTermsEnum: " + callCounts,
81-
callCounts.get(callerExpr) > 0);
82-
} else {
83-
assertEquals(
84-
"there should be no calls from ExitableTermsEnum", 0, (int) callCounts.get(callerExpr));
85-
}
65+
assertTrue(
66+
"there should be some calls from ExitableTermsEnum: " + callCounts,
67+
callCounts.get(callerExpr) > 0);
8668

8769
// check that the limits are tripped in ExitableDirectoryReader if it's in use
8870
int maxCount = random().nextInt(10) + 1;
@@ -91,19 +73,10 @@ private void doTestWithExitableDirectoryReader(boolean withExitableDirectoryRead
9173
TestInjection.queryTimeout = queryLimit;
9274
// avoid using the cache
9375
q = "name:b*";
94-
if (withExitableDirectoryReader) {
95-
assertJQ(req("q", q), failureAssertionString);
96-
} else {
97-
assertJQ(req("q", q), assertionString);
98-
}
76+
assertJQ(req("q", q), failureAssertionString);
9977
callCounts = queryLimit.getCallerMatcher().getCallCounts();
100-
if (withExitableDirectoryReader) {
101-
assertTrue(
102-
"there should be at least " + maxCount + " calls from ExitableTermsEnum: " + callCounts,
103-
callCounts.get(callerExpr) >= maxCount);
104-
} else {
105-
assertEquals(
106-
"there should be no calls from ExitableTermsEnum", 0, (int) callCounts.get(callerExpr));
107-
}
78+
assertTrue(
79+
"there should be at least " + maxCount + " calls from ExitableTermsEnum: " + callCounts,
80+
callCounts.get(callerExpr) >= maxCount);
10881
}
10982
}

0 commit comments

Comments
 (0)