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

Namenode format does not work when hadoop is installed for first time

    Details

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

      Linux CentOS 4

      Description

      The namenode can not be formatted for the first time installation. There is a bug is the main function of org.apache.hadoop.dfs.NameNode class. The code will skip formatting when the directory for name does not exist. There is a possible fix for the bug

      if (argv.length == 1 && argv[0].equals("-format")) {
      boolean aborted = false;
      File[] dirs = getDirs(conf);

      for (int idx = 0; idx < dirs.length; idx++) {
      if (dirs[idx].exists()) {
      System.err.print("Re-format filesystem in " + dirs[idx]
      + " ? (Y or N) ");
      if (!(System.in.read() == 'Y'))

      { System.err .println("Format aborted in " + dirs[idx]); aborted = true; }

      else

      { System.out.println("do format" + dirs[idx].getAbsolutePath()); format(dirs[idx]); System.err.println("Formatted " + dirs[idx]); }

      System.in.read(); // discard the enter-key
      } else

      { System.out.println("do format" + dirs[idx].getAbsolutePath()); format(dirs[idx]); System.err.println("Formatted " + dirs[idx]); }

      }

      System.exit(aborted ? 1 : 0);
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lchen5 Lei Chen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: