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

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


 
  private void restoreEditsDirAtIndex(int index, EditLogOutputStream elos) {
    FSImage fsimage = cluster.getNameNode(0).avatars.get(0).avatar.getFSImage();
    FSEditLog editLog = fsimage.getEditLog();

    JournalAndStream jas = editLog.getJournals().get(index);
    jas.setCurrentStreamForTests(elos);
  }
View Full Code Here

  private EditLogOutputStream invalidateEditsDirAtIndex(int index)
      throws IOException {
    FSImage fsimage = cluster.getNameNode(0).avatars.get(0).avatar.getFSImage();
    FSEditLog editLog = fsimage.getEditLog();

    JournalAndStream jas = editLog.getJournals().get(index);
    EditLogFileOutputStream elos = (EditLogFileOutputStream) jas
        .getCurrentStream();
    EditLogFileOutputStream spyElos = spy(elos);

    doThrow(new IOException("fail on write()")).when(spyElos).write(
        (FSEditLogOp) any());
    doThrow(new IOException("fail on write()")).when(spyElos).writeRaw(
        (byte[]) any(), anyInt(), anyInt());
    doThrow(new IOException("fail on write()")).when(spyElos).writeRawOp(
        (byte[]) any(), anyInt(), anyInt(), anyLong());
    doNothing().when(spyElos).abort();
    jas.setCurrentStreamForTests(spyElos);

    return elos;
  }
View Full Code Here

      cluster.waitActive();
      final FSNamesystem namesystem = cluster.getNameNode().getNamesystem();
      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

  private EditLogOutputStream invalidateEditsDirAtIndex(int index,
      boolean failOnFlush, boolean failOnWrite) throws IOException {
    FSImage fsimage = cluster.getNameNode().getFSImage();
    FSEditLog editLog = fsimage.getEditLog();

    JournalAndStream jas = editLog.getJournals().get(index);
    EditLogFileOutputStream elos =
      (EditLogFileOutputStream) jas.getCurrentStream();
    EditLogFileOutputStream spyElos = spy(elos);
    if (failOnWrite) {
      doThrow(new IOException("fail on write()")).when(spyElos).write(
          (FSEditLogOp) any());
    }
    if (failOnFlush) {
      doThrow(new IOException("fail on flush()")).when(spyElos).flush();
    } else {
      doThrow(new IOException("fail on setReadyToFlush()")).when(spyElos)
        .setReadyToFlush();
    }
    doNothing().when(spyElos).abort();
    
    jas.setCurrentStreamForTests(spyElos);
    
    return elos;
  }
View Full Code Here

   */
  private void restoreEditsDirAtIndex(int index, EditLogOutputStream elos) {
    FSImage fsimage = cluster.getNameNode().getFSImage();
    FSEditLog editLog = fsimage.getEditLog();

    JournalAndStream jas = editLog.getJournals().get(index);
    jas.setCurrentStreamForTests(elos);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.server.namenode.JournalSet.JournalAndStream

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.