mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-20 01:59:23 +08:00
lock "addChunks()"
This commit is contained in:
@@ -15,10 +15,10 @@ type ContinuousDirtyPages struct {
|
|||||||
intervals *ContinuousIntervals
|
intervals *ContinuousIntervals
|
||||||
f *File
|
f *File
|
||||||
writeWaitGroup sync.WaitGroup
|
writeWaitGroup sync.WaitGroup
|
||||||
|
chunkAddLock sync.Mutex
|
||||||
chunkSaveErrChan chan error
|
chunkSaveErrChan chan error
|
||||||
chunkSaveErrChanClosed bool
|
chunkSaveErrChanClosed bool
|
||||||
lastErr error
|
lastErr error
|
||||||
lock sync.Mutex
|
|
||||||
collection string
|
collection string
|
||||||
replication string
|
replication string
|
||||||
}
|
}
|
||||||
@@ -117,6 +117,8 @@ func (pages *ContinuousDirtyPages) saveToStorage(reader io.Reader, offset int64,
|
|||||||
}
|
}
|
||||||
chunk.Mtime = mtime
|
chunk.Mtime = mtime
|
||||||
pages.collection, pages.replication = collection, replication
|
pages.collection, pages.replication = collection, replication
|
||||||
|
pages.chunkAddLock.Lock()
|
||||||
|
defer pages.chunkAddLock.Unlock()
|
||||||
pages.f.addChunks([]*filer_pb.FileChunk{chunk})
|
pages.f.addChunks([]*filer_pb.FileChunk{chunk})
|
||||||
glog.V(3).Infof("%s saveToStorage [%d,%d)", pages.f.fullpath(), offset, offset+size)
|
glog.V(3).Infof("%s saveToStorage [%d,%d)", pages.f.fullpath(), offset, offset+size)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user