hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r960947 - in /hadoop/hdfs/branches/branch-0.21: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java src/test/hdfs/org/apache/hadoop/hdfs/TestQuota.java
Date Tue, 06 Jul 2010 17:25:12 GMT
Author: szetszwo
Date: Tue Jul  6 17:25:12 2010
New Revision: 960947

URL: http://svn.apache.org/viewvc?rev=960947&view=rev
Log:
HDFS-1258. Clearing namespace quota on "/" corrupts fs image.  Contributed by Aaron T. Myers

Modified:
    hadoop/hdfs/branches/branch-0.21/CHANGES.txt
    hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestQuota.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=960947&r1=960946&r2=960947&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/CHANGES.txt (original)
+++ hadoop/hdfs/branches/branch-0.21/CHANGES.txt Tue Jul  6 17:25:12 2010
@@ -918,6 +918,9 @@ Release 0.20.3 - Unreleased
     HDFS-909. Wait until edits syncing is finishes before purging edits.
     (Todd Lipcon via shv)
 
+    HDFS-1258. Clearing namespace quota on "/" corrupts fs image.
+    (Aaron T. Myers via szetszwo)
+
 Release 0.20.2 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java?rev=960947&r1=960946&r2=960947&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
Tue Jul  6 17:25:12 2010
@@ -1684,6 +1684,8 @@ class FSDirectory implements Closeable {
         throw new FileNotFoundException("Directory does not exist: " + srcs);
       } else if (!targetNode.isDirectory()) {
         throw new FileNotFoundException("Cannot set quota on a file: " + srcs);  
+      } else if (targetNode.isRoot() && nsQuota == FSConstants.QUOTA_RESET) {
+        throw new IllegalArgumentException("Cannot clear namespace quota on root.");
       } else { // a directory inode
         INodeDirectory dirNode = (INodeDirectory)targetNode;
         long oldNsQuota = dirNode.getNsQuota();

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestQuota.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestQuota.java?rev=960947&r1=960946&r2=960947&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestQuota.java (original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/TestQuota.java Tue
Jul  6 17:25:12 2010
@@ -268,6 +268,12 @@ public class TestQuota extends TestCase 
           return null;
         }
       });
+
+      // 19: clrQuota on the root directory ("/") should fail
+      runCommand(admin, true, "-clrQuota", "/");
+
+      // 20: setQuota on the root directory ("/") should succeed
+      runCommand(admin, false, "-setQuota", "1000000", "/");
     } finally {
       cluster.shutdown();
     }



Mime
View raw message