You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2020/07/03 03:57:03 UTC
[lucene-solr] branch branch_8x updated: SOLR-10742:
SolrCores.getNamesForCore is quite inefficient and blocks other core
operations
This is an automated email from the ASF dual-hosted git repository.
erick pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new e39c2f6 SOLR-10742: SolrCores.getNamesForCore is quite inefficient and blocks other core operations
e39c2f6 is described below
commit e39c2f624a71e6f9eec242e91b3545fd5b64d8f8
Author: Erick Erickson <Er...@gmail.com>
AuthorDate: Thu Jul 2 18:54:49 2020 -0400
SOLR-10742: SolrCores.getNamesForCore is quite inefficient and blocks other core operations
---
solr/CHANGES.txt | 2 ++
.../java/org/apache/solr/core/CoreContainer.java | 10 ----------
.../src/java/org/apache/solr/core/SolrCore.java | 1 -
.../src/java/org/apache/solr/core/SolrCores.java | 23 ----------------------
.../apache/solr/core/TransientSolrCoreCache.java | 10 ----------
.../solr/core/TransientSolrCoreCacheDefault.java | 11 -----------
6 files changed, 2 insertions(+), 55 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index a0bdcd4..0c3f9a5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -31,6 +31,8 @@ Other Changes
* 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 ==================
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 119b5db..7fe649b 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -1539,22 +1539,12 @@ public class CoreContainer {
}
/**
- * 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
*
* @return a list of all the available core names in either permanent or transient cores
*/
public Collection<String> getAllCoreNames() {
return solrCores.getAllCoreNames();
-
}
/**
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 39fe489..e0d6162 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -1183,7 +1183,6 @@ public final class SolrCore implements SolrInfoBean, SolrMetricProducer, Closeab
parentContext.gauge(this, () -> isClosed() ? 0 : getIndexSize(), true, "sizeInBytes", Category.INDEX.toString());
parentContext.gauge(this, () -> isClosed() ? "(closed)" : NumberUtils.readableSize(getIndexSize()), true, "size", Category.INDEX.toString());
if (coreContainer != null) {
- parentContext.gauge(this, () -> coreContainer.getNamesForCore(this), true, "aliases", Category.CORE.toString());
final CloudDescriptor cd = getCoreDescriptor().getCloudDescriptor();
if (cd != null) {
parentContext.gauge(this, () -> {
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCores.java b/solr/core/src/java/org/apache/solr/core/SolrCores.java
index d655d71..900738c 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCores.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCores.java
@@ -17,7 +17,6 @@
package org.apache.solr.core;
import com.google.common.collect.Lists;
-import org.apache.http.annotation.Experimental;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.logging.MDCLoggingContext;
@@ -210,28 +209,6 @@ class SolrCores {
}
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
*
diff --git a/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCache.java b/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCache.java
index d7e59b1..c68f779 100644
--- a/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCache.java
+++ b/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCache.java
@@ -19,12 +19,8 @@ package org.apache.solr.core;
import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
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
* 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.
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!
*/
diff --git a/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCacheDefault.java b/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCacheDefault.java
index 476dca9..84f3b73 100644
--- a/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCacheDefault.java
+++ b/solr/core/src/java/org/apache/solr/core/TransientSolrCoreCacheDefault.java
@@ -169,17 +169,6 @@ public class TransientSolrCoreCacheDefault extends TransientSolrCoreCache {
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.
@Override
public int getStatus(String coreName) { return 0; } //no_op for default handler.