Skip to content

Commit

Permalink
Remove some obsolete exceptions (#69675)
Browse files Browse the repository at this point in the history
- `NodeShouldNotConnectException` has not been instantiated since 5.0
- `GatewayException` has not been instantiated since 5.0
- `SnapshotFailedEngineException` has not been instantated since 6.2.0
  (#28038) and was never thrown across clusters

This commit removes these obsolete exceptions.
  • Loading branch information
DaveCTurner committed Mar 1, 2021
1 parent 88b9db3 commit 6588538
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,7 @@ private enum ElasticsearchExceptionHandle {
org.elasticsearch.action.search.ReduceSearchPhaseException::new, 8, UNKNOWN_VERSION_ADDED),
NODE_CLOSED_EXCEPTION(org.elasticsearch.node.NodeClosedException.class,
org.elasticsearch.node.NodeClosedException::new, 9, UNKNOWN_VERSION_ADDED),
SNAPSHOT_FAILED_ENGINE_EXCEPTION(org.elasticsearch.index.engine.SnapshotFailedEngineException.class,
org.elasticsearch.index.engine.SnapshotFailedEngineException::new, 10, UNKNOWN_VERSION_ADDED),
// 10 was for SnapshotFailedEngineException, never instantiated in 6.2.0+ and never thrown across clusters
SHARD_NOT_FOUND_EXCEPTION(org.elasticsearch.index.shard.ShardNotFoundException.class,
org.elasticsearch.index.shard.ShardNotFoundException::new, 11, UNKNOWN_VERSION_ADDED),
CONNECT_TRANSPORT_EXCEPTION(org.elasticsearch.transport.ConnectTransportException.class,
Expand Down Expand Up @@ -810,8 +809,7 @@ private enum ElasticsearchExceptionHandle {
org.elasticsearch.indices.recovery.RecoveryFailedException::new, 44, UNKNOWN_VERSION_ADDED),
INDEX_SHARD_RELOCATED_EXCEPTION(org.elasticsearch.index.shard.IndexShardRelocatedException.class,
org.elasticsearch.index.shard.IndexShardRelocatedException::new, 45, UNKNOWN_VERSION_ADDED),
NODE_SHOULD_NOT_CONNECT_EXCEPTION(org.elasticsearch.transport.NodeShouldNotConnectException.class,
org.elasticsearch.transport.NodeShouldNotConnectException::new, 46, UNKNOWN_VERSION_ADDED),
// 46 was for NodeShouldNotConnectException, never instantiated in 5.0+
// 47 used to be for IndexTemplateAlreadyExistsException which was deprecated in 5.1 removed in 6.0
TRANSLOG_CORRUPTED_EXCEPTION(org.elasticsearch.index.translog.TranslogCorruptedException.class,
org.elasticsearch.index.translog.TranslogCorruptedException::new, 48, UNKNOWN_VERSION_ADDED),
Expand Down Expand Up @@ -841,8 +839,7 @@ private enum ElasticsearchExceptionHandle {
ALIAS_FILTER_PARSING_EXCEPTION(org.elasticsearch.indices.AliasFilterParsingException.class,
org.elasticsearch.indices.AliasFilterParsingException::new, 63, UNKNOWN_VERSION_ADDED),
// 64 was DeleteByQueryFailedEngineException, which was removed in 5.0
GATEWAY_EXCEPTION(org.elasticsearch.gateway.GatewayException.class, org.elasticsearch.gateway.GatewayException::new, 65,
UNKNOWN_VERSION_ADDED),
// 65 was for GatewayException, never instantiated in 5.0+
INDEX_SHARD_NOT_RECOVERING_EXCEPTION(org.elasticsearch.index.shard.IndexShardNotRecoveringException.class,
org.elasticsearch.index.shard.IndexShardNotRecoveringException::new, 66, UNKNOWN_VERSION_ADDED),
HTTP_EXCEPTION(org.elasticsearch.http.HttpException.class, org.elasticsearch.http.HttpException::new, 67, UNKNOWN_VERSION_ADDED),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.elasticsearch.tasks.Task;
import org.elasticsearch.tasks.TaskCancelledException;
import org.elasticsearch.tasks.TaskId;
import org.elasticsearch.transport.NodeShouldNotConnectException;
import org.elasticsearch.transport.TransportChannel;
import org.elasticsearch.transport.TransportException;
import org.elasticsearch.transport.TransportRequest;
Expand Down Expand Up @@ -360,9 +359,7 @@ protected void onNodeResponse(DiscoveryNode node, int nodeIndex, NodeResponse re

protected void onNodeFailure(DiscoveryNode node, int nodeIndex, Throwable t) {
String nodeId = node.getId();
if (logger.isDebugEnabled() && (t instanceof NodeShouldNotConnectException) == false) {
logger.debug(new ParameterizedMessage("failed to execute [{}] on node [{}]", actionName, nodeId), t);
}
logger.debug(new ParameterizedMessage("failed to execute [{}] on node [{}]", actionName, nodeId), t);

// this is defensive to protect against the possibility of double invocation
// the current implementation of TransportService#sendRequest guards against this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.NodeShouldNotConnectException;
import org.elasticsearch.transport.TransportChannel;
import org.elasticsearch.transport.TransportException;
import org.elasticsearch.transport.TransportRequest;
Expand Down Expand Up @@ -251,9 +250,7 @@ private void onOperation(int idx, NodeResponse nodeResponse) {
}

private void onFailure(int idx, String nodeId, Throwable t) {
if (logger.isDebugEnabled() && (t instanceof NodeShouldNotConnectException) == false) {
logger.debug(new ParameterizedMessage("failed to execute on node [{}]", nodeId), t);
}
logger.debug(new ParameterizedMessage("failed to execute on node [{}]", nodeId), t);
responses.set(idx, new FailedNodeException(nodeId, "Failed node [" + nodeId + "]", t));
if (counter.incrementAndGet() == responses.length()) {
finishHim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.util.concurrent.AtomicArray;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.transport.NodeShouldNotConnectException;
import org.elasticsearch.transport.TransportChannel;
import org.elasticsearch.transport.TransportException;
import org.elasticsearch.transport.TransportRequest;
Expand Down Expand Up @@ -279,9 +278,7 @@ private void onOperation(int idx, NodeTasksResponse nodeResponse) {
}

private void onFailure(int idx, String nodeId, Throwable t) {
if (logger.isDebugEnabled() && (t instanceof NodeShouldNotConnectException) == false) {
logger.debug(new ParameterizedMessage("failed to execute on node [{}]", nodeId), t);
}
logger.debug(new ParameterizedMessage("failed to execute on node [{}]", nodeId), t);

responses.set(idx, new FailedNodeException(nodeId, "Failed node [" + nodeId + "]", t));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Gateway(final Settings settings, final ClusterService clusterService,
this.minimumMasterNodes = ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.get(settings);
}

public void performStateRecovery(final GatewayStateRecoveredListener listener) throws GatewayException {
public void performStateRecovery(final GatewayStateRecoveredListener listener) {
final String[] nodesIds = clusterService.state().nodes().getMasterNodes().keys().toArray(String.class);
logger.trace("performing state recovery from {}", Arrays.toString(nodesIds));
final TransportNodesListGatewayMetaState.NodesGatewayMetaState nodesState = listGatewayMetaState.list(nodesIds, null).actionGet();
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ public void testIds() {
ids.put(7, org.elasticsearch.http.BindHttpException.class);
ids.put(8, org.elasticsearch.action.search.ReduceSearchPhaseException.class);
ids.put(9, org.elasticsearch.node.NodeClosedException.class);
ids.put(10, org.elasticsearch.index.engine.SnapshotFailedEngineException.class);
ids.put(10, null); // SnapshotFailedEngineException, never instantiated in 6.2.0+ and never thrown across clusters
ids.put(11, org.elasticsearch.index.shard.ShardNotFoundException.class);
ids.put(12, org.elasticsearch.transport.ConnectTransportException.class);
ids.put(13, org.elasticsearch.transport.NotSerializableTransportException.class);
Expand Down Expand Up @@ -710,7 +710,7 @@ public void testIds() {
ids.put(43, org.elasticsearch.index.translog.TruncatedTranslogException.class);
ids.put(44, org.elasticsearch.indices.recovery.RecoveryFailedException.class);
ids.put(45, org.elasticsearch.index.shard.IndexShardRelocatedException.class);
ids.put(46, org.elasticsearch.transport.NodeShouldNotConnectException.class);
ids.put(46, null); // NodeShouldNotConnectException, never instantiated in 5.0+
ids.put(47, null);
ids.put(48, org.elasticsearch.index.translog.TranslogCorruptedException.class);
ids.put(49, org.elasticsearch.cluster.block.ClusterBlockException.class);
Expand All @@ -729,7 +729,7 @@ public void testIds() {
ids.put(62, org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper.class);
ids.put(63, org.elasticsearch.indices.AliasFilterParsingException.class);
ids.put(64, null); // DeleteByQueryFailedEngineException was removed in 3.0
ids.put(65, org.elasticsearch.gateway.GatewayException.class);
ids.put(65, null); // GatewayException, never instantiated in 5.0+
ids.put(66, org.elasticsearch.index.shard.IndexShardNotRecoveringException.class);
ids.put(67, org.elasticsearch.http.HttpException.class);
ids.put(68, org.elasticsearch.ElasticsearchException.class);
Expand Down

0 comments on commit 6588538

Please sign in to comment.