lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r1695087 - in /lucene/dev/branches/lucene_solr_5_3: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java
Date Mon, 10 Aug 2015 14:39:54 GMT
Author: shalin
Date: Mon Aug 10 14:39:54 2015
New Revision: 1695087

URL: http://svn.apache.org/r1695087
Log:
SOLR-7908: SegmentsInfoRequestHandler gets a ref counted IndexWriter and does not properly
release it

Modified:
    lucene/dev/branches/lucene_solr_5_3/   (props changed)
    lucene/dev/branches/lucene_solr_5_3/solr/   (props changed)
    lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_5_3/solr/core/   (props changed)
    lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java

Modified: lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt?rev=1695087&r1=1695086&r2=1695087&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/CHANGES.txt Mon Aug 10 14:39:54 2015
@@ -232,6 +232,9 @@ Bug Fixes
 * SOLR-7666 (and linked tickets): Many fixes to AngularJS Admin UI bringing it close to feature
   parity with existing UI. (Upayavira)
 
+* SOLR-7908: SegmentsInfoRequestHandler gets a ref counted IndexWriter and does not properly
release it.
+  (Mark Miller, shalin)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java?rev=1695087&r1=1695086&r2=1695087&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java
(original)
+++ lucene/dev/branches/lucene_solr_5_3/solr/core/src/java/org/apache/solr/handler/admin/SegmentsInfoRequestHandler.java
Mon Aug 10 14:39:54 2015
@@ -17,6 +17,7 @@ import org.apache.solr.handler.RequestHa
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.search.SolrIndexSearcher;
+import org.apache.solr.util.RefCounted;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -93,25 +94,26 @@ public class SegmentsInfoRequestHandler
 
   private List<String> getMergeCandidatesNames(SolrQueryRequest req, SegmentInfos infos)
throws IOException {
     List<String> result = new ArrayList<String>();
-    IndexWriter indexWriter = getIndexWriter(req);
-    //get chosen merge policy
-    MergePolicy mp = indexWriter.getConfig().getMergePolicy();
-    //Find merges
-    MergeSpecification findMerges = mp.findMerges(MergeTrigger.EXPLICIT, infos, indexWriter);
-    if (findMerges != null && findMerges.merges != null && findMerges.merges.size()
> 0) {
-      for (OneMerge merge : findMerges.merges) {
-        //TODO: add merge grouping
-        for (SegmentCommitInfo mergeSegmentInfo : merge.segments) {
-          result.add(mergeSegmentInfo.info.name);
+    RefCounted<IndexWriter> refCounted = req.getCore().getSolrCoreState().getIndexWriter(req.getCore());
+    try {
+      IndexWriter indexWriter = refCounted.get();
+      //get chosen merge policy
+      MergePolicy mp = indexWriter.getConfig().getMergePolicy();
+      //Find merges
+      MergeSpecification findMerges = mp.findMerges(MergeTrigger.EXPLICIT, infos, indexWriter);
+      if (findMerges != null && findMerges.merges != null && findMerges.merges.size()
> 0) {
+        for (OneMerge merge : findMerges.merges) {
+          //TODO: add merge grouping
+          for (SegmentCommitInfo mergeSegmentInfo : merge.segments) {
+            result.add(mergeSegmentInfo.info.name);
+          }
         }
       }
-    }
-
-    return result;
-  }
 
-  private IndexWriter getIndexWriter(SolrQueryRequest req) throws IOException {
-    return req.getCore().getSolrCoreState().getIndexWriter(req.getCore()).get();
+      return result;
+    } finally {
+      refCounted.decref();
+    }
   }
 
   @Override



Mime
View raw message