@Override public void selectInputStreams(Collection<EditLogInputStream> streams, long fromTxId, boolean inProgressOk, boolean onlyDurableTxns) throws IOException { journalSet.selectInputStreams(streams, fromTxId, inProgressOk, onlyDurableTxns); }
/** * Initialize the output stream for logging, opening the first * log segment. */ synchronized void openForWrite(int layoutVersion) throws IOException { Preconditions.checkState(state == State.BETWEEN_LOG_SEGMENTS, "Bad state: %s", state); long segmentTxId = getLastWrittenTxId() + 1; // Safety check: we should never start a segment if there are // newer txids readable. List<EditLogInputStream> streams = new ArrayList<EditLogInputStream>(); journalSet.selectInputStreams(streams, segmentTxId, true, false); if (!streams.isEmpty()) { String error = String.format("Cannot start writing at txid %s " + "when there is a stream available for read: %s", segmentTxId, streams.get(0)); IOUtils.cleanupWithLogger(LOG, streams.toArray(new EditLogInputStream[0])); throw new IllegalStateException(error); } startLogSegmentAndWriteHeaderTxn(segmentTxId, layoutVersion); assert state == State.IN_SEGMENT : "Bad state: " + state; }
@Override public void selectInputStreams(Collection<EditLogInputStream> streams, long fromTxId, boolean inProgressOk) throws IOException { journalSet.selectInputStreams(streams, fromTxId, inProgressOk); }
@Override public void selectInputStreams(Collection<EditLogInputStream> streams, long fromTxId, boolean inProgressOk) throws IOException { journalSet.selectInputStreams(streams, fromTxId, inProgressOk); }
@Override public Void answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); journalSet.selectInputStreams((Collection<EditLogInputStream>)args[0], (Long)args[1], (Boolean)args[2]); return null; } }).when(mockLog).selectInputStreams(Mockito.anyCollection(),
/** * Initialize the output stream for logging, opening the first * log segment. */ synchronized void openForWrite() throws IOException { Preconditions.checkState(state == State.BETWEEN_LOG_SEGMENTS, "Bad state: %s", state); long segmentTxId = getLastWrittenTxId() + 1; // Safety check: we should never start a segment if there are // newer txids readable. List<EditLogInputStream> streams = new ArrayList<EditLogInputStream>(); journalSet.selectInputStreams(streams, segmentTxId, true); if (!streams.isEmpty()) { String error = String.format("Cannot start writing at txid %s " + "when there is a stream available for read: %s", segmentTxId, streams.get(0)); IOUtils.cleanup(LOG, streams.toArray(new EditLogInputStream[0])); throw new IllegalStateException(error); } startLogSegment(segmentTxId, true); assert state == State.IN_SEGMENT : "Bad state: " + state; }
/** * Initialize the output stream for logging, opening the first * log segment. */ synchronized void openForWrite() throws IOException { Preconditions.checkState(state == State.BETWEEN_LOG_SEGMENTS, "Bad state: %s", state); long segmentTxId = getLastWrittenTxId() + 1; // Safety check: we should never start a segment if there are // newer txids readable. List<EditLogInputStream> streams = new ArrayList<EditLogInputStream>(); journalSet.selectInputStreams(streams, segmentTxId, true); if (!streams.isEmpty()) { String error = String.format("Cannot start writing at txid %s " + "when there is a stream available for read: %s", segmentTxId, streams.get(0)); IOUtils.cleanup(LOG, streams.toArray(new EditLogInputStream[0])); throw new IllegalStateException(error); } startLogSegment(segmentTxId, true); assert state == State.IN_SEGMENT : "Bad state: " + state; }