Skip to content

Commit e91e8dc

Browse files
authored
SOLR-17629: SQLHandler: remember to close if open fails (#3045)
1 parent 773156b commit e91e8dc

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

solr/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ Bug Fixes
173173
doing distributed search (sharded collections). This could likely occur for fielded parameters such as
174174
f.CASE_SENSITIVE_FIELD.facet.limit=50. (Yue Yu, David Smiley)
175175

176+
* SOLR-17629: If SQLHandler failed to open the underlying stream (e.g. Solr returns an error; could be user/syntax problem),
177+
it needs to close the stream to cleanup resources but wasn't. (David Smiley)
178+
176179
Dependency Upgrades
177180
---------------------
178181
* SOLR-17471: Upgrade Lucene to 9.12.1. (Pierre Salagnac, Christine Poerschke)

solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrEnumerator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.calcite.linq4j.Enumerator;
2525
import org.apache.solr.client.solrj.io.Tuple;
2626
import org.apache.solr.client.solrj.io.stream.TupleStream;
27+
import org.apache.solr.common.util.IOUtils;
2728
import org.slf4j.Logger;
2829
import org.slf4j.LoggerFactory;
2930

@@ -42,11 +43,11 @@ class SolrEnumerator implements Enumerator<Object> {
4243
* @param fields Fields to get from each Tuple
4344
*/
4445
SolrEnumerator(TupleStream tupleStream, List<Map.Entry<String, Class<?>>> fields) {
45-
4646
this.tupleStream = tupleStream;
4747
try {
4848
this.tupleStream.open();
4949
} catch (IOException e) {
50+
IOUtils.closeQuietly(tupleStream);
5051
throw new RuntimeException(e);
5152
}
5253
this.fields = fields;

0 commit comments

Comments
 (0)