mirror of https://github.com/apache/lucene.git
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:
parent
421897ea3c
commit
c7427a2fd1
|
@ -1242,6 +1242,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
|
||||
|
|
|
@ -74,18 +74,6 @@ import static org.apache.solr.common.params.CollectionParams.CollectionAction.BA
|
|||
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 Closeable {
|
|||
}
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -131,24 +131,6 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {
|
|||
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";
|
||||
|
||||
|
@ -587,88 +569,71 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {
|
|||
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");
|
||||
|
|
Loading…
Reference in New Issue