Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-9748

When addExpectedReplicasToPending is called twice, pendingReplications should avoid duplication

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.0
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      1. When completeFile() is called, addExpectedReplicasToPending() will be called (HDFS-8999).

      2. When first replica is reported, addExpectedReplicasToPending() will be called the second time.

      //BlockManager.addStoredBlock(..)
          if(storedBlock.getBlockUCState() == BlockUCState.COMMITTED &&
              hasMinStorage(storedBlock, numLiveReplicas)) {
            addExpectedReplicasToPending(storedBlock, bc);
            completeBlock(storedBlock, false);
          } else if (storedBlock.isComplete() && result == AddBlockResult.ADDED) {
      

      But,

      //PendingReplicationBlocks.java
          void incrementReplicas(DatanodeDescriptor... newTargets) {
            if (newTargets != null) {
              Collections.addAll(targets, newTargets);
            }
          }
      

      targets is ArrayList, the above code simply add all newTargets to targets.

        Attachments

          Activity

            People

            • Assignee:
              walter.k.su Walter Su
              Reporter:
              walter.k.su Walter Su
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: