Package org.apache.hadoop.hdfs.server.namenode

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


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

    createEdits(20);
    h.setDisabled(true);
   
    if (!enableQJM) {
      standby.quiesceStandby(getCurrentTxId(primary) - 1);
      // SLS + 20 edits
      assertEquals(21, getCurrentTxId(primary));
      assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
    }
    tearDown();
View Full Code Here


    TestAvatarIngestingHandler h = new TestAvatarIngestingHandler(
        InjectionEvent.FSEDIT_LOG_WRITE_END_LOG_SEGMENT);
    InjectionHandler.set(h);
    setUp(3, "testCheckpointWithRestarts", true, false);
    // 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

    TestAvatarIngestingHandler h = new TestAvatarIngestingHandler(
        InjectionEvent.STANDBY_RECOVER_STATE);
    InjectionHandler.set(h);
    setUp(3, "testRecoverState", true, false);
    // 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

  @Test
  public void testWithFailoverTxIdMismatchHard() throws Exception {
    setUp("testWithFailoverTxIdMismatchHard", true);
    // Create edits before failover.
    createEdits(20);
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;

    // SLS + ELS (first checkpoint with no txns) + SLS + 20 edits
    assertEquals(23, getCurrentTxId(primary));

    standby.getFSImage().getEditLog().setLastWrittenTxId(49);
    assertEquals(50, getCurrentTxId(standby));

    // Perform failover and verify it fails.
    try {
      cluster.failOver();
View Full Code Here

  @Test
  public void testBasic() throws Exception {
    setUp("testBasic", false);
    createEdits(20);
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
    standby.quiesceStandby(getCurrentTxId(primary)-1);
   
    // SLS + ELS + SLS + 20 edits
    assertEquals(23, getCurrentTxId(primary));
    assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
  }
View Full Code Here

 
  protected void doTestWithFailover(boolean enableQJM) throws Exception {
    setUp("testWithFailover", enableQJM);
    // Create edits before failover.
    createEdits(20);
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
   
    // SLS + ELS (first checkpoint with no txns) + SLS + 20 edits
    assertEquals(23, getCurrentTxId(primary));

    // Perform failover and restart old primary.
    cluster.failOver(); // shutdown adds ELS (24)
    assertEquals(25, getCurrentTxId(cluster.getPrimaryAvatar(0).avatar));
   
    cluster.restartStandby();

    // Get new instances after failover.
    primary = cluster.getPrimaryAvatar(0).avatar;
    standby = cluster.getStandbyAvatar(0).avatar;
   
    // checkpoint by the new standby adds 2 transactions
    // standby opens the log with SLS (25)
    // new standby checkpoints ELS + SLS

    if (!enableQJM) {
      // Create some more edits and verify.
      createEdits(20);
      standby.quiesceStandby(getCurrentTxId(primary)-1);
     
      assertEquals(47, getCurrentTxId(primary));
      assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
    }
  }
View Full Code Here

   
    // Perform second failover.
    cluster.failOver(); // 49
    cluster.restartStandby(); // 51

    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
   
    if (!enableQJM) {
      createEdits(20);
      standby.quiesceStandby(getCurrentTxId(primary)-1);
      assertEquals(71, getCurrentTxId(primary));
      assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
    }
  }
View Full Code Here

    doTestWithStandbyDead(false);
  }
 
  protected void doTestWithStandbyDead(boolean enableQJM) throws Exception {
    setUp("testWithStandbyDead", enableQJM);
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    createEdits(20); // 23 (initial checkpoint) + 20 edits
    assertEquals(23, getCurrentTxId(primary));
   
    cluster.killStandby();
    createEdits(20); // 43
    assertEquals(43, getCurrentTxId(primary));
   
    cluster.restartStandby(); // 45 (checkpoint)
    Thread.sleep(1000); // for checkpoint
    assertEquals(45, getCurrentTxId(primary));
   
    createEdits(20); // 67

    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
   
  if (!enableQJM) {
      standby.quiesceStandby(getCurrentTxId(primary)-1);
      assertEquals(65, getCurrentTxId(primary));
      assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
    }
  }
View Full Code Here

  }
 
  protected void doTestWithStandbyDeadAfterFailover(boolean enableQJM) throws Exception {
    setUp("testWithStandbyDeadAfterFailover", enableQJM);
    // initial checkpoint 3
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
   
    createEdits(20); //23
    assertEquals(23, getCurrentTxId(primary));
    cluster.failOver(); //25
    primary = cluster.getPrimaryAvatar(0).avatar;
    assertEquals(25, getCurrentTxId(primary));
    createEdits(20); //45
    assertEquals(45, getCurrentTxId(primary));
    cluster.killStandby();
    createEdits(20); //65
    assertEquals(65, getCurrentTxId(primary));
    cluster.restartStandby(); //67
    Thread.sleep(1000);
    assertEquals(67, getCurrentTxId(primary));
      
    createEdits(20);

    assertEquals(87, getCurrentTxId(cluster.getPrimaryAvatar(0).avatar));
   
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
   
    if (!enableQJM) {
      standby.quiesceStandby(getCurrentTxId(primary)-1);
      assertEquals(87, getCurrentTxId(primary));
      assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
    }
  }
View Full Code Here

    TestAvatarTxIdsHandler h = new TestAvatarTxIdsHandler();
    InjectionHandler.set(h);
    setUp("testWithCheckPoints", enableQJM);
    // 3 (initial checkpoint)
    createEdits(20); //23
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
    h.doCheckpoint(); //25
    createEdits(20); //45
   
    if (!enableQJM) {
      standby.quiesceStandby(getCurrentTxId(primary)-1);
      assertEquals(45, getCurrentTxId(primary));
      assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
    }
    InjectionHandler.clear();
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.server.namenode.AvatarNode$ShutdownAvatarThread

Copyright © 2018 www.massapicom. 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.