hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rang...@apache.org
Subject svn commit: r689327 - in /hadoop/core/trunk: CHANGES.txt src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java src/test/org/apache/hadoop/hdfs/TestQuota.java
Date Wed, 27 Aug 2008 01:25:17 GMT
Author: rangadi
Date: Tue Aug 26 18:25:16 2008
New Revision: 689327

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


Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
    hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestQuota.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=689327&r1=689326&r2=689327&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Tue Aug 26 18:25:16 2008
@@ -386,6 +386,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/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java?rev=689327&r1=689326&r2=689327&view=diff
==============================================================================
--- hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java (original)
+++ hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java Tue
Aug 26 18:25:16 2008
@@ -375,6 +375,8 @@
         return false;
       }
 
+      String srcChildName = srcChild.getLocalName();
+      
       // check the validity of the destination
       INode dstChild = null;
       QuotaExceededException failureByQuota = null;
@@ -416,6 +418,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/trunk/src/test/org/apache/hadoop/hdfs/TestQuota.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestQuota.java?rev=689327&r1=689326&r2=689327&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestQuota.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/TestQuota.java Tue Aug 26 18:25:16 2008
@@ -268,7 +268,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));
@@ -276,6 +276,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