use of org.apache.hadoop.hdds.scm.container.ContainerException in project ozone by apache.
the class DeadNodeHandler method removeContainerReplicas.
/**
* Removes the ContainerReplica of the dead datanode from the containers
* which are hosted by that datanode.
*
* @param datanodeDetails DatanodeDetails
* @throws NodeNotFoundException
*/
private void removeContainerReplicas(final DatanodeDetails datanodeDetails) throws NodeNotFoundException {
nodeManager.getContainers(datanodeDetails).forEach(id -> {
try {
final ContainerInfo container = containerManager.getContainer(id);
// Identify and remove the ContainerReplica of dead node
containerManager.getContainerReplicas(id).stream().filter(r -> r.getDatanodeDetails().equals(datanodeDetails)).findFirst().ifPresent(replica -> {
try {
containerManager.removeContainerReplica(id, replica);
} catch (ContainerException ex) {
LOG.warn("Exception while removing container replica #{} " + "of container {}.", replica, container, ex);
}
});
} catch (ContainerNotFoundException cnfe) {
LOG.warn("Container {} is not managed by ContainerManager.", id, cnfe);
}
});
}
Aggregations