Examples of AvatarNode


Examples of org.apache.hadoop.hdfs.server.namenode.AvatarNode

      assertTrue(locs.length != 0);
    }
  }

  private boolean blocksReceived(int nBlocks, String fileName) throws IOException {
    AvatarNode avatar = cluster.getPrimaryAvatar(0).avatar;
    LocatedBlocks lbks = avatar.namesystem.getBlockLocations(fileName, 0,
        Long.MAX_VALUE);
    int blocks = lbks.locatedBlockCount();
    if (blocks != nBlocks)
      return false;
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.AvatarNode

        argList.add(StartupOption.SERVICE.getName());
        argList.add(nni.nameserviceId);
      }
      a0Args = new String[argList.size()];
      argList.toArray(a0Args);
      AvatarNode a0 = instantiateAvatarNode(a0Args,
                         getServerConf(AvatarConstants.
                                       StartupOption.
                                       NODEZERO.
                                       getName(), nni));

      avatars.add(new AvatarInfo(a0,
                                 AvatarState.ACTIVE,
                                 nni.nn0Port, nni.nnDn0Port, nni.http0Port, nni.rpc0Port,
                                 AvatarConstants.StartupOption.NODEZERO.
                                 getName()));
     
      // wait for up to 10 seconds until the ACTIVE is initialized
      for (int i = 0; i < 10; i++) {
        if (a0.isInitDone())
          break;
        LOG.info("Waiting for the ACTIVE to be initialized...");
        sleep(1000);
      }
      if (!a0.isInitDone()) {
        throw new IOException("The ACTIVE cannot be initialized");
      }
    }

    {
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.AvatarNode

  @SuppressWarnings("unchecked")
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response
                    ) throws ServletException, IOException {
    ServletContext context = getServletContext();
    AvatarNode nn = (AvatarNode)context.getAttribute("avatar.node");
    FSNamesystem fsn = nn.getNamesystem();
    boolean isStandby = false;
    boolean isFailover = false;
    Set <DatanodeID> heartbeats = null;
    Set <DatanodeID> reports = null;
    String msg = null;
    fsn.writeLock();
    // We need to capture all information under a namesystem lock, since we
    // might leave safemode and the safemode object might be set to null.
    try {
      isStandby = (nn.reportAvatar() == Avatar.STANDBY);
      StandbySafeMode sm = nn.getStandbySafeMode();
      if (sm == null && isStandby) {
        msg = standbyNull;
      } else if (sm == null) {
        msg = notStandby;
      } else {
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.AvatarNode

    TestAvatarIngestingHandler h = new TestAvatarIngestingHandler(
        InjectionEvent.FSEDIT_LOG_WRITE_END_LOG_SEGMENT);
    InjectionHandler.set(h);
    setUp(3, "testCheckpointWithRestarts", true, true);
    // simulate interruption, no ckpt failure
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
    createEdits(20);
    h.doCheckpoint();
    // 2 for initial checkpoint + 2 for this checkpoint + SLS + 20 edits
    h.disabled = false;
    assertEquals(25, getCurrentTxId(primary));
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.AvatarNode

    TestAvatarIngestingHandler h = new TestAvatarIngestingHandler(
        InjectionEvent.STANDBY_RECOVER_STATE);
    InjectionHandler.set(h);
    setUp(3, "testRecoverState", true, true);
    // simulate interruption, no ckpt failure
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
    h.setDisabled(true);

    createEdits(20);
    h.doCheckpoint();
    // 2 for initial checkpoint + 2 for this checkpoint + SLS + 20 edits
    assertEquals(25, getCurrentTxId(primary));
    createEdits(20);
    h.setDisabled(false);

    // sleep to see if the state recovers correctly
    DFSTestUtil.waitNSecond(5);
    h.doCheckpoint();
    standby.quiesceStandby(getCurrentTxId(primary) - 1);

    assertEquals(47, getCurrentTxId(primary));
    assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.AvatarNode

  public void testBlocksMisMatch() throws Exception {
    setUp("testBlocksMisMatch", false);
    int totalBlocks = 50;
    DFSTestUtil.createFile(fs, new Path("/testBlocksMisMatch"),
        (long) totalBlocks * 1024, (short) 3, System.currentTimeMillis());
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
    standby.quiesceStandby(cluster
        .getPrimaryAvatar(0).avatar.getLastWrittenTxId());
    // This sets the standby number of blocks to 0.
    standby.namesystem.close();
    try {
      cluster.failOver();
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.AvatarNode

  @Test
  public void testStandbyTailingJNFailure() throws Exception {
    setUp("testStandbyTailingJNFailure");

    DFSTestUtil.createFile(fs, new Path("/test"), 1024, (short) 1, 0);
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
    handler.doCheckpoint();

    // Find the journal node the Standby is tailing from.
    JournalNode jn = getStandbyTailingJN();
    assertNotNull(jn);

    jn.stopAndJoin(0);
    handler.instantiatedIngest = false;

    LOG.info("Stopped JournalNode with port "
        + jn.getBoundHttpAddress().getPort());
    LOG.info("current journal port : " + handler.currentJournalHttpPort);

    DFSTestUtil.createFile(fs, new Path("/test1"), 1024, (short) 1, 0);

    // Wait for ingest.
    long start = System.currentTimeMillis();
    while (!handler.instantiatedIngest
        && System.currentTimeMillis() - start < 10000) {
      DFSTestUtil.waitSecond();
    }

    assertTrue(handler.instantiatedIngest);

    LOG.info("Ingest failures : "
        + standby.getAvatarNodeMetrics().numIngestFailures.get());
    assertTrue(standby.getAvatarNodeMetrics().numIngestFailures
        .get() <= 1);
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.AvatarNode

  protected void doTestDelayedCheckpoint(boolean enableQJM) throws Exception {
    TestAvatarCheckpointingHandler h = new TestAvatarCheckpointingHandler();
    InjectionHandler.set(h);
    setUp(3600, "testDelayedCheckpoint", enableQJM);

    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
    createEdits(40);

    long start = System.currentTimeMillis();
    while (System.currentTimeMillis() - start < 10000) {
      if (h.receivedEvents.contains(InjectionEvent.STANDBY_DELAY_CHECKPOINT)) {
        // checkpoint has been delayed at least once
        break;
      }
    }
    // checkpoint was delayed
    assertTrue(h.receivedEvents
        .contains(InjectionEvent.STANDBY_DELAY_CHECKPOINT));
    // no actual checkpoint happened at startup
    assertFalse(h.receivedEvents
        .contains(InjectionEvent.STANDBY_BEFORE_ROLL_EDIT));

    if (!enableQJM) {
      standby.quiesceStandby(DFSAvatarTestUtil.getCurrentTxId(primary) - 1);
      // edits + SLS
      assertEquals(41, DFSAvatarTestUtil.getCurrentTxId(primary));
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.AvatarNode

      throws IOException, ConfigException, InterruptedException{
    MiniAvatarCluster cluster = new MiniAvatarCluster(conf, 1, true, null, null, 2, true);
    try {
      NameNodeInfo nn1 = cluster.getNameNode(0);
      NameNodeInfo nn2 = cluster.getNameNode(1);
      AvatarNode nn1zero = nn1.avatars.get(0).avatar;
      AvatarNode nn1one = nn1.avatars.get(1).avatar;
      AvatarNode nn2zero = nn2.avatars.get(0).avatar;
      AvatarNode nn2one = nn2.avatars.get(1).avatar;
      assertNotNull("cannot create nn1 avatar 0", nn1zero);
      assertNotNull("cannot create nn1 avatar 1", nn1one);
      assertNotNull("cannot create nn2 avatar 0", nn2zero);
      assertNotNull("cannot create nn2 avatar 1", nn2one);
     
      int ns1zero = nn1zero.getNamespaceID();
      int ns1one = nn1one.getNamespaceID();
      assertEquals("namespace ids for namenode 1 should be the same",
          ns1zero, ns1one);
      int ns2zero = nn2zero.getNamespaceID();
      int ns2one = nn2one.getNamespaceID();
      assertEquals("namespace ids for namenode 2 should be the same",
          ns2zero, ns2one);
      int lv1zero = nn1zero.getFSImage().getLayoutVersion();
      int lv1one = nn1one.getFSImage().getLayoutVersion();
      int lv2zero = nn2zero.getFSImage().getLayoutVersion();
      int lv2one = nn2one.getFSImage().getLayoutVersion();
      assertNotSame("namespace ids should be different", ns1zero, ns2zero);
      LOG.info("nn1zero: lv=" + lv1zero + ";uri=" + nn1zero.getNameNodeAddress());
      LOG.info("nn1one: lv=" + lv1one + ";uri=" + nn1one.getNameNodeAddress());
      LOG.info("nn2zero: lv=" + lv2zero + ";uri=" + nn2zero.getNameNodeAddress());
      LOG.info("nn2one: lv=" + lv2one + ";uri=" + nn2one.getNameNodeAddress());

      // check number of volumes in fsdataset
      AvatarDataNode dn = cluster.getDataNodes().get(0);
     
      for (NamespaceService nsos : dn.getAllNamespaceServices()) {
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.AvatarNode

  public void testFedSingleNN()
      throws IOException, ConfigException, InterruptedException {
    MiniAvatarCluster cluster = new MiniAvatarCluster(conf, 1, true, null, null, 1, true);
    try {
      NameNodeInfo nn1 = cluster.getNameNode(0);
      AvatarNode nn1zero = nn1.avatars.get(0).avatar;
      AvatarNode nn1one = nn1.avatars.get(1).avatar;
      assertNotNull("cannot create nn1 zero", nn1zero);
      assertNotNull("cannot create nn1 one", nn1one);

      int nsid1zero = nn1zero.getNamespaceID();
      int nsid1one = nn1one.getNamespaceID();
      assertEquals("namespace ids for namenode 1 should be the same",
          nsid1zero, nsid1one);
      int lv1zero = nn1zero.getFSImage().getLayoutVersion();
      int lv1one = nn1one.getFSImage().getLayoutVersion();
      LOG.info("nn1: lv=" + lv1zero + ";nsid=" + nsid1zero + ";uri="
          + nn1zero.getNameNodeAddress());
      LOG.info("nn1: lv=" + lv1one + ";nsid=" + nsid1one + ";uri="
          + nn1one.getNameNodeAddress());

      // check number of vlumes in fsdataset
      AvatarDataNode dn = cluster.getDataNodes().get(0);
      for (NamespaceService nsos : dn.getAllNamespaceServices()) {
        LOG.info("reg: nsid =" + nsos.getNamespaceId() + "; name="
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.