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

Remove unnecessary Lease Renew in FSNamesystem#internalReleaseLease

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.4.0
    • namenode
    • None
    • Reviewed

    Description

      The method of FSNamesystem#internalReleaseLease() as follow:

       

      boolean internalReleaseLease(Lease lease, String src, INodesInPath iip,
          String recoveryLeaseHolder) throws IOException {
        ...
          // Start recovery of the last block for this file
          // Only do so if there is no ongoing recovery for this block,
          // or the previous recovery for this block timed out.
          if (blockManager.addBlockRecoveryAttempt(lastBlock)) {
            long blockRecoveryId = nextGenerationStamp(
                blockManager.isLegacyBlock(lastBlock));
            if(copyOnTruncate) {
              lastBlock.setGenerationStamp(blockRecoveryId);
            } else if(truncateRecovery) {
              recoveryBlock.setGenerationStamp(blockRecoveryId);
            }
            uc.initializeBlockRecovery(lastBlock, blockRecoveryId, true);
      
            // Cannot close file right now, since the last block requires recovery.
            // This may potentially cause infinite loop in lease recovery
            // if there are no valid replicas on data-nodes.
            NameNode.stateChangeLog.warn(
                "DIR* NameSystem.internalReleaseLease: " +
                    "File " + src + " has not been closed." +
                    " Lease recovery is in progress. " +
                    "RecoveryId = " + blockRecoveryId + " for block " + lastBlock);
          }
          lease = reassignLease(lease, src, recoveryLeaseHolder, pendingFile);
          leaseManager.renewLease(lease);
          break;
        }
        return false;
      }
      

       Call LeaseManager#renewLease in FSNamesystem#reassignLease=>FSNamesystem#reassignLeaseInternal.

       So no need to call LeaseManager#renewLease  again after leaseManager#renewLease.

      Attachments

        1. HDFS-15787.001.patch
          1 kB
          Lisheng Sun
        2. HDFS-15787.002.patch
          1 kB
          Lisheng Sun

        Issue Links

          Activity

            People

              leosun08 Lisheng Sun
              leosun08 Lisheng Sun
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: