Example usage for org.apache.hadoop.hdfs.server.protocol DatanodeProtocol DISK_ERROR

List of usage examples for org.apache.hadoop.hdfs.server.protocol DatanodeProtocol DISK_ERROR

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs.server.protocol DatanodeProtocol DISK_ERROR.

Prototype

int DISK_ERROR

To view the source code for org.apache.hadoop.hdfs.server.protocol DatanodeProtocol DISK_ERROR.

Click Source Link

Usage

From source file:common.DataNode.java

License:Apache License

private void handleDiskError(String errMsgr) {
    boolean hasEnoughResource = data.hasEnoughResource();
    LOG.warn("DataNode.handleDiskError: Keep Running: " + hasEnoughResource);

    //if hasEnoughtResource = true - more volumes are available, so we don't want 
    // to shutdown DN completely and don't want NN to remove it.
    int dp_error = DatanodeProtocol.DISK_ERROR;
    if (hasEnoughResource == false) {
        // DN will be shutdown and NN should remove it
        dp_error = DatanodeProtocol.FATAL_DISK_ERROR;
    }//from ww  w. j a va  2s.  co m
    //inform NameNode
    try {
        namenode.errorReport(dnRegistration, dp_error, errMsgr);
    } catch (IOException ignored) {
    }

    if (hasEnoughResource) {
        scheduleBlockReport(0);
        return; // do not shutdown
    }

    LOG.warn("DataNode is shutting down.\n" + errMsgr);
    shouldRun = false;
}

From source file:common.NameNode.java

License:Apache License

/**
 *///from  w  w w.jav a 2 s  .  co  m
public void errorReport(DatanodeRegistration nodeReg, int errorCode, String msg) throws IOException {
    // Log error message from datanode
    String dnName = (nodeReg == null ? "unknown DataNode" : nodeReg.getName());
    LOG.info("Error report from " + dnName + ": " + msg);
    if (errorCode == DatanodeProtocol.NOTIFY) {
        return;
    }
    verifyRequest(nodeReg);
    if (errorCode == DatanodeProtocol.DISK_ERROR) {
        LOG.warn("Volume failed on " + dnName);
    } else if (errorCode == DatanodeProtocol.FATAL_DISK_ERROR) {
        namesystem.removeDatanode(nodeReg);
    }
}