mirror of https://github.com/apache/lucene.git
SOLR-14431: SegmentsInfoRequestHandler does not release IndexWriter.
This commit is contained in:
parent
0c58687a97
commit
5eea489e44
|
@ -150,6 +150,8 @@ Bug Fixes
|
|||
|
||||
* SOLR-14421: New examples in solr.in.cmd in Solr 8.5 don't work as provided (Colvin Cowie via janhoy)
|
||||
|
||||
* SOLR-14431: SegmentsInfoRequestHandler does not release IndexWriter (Tiziano Degaetano, ab)
|
||||
|
||||
Other Changes
|
||||
---------------------
|
||||
* SOLR-14197: SolrResourceLoader: marked many methods as deprecated, and in some cases rerouted exiting logic to avoid
|
||||
|
|
|
@ -127,7 +127,6 @@ public class SegmentsInfoRequestHandler extends RequestHandlerBase {
|
|||
SimpleOrderedMap<Object> segmentInfos = new SimpleOrderedMap<>();
|
||||
|
||||
SolrCore core = req.getCore();
|
||||
RefCounted<IndexWriter> iwRef = core.getSolrCoreState().getIndexWriter(core);
|
||||
SimpleOrderedMap<Object> infosInfo = new SimpleOrderedMap<>();
|
||||
Version minVersion = infos.getMinSegmentLuceneVersion();
|
||||
if (minVersion != null) {
|
||||
|
@ -149,6 +148,7 @@ public class SegmentsInfoRequestHandler extends RequestHandlerBase {
|
|||
coreInfo.add("indexDir", core.getIndexDir());
|
||||
coreInfo.add("sizeInGB", (double)core.getIndexSize() / GB);
|
||||
|
||||
RefCounted<IndexWriter> iwRef = core.getSolrCoreState().getIndexWriter(core);
|
||||
if (iwRef != null) {
|
||||
try {
|
||||
IndexWriter iw = iwRef.get();
|
||||
|
|
|
@ -17,11 +17,14 @@
|
|||
package org.apache.solr.handler.admin;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.SegmentCommitInfo;
|
||||
import org.apache.lucene.index.SegmentInfos;
|
||||
import org.apache.lucene.util.Version;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.apache.solr.index.NoMergePolicyFactory;
|
||||
import org.apache.solr.util.RefCounted;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -35,6 +38,8 @@ public class SegmentsInfoRequestHandlerTest extends SolrTestCaseJ4 {
|
|||
private static final int DEL_COUNT = 1;
|
||||
|
||||
private static final int NUM_SEGMENTS = 2;
|
||||
|
||||
private static int initialRefCount;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
|
@ -69,11 +74,18 @@ public class SegmentsInfoRequestHandlerTest extends SolrTestCaseJ4 {
|
|||
NUM_SEGMENTS, numSegments);
|
||||
return null;
|
||||
});
|
||||
|
||||
// see SOLR-14431
|
||||
RefCounted<IndexWriter> iwRef = h.getCore().getSolrCoreState().getIndexWriter(h.getCore());
|
||||
initialRefCount = iwRef.getRefcount();
|
||||
iwRef.decref();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() {
|
||||
public static void afterClass() throws Exception {
|
||||
RefCounted<IndexWriter> iwRef = h.getCore().getSolrCoreState().getIndexWriter(h.getCore());
|
||||
int finalRefCount = iwRef.getRefcount();
|
||||
iwRef.decref();
|
||||
assertEquals("IW refcount mismatch", initialRefCount, finalRefCount);
|
||||
systemClearPropertySolrTestsMergePolicyFactory();
|
||||
System.clearProperty("solr.tests.maxBufferedDocs");
|
||||
System.clearProperty("solr.tests.ramBufferSizeMB");
|
||||
|
|
Loading…
Reference in New Issue