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
sorting chunks
Chris Lud60bcbf08ab1
diff --git a/weed/filer2/filechunks.go b/weed/filer2/filechunks.goindex 1ab6679f94..9ab7ea355f 100644--- a/weed/filer2/filechunks.go+++ b/weed/filer2/filechunks.go@@ -219,7 +219,7 @@ func NonOverlappingVisibleIntervals(lookupFileIdFn LookupFileIdFunctionType, chuchunks, _, err = ResolveChunkManifest(lookupFileIdFn, chunks)sort.Slice(chunks, func(i, j int) bool {- return chunks[i].Mtime < chunks[j].Mtime+ return chunks[i].Fid.FileKey < chunks[j].Fid.FileKey})var newVisibles []VisibleIntervaldiff --git a/weed/filesys/file.go b/weed/filesys/file.goindex d57f6cc577..d9e1f2662b 100644--- a/weed/filesys/file.go+++ b/weed/filesys/file.go@@ -258,7 +258,7 @@ func (file *File) maybeLoadEntry(ctx context.Context) error {func (file *File) addChunks(chunks []*filer_pb.FileChunk) {sort.Slice(chunks, func(i, j int) bool {- return chunks[i].Mtime < chunks[j].Mtime+ return chunks[i].Fid.FileKey < chunks[j].Fid.FileKey})var newVisibles []filer2.VisibleIntervaldiff --git a/weed/shell/command_fs_meta_cat.go b/weed/shell/command_fs_meta_cat.goindex 0679ec0750..8cba2d520c 100644--- a/weed/shell/command_fs_meta_cat.go+++ b/weed/shell/command_fs_meta_cat.go@@ -3,6 +3,7 @@ package shellimport ("fmt""io"+ "sort""github.com/golang/protobuf/jsonpb"@@ -54,6 +55,13 @@ func (c *commandFsMetaCat) Do(args []string, commandEnv *CommandEnv, writer io.WIndent: " ",}+ sort.Slice(respLookupEntry.Entry.Chunks, func(i, j int) bool {+ if respLookupEntry.Entry.Chunks[i].Offset == respLookupEntry.Entry.Chunks[j].Offset {+ return respLookupEntry.Entry.Chunks[i].Mtime < respLookupEntry.Entry.Chunks[j].Mtime+ }+ return respLookupEntry.Entry.Chunks[i].Offset < respLookupEntry.Entry.Chunks[j].Offset+ })+text, marshalErr := m.MarshalToString(respLookupEntry.Entry)if marshalErr != nil {return fmt.Errorf("marshal meta: %v", marshalErr)