Skip to content

Commit

Permalink
Resolve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Rishab Nahata <[email protected]>
  • Loading branch information
imRishN committed Sep 6, 2022
1 parent f5c9483 commit fe145ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions server/src/main/java/org/opensearch/OpenSearchException.java
Original file line number Diff line number Diff line change
Expand Up @@ -1614,13 +1614,13 @@ private enum OpenSearchExceptionHandle {
org.opensearch.cluster.decommission.DecommissioningFailedException.class,
org.opensearch.cluster.decommission.DecommissioningFailedException::new,
163,
V_2_3_0
V_3_0_0
),
NODE_DECOMMISSIONED_EXCEPTION(
org.opensearch.cluster.decommission.NodeDecommissionedException.class,
org.opensearch.cluster.decommission.NodeDecommissionedException::new,
164,
V_2_3_0
V_3_0_0
);

final Class<? extends OpenSearchException> exceptionClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void removeDecommissionedNodes(
clusterService.submitStateUpdateTasks(
"node-decommissioned",
nodesDecommissionTasks,
ClusterStateTaskConfig.build(Priority.IMMEDIATE),
ClusterStateTaskConfig.build(Priority.URGENT),
nodeRemovalExecutor
);

Expand All @@ -170,15 +170,16 @@ public void onNewClusterState(ClusterState state) {

@Override
public void onClusterServiceClose() {
logger.debug("cluster service closed while waiting for removal of decommissioned nodes.");
logger.warn("cluster service closed while waiting for removal of decommissioned nodes.");
}

@Override
public void onTimeout(TimeValue timeout) {
logger.info("timed out while waiting for removal of decommissioned nodes");
nodesRemovedListener.onFailure(
new OpenSearchTimeoutException(
"timed out waiting for removal of decommissioned nodes [{}] to take effect",
"timed out [{}] while waiting for removal of decommissioned nodes [{}] to take effect",
timeout.toString(),
nodesToBeDecommissioned.toString()
)
);
Expand Down Expand Up @@ -226,9 +227,11 @@ private static boolean assertStatusTransitionOrFailed(DecommissionStatus oldStat
case DECOMMISSION_SUCCESSFUL:
// if the new status is SUCCESSFUL, the old status has to be IN_PROGRESS
return oldStatus.equals(DecommissionStatus.DECOMMISSION_IN_PROGRESS);
default:
case DECOMMISSION_FAILED:
// if the new status is FAILED, we don't need to assert for previous state
return true;
default:
throw new IllegalStateException("unexpected status [" + newStatus.status() + "] requested to update");
}
}
}

0 comments on commit fe145ae

Please sign in to comment.