aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/filechunks.go
diff options
context:
space:
mode:
authora <eddy@gfxlabs.io>2022-04-20 14:01:42 -0700
committera <eddy@gfxlabs.io>2022-04-20 14:01:42 -0700
commit1d6a9e66b608f77a0da9a6903802bb24ff0629d7 (patch)
tree7f3e02d6e69d10913d882c5f87d9156001e1b77c /weed/filer/filechunks.go
parent846858fb436cc061c40c4f2565ed3682e3758596 (diff)
parentd1fd40358215a6237f51e0918659f74cc7269ff1 (diff)
downloadseaweedfs-1d6a9e66b608f77a0da9a6903802bb24ff0629d7.tar.xz
seaweedfs-1d6a9e66b608f77a0da9a6903802bb24ff0629d7.zip
Merge branch 'master' into a
Diffstat (limited to 'weed/filer/filechunks.go')
-rw-r--r--weed/filer/filechunks.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/weed/filer/filechunks.go b/weed/filer/filechunks.go
index 11a779147..208ef8095 100644
--- a/weed/filer/filechunks.go
+++ b/weed/filer/filechunks.go
@@ -4,8 +4,8 @@ import (
"bytes"
"fmt"
"github.com/chrislusf/seaweedfs/weed/wdclient"
+ "golang.org/x/exp/slices"
"math"
- "sort"
"sync"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
@@ -254,19 +254,17 @@ func NonOverlappingVisibleIntervals(lookupFileIdFn wdclient.LookupFileIdFunction
if true {
return visibles2, err
}
-
- sort.Slice(chunks, func(i, j int) bool {
- if chunks[i].Mtime == chunks[j].Mtime {
- filer_pb.EnsureFid(chunks[i])
- filer_pb.EnsureFid(chunks[j])
- if chunks[i].Fid == nil || chunks[j].Fid == nil {
+ slices.SortFunc(chunks, func(a, b *filer_pb.FileChunk) bool {
+ if a.Mtime == b.Mtime {
+ filer_pb.EnsureFid(a)
+ filer_pb.EnsureFid(b)
+ if a.Fid == nil || b.Fid == nil {
return true
}
- return chunks[i].Fid.FileKey < chunks[j].Fid.FileKey
+ return a.Fid.FileKey < b.Fid.FileKey
}
- return chunks[i].Mtime < chunks[j].Mtime // keep this to make tests run
+ return a.Mtime < b.Mtime
})
-
for _, chunk := range chunks {
// glog.V(0).Infof("merge [%d,%d)", chunk.Offset, chunk.Offset+int64(chunk.Size))