SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
locks for data racing
Chris Lu5e6dfbc25fab
diff --git a/weed/server/filer_server_handlers_write_upload.go b/weed/server/filer_server_handlers_write_upload.goindex 32a7225072..e28309c6a9 100644--- a/weed/server/filer_server_handlers_write_upload.go+++ b/weed/server/filer_server_handlers_write_upload.go@@ -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) {- var fileChunks []*filer_pb.FileChunkmd5Hash := md5.New()var partReader = ioutil.NopCloser(io.TeeReader(reader, md5Hash))@@ -41,6 +40,8 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.Requevar wg sync.WaitGroupvar bytesBufferCounter int64bytesBufferLimitCond := sync.NewCond(new(sync.Mutex))+ var fileChunks []*filer_pb.FileChunk+ var fileChunksLock sync.Mutexfor {// need to throttle used byte buffer@@ -94,7 +95,9 @@ func (fs *FilerServer) uploadReaderToChunks(w http.ResponseWriter, r *http.RequeuploadErr = toChunkErr}if chunk != nil {+ fileChunksLock.Lock()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))}}(chunkOffset)