瀏覽代碼

HDFS-438. Improve help message for space quota command. (Raghu Angadi)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hdfs/trunk@788109 13f79535-47bb-0310-9956-ffa450edef68
Raghu Angadi 16 年之前
父節點
當前提交
7540ce19b2

+ 7 - 0
CHANGES.txt

@@ -31,3 +31,10 @@ Trunk (unreleased changes)
 
     HDFS-195. Handle expired tokens when write pipeline is restablished.
     (Kan Zhang via rangadi)
+
+Release 0.20.1 - Unreleased
+
+  IMPROVEMENTS
+
+    HDFS-438. Improve help message for space quota command. (Raghu Angadi)
+

+ 2 - 1
src/docs/src/documentation/content/xdocs/hdfs_quota_admin_guide.xml

@@ -73,7 +73,8 @@ effort for each directory, with faults reported if the directory does not exist
 directory has no quota. </li>
 
  <li> <code>dfsadmin -setSpaceQuota &lt;N> &lt;directory>...&lt;directory></code> <br /> Set the space quota to be
-N bytes for each directory. N can also be specified with a binary prefix for convenience, for e.g. 50g for 50 gigabytes and 
+N bytes for each directory. This is a hard limit on total size of all the files under the directory tree.
+The space quota takes replication also into account, i.e. one GB of data with replication of 3 consumes 3GB of quota. N can also be specified with a binary prefix for convenience, for e.g. 50g for 50 gigabytes and 
 2t for 2 terabytes etc. Best effort for each directory, with faults reported if <code>N</code> is
 neither zero nor a positive integer, the directory does not exist or it is a file, or the directory would immediately exceed
 the new quota. </li>

+ 8 - 6
src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java

@@ -201,8 +201,10 @@ public class DFSAdmin extends FsShell {
       "-"+NAME+" <quota> <dirname>...<dirname>";
     private static final String DESCRIPTION = USAGE + ": " +
       "Set the disk space quota <quota> for each directory <dirName>.\n" + 
-      "\t\tThe directory quota is a long integer that puts a hard limit\n" +
-      "\t\ton the number of names in the directory tree.\n" +
+      "\t\tThe space quota is a long integer that puts a hard limit\n" +
+      "\t\ton the total size of all the files under the directory tree.\n" +
+      "\t\tThe extra space required for replication is also counted. E.g.\n" +
+      "\t\ta 1GB file with replication of 3 consumes 3GB of the quota.\n\n" +
       "\t\tQuota can also be speciefied with a binary prefix for terabytes,\n" +
       "\t\tpetabytes etc (e.g. 50t is 50TB, 5m is 5MB, 3p is 3PB).\n" + 
       "\t\tBest effort for the directory, with faults reported if\n" +
@@ -542,13 +544,13 @@ public class DFSAdmin extends FsShell {
       System.out.println(upgradeProgress);
     } else if ("metasave".equals(cmd)) {
       System.out.println(metaSave);
-    } else if (SetQuotaCommand.matches(cmd)) {
+    } else if (SetQuotaCommand.matches("-"+cmd)) {
       System.out.println(SetQuotaCommand.DESCRIPTION);
-    } else if (ClearQuotaCommand.matches(cmd)) {
+    } else if (ClearQuotaCommand.matches("-"+cmd)) {
       System.out.println(ClearQuotaCommand.DESCRIPTION);
-    } else if (SetSpaceQuotaCommand.matches(cmd)) {
+    } else if (SetSpaceQuotaCommand.matches("-"+cmd)) {
       System.out.println(SetSpaceQuotaCommand.DESCRIPTION);
-    } else if (ClearSpaceQuotaCommand.matches(cmd)) {
+    } else if (ClearSpaceQuotaCommand.matches("-"+cmd)) {
       System.out.println(ClearSpaceQuotaCommand.DESCRIPTION);
     } else if ("refreshServiceAcl".equals(cmd)) {
       System.out.println(refreshServiceAcl);

+ 3 - 7
src/test/hdfs/org/apache/hadoop/cli/testHDFSConf.xml

@@ -16068,19 +16068,15 @@
         </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^( |\t)*The directory quota is a long integer that puts a hard limit( )*</expected-output>
+          <expected-output>^( |\t)*The space quota is a long integer that puts a hard limit( )*</expected-output>
         </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^( |\t)*on the number of names in the directory tree.( )*</expected-output>
+          <expected-output>^( |\t)*on the total size of all the files under the directory tree.( )*</expected-output>
         </comparator>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^( |\t)*2. user is not an administrator.( )*</expected-output>
-        </comparator>
-        <comparator>
-          <type>RegexpComparator</type>
-          <expected-output>^( |\t)*It does not fault if the directory has no quota.( )*</expected-output>
+          <expected-output>^( |\t)*2. user is not an administrator, or( )*</expected-output>
         </comparator>
       </comparators>
     </test>