mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
sorting chunks
This commit is contained in:
parent
5e6b714836
commit
d60bcbf08a
|
@ -219,7 +219,7 @@ func NonOverlappingVisibleIntervals(lookupFileIdFn LookupFileIdFunctionType, chu
|
||||||
chunks, _, err = ResolveChunkManifest(lookupFileIdFn, chunks)
|
chunks, _, err = ResolveChunkManifest(lookupFileIdFn, chunks)
|
||||||
|
|
||||||
sort.Slice(chunks, func(i, j int) bool {
|
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 []VisibleInterval
|
var newVisibles []VisibleInterval
|
||||||
|
|
|
@ -258,7 +258,7 @@ func (file *File) maybeLoadEntry(ctx context.Context) error {
|
||||||
func (file *File) addChunks(chunks []*filer_pb.FileChunk) {
|
func (file *File) addChunks(chunks []*filer_pb.FileChunk) {
|
||||||
|
|
||||||
sort.Slice(chunks, func(i, j int) bool {
|
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.VisibleInterval
|
var newVisibles []filer2.VisibleInterval
|
||||||
|
|
|
@ -3,6 +3,7 @@ package shell
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"sort"
|
||||||
|
|
||||||
"github.com/golang/protobuf/jsonpb"
|
"github.com/golang/protobuf/jsonpb"
|
||||||
|
|
||||||
|
@ -54,6 +55,13 @@ func (c *commandFsMetaCat) Do(args []string, commandEnv *CommandEnv, writer io.W
|
||||||
Indent: " ",
|
Indent: " ",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
text, marshalErr := m.MarshalToString(respLookupEntry.Entry)
|
||||||
if marshalErr != nil {
|
if marshalErr != nil {
|
||||||
return fmt.Errorf("marshal meta: %v", marshalErr)
|
return fmt.Errorf("marshal meta: %v", marshalErr)
|
||||||
|
|
Loading…
Reference in a new issue