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
|
* 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
|
||||||
|
|
|
@ -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,47 +363,33 @@ public class Overseer implements Closeable {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
OverseerAction overseerAction = OverseerAction.get(operation);
|
OverseerAction overseerAction = OverseerAction.get(operation);
|
||||||
if (overseerAction != null) {
|
if (overseerAction == null) {
|
||||||
switch (overseerAction) {
|
throw new RuntimeException("unknown operation:" + operation + " contents:" + message.getProperties());
|
||||||
case STATE:
|
}
|
||||||
return new ReplicaMutator(getZkStateReader()).setState(clusterState, message);
|
switch (overseerAction) {
|
||||||
case LEADER:
|
case STATE:
|
||||||
return new SliceMutator(getZkStateReader()).setShardLeader(clusterState, message);
|
return new ReplicaMutator(getZkStateReader()).setState(clusterState, message);
|
||||||
case DELETECORE:
|
case LEADER:
|
||||||
return new SliceMutator(getZkStateReader()).removeReplica(clusterState, message);
|
return new SliceMutator(getZkStateReader()).setShardLeader(clusterState, message);
|
||||||
case ADDROUTINGRULE:
|
case DELETECORE:
|
||||||
return new SliceMutator(getZkStateReader()).addRoutingRule(clusterState, message);
|
return new SliceMutator(getZkStateReader()).removeReplica(clusterState, message);
|
||||||
case REMOVEROUTINGRULE:
|
case ADDROUTINGRULE:
|
||||||
return new SliceMutator(getZkStateReader()).removeRoutingRule(clusterState, message);
|
return new SliceMutator(getZkStateReader()).addRoutingRule(clusterState, message);
|
||||||
case UPDATESHARDSTATE:
|
case REMOVEROUTINGRULE:
|
||||||
return new SliceMutator(getZkStateReader()).updateShardState(clusterState, message);
|
return new SliceMutator(getZkStateReader()).removeRoutingRule(clusterState, message);
|
||||||
case QUIT:
|
case UPDATESHARDSTATE:
|
||||||
if (myId.equals(message.get("id"))) {
|
return new SliceMutator(getZkStateReader()).updateShardState(clusterState, message);
|
||||||
log.info("Quit command received {}", LeaderElector.getNodeName(myId));
|
case QUIT:
|
||||||
overseerCollectionProcessor.close();
|
if (myId.equals(message.get("id"))) {
|
||||||
close();
|
log.info("Quit command received {}", LeaderElector.getNodeName(myId));
|
||||||
} else {
|
overseerCollectionProcessor.close();
|
||||||
log.warn("Overseer received wrong QUIT message {}", message);
|
close();
|
||||||
}
|
} else {
|
||||||
break;
|
log.warn("Overseer received wrong QUIT message {}", message);
|
||||||
default:
|
}
|
||||||
throw new RuntimeException("unknown operation:" + operation
|
break;
|
||||||
+ " contents:" + message.getProperties());
|
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());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,24 +131,6 @@ public class OverseerCollectionProcessor implements Runnable, Closeable {
|
||||||
static final boolean CREATE_NODE_SET_SHUFFLE_DEFAULT = true;
|
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_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";
|
||||||
|
|
||||||
|
@ -587,88 +569,71 @@ 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:
|
switch (action) {
|
||||||
createCollection(zkStateReader.getClusterState(), message, results);
|
case CREATE:
|
||||||
break;
|
createCollection(zkStateReader.getClusterState(), message, results);
|
||||||
case DELETECOLLECTION:
|
break;
|
||||||
deleteCollection(message, results);
|
case DELETE:
|
||||||
break;
|
deleteCollection(message, results);
|
||||||
case RELOADCOLLECTION:
|
break;
|
||||||
ModifiableSolrParams params = new ModifiableSolrParams();
|
case RELOAD:
|
||||||
params.set(CoreAdminParams.ACTION, CoreAdminAction.RELOAD.toString());
|
ModifiableSolrParams params = new ModifiableSolrParams();
|
||||||
collectionCmd(zkStateReader.getClusterState(), message, params, results, ZkStateReader.ACTIVE);
|
params.set(CoreAdminParams.ACTION, CoreAdminAction.RELOAD.toString());
|
||||||
break;
|
collectionCmd(zkStateReader.getClusterState(), message, params, results, ZkStateReader.ACTIVE);
|
||||||
default:
|
break;
|
||||||
throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown operation:"
|
case CREATEALIAS:
|
||||||
+ operation);
|
createAlias(zkStateReader.getAliases(), message);
|
||||||
}
|
break;
|
||||||
} else {
|
case DELETEALIAS:
|
||||||
switch (action) {
|
deleteAlias(zkStateReader.getAliases(), message);
|
||||||
case CREATE:
|
break;
|
||||||
createCollection(zkStateReader.getClusterState(), message, results);
|
case SPLITSHARD:
|
||||||
break;
|
splitShard(zkStateReader.getClusterState(), message, results);
|
||||||
case DELETE:
|
break;
|
||||||
deleteCollection(message, results);
|
case DELETESHARD:
|
||||||
break;
|
deleteShard(zkStateReader.getClusterState(), message, results);
|
||||||
case RELOAD:
|
break;
|
||||||
ModifiableSolrParams params = new ModifiableSolrParams();
|
case CREATESHARD:
|
||||||
params.set(CoreAdminParams.ACTION, CoreAdminAction.RELOAD.toString());
|
createShard(zkStateReader.getClusterState(), message, results);
|
||||||
collectionCmd(zkStateReader.getClusterState(), message, params, results, ZkStateReader.ACTIVE);
|
break;
|
||||||
break;
|
case DELETEREPLICA:
|
||||||
case CREATEALIAS:
|
deleteReplica(zkStateReader.getClusterState(), message, results);
|
||||||
createAlias(zkStateReader.getAliases(), message);
|
break;
|
||||||
break;
|
case MIGRATE:
|
||||||
case DELETEALIAS:
|
migrate(zkStateReader.getClusterState(), message, results);
|
||||||
deleteAlias(zkStateReader.getAliases(), message);
|
break;
|
||||||
break;
|
case ADDROLE:
|
||||||
case SPLITSHARD:
|
processRoleCommand(message, operation);
|
||||||
splitShard(zkStateReader.getClusterState(), message, results);
|
break;
|
||||||
break;
|
case REMOVEROLE:
|
||||||
case DELETESHARD:
|
processRoleCommand(message, operation);
|
||||||
deleteShard(zkStateReader.getClusterState(), message, results);
|
break;
|
||||||
break;
|
case ADDREPLICA:
|
||||||
case CREATESHARD:
|
addReplica(zkStateReader.getClusterState(), message, results);
|
||||||
createShard(zkStateReader.getClusterState(), message, results);
|
break;
|
||||||
break;
|
case OVERSEERSTATUS:
|
||||||
case DELETEREPLICA:
|
getOverseerStatus(message, results);
|
||||||
deleteReplica(zkStateReader.getClusterState(), message, results);
|
break;
|
||||||
break;
|
case CLUSTERSTATUS:
|
||||||
case MIGRATE:
|
getClusterStatus(zkStateReader.getClusterState(), message, results);
|
||||||
migrate(zkStateReader.getClusterState(), message, results);
|
break;
|
||||||
break;
|
case ADDREPLICAPROP:
|
||||||
case ADDROLE:
|
processReplicaAddPropertyCommand(message);
|
||||||
processRoleCommand(message, operation);
|
break;
|
||||||
break;
|
case DELETEREPLICAPROP:
|
||||||
case REMOVEROLE:
|
processReplicaDeletePropertyCommand(message);
|
||||||
processRoleCommand(message, operation);
|
break;
|
||||||
break;
|
case BALANCESHARDUNIQUE:
|
||||||
case ADDREPLICA:
|
balanceProperty(message);
|
||||||
addReplica(zkStateReader.getClusterState(), message, results);
|
break;
|
||||||
break;
|
case REBALANCELEADERS:
|
||||||
case OVERSEERSTATUS:
|
processRebalanceLeaders(message);
|
||||||
getOverseerStatus(message, results);
|
break;
|
||||||
break;
|
default:
|
||||||
case CLUSTERSTATUS:
|
throw new SolrException(ErrorCode.BAD_REQUEST, "Unknown operation:"
|
||||||
getClusterStatus(zkStateReader.getClusterState(), message, results);
|
+ operation);
|
||||||
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) {
|
} catch (Exception e) {
|
||||||
String collName = message.getStr("collection");
|
String collName = message.getStr("collection");
|
||||||
|
|
Loading…
Reference in New Issue