Hadoop Common
  1. Hadoop Common
  2. HADOOP-554

hadoop dfs command line doesn't exit with status code on error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.8.0
    • Component/s: None
    • Labels:
      None

      Description

      In DFSClient, the code looks like:

      ---- >8 ----

      int exitCode = -1;
      ...
      try {
      if ("-put".equals(cmd) || "-copyFromLocal".equals(cmd))

      { copyFromLocal(new Path(argv[i++]), argv[i++]); ... exitCode = 0;; }

      catch (IOException e )

      { System.err.println( cmd.substring(1) + ": " + e.getLocalizedMessage() ); }

      finally

      { fs.close(); }

      return exitCode;

      ---- 8< ----

      Point 1: Few, if any of the functions called throw an exception. Instead they System.err.println and return.
      Point 2: exitCode, regardless if there is an exception, is always 0.

      At minimum, it would be best if SOME status code were returned, so that any scripts calling hadoop dfs would know to parse the output.

      At best, there'd be a well-documented table of exit codes so that parsing stderr wouldn't be required.

      1. errorcodes.patch
        2 kB
        dhruba borthakur

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Patch Available Patch Available
        31d 23h 20m 1 dhruba borthakur 23/Oct/06 18:25
        Patch Available Patch Available Resolved Resolved
        1d 4h 8m 1 Doug Cutting 24/Oct/06 22:33
        Resolved Resolved Closed Closed
        10d 1h 6m 1 Doug Cutting 03/Nov/06 22:40
        Owen O'Malley made changes -
        Component/s dfs [ 12310710 ]
        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Doug Cutting made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 0.8.0 [ 12312098 ]
        Hide
        Doug Cutting added a comment -

        I just committed this. Thanks, Dhruba.

        Show
        Doug Cutting added a comment - I just committed this. Thanks, Dhruba.
        dhruba borthakur made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        dhruba borthakur added a comment -

        Prints out appropriate error message in case of version mismatch. This is a common case when a cluster is upgraded. In all error cases, returns and error code of -1.

        Show
        dhruba borthakur added a comment - Prints out appropriate error message in case of version mismatch. This is a common case when a cluster is upgraded. In all error cases, returns and error code of -1.
        dhruba borthakur made changes -
        Attachment errorcodes.patch [ 12343440 ]
        Hide
        dhruba borthakur added a comment -

        Prints out appropriate error message in case of version mismatch. This is a common case when a cluster is upgraded. In all error cases, returns and error code of -1.

        Show
        dhruba borthakur added a comment - Prints out appropriate error message in case of version mismatch. This is a common case when a cluster is upgraded. In all error cases, returns and error code of -1.
        dhruba borthakur made changes -
        Field Original Value New Value
        Assignee dhruba borthakur [ dhruba ]
        Marco Nicosia created issue -

          People

          • Assignee:
            dhruba borthakur
            Reporter:
            Marco Nicosia
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development