lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r1669777 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/cloud/Overseer.java solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
Date Sat, 28 Mar 2015 14:11:48 GMT
Author: varun
Date: Sat Mar 28 14:11:47 2015
New Revision: 1669777

URL: http://svn.apache.org/r1669777
Log:
SOLR-7202: Remove deprecated string action types in Overseer, OverseerCollectionProcessor
- deletecollection, createcollection, reloadcollection, removecollection, removeshard (merging
from trunk)

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/Overseer.java
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1669777&r1=1669776&r2=1669777&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Sat Mar 28 14:11:47 2015
@@ -1175,6 +1175,10 @@ Other Changes
 * SOLR-6227: Avoid spurious failures of ChaosMonkeySafeLeaderTest by ensuring there's
   at least one jetty to kill. (shalin)
 
+* SOLR-7202: Remove deprecated string action types in Overseer and OverseerCollectionProcessor
-
+  "deletecollection", "createcollection", "reloadcollection", "removecollection", "removeshard".
+  (Varun Thacker, shalin)
+
 ==================  4.10.4 ==================
 
 Bug Fixes

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/Overseer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/Overseer.java?rev=1669777&r1=1669776&r2=1669777&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/Overseer.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/Overseer.java Sat
Mar 28 14:11:47 2015
@@ -74,18 +74,6 @@ import static org.apache.solr.common.par
 public class Overseer implements Closeable {
   public static final String QUEUE_OPERATION = "operation";
 
-  /**
-   * @deprecated use {@link org.apache.solr.common.params.CollectionParams.CollectionAction#DELETE}
-   */
-  @Deprecated
-  public static final String REMOVECOLLECTION = "removecollection";
-
-  /**
-   * @deprecated use {@link org.apache.solr.common.params.CollectionParams.CollectionAction#DELETESHARD}
-   */
-  @Deprecated
-  public static final String REMOVESHARD = "removeshard";
-
   public static final int STATE_UPDATE_DELAY = 1500;  // delay between cloud state updates
 
   private static Logger log = LoggerFactory.getLogger(Overseer.class);
@@ -375,47 +363,33 @@ public class Overseer implements Closeab
         }
       } else {
         OverseerAction overseerAction = OverseerAction.get(operation);
-        if (overseerAction != null) {
-          switch (overseerAction) {
-            case STATE:
-              return new ReplicaMutator(getZkStateReader()).setState(clusterState, message);
-            case LEADER:
-              return new SliceMutator(getZkStateReader()).setShardLeader(clusterState, message);
-            case DELETECORE:
-              return new SliceMutator(getZkStateReader()).removeReplica(clusterState, message);
-            case ADDROUTINGRULE:
-              return new SliceMutator(getZkStateReader()).addRoutingRule(clusterState, message);
-            case REMOVEROUTINGRULE:
-              return new SliceMutator(getZkStateReader()).removeRoutingRule(clusterState,
message);
-            case UPDATESHARDSTATE:
-              return new SliceMutator(getZkStateReader()).updateShardState(clusterState,
message);
-            case QUIT:
-              if (myId.equals(message.get("id"))) {
-                log.info("Quit command received {}", LeaderElector.getNodeName(myId));
-                overseerCollectionProcessor.close();
-                close();
-              } else {
-                log.warn("Overseer received wrong QUIT message {}", message);
-              }
-              break;
-            default:
-              throw new RuntimeException("unknown operation:" + operation
-                  + " contents:" + message.getProperties());
-          }
-        } else  {
-          // merely for back-compat where overseer action names were different from the ones
-          // specified in CollectionAction. See SOLR-6115. Remove this in 5.0
-          switch (operation) {
-            case OverseerCollectionProcessor.CREATECOLLECTION:
-              return new ClusterStateMutator(getZkStateReader()).createCollection(clusterState,
message);
-            case REMOVECOLLECTION:
-              return new ClusterStateMutator(getZkStateReader()).deleteCollection(clusterState,
message);
-            case REMOVESHARD:
-              return new CollectionMutator(getZkStateReader()).deleteShard(clusterState,
message);
-            default:
-              throw new RuntimeException("unknown operation:" + operation
-                  + " contents:" + message.getProperties());
-          }
+        if (overseerAction == null) {
+          throw new RuntimeException("unknown operation:" + operation + " contents:" + message.getProperties());
+        }
+        switch (overseerAction) {
+          case STATE:
+            return new ReplicaMutator(getZkStateReader()).setState(clusterState, message);
+          case LEADER:
+            return new SliceMutator(getZkStateReader()).setShardLeader(clusterState, message);
+          case DELETECORE:
+            return new SliceMutator(getZkStateReader()).removeReplica(clusterState, message);
+          case ADDROUTINGRULE:
+            return new SliceMutator(getZkStateReader()).addRoutingRule(clusterState, message);
+          case REMOVEROUTINGRULE:
+            return new SliceMutator(getZkStateReader()).removeRoutingRule(clusterState, message);
+          case UPDATESHARDSTATE:
+            return new SliceMutator(getZkStateReader()).updateShardState(clusterState, message);
+          case QUIT:
+            if (myId.equals(message.get("id"))) {
+              log.info("Quit command received {}", LeaderElector.getNodeName(myId));
+              overseerCollectionProcessor.close();
+              close();
+            } else {
+              log.warn("Overseer received wrong QUIT message {}", message);
+            }
+            break;
+          default:
+            throw new RuntimeException("unknown operation:" + operation + " contents:" +
message.getProperties());
         }
       }
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java?rev=1669777&r1=1669776&r2=1669777&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/cloud/OverseerCollectionProcessor.java
Sat Mar 28 14:11:47 2015
@@ -130,24 +130,6 @@ public class OverseerCollectionProcessor
   static final boolean CREATE_NODE_SET_SHUFFLE_DEFAULT = true;
   public static final String CREATE_NODE_SET_SHUFFLE = "createNodeSet.shuffle";
   public static final String CREATE_NODE_SET = "createNodeSet";
-
-  /**
-   * @deprecated use {@link org.apache.solr.common.params.CollectionParams.CollectionAction#DELETE}
-   */
-  @Deprecated
-  public static final String DELETECOLLECTION = "deletecollection";
-
-  /**
-   * @deprecated use {@link org.apache.solr.common.params.CollectionParams.CollectionAction#CREATE}
-   */
-  @Deprecated
-  public static final String CREATECOLLECTION = "createcollection";
-
-  /**
-   * @deprecated use {@link org.apache.solr.common.params.CollectionParams.CollectionAction#RELOAD}
-   */
-  @Deprecated
-  public static final String RELOADCOLLECTION = "reloadcollection";
   
   public static final String ROUTER = "router";
 
@@ -586,88 +568,71 @@ public class OverseerCollectionProcessor
       zkStateReader.updateClusterState(true);
       CollectionParams.CollectionAction action = CollectionParams.CollectionAction.get(operation);
       if (action == null) {
-        // back-compat because we used strings different than enum values before SOLR-6115
-        switch (operation) {
-          case CREATECOLLECTION:
-            createCollection(zkStateReader.getClusterState(), message, results);
-            break;
-          case DELETECOLLECTION:
-            deleteCollection(message, results);
-            break;
-          case RELOADCOLLECTION:
-            ModifiableSolrParams params = new ModifiableSolrParams();
-            params.set(CoreAdminParams.ACTION, CoreAdminAction.RELOAD.toString());
-            collectionCmd(zkStateReader.getClusterState(), message, params, results, ZkStateReader.ACTIVE);
-            break;
-          default:
-            throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown operation:"
-                + operation);
-        }
-      } else  {
-        switch (action) {
-          case CREATE:
-            createCollection(zkStateReader.getClusterState(), message, results);
-            break;
-          case DELETE:
-            deleteCollection(message, results);
-            break;
-          case RELOAD:
-            ModifiableSolrParams params = new ModifiableSolrParams();
-            params.set(CoreAdminParams.ACTION, CoreAdminAction.RELOAD.toString());
-            collectionCmd(zkStateReader.getClusterState(), message, params, results, ZkStateReader.ACTIVE);
-            break;
-          case CREATEALIAS:
-            createAlias(zkStateReader.getAliases(), message);
-            break;
-          case DELETEALIAS:
-            deleteAlias(zkStateReader.getAliases(), message);
-            break;
-          case SPLITSHARD:
-            splitShard(zkStateReader.getClusterState(), message, results);
-            break;
-          case DELETESHARD:
-            deleteShard(zkStateReader.getClusterState(), message, results);
-            break;
-          case CREATESHARD:
-            createShard(zkStateReader.getClusterState(), message, results);
-            break;
-          case DELETEREPLICA:
-            deleteReplica(zkStateReader.getClusterState(), message, results);
-            break;
-          case MIGRATE:
-            migrate(zkStateReader.getClusterState(), message, results);
-            break;
-          case ADDROLE:
-            processRoleCommand(message, operation);
-            break;
-          case REMOVEROLE:
-            processRoleCommand(message, operation);
-            break;
-          case ADDREPLICA:
-            addReplica(zkStateReader.getClusterState(), message, results);
-            break;
-          case OVERSEERSTATUS:
-            getOverseerStatus(message, results);
-            break;
-          case CLUSTERSTATUS:
-            getClusterStatus(zkStateReader.getClusterState(), message, results);
-            break;
-          case ADDREPLICAPROP:
-            processReplicaAddPropertyCommand(message);
-            break;
-          case DELETEREPLICAPROP:
-            processReplicaDeletePropertyCommand(message);
-            break;
-          case BALANCESHARDUNIQUE:
-            balanceProperty(message);
-            break;
-          case REBALANCELEADERS:
-            processRebalanceLeaders(message);
-            break;
-          default:
-            throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown operation:"
-                + operation);
-        }
+        throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown operation:" + operation);
+      }
+      switch (action) {
+        case CREATE:
+          createCollection(zkStateReader.getClusterState(), message, results);
+          break;
+        case DELETE:
+          deleteCollection(message, results);
+          break;
+        case RELOAD:
+          ModifiableSolrParams params = new ModifiableSolrParams();
+          params.set(CoreAdminParams.ACTION, CoreAdminAction.RELOAD.toString());
+          collectionCmd(zkStateReader.getClusterState(), message, params, results, ZkStateReader.ACTIVE);
+          break;
+        case CREATEALIAS:
+          createAlias(zkStateReader.getAliases(), message);
+          break;
+        case DELETEALIAS:
+          deleteAlias(zkStateReader.getAliases(), message);
+          break;
+        case SPLITSHARD:
+          splitShard(zkStateReader.getClusterState(), message, results);
+          break;
+        case DELETESHARD:
+          deleteShard(zkStateReader.getClusterState(), message, results);
+          break;
+        case CREATESHARD:
+          createShard(zkStateReader.getClusterState(), message, results);
+          break;
+        case DELETEREPLICA:
+          deleteReplica(zkStateReader.getClusterState(), message, results);
+          break;
+        case MIGRATE:
+          migrate(zkStateReader.getClusterState(), message, results);
+          break;
+        case ADDROLE:
+          processRoleCommand(message, operation);
+          break;
+        case REMOVEROLE:
+          processRoleCommand(message, operation);
+          break;
+        case ADDREPLICA:
+          addReplica(zkStateReader.getClusterState(), message, results);
+          break;
+        case OVERSEERSTATUS:
+          getOverseerStatus(message, results);
+          break;
+        case CLUSTERSTATUS:
+          getClusterStatus(zkStateReader.getClusterState(), message, results);
+          break;
+        case ADDREPLICAPROP:
+          processReplicaAddPropertyCommand(message);
+          break;
+        case DELETEREPLICAPROP:
+          processReplicaDeletePropertyCommand(message);
+          break;
+        case BALANCESHARDUNIQUE:
+          balanceProperty(message);
+          break;
+        case REBALANCELEADERS:
+          processRebalanceLeaders(message);
+          break;
+        default:
+          throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown operation:"
+              + operation);
       }
     } catch (Exception e) {
       String collName = message.getStr("collection");



Mime
View raw message