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
use []byte directly instead of bytes.Buffer
Chris Lud48dd0c73855
diff --git a/weed/filer/filechunk_manifest.go b/weed/filer/filechunk_manifest.goindex da530257a2..b4bfc68429 100644--- a/weed/filer/filechunk_manifest.go+++ b/weed/filer/filechunk_manifest.go@@ -97,20 +97,20 @@ func fetchChunk(lookupFileIdFn wdclient.LookupFileIdFunctionType, fileId string,func retriedFetchChunkData(urlStrings []string, cipherKey []byte, isGzipped bool, isFullChunk bool, isCheck bool, offset int64, size int) ([]byte, error) {var err error- var buffer bytes.Buffervar shouldRetry bool+ receivedData := make([]byte, 0, size)for waitTime := time.Second; waitTime < util.RetryWaitTime; waitTime += waitTime / 2 {for _, urlString := range urlStrings {+ receivedData = receivedData[:0]shouldRetry, err = util.ReadUrlAsStream(urlString+"?readDeleted=true", cipherKey, isGzipped, isFullChunk, offset, size, func(data []byte) {- buffer.Write(data)+ receivedData = append(receivedData, data...)})if !shouldRetry {break}if err != nil {glog.V(0).Infof("read %s failed, err: %v", urlString, err)- buffer.Reset()} else {break}@@ -123,7 +123,8 @@ func retriedFetchChunkData(urlStrings []string, cipherKey []byte, isGzipped bool}}- return buffer.Bytes(), err+ return receivedData, err+}func MaybeManifestize(saveFunc SaveDataAsChunkFunctionType, inputChunks []*filer_pb.FileChunk) (chunks []*filer_pb.FileChunk, err error) {