Prechádzať zdrojové kódy

HADOOP-286. Avoid pinging the NameNode with renewLease() calls when no files are being written. Contributed by Konstantin.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@440892 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 rokov pred
rodič
commit
271c118817

+ 4 - 0
CHANGES.txt

@@ -133,6 +133,10 @@ Trunk (unreleased changes)
     the destination of a file copy is a directory.
     (Hairong Kuang via cutting)
 
+34. HADOOP-286.  In DFSClient, avoid pinging the NameNode with
+    renewLease() calls when no files are being written.
+    (Konstantin Shvachko via cutting)
+
 
 Release 0.5.0 - 2006-08-04
 

+ 2 - 1
src/java/org/apache/hadoop/dfs/DFSClient.java

@@ -436,8 +436,9 @@ class DFSClient implements FSConstants {
             while (running) {
                 if (System.currentTimeMillis() - lastRenewed > (LEASE_PERIOD / 2)) {
                     try {
+                      if( pendingCreates.size() > 0 )
                         namenode.renewLease(clientName);
-                        lastRenewed = System.currentTimeMillis();
+                      lastRenewed = System.currentTimeMillis();
                     } catch (IOException ie) {
                       String err = StringUtils.stringifyException(ie);
                       LOG.warn("Problem renewing lease for " + clientName +