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

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

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment