Examples of JournalAndStream


Examples of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

    setUpMiniCluster(conf, true);
   
    assertTrue(doAnEdit());
    // Invalidated the one required edits journal.
    invalidateEditsDirAtIndex(0, false, false);
    JournalAndStream nonRequiredJas = getJournalAndStream(1);
    EditLogFileOutputStream nonRequiredSpy =
      spyOnStream(nonRequiredJas);
   
    // The NN has not terminated (no ExitException thrown)
   
    // ..and that the other stream is active.
    assertTrue(nonRequiredJas.isActive());
   
    try {
      doAnEdit();
      fail("A single failure of a required journal should have halted the NN");
    } catch (RemoteException re) {
      assertTrue(re.getClassName().contains("ExitException"));
      GenericTestUtils.assertExceptionContains(
          "setReadyToFlush failed for required journal", re);
    }
   
    // Since the required directory failed setReadyToFlush, and that
    // directory was listed prior to the non-required directory,
    // we should not call setReadyToFlush on the non-required
    // directory. Regression test for HDFS-2874.
    Mockito.verify(nonRequiredSpy, Mockito.never()).setReadyToFlush();
    assertFalse(nonRequiredJas.isActive());
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

   * @param index the index of the journal to take offline.
   * @return the original <code>EditLogOutputStream</code> of the journal.
   */
  private void invalidateEditsDirAtIndex(int index,
      boolean failOnFlush, boolean failOnWrite) throws IOException {
    JournalAndStream jas = getJournalAndStream(index);
    EditLogFileOutputStream spyElos = spyOnStream(jas);
    if (failOnWrite) {
      doThrow(new IOException("fail on write()")).when(spyElos).write(
          (FSEditLogOp) any());
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

    try {
      FSImage fsimage = namesystem.getFSImage();
      FSEditLog editLog = fsimage.getEditLog();

      JournalAndStream jas = editLog.getJournals().get(0);
      EditLogFileOutputStream spyElos =
          spy((EditLogFileOutputStream)jas.getCurrentStream());
      jas.setCurrentStreamForTests(spyElos);

      final AtomicReference<Throwable> deferredException =
          new AtomicReference<Throwable>();
      final CountDownLatch waitToEnterFlush = new CountDownLatch(1);
     
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

    setUpMiniCluster(conf, true);
   
    assertTrue(doAnEdit());
    // Invalidated the one required edits journal.
    invalidateEditsDirAtIndex(0, false, false);
    JournalAndStream nonRequiredJas = getJournalAndStream(1);
    EditLogFileOutputStream nonRequiredSpy =
      spyOnStream(nonRequiredJas);
   
    // Make sure runtime.exit(...) hasn't been called at all yet.
    assertExitInvocations(0);
   
    // ..and that the other stream is active.
    assertTrue(nonRequiredJas.isActive());
   
    // This will actually return true in the tests, since the NN will not in
    // fact call Runtime.exit();
    doAnEdit();
   
    // Since the required directory failed setReadyToFlush, and that
    // directory was listed prior to the non-required directory,
    // we should not call setReadyToFlush on the non-required
    // directory. Regression test for HDFS-2874.
    Mockito.verify(nonRequiredSpy, Mockito.never()).setReadyToFlush();
    assertFalse(nonRequiredJas.isActive());
   
    // A single failure of a required journal should result in a call to
    // runtime.exit(...).
    assertExitInvocations(atLeast(1));
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

   * @param index the index of the journal to take offline.
   * @return the original <code>EditLogOutputStream</code> of the journal.
   */
  private void invalidateEditsDirAtIndex(int index,
      boolean failOnFlush, boolean failOnWrite) throws IOException {
    JournalAndStream jas = getJournalAndStream(index);
    EditLogFileOutputStream spyElos = spyOnStream(jas);
    if (failOnWrite) {
      doThrow(new IOException("fail on write()")).when(spyElos).write(
          (FSEditLogOp) any());
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

    setUpMiniCluster(conf, true);
   
    assertTrue(doAnEdit());
    // Invalidated the one required edits journal.
    invalidateEditsDirAtIndex(0, false, false);
    JournalAndStream nonRequiredJas = getJournalAndStream(1);
    EditLogFileOutputStream nonRequiredSpy =
      spyOnStream(nonRequiredJas);
   
    // The NN has not terminated (no ExitException thrown)
   
    // ..and that the other stream is active.
    assertTrue(nonRequiredJas.isActive());
   
    try {
      doAnEdit();
      fail("A single failure of a required journal should have halted the NN");
    } catch (RemoteException re) {
      assertTrue(re.getClassName().contains("ExitException"));
      GenericTestUtils.assertExceptionContains(
          "setReadyToFlush failed for required journal", re);
    }
   
    // Since the required directory failed setReadyToFlush, and that
    // directory was listed prior to the non-required directory,
    // we should not call setReadyToFlush on the non-required
    // directory. Regression test for HDFS-2874.
    Mockito.verify(nonRequiredSpy, Mockito.never()).setReadyToFlush();
    assertFalse(nonRequiredJas.isActive());
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

   * @param index the index of the journal to take offline.
   * @return the original <code>EditLogOutputStream</code> of the journal.
   */
  private void invalidateEditsDirAtIndex(int index,
      boolean failOnFlush, boolean failOnWrite) throws IOException {
    JournalAndStream jas = getJournalAndStream(index);
    EditLogFileOutputStream spyElos = spyOnStream(jas);
    if (failOnWrite) {
      doThrow(new IOException("fail on write()")).when(spyElos).write(
          (FSEditLogOp) any());
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

    try {
      FSImage fsimage = namesystem.getFSImage();
      FSEditLog editLog = fsimage.getEditLog();

      JournalAndStream jas = editLog.getJournals().get(0);
      EditLogFileOutputStream spyElos =
          spy((EditLogFileOutputStream)jas.getCurrentStream());
      jas.setCurrentStreamForTests(spyElos);

      final AtomicReference<Throwable> deferredException =
          new AtomicReference<Throwable>();
      final CountDownLatch waitToEnterFlush = new CountDownLatch(1);
     
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

    try {
      FSImage fsimage = namesystem.getFSImage();
      FSEditLog editLog = fsimage.getEditLog();

      JournalAndStream jas = editLog.getJournals().get(0);
      EditLogFileOutputStream spyElos =
          spy((EditLogFileOutputStream)jas.getCurrentStream());
      jas.setCurrentStreamForTests(spyElos);

      final AtomicReference<Throwable> deferredException =
          new AtomicReference<Throwable>();
      final CountDownLatch waitToEnterFlush = new CountDownLatch(1);
     
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

    setUpMiniCluster(conf, true);
   
    assertTrue(doAnEdit());
    // Invalidated the one required edits journal.
    invalidateEditsDirAtIndex(0, false, false);
    JournalAndStream nonRequiredJas = getJournalAndStream(1);
    EditLogFileOutputStream nonRequiredSpy =
      spyOnStream(nonRequiredJas);
   
    // The NN has not terminated (no ExitException thrown)
   
    // ..and that the other stream is active.
    assertTrue(nonRequiredJas.isActive());
   
    try {
      doAnEdit();
      fail("A single failure of a required journal should have halted the NN");
    } catch (RemoteException re) {
      assertTrue(re.getClassName().contains("ExitException"));
      GenericTestUtils.assertExceptionContains(
          "setReadyToFlush failed for required journal", re);
    }
   
    // Since the required directory failed setReadyToFlush, and that
    // directory was listed prior to the non-required directory,
    // we should not call setReadyToFlush on the non-required
    // directory. Regression test for HDFS-2874.
    Mockito.verify(nonRequiredSpy, Mockito.never()).setReadyToFlush();
    assertFalse(nonRequiredJas.isActive());
  }
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.