[
https://issues.apache.org/jira/browse/HDFS-16961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17703457#comment-17703457
]
ASF GitHub Bot commented on HDFS-16961:
---------------------------------------
ZanderXu opened a new pull request, #5500:
URL: https://github.com/apache/hadoop/pull/5500
### Description of PR
The blockReport RPC should throw UnregisteredNodeException when the storedDN
is null, the related code as bellows:
```
public void removeBRLeaseIfNeeded(final DatanodeID nodeID,
final BlockReportContext context) throws IOException {
namesystem.writeLock();
DatanodeDescriptor node;
try {
// Here, if the node is null, we should throw
UnregisteredNodeException insteat 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());
}
if (LOG.isDebugEnabled()) {
LOG.debug("Processing RPC with index {} out of total {} RPCs in
processReport 0x{}",
context.getCurRpc(), context.getTotalRpcs(),
Long.toHexString(context.getReportId()));
}
}
} finally {
namesystem.writeUnlock("removeBRLeaseIfNeeded");
}
}
```
> 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
> Priority: Major
>
> 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: [email protected]
For additional commands, e-mail: [email protected]