/** * Applies the journal entry, handling empty entries and multi-entries. * * @param entry the entry to apply */ private void applyEntry(JournalEntry entry) { Preconditions.checkState( entry.getAllFields().size() <= 1 || (entry.getAllFields().size() == 2 && entry.hasSequenceNumber()), "Raft journal entries should never set multiple fields in addition to sequence " + "number, but found %s", entry); if (entry.getJournalEntriesCount() > 0) { // This entry aggregates multiple entries. for (JournalEntry e : entry.getJournalEntriesList()) { applyEntry(e); } } else if (entry.toBuilder().clearSequenceNumber().build() .equals(JournalEntry.getDefaultInstance())) { // Ignore empty entries, they are created during snapshotting. } else { printEntry(entry); } }
/** * Applies the journal entry, ignoring empty entries and expanding multi-entries. * * @param entry the entry to apply */ private void applyEntry(JournalEntry entry) { Preconditions.checkState( entry.getAllFields().size() <= 1 || (entry.getAllFields().size() == 2 && entry.hasSequenceNumber()), "Raft journal entries should never set multiple fields in addition to sequence " + "number, but found %s", entry); if (entry.getJournalEntriesCount() > 0) { // This entry aggregates multiple entries. for (JournalEntry e : entry.getJournalEntriesList()) { applyEntry(e); } } else if (entry.getSequenceNumber() < 0) { // Negative sequence numbers indicate special entries used to indicate that a new primary is // starting to serve. mLastPrimaryStartSequenceNumber = entry.getSequenceNumber(); } else if (entry.toBuilder().clearSequenceNumber().build() .equals(JournalEntry.getDefaultInstance())) { // Ignore empty entries, they are created during snapshotting. } else { applySingleEntry(entry); } }
hash = (53 * hash) + getJournalEntriesList().hashCode();
.equals(other.getUpdateInodeFile()); result = result && getJournalEntriesList() .equals(other.getJournalEntriesList()); result = result && unknownFields.equals(other.unknownFields); return result;