Return-Path: X-Original-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CFD8110CA4 for ; Thu, 30 Jan 2014 21:21:55 +0000 (UTC) Received: (qmail 65548 invoked by uid 500); 30 Jan 2014 21:21:42 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 65496 invoked by uid 500); 30 Jan 2014 21:21:39 -0000 Mailing-List: contact hdfs-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-dev@hadoop.apache.org Delivered-To: mailing list hdfs-commits@hadoop.apache.org Received: (qmail 65271 invoked by uid 99); 30 Jan 2014 21:21:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jan 2014 21:21:24 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jan 2014 21:21:22 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B0F7F2388993; Thu, 30 Jan 2014 21:21:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1562969 - in /hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java Date: Thu, 30 Jan 2014 21:21:02 -0000 To: hdfs-commits@hadoop.apache.org From: todd@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140130212102.B0F7F2388993@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: todd Date: Thu Jan 30 21:21:02 2014 New Revision: 1562969 URL: http://svn.apache.org/r1562969 Log: HDFS-5790. LeaseManager.findPath is very slow when many leases need recovery. Contributed by Todd Lipcon. Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1562969&r1=1562968&r2=1562969&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Jan 30 21:21:02 2014 @@ -13,6 +13,9 @@ Release 2.4.0 - UNRELEASED OPTIMIZATIONS + HDFS-5790. LeaseManager.findPath is very slow when many leases need recovery + (todd) + BUG FIXES HDFS-5492. Port HDFS-2069 (Incorrect default trash interval in the Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1562969&r1=1562968&r2=1562969&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java Thu Jan 30 21:21:02 2014 @@ -3773,7 +3773,7 @@ public class FSNamesystem implements Nam final long diff = fileINode.getPreferredBlockSize() - commitBlock.getNumBytes(); if (diff > 0) { try { - String path = leaseManager.findPath(fileINode); + String path = fileINode.getFullPathName(); dir.updateSpaceConsumed(path, 0, -diff*fileINode.getFileReplication()); } catch (IOException e) { LOG.warn("Unexpected exception while updating disk space.", e); @@ -3978,7 +3978,7 @@ public class FSNamesystem implements Nam BlockInfo storedBlock) throws IOException { - String src = leaseManager.findPath(pendingFile); + String src = pendingFile.getFullPathName(); // commit the last block and complete it if it has minimum replicas commitOrCompleteLastBlock(pendingFile, storedBlock); @@ -4000,7 +4000,7 @@ public class FSNamesystem implements Nam @VisibleForTesting String persistBlocks(INodeFileUnderConstruction pendingFile, boolean logRetryCache) throws IOException { - String src = leaseManager.findPath(pendingFile); + String src = pendingFile.getFullPathName(); dir.persistBlocks(src, pendingFile, logRetryCache); return src; } @@ -5929,7 +5929,7 @@ public class FSNamesystem implements Nam .getDatanodeStorageInfos(newNodes, newStorageIDs); blockinfo.setExpectedLocations(storages); - String src = leaseManager.findPath(pendingFile); + String src = pendingFile.getFullPathName(); dir.persistBlocks(src, pendingFile, logRetryCache); } Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java?rev=1562969&r1=1562968&r2=1562969&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/LeaseManager.java Thu Jan 30 21:21:02 2014 @@ -180,22 +180,6 @@ public class LeaseManager { } /** - * Finds the pathname for the specified pendingFile - */ - public synchronized String findPath(INodeFileUnderConstruction pendingFile) - throws IOException { - Lease lease = getLease(pendingFile.getClientName()); - if (lease != null) { - String src = lease.findPath(pendingFile); - if (src != null) { - return src; - } - } - throw new IOException("pendingFile (=" + pendingFile + ") not found." - + "(lease=" + lease + ")"); - } - - /** * Renew the lease(s) held by the given client */ synchronized void renewLease(String holder) { @@ -250,24 +234,6 @@ public class LeaseManager { return now() - lastUpdate > softLimit; } - /** - * @return the path associated with the pendingFile and null if not found. - */ - private String findPath(INodeFileUnderConstruction pendingFile) { - try { - for (String src : paths) { - INode node = fsnamesystem.dir.getINode(src); - if (node == pendingFile - || (node.isFile() && node.asFile() == pendingFile)) { - return src; - } - } - } catch (UnresolvedLinkException e) { - throw new AssertionError("Lease files should reside on this FS"); - } - return null; - } - /** Does this lease contain any path? */ boolean hasPath() {return !paths.isEmpty();}