Skip to content

Commit

Permalink
Merge pull request influxdata#8577 from influxdata/jw-wal-sync-hang
Browse files Browse the repository at this point in the history
Fix indefinite hang in WAL.writeToLog
  • Loading branch information
jwilder authored Jul 7, 2017
2 parents 7ac4f5b + e9370e0 commit 3fac694
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tsdb/engine/tsm1/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ func (l *WAL) scheduleSync() {

// Fsync the wal and notify all pending waiters
go func() {
defer atomic.StoreUint64(&l.syncCount, 0)
var timerCh <-chan time.Time

// time.NewTicker requires a > 0 delay, since 0 indicates no delay, use a closed
Expand All @@ -267,13 +266,15 @@ func (l *WAL) scheduleSync() {
case <-timerCh:
l.mu.Lock()
if len(l.syncWaiters) == 0 {
atomic.StoreUint64(&l.syncCount, 0)
l.mu.Unlock()
return
}

l.sync()
l.mu.Unlock()
case <-l.closing:
atomic.StoreUint64(&l.syncCount, 0)
return
}
}
Expand Down

0 comments on commit 3fac694

Please sign in to comment.