Ejemplo n.º 1
0
 @Test
 public void testStandbyWithFederation() throws Exception {
   setUp(true, "testStandbyWithFederation");
   LOG.info("DAFS testStandby");
   long lastTxId = getLastTxId();
   cluster.killPrimary(0, false);
   // make sure to consume all transactions
   cluster.getStandbyAvatar(0).avatar.quiesceStandby(lastTxId);
   checkStandby();
 }
Ejemplo n.º 2
0
 @Test
 public void testPrimaryWithFederation() throws Exception {
   setUp(true, "testPrimaryWithFederation");
   LOG.info("DAFS testPrimary");
   cluster.killStandby(0);
   checkPrimary();
 }
Ejemplo n.º 3
0
 /** Read from primary avatar. */
 @Test
 public void testPrimary() throws Exception {
   setUp(false, "testPrimary");
   LOG.info("DAFS testPrimary");
   cluster.killStandby();
   checkPrimary();
 }
Ejemplo n.º 4
0
 @Test
 public void testPrimaryShutdownFailure() throws Exception {
   setUp(false, "testPrimaryShutdownFailure");
   InjectionHandler.set(new TestAvatarAPIHandler());
   LOG.info("DAFS testPrimary");
   try {
     cluster.killPrimary();
     fail("Shutting down the node should fail");
   } catch (IOException e) {
     assertTrue(e.toString().contains("number of required edit streams"));
   }
   InjectionHandler.clear();
 }
Ejemplo n.º 5
0
  /** Set up MiniAvatarCluster. */
  public void setUp(boolean federation, String name) throws Exception {
    LOG.info("------------------- test: " + name + " START ----------------");
    conf = new Configuration();
    // populate repl queues on standby (in safe mode)
    conf.setFloat("dfs.namenode.replqueue.threshold-pct", 0f);
    conf.setLong("fs.avatar.standbyfs.initinterval", 1000);
    conf.setLong("fs.avatar.standbyfs.checkinterval", 1000);
    if (!federation) {
      cluster = new MiniAvatarCluster(conf, 3, true, null, null);
      dafs = cluster.getFileSystem();
    } else {
      cluster = new MiniAvatarCluster(conf, 3, true, null, null, 1, true);
      dafs = cluster.getFileSystem(0);
    }

    path = new Path(FILE_PATH);
    dirPath = new Path(DIR_PATH);
    DFSTestUtil.createFile(dafs, path, FILE_LEN, (short) 1, 0L);
    DFSTestUtil.waitReplication(dafs, path, (short) 1);
    try {
      Thread.sleep(4000);
    } catch (InterruptedException ignore) {
    }
  }
Ejemplo n.º 6
0
  @Test
  public void testFailOverWithFederation() throws Exception {
    setUp(true, "testFailoverWithFederation");
    LOG.info("DAFS testFailOver");
    long lastTxId = getLastTxId();
    cluster.killPrimary(0);
    cluster.failOver(0);
    cluster.restartStandby(0);
    cluster.waitAvatarNodesActive(0);
    cluster.waitDataNodesActive(0);
    // make sure to consume all transactions.
    cluster.getStandbyAvatar(0).avatar.quiesceStandby(lastTxId);

    try {
      Thread.sleep(2000);
    } catch (InterruptedException ignore) {
    }

    checkStandby();
    checkPrimary();
  }
Ejemplo n.º 7
0
 @BeforeClass
 public static void setUpClass() throws Exception {
   MiniAvatarCluster.createAndStartZooKeeper();
 }
Ejemplo n.º 8
0
 @AfterClass
 public static void shutDownClass() throws Exception {
   MiniAvatarCluster.shutDownZooKeeper();
 }
Ejemplo n.º 9
0
 @After
 public void shutDown() throws Exception {
   dafs.close();
   cluster.shutDown();
 }
Ejemplo n.º 10
0
 private long getLastTxId() {
   return cluster.getPrimaryAvatar(0).avatar.getFSImage().getEditLog().getCurrentTxId() - 1;
 }