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
add a place holder for later merge consecutive chunks
chrislu79b8e6a8c31d
diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.goindex 854b35f822..9bf2df6ef8 100644--- a/weed/server/filer_server_handlers_write_autochunk.go+++ b/weed/server/filer_server_handlers_write_autochunk.go@@ -164,6 +164,7 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa}var entry *filer.Entry+ var newChunks []*filer_pb.FileChunkvar mergedChunks []*filer_pb.FileChunkisAppend := isAppend(r)@@ -186,7 +187,7 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa}entry.FileSize += uint64(chunkOffset)}- mergedChunks = append(entry.Chunks, fileChunks...)+ newChunks = append(entry.Chunks, fileChunks...)// TODOif len(entry.Content) > 0 {@@ -196,7 +197,7 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa} else {glog.V(4).Infoln("saving", path)- mergedChunks = fileChunks+ newChunks = fileChunksentry = &filer.Entry{FullPath: util.FullPath(path),Attr: filer.Attr{@@ -217,6 +218,13 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa}}+ // maybe concatenate small chunks into one whole chunk+ mergedChunks, replyerr = fs.maybeMergeChunks(so, newChunks)+ if replyerr != nil {+ glog.V(0).Infof("merge chunks %s: %v", r.RequestURI, replyerr)+ mergedChunks = newChunks+ }+// maybe compact entry chunksmergedChunks, replyerr = filer.MaybeManifestize(fs.saveAsChunk(so), mergedChunks)if replyerr != nil {diff --git a/weed/server/filer_server_handlers_write_merge.go b/weed/server/filer_server_handlers_write_merge.gonew file mode 100644index 0000000000..dadc6f7265--- /dev/null+++ b/weed/server/filer_server_handlers_write_merge.go@@ -0,0 +1,11 @@+package weed_server++import (+ "github.com/chrislusf/seaweedfs/weed/operation"+ "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"+)++func (fs *FilerServer) maybeMergeChunks(so *operation.StorageOption, inputChunks []*filer_pb.FileChunk) (mergedChunks []*filer_pb.FileChunk, err error) {+ //TODO merge consecutive smaller chunks into a large chunk to reduce number of chunks+ return inputChunks, nil+}