Skip to content

Commit

Permalink
fixing race condition in disk storage sync and save (#7263)
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-bansal authored Jan 8, 2021
1 parent 31164dd commit d13e744
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions raftwal/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ func (w *DiskStorage) NumLogFiles() int {

// Sync calls the Sync method in the underlying badger instance to write all the contents to disk.
func (w *DiskStorage) Sync() error {
w.lock.Lock()
defer w.lock.Unlock()

if err := w.meta.Sync(); err != nil {
return errors.Wrapf(err, "while syncing meta")
}
Expand Down

0 comments on commit d13e744

Please sign in to comment.