ZanderXu created HDFS-16961:
-------------------------------

             Summary: The blockReport RPC should throw 
UnregisteredNodeException when the storedDN is null
                 Key: HDFS-16961
                 URL: https://issues.apache.org/jira/browse/HDFS-16961
             Project: Hadoop HDFS
          Issue Type: Bug
            Reporter: ZanderXu
            Assignee: ZanderXu


The blockReport RPC should throw UnregisteredNodeException when the storedDN is 
null, and the related code as bellows:
{code:java}
public void removeBRLeaseIfNeeded(final DatanodeID nodeID,
    final BlockReportContext context) throws IOException {
  namesystem.writeLock(OperationName.REMOVE_BR_LEASE_IF_NEEDED);
  DatanodeDescriptor node;
  try {
    // Here, if the node is null, should throw UnregisteredNodeException 
instand of NPE
    node = datanodeManager.getDatanode(nodeID);
    if (context != null) {
      if (context.getTotalRpcs() == context.getCurRpc() + 1) {
        long leaseId = this.getBlockReportLeaseManager().removeLease(node);
        BlockManagerFaultInjector.getInstance().
            removeBlockReportLease(node, leaseId);
        node.setLastBlockReportTime(now());
        node.setLastBlockReportMonotonic(Time.monotonicNow());
      }
      LOG.debug("Processing RPC with index {} out of total {} RPCs in "
              + "processReport 0x{}", context.getCurRpc(),
          context.getTotalRpcs(), Long.toHexString(context.getReportId()));
    }
  } finally {
    namesystem.writeUnlock(OperationName.REMOVE_BR_LEASE_IF_NEEDED);
  }
}{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org

Reply via email to