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
        1 kB
        Kang Xiao
      5. HDFS-1189.patch
        4 kB
        John George
      6. HDFS-1189.patch
        4 kB
        John George

        Issue Links

          Activity

          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.
          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.
          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.
          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
          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!
          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.
          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
          Hide
          John George added a comment -

          Submitting patch for 20.204 branch

          Show
          John George added a comment - Submitting patch for 20.204 branch
          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]
          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.
          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.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development