Examples of AvatarNode


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

        .getStartupConf());
    return zkClient.getPrimaryLastTxId(address);
  }

  private long getSessionId() throws Exception {
    AvatarNode primaryAvatar = cluster.getPrimaryAvatar(0).avatar;
    String address = AvatarNode.getClusterAddress(primaryAvatar
        .getStartupConf());
    return zkClient.getPrimarySsId(address);
  }
View Full Code Here

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

  @Test
  public void testBlocksMisMatch() throws Exception {
    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

  public static void tearDownAfterClass() throws Exception {
    MiniAvatarCluster.shutDownZooKeeper();
  }

  private long getSessionId(int index) throws Exception {
    AvatarNode primaryAvatar = cluster.getPrimaryAvatar(index).avatar;
    String address = AvatarNode.getClusterAddress(primaryAvatar
        .getStartupConf());
    return zkClient.getPrimarySsId(address);
  }
View Full Code Here

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

    String[] normalArgs = { AvatarConstants.StartupOption.NODEZERO.getName() };
    String[] federationArgs = {
        AvatarConstants.StartupOption.NODEZERO.getName(),
        StartupOption.SERVICE.getName(), nnInfo.nameserviceId };
    String[] args = (federation) ? federationArgs : normalArgs;
    AvatarNode primary1 = AvatarNode.createAvatarNode(
        args,
        MiniAvatarCluster.getServerConf(
            AvatarConstants.StartupOption.NODEZERO.getName(), nnInfo));
    try {
      AvatarNode.createAvatarNode(args, MiniAvatarCluster.getServerConf(
              AvatarConstants.StartupOption.NODEONE.getName(), nnInfo));
      fail("Did not throw exception");
    } catch (Exception e) {
      LOG.info("Expected exception : ", e);
      assertEquals(primary1.getSessionId(), getSessionId(index));
    }
  }
View Full Code Here

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

  private int initializeTest(String testName) throws IOException {
    String fileName = testName;
    createRBWFile(fileName);
    // Verify we have 1 RBW block.
    AvatarNode avatar = cluster.getPrimaryAvatar(0).avatar;
    LocatedBlocks lbks = avatar.namesystem.getBlockLocations(fileName, 0,
        Long.MAX_VALUE);
    int blocksBefore = lbks.locatedBlockCount();
    for (LocatedBlock lbk : lbks.getLocatedBlocks()) {
      DatanodeInfo[] locs = lbk.getLocations();
View Full Code Here

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

  }

  private void verifyResults(int blocksBefore, String fileName)
    throws IOException {
    // Verify we have RBWs after restart.
    AvatarNode avatarAfter = cluster.getPrimaryAvatar(0).avatar;
    LocatedBlocks lbks = avatarAfter.namesystem
        .getBlockLocations(fileName, 0,
        Long.MAX_VALUE);
    long blocksAfter = lbks.locatedBlockCount();
View Full Code Here

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

      throws Exception {
    LOG.info("TEST Ingest Failure : " + event);
    TestAvatarIngestingHandler h = new TestAvatarIngestingHandler(event);
    InjectionHandler.set(h);
    setUp(3); // simulate interruption, no ckpt failure
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
    h.setDisabled(false);

    createEdits(20);
    try {
      Thread.sleep(10000);
    } catch (Exception e) {
    }
    h.setDisabled(true);
    standby.quiesceStandby(getCurrentTxId(primary) - 1);
    assertEquals(20, getCurrentTxId(primary));
    assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
    tearDown();
  }
View Full Code Here

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

  @Test
  public void testBasic() throws Exception {
    LOG.info("------------ testBasic-----------");
    createEdits(20);
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
    standby.quiesceStandby(getCurrentTxId(primary)-1);
    assertEquals(20, getCurrentTxId(primary));
    assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
    LOG.info("------------ testBasic----------- DONE");
  }
View Full Code Here

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

  @Test
  public void testWithFailover() throws Exception {
    LOG.info("------------ testWithFailover-----------");
    // Create edits before failover.
    createEdits(20);
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
    assertEquals(20, getCurrentTxId(primary));

    // Perform failover and restart old primary.
    cluster.failOver();
    cluster.restartStandby();

    // Get new instances after failover.
    primary = cluster.getPrimaryAvatar(0).avatar;
    standby = cluster.getStandbyAvatar(0).avatar;
    assertEquals(20, getCurrentTxId(primary));

    // Create some more edits and verify.
    createEdits(20);
    standby.quiesceStandby(getCurrentTxId(primary)-1);
    assertEquals(40, getCurrentTxId(primary));
    assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
    LOG.info("------------ testWithFailover----------- DONE");
  }
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.