JournalEntry entry = it.next().toBuilder().setSequenceNumber(snapshotSN).build();
@Override public void write(JournalEntry entry) throws JournalClosedException { if (mClosed) { throw new JournalClosedException("Cannot write to journal. Journal writer has been closed"); } Preconditions.checkState(entry.getAllFields().size() <= 1, "Raft journal entries should never set multiple fields, but found %s", entry); if (mJournalEntryBuilder == null) { mJournalEntryBuilder = JournalEntry.newBuilder(); } mJournalEntryBuilder.addJournalEntries(entry.toBuilder() .setSequenceNumber(mNextSequenceNumberToWrite.getAndIncrement()).build()); }
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); } }
public Builder mergeFrom(alluxio.proto.journal.Journal.JournalEntry other) { if (other == alluxio.proto.journal.Journal.JournalEntry.getDefaultInstance()) return this; if (other.hasSequenceNumber()) { setSequenceNumber(other.getSequenceNumber());
/** * The given entry should not have its sequence number set. This method will add the proper * sequence number to the passed in entry. * * @param entry an entry to write to the journal checkpoint file */ @Override public synchronized void write(JournalEntry entry) throws IOException { if (mIsClosed) { throw new IOException(ExceptionMessage.JOURNAL_WRITE_AFTER_CLOSE.getMessage()); } if (mRotateLogForNextWrite) { rotateLog(); mRotateLogForNextWrite = false; } try { mJournalFormatter.serialize( entry.toBuilder().setSequenceNumber(mJournalWriter.getNextSequenceNumber()).build(), mDataOutputStream); } catch (IOException e) { mRotateLogForNextWrite = true; throw new IOException(ExceptionMessage.JOURNAL_WRITE_FAILURE.getMessageWithUrl( RuntimeConstants.ALLUXIO_DEBUG_DOCS_URL, mCurrentLog, e.getMessage()), 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 an entry to the checkpoint file. * * The entry should not have its sequence number set. This method will add the proper sequence * number to the passed in entry. * * @param entry an entry to write to the journal checkpoint file */ @Override public synchronized void write(JournalEntry entry) throws IOException { if (mIsClosed) { throw new IOException(ExceptionMessage.JOURNAL_WRITE_AFTER_CLOSE.getMessage()); } mJournal.getJournalFormatter().serialize( entry.toBuilder().setSequenceNumber(getNextSequenceNumber()).build(), mOutputStream); }
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++; }
public Builder mergeFrom(alluxio.proto.journal.Journal.JournalEntry other) { if (other == alluxio.proto.journal.Journal.JournalEntry.getDefaultInstance()) return this; if (other.hasSequenceNumber()) { setSequenceNumber(other.getSequenceNumber());
lastAppliedSN, gainPrimacySN); CompletableFuture<Void> future = client.submit(new JournalEntryCommand( JournalEntry.newBuilder().setSequenceNumber(gainPrimacySN).build())); try { future.get(5, TimeUnit.SECONDS);
/** * The given entry should not have its sequence number set. This method will add the proper * sequence number to the passed in entry. * * @param entry an entry to write to the journal checkpoint file */ @Override public synchronized void write(JournalEntry entry) throws IOException { if (mIsClosed) { throw new IOException(ExceptionMessage.JOURNAL_WRITE_AFTER_CLOSE.getMessage()); } if (mRotateLogForNextWrite) { rotateLog(); mRotateLogForNextWrite = false; } try { mJournalFormatter.serialize( entry.toBuilder().setSequenceNumber(mJournalWriter.getNextSequenceNumber()).build(), mDataOutputStream); } catch (IOException e) { mRotateLogForNextWrite = true; throw new IOException(ExceptionMessage.JOURNAL_WRITE_FAILURE.getMessageWithUrl( RuntimeConstants.ALLUXIO_DEBUG_DOCS_URL, mCurrentLog, e.getMessage()), e); } }
/** * Writes an entry to the checkpoint file. * * The entry should not have its sequence number set. This method will add the proper sequence * number to the passed in entry. * * @param entry an entry to write to the journal checkpoint file */ @Override public synchronized void write(JournalEntry entry) throws IOException { if (mIsClosed) { throw new IOException(ExceptionMessage.JOURNAL_WRITE_AFTER_CLOSE.getMessage()); } mJournal.getJournalFormatter().serialize( entry.toBuilder().setSequenceNumber(getNextSequenceNumber()).build(), mOutputStream); }
/** * Creates a dummy journal entry with the given sequence number. * * @param sequenceNumber the sequence number * @return the journal entry */ private Journal.JournalEntry newEntry(long sequenceNumber) { return Journal.JournalEntry.newBuilder().setSequenceNumber(sequenceNumber).build(); } }
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++; }
/** * Creates a dummy journal entry with the given sequence number. * * @param sequenceNumber the sequence number * @return the journal entry */ private Journal.JournalEntry newEntry(long sequenceNumber) { return Journal.JournalEntry.newBuilder().setSequenceNumber(sequenceNumber).build(); } }
/** * Creates a dummy journal entry with the given sequence number. * * @param sequenceNumber the sequence number * @return the journal entry */ private Journal.JournalEntry newEntry(long sequenceNumber) { return Journal.JournalEntry.newBuilder().setSequenceNumber(sequenceNumber).build(); } }
/** * Creates a dummy journal entry with the given sequence number. * * @param sequenceNumber the sequence number * @return the journal entry */ private Journal.JournalEntry newEntry(long sequenceNumber) { return Journal.JournalEntry.newBuilder().setSequenceNumber(sequenceNumber).build(); } }