Examples of EditLogFileOutputStream


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

 
  private void testMultipleOperationsRoll(long txPerNormalPhase,
      long txPerRollPhase, long txCount) throws Exception {
    File editsDir = createEditsDir();
    DummyServerCore core = new DummyServerCore();
    EditLogFileOutputStream out = initEdits(editsDir);
    ServerLogReaderPreTransactional logReader = new ServerLogReaderPreTransactional(core,
        Util.stringAsURI(editsDir.getAbsolutePath()));
    core.logReader = logReader;
    Thread coreThread, logReaderThread;
    boolean rollPhase = false;
   
    coreThread = new Thread(core);
    logReaderThread = new Thread(logReader);
   
    logReaderThread.start();
    coreThread.start();
    Thread.sleep(1000);
   
    long count = 0;
    for (long txId = 0; txId < txCount; txId ++) {
      if (rollPhase) {
        count --;
        if (count == 0) {
          rollPhase = false;
          count = txPerNormalPhase;
          endRoll(editsDir);
        }
      } else {
        count --;
        if (count == 0) {
          rollPhase = true;
          count = txPerRollPhase;
          beginRoll(editsDir, out);
        }
      }
     
      writeOperation(out, txId, false);
      if (txId % 10 == 0) {
        Thread.sleep(1);
      }
    }
   
    // flush
    out.setReadyToFlush();
    out.flush();
   
    Thread.sleep(1000);
    core.shutdown();
    logReaderThread.join();
    coreThread.join();
View Full Code Here

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

    File edits = TestPreTransactionalServerLogReader.getFileWithCurrent(
        editsDir, "edits_inprogress_0000000000000000000");

    if (!edits.createNewFile())
      throw new IOException("Failed to create edits file");
    EditLogFileOutputStream out = new EditLogFileOutputStream(edits, null);
    out.create();
    return out;
  }
View Full Code Here

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

  @Test
  public void testWrite() throws Exception {
    LedgerHandle ledger = createLedger();
    BookKeeperEditLogOutputStream bkEdits =
        new BookKeeperEditLogOutputStream(ledger);
    EditLogFileOutputStream fileEdits =
        new EditLogFileOutputStream(tempEditsFile, null);

    FSEditLogTestUtil.createAndPopulateStreams(1, 100, bkEdits, fileEdits);

    // Test that after closing both, an EditLogFileOutputStream
    // and a BookKeeperEditLogOutputStream objects return identical
View Full Code Here

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

    throws Exception {
    LedgerHandle ledgerOut = createLedger();
    long ledgerId = ledgerOut.getId();
    BookKeeperEditLogOutputStream bkEditsOut =
        new BookKeeperEditLogOutputStream(ledgerOut);
    EditLogFileOutputStream fileEditsOut =
        new EditLogFileOutputStream(tempEditsFile, null);

    FSEditLogTestUtil.createAndPopulateStreams(1,
        numEdits, bkEditsOut, fileEditsOut);

    BookKeeperEditLogInputStream bkEditsIn =
View Full Code Here

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

    FSEditLog.sizeFlushBuffer = 100;
    LedgerHandle ledgerOut = createLedger();
    long ledgerId = ledgerOut.getId();
    BookKeeperEditLogOutputStream bkEditsOut =
        new BookKeeperEditLogOutputStream(ledgerOut);
    EditLogFileOutputStream fileEditsOut =
        new EditLogFileOutputStream(tempEditsFile, null);

    FSEditLogTestUtil.createAndPopulateStreams(1,
        numEdits, bkEditsOut, fileEditsOut);

    BookKeeperEditLogInputStream bkEditsIn =
View Full Code Here

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

    LedgerHandle ledgerOut = createLedger();
    long ledgerId = ledgerOut.getId();
    BookKeeperEditLogOutputStream bkEditsOut =
        new BookKeeperEditLogOutputStream(ledgerOut);
    EditLogFileOutputStream fileEditsOut =
        new EditLogFileOutputStream(tempEditsFile, null);

    FSEditLogTestUtil.createAndPopulateStreams(1,
        numEdits, bkEditsOut, fileEditsOut);

    BookKeeperEditLogInputStream bkEditsIn =
View Full Code Here

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

            ledgerId,
            0,
            1,
            -1,
            true);
    EditLogFileOutputStream fileEditsOut =
        new EditLogFileOutputStream(tempEditsFile, null);
    bkEditsIn.init();
    // Set the edit log buffer flush size smaller than the size of
    // of the buffer in BufferedInputStream in BookKeeperJournalInputStream
    FSEditLog.sizeFlushBuffer = bkEditsIn.bin.available() / 3;
    LOG.info("Set flush buffer size to " + FSEditLog.sizeFlushBuffer);
View Full Code Here

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

    try {
      TestBKJMInjectionHandler h = new TestBKJMInjectionHandler();
      InjectionHandler.set(h);
      EditLogOutputStream bkeos = bkjm.startLogSegment(1);
      EditLogOutputStream elfos =
          new EditLogFileOutputStream(tempEditsFile, null);
      elfos.create();
      FSEditLogTestUtil.populateStreams(1, 100, bkeos, elfos);
      EditLogInputStream bkeis =
          FSEditLogTestUtil.getJournalInputStream(bkjm, 1, true);
      EditLogInputStream elfis = new EditLogFileInputStream(tempEditsFile);
      Map<String, EditLogInputStream> streamByName =
View Full Code Here

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

    File tempEditsFile = FSEditLogTestUtil.createTempEditsFile(
        "test-get-input-stream-with-validation");
    try {
      EditLogOutputStream bkeos = bkjm.startLogSegment(1);
      EditLogOutputStream elfos =
          new EditLogFileOutputStream(tempEditsFile, null);
      elfos.create();
      FSEditLogTestUtil.populateStreams(1, 100, bkeos, elfos);
      EditLogInputStream bkeis =
          getJournalInputStreamDontCheckLastTxId(bkjm, 1);
      EditLogInputStream elfis = new EditLogFileInputStream(tempEditsFile);
      Map<String, EditLogInputStream> streamByName =
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.