You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "zhtttylz (via GitHub)" <gi...@apache.org> on 2023/06/21 07:32:52 UTC

[GitHub] [hadoop] zhtttylz commented on pull request #5759: HDFS-17052. Erasure coding reconstruction failed when num of storageT…

zhtttylz commented on PR #5759:
URL: https://github.com/apache/hadoop/pull/5759#issuecomment-1600330026

   
   ```java
    //BlockPlacementPolicyRackFaultTolerant#chooseEvenlyFromRemainingRacks
    int bestEffortMaxNodesPerRack = maxNodesPerRack;
    while (results.size() != totalReplicaExpected &&
           numResultsOflastChoose != results.size()) {
         // Exclude the chosen nodes
         final Set<Node> newExcludeNodes = new HashSet<>();
         for (DatanodeStorageInfo resultStorage : results) {
           addToExcludedNodes(resultStorage.getDatanodeDescriptor(),
               newExcludeNodes);
         }
   
         LOG.trace("Chosen nodes: {}", results);
         LOG.trace("Excluded nodes: {}", excludedNodes);
         LOG.trace("New Excluded nodes: {}", newExcludeNodes);
         final int numOfReplicas = totalReplicaExpected - results.size();
         numResultsOflastChoose = results.size();
         try {
           chooseOnce(numOfReplicas, writer, newExcludeNodes, blocksize,
               ++bestEffortMaxNodesPerRack, results, avoidStaleNodes,
               storageTypes);
         } catch (NotEnoughReplicasException nere) {
           lastException = nere;
         } finally {
           excludedNodes.addAll(newExcludeNodes);
         }
       }
   ```
   Since **totalNumOfReplicas < numOfRacks**, **maxNodesPerRack** initial to **1**. If after incrementing **bestEffortMaxNodesPerRack++**, **BlockPlacementPolicyRackFaultTolerant#chooseOnce** still cannot select a new node to add to the results, the 'while' loop will exit because **numResultsOflastChoose != results.size()** is **false**.


-- 
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: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org