SOLR-7202: Remove deprecated string action types in Overseer, OverseerCollectionProcessor - deletecollection, createcollection, reloadcollection, removecollection, removeshard

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1669748 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Varun Thacker 2015-03-28 11:47:17 +00:00
parent 421897ea3c
commit c7427a2fd1
3 changed files with 96 additions and 153 deletions

View File

@ -1242,6 +1242,10 @@ Other Changes
* SOLR-6227: Avoid spurious failures of ChaosMonkeySafeLeaderTest by ensuring there's * SOLR-6227: Avoid spurious failures of ChaosMonkeySafeLeaderTest by ensuring there's
at least one jetty to kill. (shalin) 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 ================== ================== 4.10.4 ==================
Bug Fixes Bug Fixes

View File

@ -74,18 +74,6 @@ import static org.apache.solr.common.params.CollectionParams.CollectionAction.BA
public class Overseer implements Closeable { public class Overseer implements Closeable {
public static final String QUEUE_OPERATION = "operation"; 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 public static final int STATE_UPDATE_DELAY = 1500; // delay between cloud state updates
private static Logger log = LoggerFactory.getLogger(Overseer.class); private static Logger log = LoggerFactory.getLogger(Overseer.class);
@ -375,7 +363,9 @@ public class Overseer implements Closeable {
} }
} else { } else {
OverseerAction overseerAction = OverseerAction.get(operation); OverseerAction overseerAction = OverseerAction.get(operation);
if (overseerAction != null) { if (overseerAction == null) {
throw new RuntimeException("unknown operation:" + operation + " contents:" + message.getProperties());
}
switch (overseerAction) { switch (overseerAction) {
case STATE: case STATE:
return new ReplicaMutator(getZkStateReader()).setState(clusterState, message); return new ReplicaMutator(getZkStateReader()).setState(clusterState, message);
@ -399,23 +389,7 @@ public class Overseer implements Closeable {
} }
break; break;
default: default:
throw new RuntimeException("unknown operation:" + operation throw new RuntimeException("unknown operation:" + operation + " contents:" + message.getProperties());
+ " 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());
}
} }
} }

View File

@ -132,24 +132,6 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {
public static final String CREATE_NODE_SET_SHUFFLE = "createNodeSet.shuffle"; public static final String CREATE_NODE_SET_SHUFFLE = "createNodeSet.shuffle";
public static final String CREATE_NODE_SET = "createNodeSet"; 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"; public static final String ROUTER = "router";
public static final String SHARDS_PROP = "shards"; public static final String SHARDS_PROP = "shards";
@ -587,24 +569,8 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {
zkStateReader.updateClusterState(true); zkStateReader.updateClusterState(true);
CollectionParams.CollectionAction action = CollectionParams.CollectionAction.get(operation); CollectionParams.CollectionAction action = CollectionParams.CollectionAction.get(operation);
if (action == null) { if (action == null) {
// back-compat because we used strings different than enum values before SOLR-6115 throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown operation:" + operation);
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) { switch (action) {
case CREATE: case CREATE:
createCollection(zkStateReader.getClusterState(), message, results); createCollection(zkStateReader.getClusterState(), message, results);
@ -669,7 +635,6 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {
throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown operation:" throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown operation:"
+ operation); + operation);
} }
}
} catch (Exception e) { } catch (Exception e) {
String collName = message.getStr("collection"); String collName = message.getStr("collection");
if (collName == null) collName = message.getStr("name"); if (collName == null) collName = message.getStr("name");