Package org.apache.hadoop.hdfs.qjournal.server

Examples of org.apache.hadoop.hdfs.qjournal.server.JournalNode


    try {
      URI uri = c.getQuorumJournalURI("myjournal");
      String[] addrs = uri.getAuthority().split(";");
      assertEquals(3, addrs.length);
     
      JournalNode node = c.getJournalNode(0);
      String dir = node.getConf().get(DFSConfigKeys.DFS_JOURNALNODE_EDITS_DIR_KEY);
      assertEquals(
          new File(MiniDFSCluster.getBaseDirectory() + "journalnode-0")
            .getAbsolutePath(),
          dir);
    } finally {
View Full Code Here


   
    conf.set(DFSConfigKeys.DFS_JOURNALNODE_EDITS_DIR_KEY,
        editsDir.getAbsolutePath());
    conf.set(DFSConfigKeys.DFS_JOURNALNODE_RPC_ADDRESS_KEY,
        "0.0.0.0:0");
    jn = new JournalNode();
    jn.setConf(conf);
    jn.start();
    journalId = "test-journalid-" + GenericTestUtils.uniqueSequenceId();
    journal = jn.getOrCreateJournal(journalId);
    journal.format(FAKE_NSINFO);
View Full Code Here

  }

  private static void assertJNFailsToStart(Configuration conf,
      String errString) {
    try {
      JournalNode jn = new JournalNode();
      jn.setConf(conf);
      jn.start();
    } catch (Exception e) {
      GenericTestUtils.assertExceptionContains(errString, e);
    }
  }
View Full Code Here

   
    conf.set(DFSConfigKeys.DFS_JOURNALNODE_EDITS_DIR_KEY,
        editsDir.getAbsolutePath());
    conf.set(DFSConfigKeys.DFS_JOURNALNODE_RPC_ADDRESS_KEY,
        "0.0.0.0:0");
    jn = new JournalNode();
    jn.setConf(conf);
    jn.start();
    journalId = "test-journalid-" + GenericTestUtils.uniqueSequenceId();
    journal = jn.getOrCreateJournal(journalId);
    journal.format(FAKE_NSINFO);
View Full Code Here

  }

  private static void assertJNFailsToStart(Configuration conf,
      String errString) {
    try {
      JournalNode jn = new JournalNode();
      jn.setConf(conf);
      jn.start();
    } catch (Exception e) {
      GenericTestUtils.assertExceptionContains(errString, e);
    }
  }
View Full Code Here

      if (b.format) {
        File dir = getStorageDir(i);
        LOG.debug("Fully deleting JN directory " + dir);
        FileUtil.fullyDelete(dir);
      }
      nodes[i] = new JournalNode();
      nodes[i].setConf(createConfForNode(b, i));
      nodes[i].start();

      ipcAddrs[i] = nodes[i].getBoundIpcAddress();
      httpAddrs[i] = nodes[i].getBoundHttpAddress();
View Full Code Here

    conf.set(DFSConfigKeys.DFS_JOURNALNODE_RPC_ADDRESS_KEY, "127.0.0.1:" +
        ipcAddrs[i].getPort());
    conf.set(DFSConfigKeys.DFS_JOURNALNODE_HTTP_ADDRESS_KEY, "127.0.0.1:" +
        httpAddrs[i].getPort());
   
    JournalNode jn = new JournalNode();
    jn.setConf(conf);
    jn.start();
  }
View Full Code Here

    conf.setInt(JournalConfigKeys.DFS_QJOURNAL_WRITE_TXNS_TIMEOUT_KEY,
        WRITE_TXID_TIMEOUT);
    setUp(conf, null, "testJournalNodeHang");

    // Get the current journal port.
    JournalNode jn = getStandbyTailingJN();

    DFSTestUtil.createFile(fs, new Path("/test"), 1024, (short) 1, 0);
    handler.simulateJournalHang = true;

    // Ensure we can still write.
    DFSTestUtil.createFile(fs, new Path("/test1"), 1024, (short) 1, 0);

    // Ensure we can still do checkpoints.
    handler.doCheckpoint();
    DFSTestUtil.createFile(fs, new Path("/test2"), 1024, (short) 1, 0);

    // Verify the JN is lagging.
    assertFalse(cluster.getPrimaryAvatar(0).avatar.getLastWrittenTxId() == jn
        .getJournal((MiniAvatarCluster.JID + "/zero").getBytes())
        .getHighestWrittenTxId());

    // Ensure we can failover.
    cluster.failOver();
    cluster.restartStandby();

    // Ensure we can write after failover.
    DFSTestUtil.createFile(fs, new Path("/test3"), 1024, (short) 1, 0);

    // Ensure we can still do checkpoints.
    handler.doCheckpoint();

    // Ensure that we did end up hanging a journal node.
    DFSTestUtil.createFile(fs, new Path("/test4"), 1024, (short) 1, 0);
    assertTrue(handler.journalFailures > 0);
    assertFalse(cluster.getPrimaryAvatar(0).avatar.getLastWrittenTxId() == jn
        .getJournal((MiniAvatarCluster.JID + "/one").getBytes())
        .getHighestWrittenTxId());

    handler.simulateJournalHang = false;
  }
View Full Code Here


  private JournalNode getStandbyTailingJN() {
    assertTrue(handler.currentJournalHttpPort != -1);
    // Find the journal node the Standby is tailing from.
    JournalNode jn = null;
    for (JournalNode j : journalCluster.getJournalNodes()) {
      if (j.getBoundHttpAddress().getPort() == handler.currentJournalHttpPort) {
        jn = j;
        break;
      }
    }
    handler.currentJournalRPCPort = jn.getBoundIpcAddress().getPort();
    return jn;
  }
View Full Code Here

    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.
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.qjournal.server.JournalNode

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.