aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/stream.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-08-15 20:23:41 -0700
committerChris Lu <chris.lu@gmail.com>2021-08-15 20:23:41 -0700
commit72eb6d5b9da9196a17f7ec854d2c4d44a84fad73 (patch)
tree2d1f49eb248bcd3da91807b852739d8f7fe5ebfe /weed/filer/stream.go
parent5a7c40510f849f89b9aa72dcbc80b86a48ae4382 (diff)
downloadseaweedfs-72eb6d5b9da9196a17f7ec854d2c4d44a84fad73.tar.xz
seaweedfs-72eb6d5b9da9196a17f7ec854d2c4d44a84fad73.zip
ensure no writes to remote storage if content is not changed
Diffstat (limited to 'weed/filer/stream.go')
-rw-r--r--weed/filer/stream.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/weed/filer/stream.go b/weed/filer/stream.go
index 2a3870aac..9f28056cd 100644
--- a/weed/filer/stream.go
+++ b/weed/filer/stream.go
@@ -3,7 +3,6 @@ package filer
import (
"bytes"
"fmt"
- "github.com/golang/protobuf/proto"
"io"
"math"
"sort"
@@ -39,9 +38,14 @@ func isSameChunks(a, b []*filer_pb.FileChunk) bool {
if len(a) != len(b) {
return false
}
+ sort.Slice(a, func(i, j int) bool {
+ return strings.Compare(a[i].ETag, a[j].ETag) < 0
+ })
+ sort.Slice(b, func(i, j int) bool {
+ return strings.Compare(b[i].ETag, b[j].ETag) < 0
+ })
for i := 0; i < len(a); i++ {
- x, y := a[i], b[i]
- if !proto.Equal(x, y) {
+ if a[i].ETag != b[i].ETag {
return false
}
}