mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
ensure no writes to remote storage if content is not changed
This commit is contained in:
parent
5a7c40510f
commit
72eb6d5b9d
|
@ -176,7 +176,6 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
|
||||||
if resp.Directory == message.NewParentPath && message.OldEntry.Name == message.NewEntry.Name {
|
if resp.Directory == message.NewParentPath && message.OldEntry.Name == message.NewEntry.Name {
|
||||||
if filer.IsSameData(message.OldEntry, message.NewEntry) {
|
if filer.IsSameData(message.OldEntry, message.NewEntry) {
|
||||||
glog.V(2).Infof("update meta: %+v", resp)
|
glog.V(2).Infof("update meta: %+v", resp)
|
||||||
glog.V(0).Infof("delete %s", remote_storage.FormatLocation(dest))
|
|
||||||
return client.UpdateFileMetadata(dest, message.OldEntry, message.NewEntry)
|
return client.UpdateFileMetadata(dest, message.OldEntry, message.NewEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package filer
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/golang/protobuf/proto"
|
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
"sort"
|
"sort"
|
||||||
|
@ -39,9 +38,14 @@ func isSameChunks(a, b []*filer_pb.FileChunk) bool {
|
||||||
if len(a) != len(b) {
|
if len(a) != len(b) {
|
||||||
return false
|
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++ {
|
for i := 0; i < len(a); i++ {
|
||||||
x, y := a[i], b[i]
|
if a[i].ETag != b[i].ETag {
|
||||||
if !proto.Equal(x, y) {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue