mirror of https://github.com/apache/lucene.git
SOLR-10742: SolrCores.getNamesForCore is quite inefficient and blocks other core operations
This commit is contained in:
parent
2005c43667
commit
e9568c3473
|
@ -118,6 +118,8 @@ Other Changes
|
||||||
|
|
||||||
* SOLR-14592: Upgrade Zookeeper to 3.6.1. NOTE: this required upgrading netty to 4.1.50 (Erick Erickson)
|
* SOLR-14592: Upgrade Zookeeper to 3.6.1. NOTE: this required upgrading netty to 4.1.50 (Erick Erickson)
|
||||||
|
|
||||||
|
* SOLR-10742: SolrCores.getNamesForCore is quite inefficient and blocks other core operations.
|
||||||
|
NOTE: this experimental method has been removed (Erick Erickson)
|
||||||
|
|
||||||
================== 8.6.0 ==================
|
================== 8.6.0 ==================
|
||||||
|
|
||||||
|
|
|
@ -1526,15 +1526,6 @@ public class CoreContainer {
|
||||||
return solrCores.getLoadedCoreNames();
|
return solrCores.getLoadedCoreNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is currently experimental.
|
|
||||||
*
|
|
||||||
* @return a Collection of the names that a specific core object is mapped to, there are more than one.
|
|
||||||
*/
|
|
||||||
public Collection<String> getNamesForCore(SolrCore core) {
|
|
||||||
return solrCores.getNamesForCore(core);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a list of all the cores that are currently known, whether currently loaded or not
|
* get a list of all the cores that are currently known, whether currently loaded or not
|
||||||
*
|
*
|
||||||
|
@ -1542,7 +1533,6 @@ public class CoreContainer {
|
||||||
*/
|
*/
|
||||||
public Collection<String> getAllCoreNames() {
|
public Collection<String> getAllCoreNames() {
|
||||||
return solrCores.getAllCoreNames();
|
return solrCores.getAllCoreNames();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1190,7 +1190,6 @@ public final class SolrCore implements SolrInfoBean, Closeable {
|
||||||
parentContext.gauge(() -> isClosed() ? 0 : getIndexSize(), true, "sizeInBytes", Category.INDEX.toString());
|
parentContext.gauge(() -> isClosed() ? 0 : getIndexSize(), true, "sizeInBytes", Category.INDEX.toString());
|
||||||
parentContext.gauge(() -> isClosed() ? "(closed)" : NumberUtils.readableSize(getIndexSize()), true, "size", Category.INDEX.toString());
|
parentContext.gauge(() -> isClosed() ? "(closed)" : NumberUtils.readableSize(getIndexSize()), true, "size", Category.INDEX.toString());
|
||||||
if (coreContainer != null) {
|
if (coreContainer != null) {
|
||||||
parentContext.gauge(() -> coreContainer.getNamesForCore(this), true, "aliases", Category.CORE.toString());
|
|
||||||
final CloudDescriptor cd = getCoreDescriptor().getCloudDescriptor();
|
final CloudDescriptor cd = getCoreDescriptor().getCloudDescriptor();
|
||||||
if (cd != null) {
|
if (cd != null) {
|
||||||
parentContext.gauge(() -> {
|
parentContext.gauge(() -> {
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package org.apache.solr.core;
|
package org.apache.solr.core;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.apache.http.annotation.Experimental;
|
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
import org.apache.solr.common.util.ExecutorUtil;
|
import org.apache.solr.common.util.ExecutorUtil;
|
||||||
import org.apache.solr.logging.MDCLoggingContext;
|
import org.apache.solr.logging.MDCLoggingContext;
|
||||||
|
@ -210,28 +209,6 @@ class SolrCores {
|
||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is currently experimental.
|
|
||||||
*
|
|
||||||
* @return a Collection of the names that a specific core object is mapped to, there are more than one.
|
|
||||||
*/
|
|
||||||
@Experimental
|
|
||||||
List<String> getNamesForCore(SolrCore core) {
|
|
||||||
List<String> lst = new ArrayList<>();
|
|
||||||
|
|
||||||
synchronized (modifyLock) {
|
|
||||||
for (Map.Entry<String, SolrCore> entry : cores.entrySet()) {
|
|
||||||
if (core == entry.getValue()) {
|
|
||||||
lst.add(entry.getKey());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (getTransientCacheHandler() != null) {
|
|
||||||
lst.addAll(getTransientCacheHandler().getNamesForCore(core));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return lst;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of all cores, loaded and unloaded
|
* Gets a list of all cores, loaded and unloaded
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,12 +19,8 @@ package org.apache.solr.core;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.http.annotation.Experimental;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base class for custom transient core maintenance. Any custom plugin that want's to take control of transient
|
* The base class for custom transient core maintenance. Any custom plugin that want's to take control of transient
|
||||||
* caches (i.e. any core defined with transient=true) should override this class.
|
* caches (i.e. any core defined with transient=true) should override this class.
|
||||||
|
@ -105,12 +101,6 @@ public abstract class TransientSolrCoreCache {
|
||||||
// Remove the core descriptor from your list of transient descriptors.
|
// Remove the core descriptor from your list of transient descriptors.
|
||||||
public abstract CoreDescriptor removeTransientDescriptor(String name);
|
public abstract CoreDescriptor removeTransientDescriptor(String name);
|
||||||
|
|
||||||
// Find all the names a specific core is mapped to. Should not return null, return empty set instead.
|
|
||||||
@Experimental
|
|
||||||
public List<String> getNamesForCore(SolrCore core) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Must be called in order to free resources!
|
* Must be called in order to free resources!
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -171,17 +171,6 @@ public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache {
|
||||||
return transientDescriptors.remove(name);
|
return transientDescriptors.remove(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getNamesForCore(SolrCore core) {
|
|
||||||
List<String> ret = new ArrayList<>();
|
|
||||||
for (Map.Entry<String, SolrCore> entry : transientCores.entrySet()) {
|
|
||||||
if (core == entry.getValue()) {
|
|
||||||
ret.add(entry.getKey());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For custom implementations to communicate arbitrary information as necessary.
|
// For custom implementations to communicate arbitrary information as necessary.
|
||||||
@Override
|
@Override
|
||||||
public int getStatus(String coreName) { return 0; } //no_op for default handler.
|
public int getStatus(String coreName) { return 0; } //no_op for default handler.
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class ExportWriterStream extends TupleStream implements Expressible {
|
||||||
@Override
|
@Override
|
||||||
public EntryWriter put(CharSequence k, Object v) throws IOException {
|
public EntryWriter put(CharSequence k, Object v) throws IOException {
|
||||||
if (v instanceof IteratorWriter) {
|
if (v instanceof IteratorWriter) {
|
||||||
List lst = new ArrayList();
|
List<Object> lst = new ArrayList<>();
|
||||||
((IteratorWriter)v).toList(lst);
|
((IteratorWriter)v).toList(lst);
|
||||||
v = lst;
|
v = lst;
|
||||||
} else if (v instanceof MapWriter) {
|
} else if (v instanceof MapWriter) {
|
||||||
|
|
Loading…
Reference in New Issue