hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r933430 - in /hadoop/hdfs/branches/branch-0.21: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java src/test/hdfs/org/apache/hadoop/hdfs/TestReadWhileWriting.java
Date Mon, 12 Apr 2010 21:49:51 GMT
Author: shv
Date: Mon Apr 12 21:49:50 2010
New Revision: 933430

URL: http://svn.apache.org/viewvc?rev=933430&view=rev
Log:
HDFS-1072. Merge -r 933425:933426 from trunk to branch-0.21.

Modified:
    hadoop/hdfs/branches/branch-0.21/CHANGES.txt
    hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestReadWhileWriting.java

Modified: hadoop/hdfs/branches/branch-0.21/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/CHANGES.txt?rev=933430&r1=933429&r2=933430&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/CHANGES.txt (original)
+++ hadoop/hdfs/branches/branch-0.21/CHANGES.txt Mon Apr 12 21:49:50 2010
@@ -556,6 +556,8 @@ Trunk (unreleased changes)
     HDFS-1046. Fix Tomcat version in hdfsproxy/build.xml.  (Srikanth
     Sundarrajan via szetszwo)
 
+    HDFS-1072. Fix TestReadWhileWriting failure. (Erik Steffl via shv)
+
 Release 0.20.3 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=933430&r1=933429&r2=933430&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Mon Apr 12 21:49:50 2010
@@ -993,12 +993,21 @@ public class FSNamesystem implements FSC
                 "Failed to close file " + src +
                 ". Lease recovery is in progress. Try again later.");
 
-        } else
-          throw new AlreadyBeingCreatedException("failed to create file " +
-              src + " for " + holder + " on client " + clientMachine + 
-              ", because this file is already being created by " +
-              pendingFile.getClientName() + 
-              " on " + pendingFile.getClientMachine());
+        } else {
+          if(pendingFile.getLastBlock().getBlockUCState() ==
+            BlockUCState.UNDER_RECOVERY) {
+            throw new RecoveryInProgressException(
+              "Recovery in progress, file [" + src + "], " +
+              "lease owner [" + lease.getHolder() + "]");
+            } else {
+              throw new AlreadyBeingCreatedException(
+                "Failed to create file [" + src + "] for [" + holder +
+                "] on client [" + clientMachine +
+                "], because this file is already being created by [" +
+                pendingFile.getClientName() + "] on [" +
+                pendingFile.getClientMachine() + "]");
+            }
+         }
       }
 
       try {

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestReadWhileWriting.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestReadWhileWriting.java?rev=933430&r1=933429&r2=933430&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestReadWhileWriting.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestReadWhileWriting.java
Mon Apr 12 21:49:50 2010
@@ -45,7 +45,10 @@ public class TestReadWhileWriting {
   private static final String DIR = "/"
       + TestReadWhileWriting.class.getSimpleName() + "/";
   private static final int BLOCK_SIZE = 8192;
-  private static final long LEASE_LIMIT = 500;
+  // soft limit is short and hard limit is long, to test that
+  // another thread can lease file after soft limit expired
+  private static final long SOFT_LEASE_LIMIT = 500;
+  private static final long HARD_LEASE_LIMIT = 1000*600; 
   
   /** Test reading while writing. */
   @Test
@@ -59,7 +62,7 @@ public class TestReadWhileWriting {
     final MiniDFSCluster cluster = new MiniDFSCluster(conf, 3, true, null);
     try {
       //change the lease limits.
-      cluster.setLeasePeriod(LEASE_LIMIT, LEASE_LIMIT);
+      cluster.setLeasePeriod(SOFT_LEASE_LIMIT, HARD_LEASE_LIMIT);
 
       //wait for the cluster
       cluster.waitActive();
@@ -89,7 +92,7 @@ public class TestReadWhileWriting {
       //c. On M1, append another half block of data.  Close file on M1.
       {
         //sleep to let the lease is expired.
-        Thread.sleep(2*LEASE_LIMIT);
+        Thread.sleep(2*SOFT_LEASE_LIMIT);
   
         final DistributedFileSystem dfs = (DistributedFileSystem)FileSystem.newInstance(conf);
         final FSDataOutputStream out = append(dfs, p);



Mime
View raw message