[
https://issues.apache.org/jira/browse/HDFS-16961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17703463#comment-17703463
]
ASF GitHub Bot commented on HDFS-16961:
---------------------------------------
zhangshuyan0 commented on PR #5500:
URL: https://github.com/apache/hadoop/pull/5500#issuecomment-1478871043
I found that when `BlockManager#removeBRLeaseIfNeeded` is called,
`BlockManager#checkBlockReportLease` must have been called in advance.
`BlockManager#checkBlockReportLease` already checked whether the `nodeID`
exists in `datanodeManager`, is it necessary for us to check it again in
`BlockManager#removeBRLeaseIfNeeded`?
https://github.com/apache/hadoop/blob/67e02a92e0b9c4da3dcdd01f231a98f243f12d06/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java#L2856-L2859
> 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
> Labels: pull-request-available
>
> 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]