Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deadlock when flushing discard stats. #976

Merged
merged 7 commits into from
Aug 27, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix manish comment
Signed-off-by: பாலாஜி ஜின்னா <balaji@dgraph.io>
  • Loading branch information
பாலாஜி ஜின்னா committed Aug 27, 2019
commit 90288ddc4ce061a37f90f1ee010fdcd94e0d9178
7 changes: 3 additions & 4 deletions value.go
Original file line number Diff line number Diff line change
Expand Up @@ -1413,15 +1413,14 @@ func (vlog *valueLog) flushDiscardStats() error {
Value: vlog.encodedDiscardStats(),
}}
req, err := vlog.db.sendToWriteCh(entries)
if err != nil {
if err == ErrBlockedWrites {
// We'll block write while closing db.
// When L0 compaction in close may push discard stats.
// So ignoring it.
// https://github.com/dgraph-io/badger/issues/970
if err != ErrBlockedWrites {
return errors.Wrapf(err, "failed to push discard stats to write channel")
}
return nil
} else if err != nil {
return errors.Wrapf(err, "failed to push discard stats to write channel")
}
vlog.lfDiscardStats.updatesSinceFlush = 0
return req.Wait()
Expand Down