haiyang1987 commented on code in PR #6635:
URL: https://github.com/apache/hadoop/pull/6635#discussion_r1533200066
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeManager.java:
##########
@@ -1755,12 +1755,24 @@ private BlockRecoveryCommand
getBlockRecoveryCommand(String blockPoolId,
LOG.info("Skipped stale nodes for recovery : "
+ (storages.length - recoveryLocations.size()));
}
- recoveryInfos = DatanodeStorageInfo.toDatanodeInfos(recoveryLocations);
} else {
- // If too many replicas are stale, then choose all replicas to
+ // If too many replicas are stale, then choose live replicas to
// participate in block recovery.
- recoveryInfos = DatanodeStorageInfo.toDatanodeInfos(storages);
+ recoveryLocations.clear();
+ storageIdx.clear();
+ for (int i = 0; i < storages.length; ++i) {
+ if (storages[i].getDatanodeDescriptor().isAlive()) {
+ recoveryLocations.add(storages[i]);
+ storageIdx.add(i);
+ }
+ }
+ assert recoveryLocations.size() > 0 : "recoveryLocations size should
be > 0";
Review Comment:
Check the code again. when processing handleHeartbeat executes
getBlockRecoveryCommand, the datanode should be in the live state at this
time, so the size of recoveryLocations is at least 1.
so here maybey remove this assert logic.
--
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]