Skip to content

Commit

Permalink
Merge "FAB-16605 Add log message for slow WAL" into release-1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Yellick authored and Gerrit Code Review committed Sep 19, 2019
2 parents 0abcce8 + a5d9a93 commit e09c726
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions orderer/consensus/etcdraft/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ func (n *node) start(fresh, join bool) {
}

func (n *node) run(campaign bool) {
electionTimeout := n.tickInterval.Seconds() * float64(n.config.ElectionTick)
halfElectionTimeout := electionTimeout / 2

raftTicker := n.clock.NewTicker(n.tickInterval)

if s := n.storage.Snapshot(); !raft.IsEmptySnap(s) {
Expand Down Expand Up @@ -122,6 +125,9 @@ func (n *node) run(campaign bool) {
}
duration := n.clock.Since(startStoring).Seconds()
n.metrics.DataPersistDuration.Observe(float64(duration))
if duration > halfElectionTimeout {
n.logger.Warningf("WAL sync took %v seconds and the network is configured to start elections after %v seconds. Your disk is too slow and may cause loss of quorum and trigger leadership election.", duration, electionTimeout)
}

if !raft.IsEmptySnap(rd.Snapshot) {
n.chain.snapC <- &rd.Snapshot
Expand Down

0 comments on commit e09c726

Please sign in to comment.