You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/09/01 00:09:30 UTC

[lucene-solr] branch reference_impl_dev updated: @663 Return these allow cache changes to their original for the most part (left zkupdatedistprocess) - was working around other issues at the time. If we can allow the cache option more, that should be more thought out and tested.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new 852af93  @663 Return these allow cache changes to their original for the most part (left zkupdatedistprocess) - was working around other issues at the time. If we can allow the cache option more, that should be more thought out and tested.
852af93 is described below

commit 852af93a02a6fcccf149f750034241fde226c6af
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Mon Aug 31 18:59:54 2020 -0500

    @663 Return these allow cache changes to their original for the most part (left zkupdatedistprocess) - was working around other issues at the time. If we can allow the cache option more, that should be more thought out and tested.
---
 solr/core/src/java/org/apache/solr/api/V2HttpCall.java      |  2 +-
 solr/core/src/java/org/apache/solr/cloud/CloudUtil.java     |  6 +++---
 solr/core/src/java/org/apache/solr/cloud/ZkController.java  |  2 +-
 .../java/org/apache/solr/cloud/api/collections/Assign.java  |  2 +-
 .../solr/cloud/api/collections/DeleteCollectionCmd.java     |  2 +-
 solr/core/src/java/org/apache/solr/core/SolrCore.java       |  2 +-
 solr/core/src/java/org/apache/solr/util/SolrLogLayout.java  |  2 +-
 .../apache/solr/client/solrj/impl/ClusterStateProvider.java |  2 +-
 .../src/java/org/apache/solr/common/cloud/ClusterState.java |  4 ++--
 .../java/org/apache/solr/common/cloud/ZkStateReader.java    | 13 +++++--------
 10 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/api/V2HttpCall.java b/solr/core/src/java/org/apache/solr/api/V2HttpCall.java
index 1ed461b..ac1d6dc 100644
--- a/solr/core/src/java/org/apache/solr/api/V2HttpCall.java
+++ b/solr/core/src/java/org/apache/solr/api/V2HttpCall.java
@@ -204,7 +204,7 @@ public class V2HttpCall extends HttpSolrCall {
       String collectionName = collectionsList.get(0); // first
       //TODO an option to choose another collection in the list if can't find a local replica of the first?
 
-      return zkStateReader.getClusterState().getCollectionOrNull(collectionName, true);
+      return zkStateReader.getClusterState().getCollectionOrNull(collectionName);
     };
 
     DocCollection docCollection = logic.get();
diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
index 4918e14..5321b1d 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
@@ -70,7 +70,7 @@ public class CloudUtil {
     log.debug("checkSharedFSFailoverReplaced running for coreNodeName={} baseUrl={}", thisCnn, thisBaseUrl);
 
     // if we see our core node name on a different base url, unload
-    final DocCollection docCollection = zkController.getClusterState().getCollectionOrNull(desc.getCloudDescriptor().getCollectionName(), true);
+    final DocCollection docCollection = zkController.getClusterState().getCollectionOrNull(desc.getCloudDescriptor().getCollectionName());
     if (docCollection != null && docCollection.getSlicesMap() != null) {
       Map<String,Slice> slicesMap = docCollection.getSlicesMap();
       for (Slice slice : slicesMap.values()) {
@@ -105,7 +105,7 @@ public class CloudUtil {
   }
 
   public static boolean replicaExists(ClusterState clusterState, String collection, String shard, String coreNodeName) {
-    DocCollection docCollection = clusterState.getCollectionOrNull(collection, true);
+    DocCollection docCollection = clusterState.getCollectionOrNull(collection);
     if (docCollection != null) {
       Slice slice = docCollection.getSlice(shard);
       if (slice != null) {
@@ -203,7 +203,7 @@ public class CloudUtil {
     DocCollection coll = null;
     while (!timeout.hasTimedOut()) {
       state = cloudManager.getClusterStateProvider().getClusterState();
-      coll = state.getCollectionOrNull(collection, true);
+      coll = state.getCollectionOrNull(collection);
       // due to the way we manage collections in SimClusterStateProvider a null here
       // can mean that a collection is still being created but has no replicas
       if (coll == null) { // does not yet exist?
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index 0184ae2..c8480c5 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -637,7 +637,7 @@ public class ZkController implements Closeable {
   public void giveupLeadership(CoreDescriptor cd, Throwable tragicException) {
     assert tragicException != null;
     assert cd != null;
-    DocCollection dc = getClusterState().getCollectionOrNull(cd.getCollectionName(), true);
+    DocCollection dc = getClusterState().getCollectionOrNull(cd.getCollectionName());
     if (dc == null) return;
 
     Slice shard = dc.getSlice(cd.getCloudDescriptor().getShardId());
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/Assign.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/Assign.java
index cf718de..294eb67 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/Assign.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/Assign.java
@@ -522,7 +522,7 @@ public class Assign {
       for (String shard : assignRequest.shardNames) shardVsReplicaCount.put(shard, assignRequest.numNrtReplicas);
 
       Map<String, Map<String, Integer>> shardVsNodes = new LinkedHashMap<>();
-      DocCollection docCollection = solrCloudManager.getClusterStateProvider().getClusterState().getCollectionOrNull(assignRequest.collectionName, true);
+      DocCollection docCollection = solrCloudManager.getClusterStateProvider().getClusterState().getCollectionOrNull(assignRequest.collectionName);
       if (docCollection != null) {
         for (Slice slice : docCollection.getSlices()) {
           LinkedHashMap<String, Integer> n = new LinkedHashMap<>();
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
index e77ec7a..120330b 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
@@ -101,7 +101,7 @@ public class DeleteCollectionCmd implements OverseerCollectionMessageHandler.Cmd
       SolrZkClient zkClient = zkStateReader.getZkClient();
       SolrSnapshotManager.cleanupCollectionLevelSnapshots(zkClient, collection);
 
-      if (zkStateReader.getClusterState().getCollectionOrNull(collection, true) == null) {
+      if (zkStateReader.getClusterState().getCollectionOrNull(collection) == null) {
         if (zkStateReader.getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection)) {
           // if the collection is not in the clusterstate, but is listed in zk, do nothing, it will just
           // be removed in the finally - we cannot continue, because the below code will error if the collection
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 8fbc2dd..6e3fa0a 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -1149,7 +1149,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
 
       // ZK pre-register would have already happened so we read slice properties now
       final ClusterState clusterState = coreContainer.getZkController().getClusterState();
-      final DocCollection collection = clusterState.getCollectionOrNull(coreDescriptor.getCloudDescriptor().getCollectionName(), true);
+      final DocCollection collection = clusterState.getCollectionOrNull(coreDescriptor.getCloudDescriptor().getCollectionName());
       final Slice slice = collection.getSlice(coreDescriptor.getCloudDescriptor().getShardId());
       if (slice.getState() == Slice.State.CONSTRUCTION) {
         // set update log to buffer before publishing the core
diff --git a/solr/core/src/java/org/apache/solr/util/SolrLogLayout.java b/solr/core/src/java/org/apache/solr/util/SolrLogLayout.java
index 2909424..f7c02ce 100644
--- a/solr/core/src/java/org/apache/solr/util/SolrLogLayout.java
+++ b/solr/core/src/java/org/apache/solr/util/SolrLogLayout.java
@@ -239,7 +239,7 @@ public class SolrLogLayout extends AbstractStringLayout {
 
   private Map<String, Object> getReplicaProps(ZkController zkController, SolrCore core) {
     final String collectionName = core.getCoreDescriptor().getCloudDescriptor().getCollectionName();
-    DocCollection collection = zkController.getClusterState().getCollectionOrNull(collectionName, true);
+    DocCollection collection = zkController.getClusterState().getCollectionOrNull(collectionName);
     Replica replica = collection.getReplica(zkController.getCoreNodeName(core.getCoreDescriptor()));
     if (replica != null) {
       return replica.getProperties();
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java
index e85d853..a7ce278 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ClusterStateProvider.java
@@ -76,7 +76,7 @@ public interface ClusterStateProvider extends SolrCloseable {
   ClusterState getClusterState() throws IOException;
 
   default DocCollection getCollection(String name) throws IOException{
-   return getClusterState().getCollectionOrNull(name, true);
+   return getClusterState().getCollectionOrNull(name);
   }
 
   /**
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
index 733793a..cc86d62 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
@@ -105,14 +105,14 @@ public class ClusterState implements JSONWriter.Writable {
    * because the semantics of how collection list is loaded have changed in SOLR-6629.
    */
   public boolean hasCollection(String collectionName) {
-    return getCollectionOrNull(collectionName, true) != null;
+    return getCollectionOrNull(collectionName) != null;
   }
 
   /**
    * Get the named DocCollection object, or throw an exception if it doesn't exist.
    */
   public DocCollection getCollection(String collection) {
-    DocCollection coll = getCollectionOrNull(collection, true);
+    DocCollection coll = getCollectionOrNull(collection);
     if (coll == null) throw new SolrException(ErrorCode.BAD_REQUEST, "Could not find collection : " + collection);
     return coll;
   }
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 4252629..e204bd0 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -488,8 +488,7 @@ public class ZkStateReader implements SolrCloseable {
         ParWork.propegateInterrupt(e);
       }
 
-      VersionedCollectionProps props = new VersionedCollectionProps(
-          stat.getVersion(), (Map<String,String>) fromJSON(data));
+      VersionedCollectionProps props = new VersionedCollectionProps(stat.getVersion(), (Map<String,String>) fromJSON(data));
       watchedCollectionProps.put(c, props);
     });
   }
@@ -969,7 +968,7 @@ public class ZkStateReader implements SolrCloseable {
     if (clusterState == null) {
       return null;
     }
-    final DocCollection docCollection = clusterState.getCollectionOrNull(collection, true);
+    final DocCollection docCollection = clusterState.getCollectionOrNull(collection);
     if (docCollection == null || docCollection.getSlicesMap() == null) {
       throw new ZooKeeperException(ErrorCode.BAD_REQUEST,
           "Could not find collection in zk: " + collection);
@@ -1136,8 +1135,7 @@ public class ZkStateReader implements SolrCloseable {
           try {
             byte[] data = zkClient.getData(getCollectionPropsPath(collection), propsWatcher, stat);
 
-            VersionedCollectionProps props = new VersionedCollectionProps(
-                stat.getVersion(), (Map<String,String>) fromJSON(data));
+            VersionedCollectionProps props = new VersionedCollectionProps(stat.getVersion(), (Map<String,String>) fromJSON(data));
             watchedCollectionProps.put(collection, props);
             properties = props;
           } catch (KeeperException e) {
@@ -1153,7 +1151,7 @@ public class ZkStateReader implements SolrCloseable {
     return properties.props;
   }
 
-  private class VersionedCollectionProps {
+  private static class VersionedCollectionProps {
     int zkVersion;
     Map<String, String> props;
     long cacheUntilNs = 0;
@@ -1326,8 +1324,7 @@ public class ZkStateReader implements SolrCloseable {
         try {
           byte[] data = zkClient.getData(getCollectionPropsPath(coll), this, stat);
 
-          VersionedCollectionProps props = new VersionedCollectionProps(
-              stat.getVersion(), (Map<String,String>) fromJSON(data));
+          VersionedCollectionProps props = new VersionedCollectionProps(stat.getVersion(), (Map<String,String>) fromJSON(data));
           watchedCollectionProps.put(coll, props);
 
           try (ParWork work = new ParWork(this, true)) {