entry.writeDelimitedTo(new OutputStream() { @Override public void write(int b) throws IOException {
public synchronized void write(JournalEntry entry) throws IOException, JournalClosedException { try { maybeRecoverFromUfsFailures(); maybeRotateLog(); } catch (IOJournalClosedException e) { throw e.toJournalClosedException(); } try { JournalEntry entryToWrite = entry.toBuilder().setSequenceNumber(mNextSequenceNumber).build(); entryToWrite.writeDelimitedTo(mJournalOutputStream); LOG.debug("Adding journal entry (seq={}) to retryList with {} entries.", entryToWrite.getSequenceNumber(), mEntriesToFlush.size()); mEntriesToFlush.add(entryToWrite); mNextSequenceNumber++; } catch (IOJournalClosedException e) { throw e.toJournalClosedException(); } catch (IOException e) { // Set mNeedsRecovery to true so that {@code maybeRecoverFromUfsFailures} // can know a UFS failure has occurred. mNeedsRecovery = true; throw new IOException(ExceptionMessage.JOURNAL_WRITE_FAILURE .getMessageWithUrl(RuntimeConstants.ALLUXIO_DEBUG_DOCS_URL, mJournalOutputStream.currentLog(), e.getMessage()), e); } }
/** * Writes a backup to the specified stream. * * @param os the stream to write to */ public void backup(OutputStream os) throws IOException { int count = 0; GzipCompressorOutputStream zipStream = new GzipCompressorOutputStream(os); for (Master master : mRegistry.getServers()) { Iterator<JournalEntry> it = master.getJournalEntryIterator(); while (it.hasNext()) { it.next().toBuilder().clearSequenceNumber().build().writeDelimitedTo(zipStream); count++; } } // finish() instead of close() since close would close os, which is owned by the caller. zipStream.finish(); LOG.info("Created backup with {} entries", count); }
if (entry.getSequenceNumber() > lastPersistSeq) { try { entry.toBuilder().build().writeDelimitedTo(mJournalOutputStream); retryEndSeq = entry.getSequenceNumber(); } catch (IOJournalClosedException e) {
public synchronized void write(JournalEntry entry) throws IOException, JournalClosedException { try { maybeRecoverFromUfsFailures(); maybeRotateLog(); } catch (IOJournalClosedException e) { throw e.toJournalClosedException(); } try { JournalEntry entryToWrite = entry.toBuilder().setSequenceNumber(mNextSequenceNumber).build(); entryToWrite.writeDelimitedTo(mJournalOutputStream); LOG.debug("Adding journal entry (seq={}) to retryList with {} entries.", entryToWrite.getSequenceNumber(), mEntriesToFlush.size()); mEntriesToFlush.add(entryToWrite); mNextSequenceNumber++; } catch (IOJournalClosedException e) { throw e.toJournalClosedException(); } catch (IOException e) { // Set mNeedsRecovery to true so that {@code maybeRecoverFromUfsFailures} // can know a UFS failure has occurred. mNeedsRecovery = true; throw new IOException(ExceptionMessage.JOURNAL_WRITE_FAILURE .getMessageWithUrl(RuntimeConstants.ALLUXIO_DEBUG_DOCS_URL, mJournalOutputStream.currentLog(), e.getMessage()), e); } }
/** * Writes a backup to the specified stream. * * @param os the stream to write to */ public void backup(OutputStream os) throws IOException { int count = 0; GzipCompressorOutputStream zipStream = new GzipCompressorOutputStream(os); for (Master master : mRegistry.getServers()) { Iterator<JournalEntry> it = master.getJournalEntryIterator(); while (it.hasNext()) { it.next().toBuilder().clearSequenceNumber().build().writeDelimitedTo(zipStream); count++; } } // finish() instead of close() since close would close os, which is owned by the caller. zipStream.finish(); LOG.info("Created backup with {} entries", count); }
@Override public void serialize(JournalEntry entry, OutputStream outputStream) throws IOException { entry.writeDelimitedTo(outputStream); }
public void write(JournalEntry entry) throws IOException { if (mClosed) { throw new IOException(ExceptionMessage.JOURNAL_WRITE_AFTER_CLOSE.getMessage()); } try { entry.toBuilder().setSequenceNumber(mNextSequenceNumber).build() .writeDelimitedTo(mTmpCheckpointStream); } catch (IOException e) { throw e; } mNextSequenceNumber++; }
if (entry.getSequenceNumber() > lastPersistSeq) { try { entry.toBuilder().build().writeDelimitedTo(mJournalOutputStream); retryEndSeq = entry.getSequenceNumber(); } catch (IOJournalClosedException e) {
@Override public void serialize(JournalEntry entry, OutputStream outputStream) throws IOException { entry.writeDelimitedTo(outputStream); }
public void write(JournalEntry entry) throws IOException { if (mClosed) { throw new IOException(ExceptionMessage.JOURNAL_WRITE_AFTER_CLOSE.getMessage()); } try { entry.toBuilder().setSequenceNumber(mNextSequenceNumber).build() .writeDelimitedTo(mTmpCheckpointStream); } catch (IOException e) { throw e; } mNextSequenceNumber++; }