aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-08-15 19:27:30 -0700
committerChris Lu <chris.lu@gmail.com>2021-08-15 19:27:30 -0700
commitc45c12aedc68c167beb7104be30ce4bbdf5202a7 (patch)
tree00edd41e3c62d19214ab2c395e95daaf722c47a2
parent507411bdf04486d229934db70642d0adb96ca89d (diff)
downloadseaweedfs-c45c12aedc68c167beb7104be30ce4bbdf5202a7.tar.xz
seaweedfs-c45c12aedc68c167beb7104be30ce4bbdf5202a7.zip
metadata updates
-rw-r--r--weed/command/filer_remote_sync.go2
-rw-r--r--weed/remote_storage/remote_storage.go2
-rw-r--r--weed/remote_storage/s3/s3_storage_client.go10
3 files changed, 9 insertions, 5 deletions
diff --git a/weed/command/filer_remote_sync.go b/weed/command/filer_remote_sync.go
index 41b9c67e8..bfd266c5f 100644
--- a/weed/command/filer_remote_sync.go
+++ b/weed/command/filer_remote_sync.go
@@ -174,7 +174,7 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
if resp.Directory == message.NewParentPath && message.OldEntry.Name == message.NewEntry.Name {
if isSameChunks(message.OldEntry.Chunks, message.NewEntry.Chunks) {
fmt.Printf("update meta: %+v\n", resp)
- return client.UpdateFileMetadata(dest, message.NewEntry)
+ return client.UpdateFileMetadata(dest, message.OldEntry, message.NewEntry)
}
}
fmt.Printf("update: %+v\n", resp)
diff --git a/weed/remote_storage/remote_storage.go b/weed/remote_storage/remote_storage.go
index bbc3eaa5b..eb260abe6 100644
--- a/weed/remote_storage/remote_storage.go
+++ b/weed/remote_storage/remote_storage.go
@@ -34,7 +34,7 @@ type RemoteStorageClient interface {
ReadFile(loc *filer_pb.RemoteStorageLocation, offset int64, size int64) (data []byte, err error)
WriteDirectory(loc *filer_pb.RemoteStorageLocation, entry *filer_pb.Entry) (err error)
WriteFile(loc *filer_pb.RemoteStorageLocation, entry *filer_pb.Entry, reader io.Reader) (remoteEntry *filer_pb.RemoteEntry, err error)
- UpdateFileMetadata(loc *filer_pb.RemoteStorageLocation, entry *filer_pb.Entry) (err error)
+ UpdateFileMetadata(loc *filer_pb.RemoteStorageLocation, oldEntry *filer_pb.Entry, newEntry *filer_pb.Entry) (err error)
DeleteFile(loc *filer_pb.RemoteStorageLocation) (err error)
}
diff --git a/weed/remote_storage/s3/s3_storage_client.go b/weed/remote_storage/s3/s3_storage_client.go
index 50b58b6ca..f8bba6068 100644
--- a/weed/remote_storage/s3/s3_storage_client.go
+++ b/weed/remote_storage/s3/s3_storage_client.go
@@ -13,6 +13,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/remote_storage"
"github.com/chrislusf/seaweedfs/weed/util"
"io"
+ "reflect"
)
func init() {
@@ -187,13 +188,16 @@ func (s *s3RemoteStorageClient) readFileRemoteEntry(loc *filer_pb.RemoteStorageL
}
-func (s *s3RemoteStorageClient) UpdateFileMetadata(loc *filer_pb.RemoteStorageLocation, entry *filer_pb.Entry) (err error) {
- tagging := toTagging(entry.Extended)
+func (s *s3RemoteStorageClient) UpdateFileMetadata(loc *filer_pb.RemoteStorageLocation, oldEntry *filer_pb.Entry, newEntry *filer_pb.Entry) (err error) {
+ if reflect.DeepEqual(oldEntry.Extended, newEntry.Extended) {
+ return nil
+ }
+ tagging := toTagging(newEntry.Extended)
if len(tagging.TagSet) > 0 {
_, err = s.conn.PutObjectTagging(&s3.PutObjectTaggingInput{
Bucket: aws.String(loc.Bucket),
Key: aws.String(loc.Path[1:]),
- Tagging: toTagging(entry.Extended),
+ Tagging: toTagging(newEntry.Extended),
})
} else {
_, err = s.conn.DeleteObjectTagging(&s3.DeleteObjectTaggingInput{