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

[lucene-solr] branch jira/solr14680 created (now cf5cb81)

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

noble pushed a change to branch jira/solr14680
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


      at cf5cb81  revert changes

This branch includes the following new commits:

     new 76718b6  Merge remote-tracking branch 'noble/sdk' into jira/solr14680 merging with noble sdk
     new cf5cb81  revert changes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[lucene-solr] 02/02: revert changes

Posted by no...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit cf5cb8100a52350c9d01b0e6a100c6bfc768d7ef
Author: noblepaul <no...@gmail.com>
AuthorDate: Fri Aug 7 19:33:10 2020 +1000

    revert changes
---
 .../org/apache/solr/common/cloud/ClusterState.java | 57 +---------------------
 .../apache/solr/common/cloud/DocCollection.java    | 35 +------------
 .../java/org/apache/solr/common/cloud/Replica.java | 38 +--------------
 .../java/org/apache/solr/common/cloud/Slice.java   | 43 +---------------
 4 files changed, 4 insertions(+), 169 deletions(-)

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 f241dac..3c518e0 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
@@ -25,16 +25,10 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.function.BiConsumer;
 import java.util.function.Consumer;
 
-import org.apache.solr.cluster.api.Config;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
-import org.apache.solr.cluster.api.SolrCluster;
-import org.apache.solr.cluster.api.SolrCollection;
-import org.apache.solr.cluster.api.SolrNode;
-import org.apache.solr.common.util.SimpleMap;
 import org.apache.solr.common.util.Utils;
 import org.apache.zookeeper.KeeperException;
 import org.noggit.JSONWriter;
@@ -44,7 +38,7 @@ import org.noggit.JSONWriter;
  * {@link ZkStateReader#getClusterState()}.
  * @lucene.experimental
  */
-public class ClusterState implements JSONWriter.Writable , SolrCluster {
+public class ClusterState implements JSONWriter.Writable {
 
   private final Map<String, CollectionRef> collectionStates, immutableCollectionStates;
   private Set<String> liveNodes;
@@ -64,55 +58,6 @@ public class ClusterState implements JSONWriter.Writable , SolrCluster {
     }
     return collRefs;
   }
-  private final SimpleMap<SolrCollection> _collections = new SimpleMap<>() {
-    @Override
-    public SolrCollection get(CharSequence key) {
-      CollectionRef ref = collectionStates.get(key.toString());
-      return ref ==null? null: ref.get();
-    }
-
-    @Override
-    public void forEach(BiConsumer<? super CharSequence, ? super SolrCollection> fun) {
-      collectionStates.forEach((s, collectionRef) -> {
-        DocCollection coll = collectionRef.get();
-        if (coll == null) return;
-        fun.accept(s, coll);
-      });
-    }
-  };
-
-  @Override
-  public SimpleMap<SolrCollection> collections() {
-    return _collections;
-  }
-
-
-
-  @Override
-  public SimpleMap<SolrNode> nodes() {
-    throw new UnsupportedOperationException("Not yet implemented");
-  }
-
-  @Override
-  public String overseerNode() {
-    throw new UnsupportedOperationException("Not yet implemented");
-
-  }
-
-  @Override
-  public SimpleMap<SolrCollection> collections(boolean includeAlias) {
-    throw new UnsupportedOperationException("Not yet implemented");
-  }
-
-  @Override
-  public SimpleMap<Config> configs() throws SolrException {
-    throw new UnsupportedOperationException("Not yet implemented");
-  }
-
-  @Override
-  public String thisNode() {
-    throw new UnsupportedOperationException("Not yet implemented");
-  }
 
   /**
    * Use this if all the collection states are not readily available and some needs to be lazily loaded
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java b/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
index 2eb65e5..9552c61 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/DocCollection.java
@@ -29,10 +29,6 @@ import java.util.Set;
 import java.util.function.BiConsumer;
 import java.util.function.BiPredicate;
 
-import org.apache.solr.cluster.api.Router;
-import org.apache.solr.cluster.api.Shard;
-import org.apache.solr.cluster.api.SolrCollection;
-import org.apache.solr.common.util.SimpleMap;
 import org.noggit.JSONWriter;
 
 import static org.apache.solr.common.cloud.ZkStateReader.NRT_REPLICAS;
@@ -45,7 +41,7 @@ import static org.apache.solr.common.util.Utils.toJSONString;
 /**
  * Models a Collection in zookeeper (but that Java name is obviously taken, hence "DocCollection")
  */
-public class DocCollection extends ZkNodeProps implements Iterable<Slice>, SolrCollection {
+public class DocCollection extends ZkNodeProps implements Iterable<Slice> {
 
   public static final String DOC_ROUTER = "router";
   public static final String SHARDS = "shards";
@@ -393,33 +389,4 @@ public class DocCollection extends ZkNodeProps implements Iterable<Slice>, SolrC
     if (type == Replica.Type.TLOG) result = numTlogReplicas;
     return result == null ? def : result;
   }
-
-  private SimpleMap<Shard> shards = new SimpleMap<Shard>() {
-    @Override
-    public Shard get(CharSequence key) {
-      return slices.get(key.toString());
-    }
-
-    @Override
-    public void forEach(BiConsumer<? super CharSequence, ? super Shard> fun) {
-      slices.forEach(fun::accept);
-    }
-  };
-  @Override
-  public SimpleMap<Shard> shards() {
-    return shards;
-  }
-
-  @Override
-  public Router router() {
-    return routingKey -> {
-          Slice targetSlice = router.getTargetSlice(routingKey, null, null, null, null);
-          return targetSlice == null? null: targetSlice.getName();
-        };
-  }
-
-  @Override
-  public String configSet() {
-   throw new UnsupportedOperationException("Not yet implemented");
-  }
 }
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/Replica.java b/solr/solrj/src/java/org/apache/solr/common/cloud/Replica.java
index a33e35b..51a21db 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/Replica.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/Replica.java
@@ -27,14 +27,13 @@ import java.util.Set;
 import java.util.function.BiPredicate;
 
 import org.apache.solr.common.MapWriter;
-import org.apache.solr.cluster.api.ShardReplica;
 import org.apache.solr.common.util.Utils;
 import org.noggit.JSONWriter;
 
 import static org.apache.solr.common.ConditionalMapWriter.NON_NULL_VAL;
 import static org.apache.solr.common.ConditionalMapWriter.dedupeKeyPredicate;
 
-public class Replica extends ZkNodeProps implements MapWriter, ShardReplica {
+public class Replica extends ZkNodeProps implements MapWriter {
   
   /**
    * The replica's state. In general, if the node the replica is hosted on is
@@ -338,39 +337,4 @@ public class Replica extends ZkNodeProps implements MapWriter, ShardReplica {
   public String toString() {
     return name + ':' + Utils.toJSONString(propMap); // small enough, keep it on one line (i.e. no indent)
   }
-
-  @Override
-  public String name() {
-    return name;
-  }
-
-  @Override
-  public String shard() {
-    return getShard();
-  }
-
-  @Override
-  public String collection() {
-    return getCollection();
-  }
-
-  @Override
-  public String  node() {
-    return getNodeName();
-  }
-
-  @Override
-  public String core() {
-    return getCoreName();
-  }
-
-  @Override
-  public Type type() {
-    return type;
-  }
-
-  @Override
-  public long size() {
-    throw new UnsupportedOperationException("Not yet implemented");
-  }
 }
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java b/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
index 056f731..4378ef7 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
@@ -25,15 +25,10 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.function.BiConsumer;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
-import org.apache.solr.cluster.api.HashRange;
 import org.apache.solr.common.cloud.Replica.Type;
-import org.apache.solr.cluster.api.Shard;
-import org.apache.solr.cluster.api.ShardReplica;
-import org.apache.solr.common.util.SimpleMap;
 import org.noggit.JSONWriter;
 
 import static org.apache.solr.common.util.Utils.toJSONString;
@@ -41,7 +36,7 @@ import static org.apache.solr.common.util.Utils.toJSONString;
 /**
  * A Slice contains immutable information about a logical shard (all replicas that share the same shard id).
  */
-public class Slice extends ZkNodeProps implements Iterable<Replica> , Shard {
+public class Slice extends ZkNodeProps implements Iterable<Replica> {
   public final String collection;
 
   /** Loads multiple slices into a Map from a generic Map that probably came from deserialized JSON. */
@@ -299,40 +294,4 @@ public class Slice extends ZkNodeProps implements Iterable<Replica> , Shard {
     jsonWriter.write(propMap);
   }
 
-  @Override
-  public String name() {
-    return name;
-  }
-
-  @Override
-  public String collection() {
-    return collection;
-  }
-
-  @Override
-  public HashRange range() {
-    return range;
-  }
-
-  private final SimpleMap<ShardReplica> _replicas = new SimpleMap<ShardReplica>() {
-    @Override
-    public ShardReplica get(CharSequence key) {
-      return replicas.get(key.toString());
-    }
-
-    @Override
-    public void forEach(BiConsumer<? super CharSequence, ? super ShardReplica> fun) {
-      replicas.forEach(fun::accept);
-    }
-  };
-  @Override
-  public SimpleMap<ShardReplica> replicas() {
-    return _replicas;
-  }
-
-  @Override
-  public String leader() {
-    Replica leader = getLeader();
-    return leader == null ? null : leader.getName();
-  }
 }


[lucene-solr] 01/02: Merge remote-tracking branch 'noble/sdk' into jira/solr14680 merging with noble sdk

Posted by no...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 76718b6c6a8c276f8f6718eb8b56d53101f5e3da
Merge: 9dcc42a 018c18f
Author: noblepaul <no...@gmail.com>
AuthorDate: Fri Aug 7 19:28:14 2020 +1000

    Merge remote-tracking branch 'noble/sdk' into jira/solr14680
    merging with noble sdk

 .../java/org/apache/solr/cluster/api/Config.java   | 40 ++++++++++
 .../org/apache/solr/cluster/api/HashRange.java     | 42 +++++++++++
 .../java/org/apache/solr/cluster/api/Router.java   | 25 +++++++
 .../java/org/apache/solr/cluster/api/Shard.java    | 41 +++++++++++
 .../org/apache/solr/cluster/api/ShardReplica.java  | 47 ++++++++++++
 .../org/apache/solr/cluster/api/SolrCluster.java   | 49 ++++++++++++
 .../apache/solr/cluster/api/SolrCollection.java    | 36 +++++++++
 .../java/org/apache/solr/cluster/api/SolrNode.java | 39 ++++++++++
 .../org/apache/solr/common/cloud/ClusterState.java | 57 +++++++++++++-
 .../apache/solr/common/cloud/DocCollection.java    | 35 ++++++++-
 .../org/apache/solr/common/cloud/DocRouter.java    | 13 +++-
 .../java/org/apache/solr/common/cloud/Replica.java | 38 +++++++++-
 .../java/org/apache/solr/common/cloud/Slice.java   | 43 ++++++++++-
 .../apache/solr/common/cloud/ZkStateReader.java    |  6 +-
 .../solr/common/util/LinkedSimpleHashMap.java      | 27 +++++++
 .../org/apache/solr/common/util/SimpleMap.java     | 86 ++++++++++++++++++++++
 16 files changed, 614 insertions(+), 10 deletions(-)