Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-1932

Ensure that HDFS configuration deprecations are set up in every spot that HDFS configurations are loaded.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 0.22.0
    • Fix Version/s: 0.22.0
    • Component/s: None
    • Labels:
    • Hadoop Flags:
      Reviewed

      Description

      Currently we have code blocks like the following in lots of places:

        static{
          Configuration.addDefaultResource("hdfs-default.xml");
          Configuration.addDefaultResource("hdfs-site.xml");
        }
      

      This is dangerous since, if we don't remember to also classload HdfsConfiguration, the config key deprecations won't work. We should add a method like HdfsConfiguration.init() which would load the default resources as well as ensure that deprecation gets initialized properly.

      1. hdfs-1932.txt
        7 kB
        Jolly Chen
      2. hdfs-1932-2.txt
        7 kB
        Jolly Chen

        Issue Links

          Activity

          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-trunk #673 (See https://builds.apache.org/hudson/job/Hadoop-Hdfs-trunk/673/)
          HDFS-1932. Ensure that HDFS configuration deprecations are set up in every spot that HDFS configurations are loaded. Contributed by Jolly Chen.

          todd : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1125601
          Files :

          • /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetConf.java
          • /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetGroups.java
          • /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSck.java
          • /hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java
          • /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
          • /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
          • /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
          • /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
          • /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
          • /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
          • /hadoop/hdfs/trunk/CHANGES.txt
          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-trunk #673 (See https://builds.apache.org/hudson/job/Hadoop-Hdfs-trunk/673/ ) HDFS-1932 . Ensure that HDFS configuration deprecations are set up in every spot that HDFS configurations are loaded. Contributed by Jolly Chen. todd : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1125601 Files : /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetConf.java /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/GetGroups.java /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSck.java /hadoop/hdfs/trunk/src/java/org/apache/hadoop/fs/Hdfs.java /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java /hadoop/hdfs/trunk/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java /hadoop/hdfs/trunk/CHANGES.txt
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-22-branch #53 (See https://builds.apache.org/hudson/job/Hadoop-Hdfs-22-branch/53/)
          HDFS-1932. Ensure that HDFS configuration deprecations are set up in every spot that HDFS configurations are loaded. Contributed by Jolly Chen.

          todd : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1125600
          Files :

          • /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/fs/Hdfs.java
          • /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
          • /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java
          • /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java
          • /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSck.java
          • /hadoop/hdfs/branches/branch-0.22/CHANGES.txt
          • /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
          • /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java
          • /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-22-branch #53 (See https://builds.apache.org/hudson/job/Hadoop-Hdfs-22-branch/53/ ) HDFS-1932 . Ensure that HDFS configuration deprecations are set up in every spot that HDFS configurations are loaded. Contributed by Jolly Chen. todd : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1125600 Files : /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/fs/Hdfs.java /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/tools/DFSck.java /hadoop/hdfs/branches/branch-0.22/CHANGES.txt /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/DistributedFileSystem.java /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/HdfsConfiguration.java /hadoop/hdfs/branches/branch-0.22/src/java/org/apache/hadoop/hdfs/server/namenode/SecondaryNameNode.java
          Hide
          Hudson added a comment -

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

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

          It turns out that I was wrong about this just being a cleanup JIRA. It in fact fixes a bug since a couple of the cases that loaded the DFS configs didn't set up the deprecations. I committed it to trunk and 22 and made the commit message reflect this fact.

          Thanks, Jolly!

          Show
          Todd Lipcon added a comment - It turns out that I was wrong about this just being a cleanup JIRA. It in fact fixes a bug since a couple of the cases that loaded the DFS configs didn't set up the deprecations. I committed it to trunk and 22 and made the commit message reflect this fact. Thanks, Jolly!
          Hide
          Aaron T. Myers added a comment -

          Sorry, that should've been `hadoop fs -Ddfs.block.size=4096 -touchz f1 ; hadoop fs -stat "%o" f1'

          Show
          Aaron T. Myers added a comment - Sorry, that should've been `hadoop fs -Ddfs.block.size=4096 -touchz f1 ; hadoop fs -stat "%o" f1'
          Hide
          Aaron T. Myers added a comment -

          In terms of testing does the test in HADOOP-7287 fail w/o this patch and succeed with it?

          The test case provided in the patch for HADOOP-7287 does not fail without this patch, since the bug here is really just that the calls to addDeprecation(...) never occur without this patch.

          However, the manual test case described in HADOOP-7287 (i.e. `hadoop fs -Ddfs.blocksize=4096 -touchz f1 ; hadoop fs -stat "%o" f1') does indeed fail without this patch, but succeed with it. I just tested this manually.

          Show
          Aaron T. Myers added a comment - In terms of testing does the test in HADOOP-7287 fail w/o this patch and succeed with it? The test case provided in the patch for HADOOP-7287 does not fail without this patch, since the bug here is really just that the calls to addDeprecation(...) never occur without this patch. However, the manual test case described in HADOOP-7287 (i.e. `hadoop fs -Ddfs.blocksize=4096 -touchz f1 ; hadoop fs -stat "%o" f1') does indeed fail without this patch, but succeed with it. I just tested this manually.
          Hide
          Todd Lipcon added a comment -

          +1

          Show
          Todd Lipcon added a comment - +1
          Hide
          Todd Lipcon added a comment -

          Unfortunately there isn't one central place that suffices. I think once HADOOP-7287 is fixed it will be less important to call this in every Tool. Also, in debugging HADOOP-7287 we just noticed that DistributedFileSystem doesn't instantiate HdfsConfiguration at all - so we'll have to add this there. For now, I'm all for being more cautious and having this in too-many spots rather than too-few.

          In terms of testing does the test in HADOOP-7287 fail w/o this patch and succeed with it?

          This is just a cleanup JIRA. I'll open another one to make sure we initialize it in the right spots (DistributedFileSystem in particular)

          Show
          Todd Lipcon added a comment - Unfortunately there isn't one central place that suffices. I think once HADOOP-7287 is fixed it will be less important to call this in every Tool. Also, in debugging HADOOP-7287 we just noticed that DistributedFileSystem doesn't instantiate HdfsConfiguration at all - so we'll have to add this there. For now, I'm all for being more cautious and having this in too-many spots rather than too-few. In terms of testing does the test in HADOOP-7287 fail w/o this patch and succeed with it? This is just a cleanup JIRA. I'll open another one to make sure we initialize it in the right spots (DistributedFileSystem in particular)
          Hide
          Hadoop QA added a comment -

          -1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12479285/hdfs-1932-2.txt
          against trunk revision 1103987.

          +1 @author. The patch does not contain any @author tags.

          -1 tests included. The patch doesn't appear to include any new or modified tests.
          Please justify why no new tests are needed for this patch.
          Also please list what manual steps were performed to verify this patch.

          +1 javadoc. The javadoc tool did not generate any warning messages.

          +1 javac. The applied patch does not increase the total number of javac compiler warnings.

          +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings.

          +1 release audit. The applied patch does not increase the total number of release audit warnings.

          -1 core tests. The patch failed these core unit tests:
          org.apache.hadoop.hdfs.TestDFSStorageStateRecovery
          org.apache.hadoop.hdfs.TestFileConcurrentReader
          org.apache.hadoop.tools.TestJMXGet

          +1 contrib tests. The patch passed contrib unit tests.

          +1 system test framework. The patch passed system test framework compile.

          Test results: https://builds.apache.org/hudson/job/PreCommit-HDFS-Build/533//testReport/
          Findbugs warnings: https://builds.apache.org/hudson/job/PreCommit-HDFS-Build/533//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
          Console output: https://builds.apache.org/hudson/job/PreCommit-HDFS-Build/533//console

          This message is automatically generated.

          Show
          Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12479285/hdfs-1932-2.txt against trunk revision 1103987. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. -1 core tests. The patch failed these core unit tests: org.apache.hadoop.hdfs.TestDFSStorageStateRecovery org.apache.hadoop.hdfs.TestFileConcurrentReader org.apache.hadoop.tools.TestJMXGet +1 contrib tests. The patch passed contrib unit tests. +1 system test framework. The patch passed system test framework compile. Test results: https://builds.apache.org/hudson/job/PreCommit-HDFS-Build/533//testReport/ Findbugs warnings: https://builds.apache.org/hudson/job/PreCommit-HDFS-Build/533//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: https://builds.apache.org/hudson/job/PreCommit-HDFS-Build/533//console This message is automatically generated.
          Hide
          Eli Collins added a comment -

          Thanks Jolly. Do we need to call HdfsConfiguration#init in these n places to make sure it's loaded? If so, is there 1 place that would suffice? The latest patch looks good, I'm just wondering if there's a better way to implement it.

          In terms of testing does the test in HADOOP-7287 fail w/o this patch and succeed with it?

          Show
          Eli Collins added a comment - Thanks Jolly. Do we need to call HdfsConfiguration#init in these n places to make sure it's loaded? If so, is there 1 place that would suffice? The latest patch looks good, I'm just wondering if there's a better way to implement it. In terms of testing does the test in HADOOP-7287 fail w/o this patch and succeed with it?
          Hide
          Jolly Chen added a comment -

          Per Eli's feedback, updated comments to be more accurate.

          Show
          Jolly Chen added a comment - Per Eli's feedback, updated comments to be more accurate.
          Hide
          Eli Collins added a comment -
          +   * this method is here so that when invoked, the static initializer block above
          +   * is executed to add the deprecated keys and to add the default resources
          

          Is this correct? IIUC the point of calling the empty static method HdfsConfiguration#init is to force the jvm to load the HdfsConfiguration class (if it has not already) and therefore execute the static block (which is executed when the class is loaded, not when init() is invoked).

          Show
          Eli Collins added a comment - + * this method is here so that when invoked, the static initializer block above + * is executed to add the deprecated keys and to add the default resources Is this correct? IIUC the point of calling the empty static method HdfsConfiguration#init is to force the jvm to load the HdfsConfiguration class (if it has not already) and therefore execute the static block (which is executed when the class is loaded, not when init() is invoked).

            People

            • Assignee:
              Jolly Chen
              Reporter:
              Todd Lipcon
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development