hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rang...@apache.org
Subject svn commit: r689328 - in /hadoop/core/branches/branch-0.18: CHANGES.txt src/hdfs/org/apache/hadoop/dfs/FSDirectory.java src/test/org/apache/hadoop/dfs/TestQuota.java
Date Wed, 27 Aug 2008 01:28:17 GMT
Author: rangadi
Date: Tue Aug 26 18:28:17 2008
New Revision: 689328

URL: http://svn.apache.org/viewvc?rev=689328&view=rev
Log:
HADOOP-3995. In case of quota failure on HDFS, rename does not restore
source filename. (rangadi)

Modified:
    hadoop/core/branches/branch-0.18/CHANGES.txt
    hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSDirectory.java
    hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestQuota.java

Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=689328&r1=689327&r2=689328&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Tue Aug 26 18:28:17 2008
@@ -4,6 +4,9 @@
 
   BUG FIXES
 
+    HADOOP-3995. In case of quota failure on HDFS, rename does not restore
+    source filename. (rangadi)
+
     HADOOP-3821. Prevent SequenceFile and IFile from duplicating codecs in
     CodecPool when closed more than once. (Arun Murthy via cdouglas)
 

Modified: hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSDirectory.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSDirectory.java?rev=689328&r1=689327&r2=689328&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSDirectory.java (original)
+++ hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSDirectory.java Tue Aug
26 18:28:17 2008
@@ -371,6 +371,8 @@
         return false;
       }
 
+      String srcChildName = srcChild.getLocalName();
+      
       // check the validity of the destination
       INode dstChild = null;
       QuotaExceededException failureByQuota = null;
@@ -412,6 +414,7 @@
             +"failed to rename "+src+" to "+dst);
         try {
           // put it back
+          srcChild.setLocalName(srcChildName);
           addChild(srcInodes, srcInodes.length-1, srcChild, false);
         } catch (IOException ignored) {}
         if (failureByQuota != null) {

Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestQuota.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestQuota.java?rev=689328&r1=689327&r2=689328&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestQuota.java (original)
+++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestQuota.java Tue Aug
26 18:28:17 2008
@@ -266,7 +266,7 @@
       assertEquals(c.getDirectoryCount(), 6);
       assertEquals(c.getQuota(), 6);
 
-      // 10: Move /nqdir0/qdir1/qdir21/nqdir30 to /nqdir0/qdir1/qdir21
+      // 10: Move /nqdir0/qdir1/qdir20/nqdir30 to /nqdir0/qdir1/qdir21
       hasException = false;
       try {
         assertFalse(dfs.rename(tempPath, quotaDir3));
@@ -274,6 +274,19 @@
         hasException = true;
       }
       assertTrue(hasException);
+      assertTrue(dfs.exists(tempPath));
+      assertFalse(dfs.exists(new Path(quotaDir3, "nqdir30")));
+      
+      // 10.a: Rename /nqdir0/qdir1/qdir20/nqdir30 to /nqdir0/qdir1/qdir21/nqdir32
+      hasException = false;
+      try {
+        assertFalse(dfs.rename(tempPath, new Path(quotaDir3, "nqdir32")));
+      } catch (QuotaExceededException e) {
+        hasException = true;
+      }
+      assertTrue(hasException);
+      assertTrue(dfs.exists(tempPath));
+      assertFalse(dfs.exists(new Path(quotaDir3, "nqdir32")));
 
       // 11: Move /nqdir0/qdir1/qdir20/nqdir30 to /nqdir0
       assertTrue(dfs.rename(tempPath, new Path("/nqdir0")));



Mime
View raw message