/** * Create empty edits logs file. */ @Override public void create(int layoutVersion) throws IOException { fc.truncate(0); fc.position(0); writeHeader(layoutVersion, doubleBuf.getCurrentBuf()); setReadyToFlush(); flush(); }
/** * Create empty edits logs file. */ @Override public void create(int layoutVersion) throws IOException { fc.truncate(0); fc.position(0); writeHeader(layoutVersion, doubleBuf.getCurrentBuf()); setReadyToFlush(); flush(); }
/** * Create empty edits logs file. */ @Override public void create(int layoutVersion) throws IOException { fc.truncate(0); fc.position(0); writeHeader(layoutVersion, doubleBuf.getCurrentBuf()); setReadyToFlush(); flush(); }
/** * Create empty edits logs file. */ @Override public void create() throws IOException { fc.truncate(0); fc.position(0); doubleBuf.getCurrentBuf().writeInt(FSConstants.LAYOUT_VERSION); setReadyToFlush(); flush(); }
/** * Replace the journal at index <code>index</code> with one that throws an * exception on flush. * * @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()); } if (failOnFlush) { doThrow(new IOException("fail on flush()")).when(spyElos).flush(); } else { doThrow(new IOException("fail on setReadyToFlush()")).when(spyElos) .setReadyToFlush(); } }
doAnswer(blockingFlush).when(spyElos).flush();