mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
adjust for data race
fix https://github.com/seaweedfs/seaweedfs/issues/3512
This commit is contained in:
parent
87b70a6809
commit
580a7fa685
|
@ -57,14 +57,14 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque
|
||||||
// need to throttle used byte buffer
|
// need to throttle used byte buffer
|
||||||
bytesBufferLimitCond.L.Lock()
|
bytesBufferLimitCond.L.Lock()
|
||||||
for atomic.LoadInt64(&bytesBufferCounter) >= 4 {
|
for atomic.LoadInt64(&bytesBufferCounter) >= 4 {
|
||||||
glog.V(4).Infof("waiting for byte buffer %d", bytesBufferCounter)
|
glog.V(4).Infof("waiting for byte buffer %d", atomic.LoadInt64(&bytesBufferCounter))
|
||||||
bytesBufferLimitCond.Wait()
|
bytesBufferLimitCond.Wait()
|
||||||
}
|
}
|
||||||
atomic.AddInt64(&bytesBufferCounter, 1)
|
atomic.AddInt64(&bytesBufferCounter, 1)
|
||||||
bytesBufferLimitCond.L.Unlock()
|
bytesBufferLimitCond.L.Unlock()
|
||||||
|
|
||||||
bytesBuffer := bufPool.Get().(*bytes.Buffer)
|
bytesBuffer := bufPool.Get().(*bytes.Buffer)
|
||||||
glog.V(4).Infof("received byte buffer %d", bytesBufferCounter)
|
glog.V(4).Infof("received byte buffer %d", atomic.LoadInt64(&bytesBufferCounter))
|
||||||
|
|
||||||
limitedReader := io.LimitReader(partReader, int64(chunkSize))
|
limitedReader := io.LimitReader(partReader, int64(chunkSize))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue