Compare commits

...
2 Commits
Author SHA1 Message Date
Chris Lu 76f24af79a 2.52 2021-06-07 12:13:23 -07:00
Chris Lu 5e6dfbc25f locks for data racing 2021-06-07 12:04:50 -07:00
4 changed files with 8 additions and 5 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
apiVersion: v1 apiVersion: v1
description: SeaweedFS description: SeaweedFS
name: seaweedfs name: seaweedfs
appVersion: "2.51" appVersion: "2.52"
version: "2.51" version: "2.52"
+1 -1
View File
@@ -4,7 +4,7 @@ global:
registry: "" registry: ""
repository: "" repository: ""
imageName: chrislusf/seaweedfs imageName: chrislusf/seaweedfs
# imageTag: "2.51" - started using {.Chart.appVersion} # imageTag: "2.52" - started using {.Chart.appVersion}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
imagePullSecrets: imagepullsecret imagePullSecrets: imagepullsecret
restartPolicy: Always restartPolicy: Always
@@ -29,7 +29,6 @@ var bufPool = sync.Pool{
} }
func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Request, reader io.Reader, chunkSize int32, fileName, contentType string, contentLength int64, so *operation.StorageOption) ([]*filer_pb.FileChunk, hash.Hash, int64, error, []byte) { func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Request, reader io.Reader, chunkSize int32, fileName, contentType string, contentLength int64, so *operation.StorageOption) ([]*filer_pb.FileChunk, hash.Hash, int64, error, []byte) {
var fileChunks []*filer_pb.FileChunk
md5Hash := md5.New() md5Hash := md5.New()
var partReader = ioutil.NopCloser(io.TeeReader(reader, md5Hash)) var partReader = ioutil.NopCloser(io.TeeReader(reader, md5Hash))
@@ -41,6 +40,8 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque
var wg sync.WaitGroup var wg sync.WaitGroup
var bytesBufferCounter int64 var bytesBufferCounter int64
bytesBufferLimitCond := sync.NewCond(new(sync.Mutex)) bytesBufferLimitCond := sync.NewCond(new(sync.Mutex))
var fileChunks []*filer_pb.FileChunk
var fileChunksLock sync.Mutex
for { for {
// need to throttle used byte buffer // need to throttle used byte buffer
@@ -94,7 +95,9 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Reque
uploadErr = toChunkErr uploadErr = toChunkErr
} }
if chunk != nil { if chunk != nil {
fileChunksLock.Lock()
fileChunks = append(fileChunks, chunk) fileChunks = append(fileChunks, chunk)
fileChunksLock.Unlock()
glog.V(4).Infof("uploaded %s chunk %d to %s [%d,%d)", fileName, len(fileChunks), chunk.FileId, offset, offset+int64(chunk.Size)) glog.V(4).Infof("uploaded %s chunk %d to %s [%d,%d)", fileName, len(fileChunks), chunk.FileId, offset, offset+int64(chunk.Size))
} }
}(chunkOffset) }(chunkOffset)
+1 -1
View File
@@ -5,7 +5,7 @@ import (
) )
var ( var (
VERSION = fmt.Sprintf("%s %d.%02d", sizeLimit, 2, 51) VERSION = fmt.Sprintf("%s %d.%02d", sizeLimit, 2, 52)
COMMIT = "" COMMIT = ""
) )