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

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


        argList.add(StartupOption.SERVICE.getName());
        argList.add(nni.nameserviceId);
      }
      a0Args = new String[argList.size()];
      argList.toArray(a0Args);
      AvatarNode a0 = AvatarNode.
        createAvatarNode(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.isInitialized())
          break;
        LOG.info("Waiting for the ACTIVE to be initialized...");
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          throw new IOException(
              "Received interruption when initializing ACTIVE node");
        }
      }
      if (!a0.isInitialized()) {
        throw new IOException("The ACTIVE cannot be initialized");
      }
    }

    {
View Full Code Here


  public void testAvatarShellLeaveSafeMode() throws Exception {
    setUp(false);
    int blocksBefore = blocksInFile();

    AvatarShell shell = new AvatarShell(conf);
    AvatarNode primaryAvatar = cluster.getPrimaryAvatar(0).avatar;
    primaryAvatar.setSafeMode(SafeModeAction.SAFEMODE_ENTER);
    assertTrue(primaryAvatar.isInSafeMode());
    assertEquals(0, shell.run(new String[] { "-zero", "-leaveSafeMode" }));
    assertFalse(primaryAvatar.isInSafeMode());
    assertFalse(cluster.getPrimaryAvatar(0).avatar.isInSafeMode());
    int blocksAfter = blocksInFile();
    assertTrue(blocksBefore == blocksAfter);

  }
View Full Code Here

    int blocksBefore = blocksInFile();
    cluster.failOver();
    cluster.restartStandby();

    AvatarShell shell = new AvatarShell(conf);
    AvatarNode primaryAvatar = cluster.getPrimaryAvatar(0).avatar;
    primaryAvatar.setSafeMode(SafeModeAction.SAFEMODE_ENTER);
    assertTrue(primaryAvatar.isInSafeMode());
    assertEquals(0, shell.run(new String[] { "-one", "-leaveSafeMode" }));
    assertFalse(primaryAvatar.isInSafeMode());
    assertFalse(cluster.getPrimaryAvatar(0).avatar.isInSafeMode());
    int blocksAfter = blocksInFile();
    assertTrue(blocksBefore == blocksAfter);
  }
View Full Code Here

    // fail once
    TestAvatarCheckpointingHandler h = new TestAvatarCheckpointingHandler(null, true);
    InjectionHandler.set(h);
    setUp();
    createEdits(20);
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
   
   
    try {
      Thread.sleep(3000);
      h.failNextCheckpoint = true;
      standby.doCheckpoint();
      fail("Should get IOException here");
    } catch (Exception e) {  }
   
    // checkpoint failed
    assertNotNull(h.lastSignature);
   
    h.failNextCheckpoint = false;
    standby.doCheckpoint();
    // checkpoint succeeded
    assertNull(h.lastSignature);
   
    h.failNextCheckpoint = true;
    try {
      standby.doCheckpoint();
      fail("Should get IOException here");
    } catch (Exception e) {  }
    // checkpoint failed -> now reading edits.new
   
   
    assertNotNull(h.lastSignature)
    createEdits(20);
    standby.quiesceStandby(getCurrentTxId(primary)-1);
    assertEquals(40, getCurrentTxId(primary));
    assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
  }
View Full Code Here

    LOG.info("TEST: ----> testFailCheckpointMultiAndCrash");
    TestAvatarCheckpointingHandler h = new TestAvatarCheckpointingHandler(null, true);
    InjectionHandler.set(h);
    setUp();
    createEdits(20);
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
   
    try {
      Thread.sleep(3000);
      h.failNextCheckpoint = true;
      standby.doCheckpoint();
      fail("Should get IOException here");
    } catch (IOException e) {  }
    // checkpoint did not succeed
    assertNotNull(h.lastSignature);
   
    try {
      standby.doCheckpoint();
      fail("Should get IOException here");
    } catch (IOException e) {  }
    // checkpoint did not succeed
    assertNotNull(h.lastSignature);
   
    try {
      h.alterSignature = true;
      standby.doCheckpoint();
      fail("Checkpoint should not succeed and throw RuntimeException");
    } catch (Exception e) {
      LOG.info("Expected exception : " + e.toString());
    }
  }
View Full Code Here

    LOG.info("TEST: ----> testFailCheckpointOnceAndRestartStandby");
    TestAvatarCheckpointingHandler h = new TestAvatarCheckpointingHandler(null, true);
    InjectionHandler.set(h);
    setUp();
    createEdits(20);
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
   
    try {
      Thread.sleep(3000);
      h.failNextCheckpoint = true;
      standby.doCheckpoint();
      fail("Should get IOException here");
    } catch (IOException e) {  }
    // checkpoint failed
    assertNotNull(h.lastSignature);
   
    cluster.killStandby(0);
    cluster.restartStandby(0);
    Thread.sleep(2000);
   
    standby = cluster.getStandbyAvatar(0).avatar;
    h.failNextCheckpoint = false;
    
    standby.doCheckpoint();
    // checkpoint succeeded
    assertNull(h.lastSignature);
   
    createEdits(20);
    standby.quiesceStandby(getCurrentTxId(primary)-1);
    assertEquals(40, getCurrentTxId(primary));
    assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
  }
View Full Code Here

    h.simulateEditsNotExists = true;
   
    InjectionHandler.set(h);
    setUp();
    createEdits(20);
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
   
    Thread.sleep(3000);
    standby.doCheckpoint();
    assertTrue(h.ingestRecreatedAfterFailure);
    h.simulateEditsNotExists = false;
   
    createEdits(20);
    standby.quiesceStandby(getCurrentTxId(primary)-1);
    assertEquals(40, getCurrentTxId(primary));
    assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
  }
View Full Code Here

        null, false);
    h.corruptImage = true;
    InjectionHandler.set(h);
    setUp();
    createEdits(20);
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
   
    try {
      standby.doCheckpoint();
      fail("Should get IOException here");
    } catch (IOException e) {  }
  }
View Full Code Here

  private void testQuiesceInterruption(InjectionEvent event, boolean scf) throws Exception {
    LOG.info("TEST Quiesce during checkpoint : " + event);
    TestAvatarCheckpointingHandler h = new TestAvatarCheckpointingHandler(event, scf);
    InjectionHandler.set(h);
    setUp(3); //simulate interruption, no ckpt failure  
    AvatarNode primary = cluster.getPrimaryAvatar(0).avatar;
    AvatarNode standby = cluster.getStandbyAvatar(0).avatar;
   
    createEdits(40);
    try {
      Thread.sleep(6000);
    } catch (Exception e) { }

    standby.quiesceStandby(getCurrentTxId(primary)-1);
    assertEquals(40, getCurrentTxId(primary));
    assertEquals(getCurrentTxId(primary), getCurrentTxId(standby));
    tearDown();
  }
View Full Code Here

      fs.create(new Path("/" + random.nextInt()));
    }
  }

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

TOP

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

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.