mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-23 03:13:35 +08:00
pass in bytes buffer to avoid possible race condition
related to https://github.com/seaweedfs/seaweedfs/issues/6180
This commit is contained in:
@@ -100,7 +100,7 @@ func (fs *FilerServer) uploadReaderToChunks(reader io.Reader, startOffset int64,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(offset int64) {
|
go func(offset int64, buf *bytes.Buffer) {
|
||||||
defer func() {
|
defer func() {
|
||||||
bufPool.Put(bytesBuffer)
|
bufPool.Put(bytesBuffer)
|
||||||
<-bytesBufferLimitChan
|
<-bytesBufferLimitChan
|
||||||
@@ -124,7 +124,7 @@ func (fs *FilerServer) uploadReaderToChunks(reader io.Reader, startOffset int64,
|
|||||||
}
|
}
|
||||||
fileChunksLock.Unlock()
|
fileChunksLock.Unlock()
|
||||||
}
|
}
|
||||||
}(chunkOffset)
|
}(chunkOffset, bytesBuffer)
|
||||||
|
|
||||||
// reset variables for the next chunk
|
// reset variables for the next chunk
|
||||||
chunkOffset = chunkOffset + dataSize
|
chunkOffset = chunkOffset + dataSize
|
||||||
|
Reference in New Issue
Block a user