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

When addExpectedReplicasToPending is called twice, pendingReplications should avoid duplication

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.8.0
    • 2.8.0, 3.0.0-alpha1
    • None
    • None
    • 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

        1. HDFS-9748.01.patch
          3 kB
          Walter Su

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: