|
|
|
@ -205,7 +205,6 @@ type Store struct {
|
|
|
|
|
observerChan chan raft.Observation
|
|
|
|
|
observer *raft.Observer
|
|
|
|
|
|
|
|
|
|
firstLogApplied bool // Whether the first log has been applied to the FSM.
|
|
|
|
|
firstIdxOnOpen uint64 // First index on log when Store opens.
|
|
|
|
|
lastIdxOnOpen uint64 // Last index on log when Store opens.
|
|
|
|
|
lastCommandIdxOnOpen uint64 // Last command index before applied index when Store opens.
|
|
|
|
@ -1575,10 +1574,6 @@ func (s *Store) Apply(l *raft.Log) (e interface{}) {
|
|
|
|
|
defer s.fsmIndexMu.Unlock()
|
|
|
|
|
s.fsmIndex = l.Index
|
|
|
|
|
|
|
|
|
|
if !s.firstLogApplied {
|
|
|
|
|
s.firstLogApplied = true
|
|
|
|
|
s.logger.Printf("first log applied since node start, log at index %d", l.Index)
|
|
|
|
|
}
|
|
|
|
|
if l.Index <= s.lastCommandIdxOnOpen {
|
|
|
|
|
// In here means at least one command entry was in the log when the Store
|
|
|
|
|
// opened.
|
|
|
|
@ -1592,6 +1587,7 @@ func (s *Store) Apply(l *raft.Log) (e interface{}) {
|
|
|
|
|
|
|
|
|
|
if s.firstLogAppliedT.IsZero() {
|
|
|
|
|
s.firstLogAppliedT = time.Now()
|
|
|
|
|
s.logger.Printf("first log applied since node start, log at index %d", l.Index)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typ, r := applyCommand(l.Data, &s.db, s.dechunkManager)
|
|
|
|
|