mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add lock on dirty pages
This commit is contained in:
parent
66ded8804a
commit
72e1aff237
|
@ -231,6 +231,10 @@ func min(x, y int64) int64 {
|
||||||
|
|
||||||
func (pages *ContinuousDirtyPages) ReadDirtyData(ctx context.Context, data []byte, startOffset int64) (offset int64, size int, err error) {
|
func (pages *ContinuousDirtyPages) ReadDirtyData(ctx context.Context, data []byte, startOffset int64) (offset int64, size int, err error) {
|
||||||
bufSize := int64(len(data))
|
bufSize := int64(len(data))
|
||||||
|
|
||||||
|
pages.lock.Lock()
|
||||||
|
defer pages.lock.Unlock()
|
||||||
|
|
||||||
if startOffset+bufSize < pages.Offset {
|
if startOffset+bufSize < pages.Offset {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue