Browse Source

Fix a data race in Datafile.ReadAt()

master
James Mills 4 weeks ago
parent
commit
40425394d7
Signed by: prologic GPG Key ID: AC4C014F1440EBD6
  1. 5
      internal/data/datafile.go

5
internal/data/datafile.go

@ -6,9 +6,9 @@ import (
"path/filepath"
"sync"
"github.com/pkg/errors"
"git.mills.io/prologic/bitcask/internal"
"git.mills.io/prologic/bitcask/internal/data/codec"
"github.com/pkg/errors"
"golang.org/x/exp/mmap"
)
@ -159,6 +159,9 @@ func (df *datafile) ReadAt(index, size int64) (e internal.Entry, err error) {
b := make([]byte, size)
df.RLock()
defer df.RUnlock()
if df.ra != nil {
n, err = df.ra.ReadAt(b, index)
} else {

Loading…
Cancel
Save