Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-3675

libhdfs: follow documented return codes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.1-alpha
    • Fix Version/s: 2.0.2-alpha
    • Component/s: libhdfs
    • Labels:
      None
    • Hadoop Flags:
      Incompatible change, Reviewed

      Description

      libhdfs should follow its own documentation for return codes. This means always setting errno, and in most cases returning -1 (not some other value) on error.

      1. HDFS-3675.001.patch
        3 kB
        Colin Patrick McCabe
      2. HDFS-3675.002.patch
        3 kB
        Colin Patrick McCabe

        Activity

        Colin Patrick McCabe created issue -
        Colin Patrick McCabe made changes -
        Field Original Value New Value
        Attachment HDFS-3675.001.patch [ 12536910 ]
        Colin Patrick McCabe made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Andy Isaacson added a comment -
        @@ -1866,18 +1868,18 @@ int hdfsChmod(hdfsFS fs, const char* path, short mode)
             jobject jPermObj =
               constructNewObjectOfClass(env, NULL, HADOOP_FSPERM,"(S)V",jmode);
             if (jPermObj == NULL) {
        -      return -2;
        +      ret = EINTERNAL;
        +      return -1;
        

        I think that should be "errno = EINTERNAL"? It doesn't make sense to assign to the local variable "ret" immediately before returning.

        Other than that, this looks fine. I'm not sure moving the "ret=0" down from around line 1872 to around 1889 is a win, but it's not a problem either.

        Show
        Andy Isaacson added a comment - @@ -1866,18 +1868,18 @@ int hdfsChmod(hdfsFS fs, const char * path, short mode) jobject jPermObj = constructNewObjectOfClass(env, NULL, HADOOP_FSPERM, "(S)V" ,jmode); if (jPermObj == NULL) { - return -2; + ret = EINTERNAL; + return -1; I think that should be "errno = EINTERNAL"? It doesn't make sense to assign to the local variable "ret" immediately before returning. Other than that, this looks fine. I'm not sure moving the "ret=0" down from around line 1872 to around 1889 is a win, but it's not a problem either.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12536910/HDFS-3675.001.patch
        against trunk revision .

        +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 javac. The applied patch does not increase the total number of javac compiler warnings.

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

        +1 eclipse:eclipse. The patch built with eclipse:eclipse.

        +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 unit tests in hadoop-hdfs-project/hadoop-hdfs:

        org.apache.hadoop.hdfs.server.namenode.TestNameNodeResourceChecker
        org.apache.hadoop.hdfs.server.namenode.metrics.TestNameNodeMetrics

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

        Test results: https://builds.apache.org/job/PreCommit-HDFS-Build/2847//testReport/
        Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/2847//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/12536910/HDFS-3675.001.patch against trunk revision . +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 javac. The applied patch does not increase the total number of javac compiler warnings. +1 javadoc. The javadoc tool did not generate any warning messages. +1 eclipse:eclipse. The patch built with eclipse:eclipse. +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 unit tests in hadoop-hdfs-project/hadoop-hdfs: org.apache.hadoop.hdfs.server.namenode.TestNameNodeResourceChecker org.apache.hadoop.hdfs.server.namenode.metrics.TestNameNodeMetrics +1 contrib tests. The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-HDFS-Build/2847//testReport/ Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/2847//console This message is automatically generated.
        Colin Patrick McCabe made changes -
        Attachment HDFS-3675.002.patch [ 12536954 ]
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12536954/HDFS-3675.002.patch
        against trunk revision .

        +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 javac. The applied patch does not increase the total number of javac compiler warnings.

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

        +1 eclipse:eclipse. The patch built with eclipse:eclipse.

        +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 unit tests in hadoop-hdfs-project/hadoop-hdfs:

        org.apache.hadoop.hdfs.server.namenode.metrics.TestNameNodeMetrics

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

        Test results: https://builds.apache.org/job/PreCommit-HDFS-Build/2852//testReport/
        Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/2852//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/12536954/HDFS-3675.002.patch against trunk revision . +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 javac. The applied patch does not increase the total number of javac compiler warnings. +1 javadoc. The javadoc tool did not generate any warning messages. +1 eclipse:eclipse. The patch built with eclipse:eclipse. +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 unit tests in hadoop-hdfs-project/hadoop-hdfs: org.apache.hadoop.hdfs.server.namenode.metrics.TestNameNodeMetrics +1 contrib tests. The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-HDFS-Build/2852//testReport/ Console output: https://builds.apache.org/job/PreCommit-HDFS-Build/2852//console This message is automatically generated.
        Hide
        Andy Isaacson added a comment -

        +1 lgtm.

        Thanks!

        Show
        Andy Isaacson added a comment - +1 lgtm. Thanks!
        Hide
        Eli Collins added a comment -

        +1 lgtm as well. Marking as an incompatible change since this technically changes the API (not that I expect people were depending on these particular error codes).

        Show
        Eli Collins added a comment - +1 lgtm as well. Marking as an incompatible change since this technically changes the API (not that I expect people were depending on these particular error codes).
        Eli Collins made changes -
        Hadoop Flags Incompatible change,Reviewed [ 10342, 10343 ]
        Hide
        Eli Collins added a comment -

        I've committed this and merged to branch-2. Thanks Colin.

        Show
        Eli Collins added a comment - I've committed this and merged to branch-2. Thanks Colin.
        Eli Collins made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Target Version/s 2.0.1-alpha [ 12322465 ]
        Fix Version/s 2.2.0-alpha [ 12322472 ]
        Resolution Fixed [ 1 ]
        Hide
        Hudson added a comment -

        Integrated in Hadoop-Hdfs-trunk-Commit #2566 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Commit/2566/)
        HDFS-3675. libhdfs: follow documented return codes. Contributed by Colin Patrick McCabe (Revision 1363459)

        Result = SUCCESS
        eli : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1363459
        Files :

        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
        Show
        Hudson added a comment - Integrated in Hadoop-Hdfs-trunk-Commit #2566 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Commit/2566/ ) HDFS-3675 . libhdfs: follow documented return codes. Contributed by Colin Patrick McCabe (Revision 1363459) Result = SUCCESS eli : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1363459 Files : /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
        Hide
        Hudson added a comment -

        Integrated in Hadoop-Common-trunk-Commit #2501 (See https://builds.apache.org/job/Hadoop-Common-trunk-Commit/2501/)
        HDFS-3675. libhdfs: follow documented return codes. Contributed by Colin Patrick McCabe (Revision 1363459)

        Result = SUCCESS
        eli : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1363459
        Files :

        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
        Show
        Hudson added a comment - Integrated in Hadoop-Common-trunk-Commit #2501 (See https://builds.apache.org/job/Hadoop-Common-trunk-Commit/2501/ ) HDFS-3675 . libhdfs: follow documented return codes. Contributed by Colin Patrick McCabe (Revision 1363459) Result = SUCCESS eli : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1363459 Files : /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
        Hide
        Hudson added a comment -

        Integrated in Hadoop-Mapreduce-trunk-Commit #2523 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Commit/2523/)
        HDFS-3675. libhdfs: follow documented return codes. Contributed by Colin Patrick McCabe (Revision 1363459)

        Result = FAILURE
        eli : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1363459
        Files :

        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
        Show
        Hudson added a comment - Integrated in Hadoop-Mapreduce-trunk-Commit #2523 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Commit/2523/ ) HDFS-3675 . libhdfs: follow documented return codes. Contributed by Colin Patrick McCabe (Revision 1363459) Result = FAILURE eli : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1363459 Files : /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
        Hide
        Hudson added a comment -

        Integrated in Hadoop-Mapreduce-trunk #1142 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/1142/)
        HDFS-3675. libhdfs: follow documented return codes. Contributed by Colin Patrick McCabe (Revision 1363459)

        Result = FAILURE
        eli : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1363459
        Files :

        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
        • /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
        Show
        Hudson added a comment - Integrated in Hadoop-Mapreduce-trunk #1142 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/1142/ ) HDFS-3675 . libhdfs: follow documented return codes. Contributed by Colin Patrick McCabe (Revision 1363459) Result = FAILURE eli : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1363459 Files : /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/native/libhdfs/hdfs.c
        Arun C Murthy made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Patch Available Patch Available
        13m 13s 1 Colin Patrick McCabe 17/Jul/12 23:28
        Patch Available Patch Available Resolved Resolved
        1d 18h 58m 1 Eli Collins 19/Jul/12 18:26
        Resolved Resolved Closed Closed
        83d 23h 19m 1 Arun C Murthy 11/Oct/12 17:46

          People

          • Assignee:
            Colin Patrick McCabe
            Reporter:
            Colin Patrick McCabe
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development