Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-1189

Quota counts missed between clear quota and set quota

    Details

    • Hadoop Flags:
      Reviewed
    • Tags:
      hdfs quota

      Description

      HDFS Quota counts will be missed between a clear quota operation and a set quota.

      When setting quota for a dir, the INodeDirectory will be replaced by INodeDirectoryWithQuota and dir.isQuotaSet() becomes true. When INodeDirectoryWithQuota is newly created, quota counting will be performed. However, when clearing quota, the quota conf is set to -1 and dir.isQuotaSet() becomes false while INodeDirectoryWithQuota will NOT be replaced back to INodeDirectory.

      FSDirectory.updateCount just update the quota count for inodes that isQuotaSet() is true. So after clear quota for a dir, its quota counts will not be updated and it's reasonable. But when re seting quota for this dir, quota counting will not be performed and some counts will be missed.

      1. HDFS-1189-for_20.204.patch
        4 kB
        John George
      2. HDFS-1189-for_20.204.patch
        4 kB
        John George
      3. hdfs-1189-1.patch
        4 kB
        John George
      4. HDFS-1189.patch
        4 kB
        John George
      5. HDFS-1189.patch
        4 kB
        John George
      6. HDFS-1189.patch
        1 kB
        Kang Xiao

        Issue Links

          Activity

          Kang Xiao created issue -
          Hide
          Kang Xiao added a comment -

          Patch attached.

          Replace INodeDirectoryWithQuota back to INodeDirectory if isQuotaSet() is false after setQuota.

          Show
          Kang Xiao added a comment - Patch attached. Replace INodeDirectoryWithQuota back to INodeDirectory if isQuotaSet() is false after setQuota.
          Kang Xiao made changes -
          Field Original Value New Value
          Attachment HDFS-1189.patch [ 12446462 ]
          Tsz Wo Nicholas Sze made changes -
          Link This issue relates to HDFS-1258 [ HDFS-1258 ]
          Hide
          Tsz Wo Nicholas Sze added a comment -

          HDFS-1258: another bug related to clear quota.

          Show
          Tsz Wo Nicholas Sze added a comment - HDFS-1258 : another bug related to clear quota.
          Hide
          Tsz Wo Nicholas Sze added a comment -

          Hi Xiao, thanks for reporting this and providing a patch. Some comments on the patch:

          • The following will get an array index exception when the inode is root.
            +            INodeDirectory parent = (INodeDirectory)inodes[inodes.length-2];
            
          • Need new unit tests.
          Show
          Tsz Wo Nicholas Sze added a comment - Hi Xiao, thanks for reporting this and providing a patch. Some comments on the patch: The following will get an array index exception when the inode is root. + INodeDirectory parent = (INodeDirectory)inodes[inodes.length-2]; Need new unit tests.
          John George made changes -
          Attachment HDFS-1189.patch [ 12471990 ]
          John George made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Assignee John George [ johnvijoe ]
          Fix Version/s 0.22.0 [ 12314241 ]
          Hide
          Tsz Wo Nicholas Sze added a comment -

          John, the patch looks good but it seems that you have not checked "Grant license to ASF for inclusion in ASF work" when attaching the patch.

          Show
          Tsz Wo Nicholas Sze added a comment - John, the patch looks good but it seems that you have not checked "Grant license to ASF for inclusion in ASF work" when attaching the patch.
          John George made changes -
          Attachment HDFS-1189.patch [ 12471993 ]
          Hide
          John George added a comment -

          attached a new patch after checking "Grant license to ASF for inclusion in ASF work"

          Show
          John George added a comment - attached a new patch after checking "Grant license to ASF for inclusion in ASF work"
          Hide
          John George added a comment -

          attaching the same patch with a different name

          Show
          John George added a comment - attaching the same patch with a different name
          John George made changes -
          Attachment hdfs-1189-1.patch [ 12472191 ]
          John George made changes -
          Status Patch Available [ 10002 ] Open [ 1 ]
          John George made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Hide
          John George added a comment -

          ant -Dforrest.home=$

          {FORREST_HOME}

          -Djava5.home=$

          {JAVA5}

          -Dfindbugs.home=$

          {FINDBUGS_HOME}

          -Dpatch.file=/home/johngeo/hadoop_patches/HDFS-1189.patch test-patch

          [exec] BUILD SUCCESSFUL
          [exec] Total time: 32 seconds
          [exec]
          [exec]
          [exec]
          [exec]
          [exec] +1 overall.
          [exec]
          [exec] +1 @author. The patch does not contain any @author tags.
          [exec]
          [exec] +1 tests included. The patch appears to include 4 new or modified tests.
          [exec]
          [exec] +1 javadoc. The javadoc tool did not generate any warning messages.
          [exec]
          [exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings.
          [exec]
          [exec] +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings.
          [exec]
          [exec] +1 release audit. The applied patch does not increase the total number of release audit warnings.
          [exec]
          [exec] +1 system test framework. The patch passed system test framework compile.
          [exec]

          Show
          John George added a comment - ant -Dforrest.home=$ {FORREST_HOME} -Djava5.home=$ {JAVA5} -Dfindbugs.home=$ {FINDBUGS_HOME} -Dpatch.file=/home/johngeo/hadoop_patches/ HDFS-1189 .patch test-patch [exec] BUILD SUCCESSFUL [exec] Total time: 32 seconds [exec] [exec] [exec] [exec] [exec] +1 overall. [exec] [exec] +1 @author. The patch does not contain any @author tags. [exec] [exec] +1 tests included. The patch appears to include 4 new or modified tests. [exec] [exec] +1 javadoc. The javadoc tool did not generate any warning messages. [exec] [exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings. [exec] [exec] +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings. [exec] [exec] +1 release audit. The applied patch does not increase the total number of release audit warnings. [exec] [exec] +1 system test framework. The patch passed system test framework compile. [exec]
          Hide
          John George added a comment -

          Ran ant test locally (both with and without the patch). Got the same output:

          run-test-hdfs-excluding-commit-and-smoke:
          [mkdir] Created dir: /home/johngeo/hadoop/hdfs_apache/hadoop-hdfs/build-fi/test/data
          [mkdir] Created dir: /home/johngeo/hadoop/hdfs_apache/hadoop-hdfs/build-fi/test/logs
          [copy] Copying 1 file to /home/johngeo/hadoop/hdfs_apache/hadoop-hdfs/build-fi/test/extraconf
          [copy] Copying 1 file to /home/johngeo/hadoop/hdfs_apache/hadoop-hdfs/build-fi/test/extraconf
          [junit] WARNING: multiple versions of ant detected in path for junit
          [junit] jar:file:/hadoop/config/apache-ant-1.8.2/lib/ant.jar!/org/apache/tools/ant/Project.class
          [junit] and jar:file:/home/johngeo/.ivy2/cache/ant/ant/jars/ant-1.6.5.jar!/org/apache/tools/ant/Project.class
          [junit] Running org.apache.hadoop.fs.TestFiListPath
          [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 5.445 sec
          [junit] Running org.apache.hadoop.fs.TestFiRename
          [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 18.176 sec
          [junit] Running org.apache.hadoop.hdfs.TestFiHFlush
          [junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 48.84 sec
          [junit] Running org.apache.hadoop.hdfs.TestFiHftp
          [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 43.284 sec
          [junit] Running org.apache.hadoop.hdfs.TestFiPipelines
          [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 17.021 sec
          [junit] Running org.apache.hadoop.hdfs.server.datanode.TestFiDataTransferProtocol
          [junit] Tests run: 29, Failures: 0, Errors: 0, Time elapsed: 292.307 sec
          [junit] Running org.apache.hadoop.hdfs.server.datanode.TestFiDataTransferProtocol2
          [junit] Tests run: 10, Failures: 0, Errors: 0, Time elapsed: 455.929 sec
          [junit] Running org.apache.hadoop.hdfs.server.datanode.TestFiPipelineClose
          [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 40.212 sec

          checkfailure:

          -run-test-hdfs-fault-inject-withtestcaseonly:

          run-test-hdfs-fault-inject:

          BUILD FAILED
          /home/johngeo/hadoop/hdfs_apache/hadoop-hdfs/build.xml:746: Tests failed!

          Total time: 132 minutes 29 seconds

          Show
          John George added a comment - Ran ant test locally (both with and without the patch). Got the same output: run-test-hdfs-excluding-commit-and-smoke: [mkdir] Created dir: /home/johngeo/hadoop/hdfs_apache/hadoop-hdfs/build-fi/test/data [mkdir] Created dir: /home/johngeo/hadoop/hdfs_apache/hadoop-hdfs/build-fi/test/logs [copy] Copying 1 file to /home/johngeo/hadoop/hdfs_apache/hadoop-hdfs/build-fi/test/extraconf [copy] Copying 1 file to /home/johngeo/hadoop/hdfs_apache/hadoop-hdfs/build-fi/test/extraconf [junit] WARNING: multiple versions of ant detected in path for junit [junit] jar: file:/hadoop/config/apache-ant-1.8.2/lib/ant.jar!/org/apache/tools/ant/Project.class [junit] and jar: file:/home/johngeo/.ivy2/cache/ant/ant/jars/ant-1.6.5.jar!/org/apache/tools/ant/Project.class [junit] Running org.apache.hadoop.fs.TestFiListPath [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 5.445 sec [junit] Running org.apache.hadoop.fs.TestFiRename [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 18.176 sec [junit] Running org.apache.hadoop.hdfs.TestFiHFlush [junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 48.84 sec [junit] Running org.apache.hadoop.hdfs.TestFiHftp [junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 43.284 sec [junit] Running org.apache.hadoop.hdfs.TestFiPipelines [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 17.021 sec [junit] Running org.apache.hadoop.hdfs.server.datanode.TestFiDataTransferProtocol [junit] Tests run: 29, Failures: 0, Errors: 0, Time elapsed: 292.307 sec [junit] Running org.apache.hadoop.hdfs.server.datanode.TestFiDataTransferProtocol2 [junit] Tests run: 10, Failures: 0, Errors: 0, Time elapsed: 455.929 sec [junit] Running org.apache.hadoop.hdfs.server.datanode.TestFiPipelineClose [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 40.212 sec checkfailure: -run-test-hdfs-fault-inject-withtestcaseonly: run-test-hdfs-fault-inject: BUILD FAILED /home/johngeo/hadoop/hdfs_apache/hadoop-hdfs/build.xml:746: Tests failed! Total time: 132 minutes 29 seconds
          Hide
          Tsz Wo Nicholas Sze added a comment -

          +1 patch looks good.

          I have committed this. Thanks, John!

          Show
          Tsz Wo Nicholas Sze added a comment - +1 patch looks good. I have committed this. Thanks, John!
          Tsz Wo Nicholas Sze made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Hadoop Flags [Reviewed]
          Fix Version/s 0.21.1 [ 12315271 ]
          Fix Version/s 0.23.0 [ 12315571 ]
          Resolution Fixed [ 1 ]
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-trunk-Commit #548 (See https://hudson.apache.org/hudson/job/Hadoop-Hdfs-trunk-Commit/548/)
          HDFS-1189. Quota counts missed between clear quota and set quota. Contributed by John George

          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-trunk-Commit #548 (See https://hudson.apache.org/hudson/job/Hadoop-Hdfs-trunk-Commit/548/ ) HDFS-1189 . Quota counts missed between clear quota and set quota. Contributed by John George
          Hide
          Tsz Wo Nicholas Sze added a comment -

          Committed also to Federation Branch.

          Show
          Tsz Wo Nicholas Sze added a comment - Committed also to Federation Branch.
          Tsz Wo Nicholas Sze made changes -
          Fix Version/s Federation Branch [ 12315300 ]
          Hide
          John George added a comment -

          Need to submit patch for .20 release

          Show
          John George added a comment - Need to submit patch for .20 release
          John George made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          John George made changes -
          Attachment HDFS-1189-for_20.204.patch [ 12475100 ]
          Hide
          John George added a comment -

          Submitting patch for 20.204 branch

          Show
          John George added a comment - Submitting patch for 20.204 branch
          John George made changes -
          Status Reopened [ 4 ] Patch Available [ 10002 ]
          Hadoop Flags [Reviewed]
          Affects Version/s 0.20.204.0 [ 12316319 ]
          Affects Version/s 0.20.2 [ 12314204 ]
          Affects Version/s 0.22.0 [ 12314241 ]
          Fix Version/s 0.20.204.0 [ 12316319 ]
          Fix Version/s 0.22.0 [ 12314241 ]
          Fix Version/s 0.21.1 [ 12315271 ]
          Fix Version/s Federation Branch [ 12315300 ]
          Fix Version/s 0.23.0 [ 12315571 ]
          Hide
          John George added a comment -

          I ran ant test, test-patch and the following manual tests:
          1. set Quota on a directory (both types) - pass
          2. clear Quotas on that directory - pass
          3. clear Quotas on a directory that does not have set Quotas - pass
          4. set & clear Quotas on root node - pass

          The attached test-patch tests for the use case where a namespace is set and then cleared and then set again. This is where the bug shows up. After the namespace quota is set the second time after clearing once, it should get set to the right value and any file creation that exceeds the space quota should fail.

          the test-patch for .20 branch and had the following output. The patch should not change any eclipse classpatch but the tests fail for that. I doubt if its anything to do with the patch.

          [exec] -1 overall.
          [exec]
          [exec] +1 @author. The patch does not contain any @author tags.
          [exec]
          [exec] +1 tests included. The patch appears to include 4 new or modified tests.
          [exec]
          [exec] -1 javadoc. The javadoc tool appears to have generated 1 warning messages.
          [exec]
          [exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings.
          [exec]
          [exec] +1 findbugs. The patch does not introduce any new Findbugs warnings.
          [exec]
          [exec] -1 Eclipse classpath. The patch causes the Eclipse classpath to differ from the contents of the lib directories.
          [exec]
          [exec]
          [exec]
          [exec]
          [exec] ======================================================================
          [exec] ======================================================================
          [exec] Finished build.
          [exec] ======================================================================
          [exec] ======================================================================
          [exec]
          [exec]

          Show
          John George added a comment - I ran ant test, test-patch and the following manual tests: 1. set Quota on a directory (both types) - pass 2. clear Quotas on that directory - pass 3. clear Quotas on a directory that does not have set Quotas - pass 4. set & clear Quotas on root node - pass The attached test-patch tests for the use case where a namespace is set and then cleared and then set again. This is where the bug shows up. After the namespace quota is set the second time after clearing once, it should get set to the right value and any file creation that exceeds the space quota should fail. the test-patch for .20 branch and had the following output. The patch should not change any eclipse classpatch but the tests fail for that. I doubt if its anything to do with the patch. [exec] -1 overall. [exec] [exec] +1 @author. The patch does not contain any @author tags. [exec] [exec] +1 tests included. The patch appears to include 4 new or modified tests. [exec] [exec] -1 javadoc. The javadoc tool appears to have generated 1 warning messages. [exec] [exec] +1 javac. The applied patch does not increase the total number of javac compiler warnings. [exec] [exec] +1 findbugs. The patch does not introduce any new Findbugs warnings. [exec] [exec] -1 Eclipse classpath. The patch causes the Eclipse classpath to differ from the contents of the lib directories. [exec] [exec] [exec] [exec] [exec] ====================================================================== [exec] ====================================================================== [exec] Finished build. [exec] ====================================================================== [exec] ====================================================================== [exec] [exec]
          Tsz Wo Nicholas Sze made changes -
          Fix Version/s 0.21.1 [ 12315271 ]
          Fix Version/s Federation Branch [ 12315300 ]
          Fix Version/s 0.22.0 [ 12314241 ]
          Fix Version/s 0.23.0 [ 12315571 ]
          Affects Version/s 0.20.204.0 [ 12316319 ]
          John George made changes -
          Attachment HDFS-1189-for_20.204.patch [ 12475258 ]
          Hide
          Tsz Wo Nicholas Sze added a comment -

          I have also committed this to 0.20-security.

          Show
          Tsz Wo Nicholas Sze added a comment - I have also committed this to 0.20-security.
          Tsz Wo Nicholas Sze made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Hadoop Flags [Reviewed]
          Resolution Fixed [ 1 ]
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-trunk #643 (See https://builds.apache.org/hudson/job/Hadoop-Hdfs-trunk/643/)

          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-trunk #643 (See https://builds.apache.org/hudson/job/Hadoop-Hdfs-trunk/643/ )
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-22-branch #35 (See https://builds.apache.org/hudson/job/Hadoop-Hdfs-22-branch/35/)

          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-22-branch #35 (See https://builds.apache.org/hudson/job/Hadoop-Hdfs-22-branch/35/ )
          Hide
          Owen O'Malley added a comment -

          Hadoop 0.20.204.0 was released.

          Show
          Owen O'Malley added a comment - Hadoop 0.20.204.0 was released.
          Owen O'Malley made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Patch Available Patch Available Open Open
          2d 16h 30m 1 John George 28/Feb/11 15:31
          Open Open Patch Available Patch Available
          263d 15h 24m 2 John George 28/Feb/11 15:32
          Resolved Resolved Reopened Reopened
          30d 16h 2m 1 John George 31/Mar/11 16:00
          Reopened Reopened Patch Available Patch Available
          7m 46s 1 John George 31/Mar/11 16:08
          Patch Available Patch Available Resolved Resolved
          1d 15h 1m 2 Tsz Wo Nicholas Sze 01/Apr/11 23:44
          Resolved Resolved Closed Closed
          153d 23h 31m 1 Owen O'Malley 02/Sep/11 23:16

            People

            • Assignee:
              John George
              Reporter:
              Kang Xiao
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development