Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-554

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.8.0
    • None
    • 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.

      Attachments

        1. errorcodes.patch
          2 kB
          Dhruba Borthakur

        Activity

          People

            dhruba Dhruba Borthakur
            menicosia Marco Nicosia
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: