hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1481166 - in /hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java src/test/java/org/apache/hadoop/hdfs/TestLeaseRenewer.java
Date Fri, 10 May 2013 19:54:37 GMT
Author: atm
Date: Fri May 10 19:54:27 2013
New Revision: 1481166

URL: http://svn.apache.org/r1481166
Log:
HDFS-4751. TestLeaseRenewer#testThreadName flakes. Contributed by Andrew Wang.

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/LeaseRenewer.java
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestLeaseRenewer.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=1481166&r1=1481165&r2=1481166&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 Fri May 10
19:54:27 2013
@@ -244,6 +244,8 @@ Release 2.0.5-beta - UNRELEASED
     HDFS-4799. Corrupt replica can be prematurely removed from 
     corruptReplicas map. (todd via kihwal)
 
+    HDFS-4751. TestLeaseRenewer#testThreadName flakes. (Andrew Wang via atm)
+
 Release 2.0.4-alpha - 2013-04-25
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java?rev=1481166&r1=1481165&r2=1481166&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/LeaseRenewer.java
Fri May 10 19:54:27 2013
@@ -35,6 +35,7 @@ import org.apache.hadoop.security.UserGr
 import org.apache.hadoop.util.Daemon;
 import org.apache.hadoop.util.StringUtils;
 import org.apache.hadoop.util.Time;
+import com.google.common.annotations.VisibleForTesting;
 
 /**
  * <p>
@@ -323,6 +324,11 @@ class LeaseRenewer {
     }
   }
 
+  @VisibleForTesting
+  synchronized void setEmptyTime(long time) {
+    emptyTime = time;
+  }
+
   /** Close a file. */
   void closeFile(final String src, final DFSClient dfsc) {
     dfsc.removeFileBeingWritten(src);

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestLeaseRenewer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestLeaseRenewer.java?rev=1481166&r1=1481165&r2=1481166&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestLeaseRenewer.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestLeaseRenewer.java
Fri May 10 19:54:27 2013
@@ -182,8 +182,6 @@ public class TestLeaseRenewer {
         renewer.isRunning());
     
     // Pretend to open a file
-    Mockito.doReturn(false)
-      .when(MOCK_DFSCLIENT).isFilesBeingWrittenEmpty();
     renewer.put(filePath, mockStream, MOCK_DFSCLIENT);
     
     Assert.assertTrue("Renewer should have started running",
@@ -194,9 +192,8 @@ public class TestLeaseRenewer {
     Assert.assertEquals("LeaseRenewer:myuser@hdfs://nn1/", threadName);
     
     // Pretend to close the file
-    Mockito.doReturn(true)
-      .when(MOCK_DFSCLIENT).isFilesBeingWrittenEmpty();
     renewer.closeFile(filePath, MOCK_DFSCLIENT);
+    renewer.setEmptyTime(Time.now());
     
     // Should stop the renewer running within a few seconds
     long failTime = Time.now() + 5000;



Mime
View raw message