Search in sources :

Example 1 with ContainerException

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);
        }
    });
}
Also used : ContainerException(org.apache.hadoop.hdds.scm.container.ContainerException) ContainerInfo(org.apache.hadoop.hdds.scm.container.ContainerInfo) ContainerNotFoundException(org.apache.hadoop.hdds.scm.container.ContainerNotFoundException)

Aggregations

ContainerException (org.apache.hadoop.hdds.scm.container.ContainerException)1 ContainerInfo (org.apache.hadoop.hdds.scm.container.ContainerInfo)1 ContainerNotFoundException (org.apache.hadoop.hdds.scm.container.ContainerNotFoundException)1