KevinWikant commented on code in PR #7179:
URL: https://github.com/apache/hadoop/pull/7179#discussion_r1892939831


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java:
##########
@@ -1817,11 +1835,31 @@ void removeBlocksAssociatedTo(final DatanodeDescriptor 
node) {
     }
     // Remove all pending DN messages referencing this DN.
     pendingDNMessages.removeAllMessagesForDatanode(node);
+    // Remove all Under Construction blocks on this datanode
+    ucBlocks.removeAllUcBlocksForDatanode(node);
 
     node.resetBlocks();
     invalidateBlocks.remove(node);
   }
 
+  /** Count how many Under Construction blocks there are per datanode. */
+  Map<DatanodeDescriptor, List<Block>> 
countUnderConstructionBlocksByDatanode() {
+    final Map<DatanodeDescriptor, List<Block>> result =
+        ucBlocks.getUnderConstructionBlocksByDatanode();
+    if (LOG.isDebugEnabled()) {
+      String ucBlockCounts = result.entrySet().stream()
+          .map(e -> String.format("%s=%d", e.getKey(), e.getValue().size()))
+          .collect(Collectors.joining(",", "{", "}"));
+      LOG.debug("Under Construction block counts: [{}]", ucBlockCounts);
+    }
+    return result;

Review Comment:
   Makes sense, I will add this to the underlying 
`UnderConstructionBlocks.getUnderConstructionBlocksByDatanode` method



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to