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 ) ; } }
Applies the journal entry ignoring empty entries and expanding multi - entries .