Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-4451

hdfs balancer command returns exit code 1 on success instead of 0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.2-alpha
    • 2.0.3-alpha
    • balancer & mover
    • None
    • Centos 6.3, JDK 1.6.0_25

    • Incompatible change, Reviewed
    • This is an incompatible change from release 2.0.2-alpha and prior releases. Balancer tool exited with exit code 1 on success. It is changed to exit with exit code 0 on success. Non 0 exit code indicates failure.

    Description

      Though the org.apache.hadoop.util.Tool interface javadocs indicate implementations should return 0 on success, the org.apache.hadoop.hdfs.server.balance.Balancer.Cli implementation returns the int values of this enum instead:

      // Exit status
      enum ReturnStatus {
      SUCCESS(1),
      IN_PROGRESS(0),
      ALREADY_RUNNING(-1),
      NO_MOVE_BLOCK(-2),
      NO_MOVE_PROGRESS(-3),
      IO_EXCEPTION(-4),
      ILLEGAL_ARGS(-5),
      INTERRUPTED(-6);

      This created an issue for us when we tried to run the hdfs balancer as a cron job. Cron sends emails whenever a executable it runs exits non-zero. We'd either have to disable all emails and miss real issues or fix this bug.

      I think both SUCCESS and IN_PROGRESS ReturnStatuses should lead to exit 0.

      Marking this change as incompatible because existing scripts which interpret exit 1 as success will be broken (unless they defensively/liberally interpret both exit 1 and exit 0 as success).

      Attachments

        1. HDFS-4451.patch
          6 kB
          Joshua Blatt
        2. HDFS-4451.patch
          6 kB
          Joshua Blatt
        3. HDFS-4451.patch
          7 kB
          Joshua Blatt

        Activity

          People

            Unassigned Unassigned
            jtblatt Joshua Blatt
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: