You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Nitin Goyal <ni...@gmail.com> on 2014/07/02 11:34:30 UTC

Editlog recoverUnclosedStreams not getting called when cluster restarted and its not an UPGRADE

Hi All,

I would like to know the reason behind not calling
"editLog.recoverUnclosedStreams()"
in "initEditLog" method of FSImage.java.

public void initEditLog(StartupOption startOpt) throws IOException {

    Preconditions.checkState(getNamespaceID() != 0,

        "Must know namespace ID before initting edit log");

    String nameserviceId = DFSUtil.getNamenodeNameServiceId(conf);

    if (!HAUtil.isHAEnabled(conf, nameserviceId)) {

      // If this NN is not HA

      editLog.initJournalsForWrite();

      editLog.recoverUnclosedStreams();

    } else if (HAUtil.isHAEnabled(conf, nameserviceId)

        && (startOpt == StartupOption.UPGRADE

            || RollingUpgradeStartupOption.ROLLBACK.matches(startOpt))) {

      // This NN is HA, but we're doing an upgrade or a rollback of rolling

      // upgrade so init the edit log for write.

      editLog.initJournalsForWrite();

      if (startOpt == StartupOption.UPGRADE) {

        long sharedLogCTime = editLog.getSharedLogCTime();

        if (this.storage.getCTime() < sharedLogCTime) {

          throw new IOException("It looks like the shared log is already " +

              "being upgraded but this NN has not been upgraded yet. You " +

              "should restart this NameNode with the '" +

              StartupOption.BOOTSTRAPSTANDBY.getName() + "' option to bring
" +

              "this NN in sync with the other.");

        }

      }

      editLog.recoverUnclosedStreams();

    } else {

      // This NN is HA and we're not doing an upgrade.

      editLog.initSharedJournalsForRead();

    }

  }


Actually, I have a use case where I want to read the progress file when the
namenode comes up while Yarn HA is enabled. I am using hadoop 2.4.

-- 
Regards
Nitin Goyal