From 059ef879a8a221bbdb117c4fd69fe092044587b6 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 21 Jun 2019 13:06:04 -0700 Subject: [PATCH] fix issue 986 fix issue 986 --- weed/filer2/filer_deletion.go | 2 +- weed/pb/filer_pb/filer_pb_helper.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/weed/filer2/filer_deletion.go b/weed/filer2/filer_deletion.go index e45f80b2f..06e088de6 100644 --- a/weed/filer2/filer_deletion.go +++ b/weed/filer2/filer_deletion.go @@ -78,7 +78,7 @@ func (f *Filer) deleteChunksIfNotNew(oldEntry, newEntry *Entry) { for _, oldChunk := range oldEntry.Chunks { found := false for _, newChunk := range newEntry.Chunks { - if oldChunk.FileId == newChunk.FileId { + if oldChunk.Fid.Equals(newChunk.Fid) { found = true break } diff --git a/weed/pb/filer_pb/filer_pb_helper.go b/weed/pb/filer_pb/filer_pb_helper.go index 1017e6910..be59089dd 100644 --- a/weed/pb/filer_pb/filer_pb_helper.go +++ b/weed/pb/filer_pb/filer_pb_helper.go @@ -21,6 +21,10 @@ func (fid *FileId) toFileId() string { return needle.NewFileId(needle.VolumeId(fid.VolumeId), fid.FileKey, fid.Cookie).String() } +func (fid *FileId) Equals(that *FileId) bool { + return fid.FileKey == that.FileKey && fid.VolumeId == that.VolumeId && fid.Cookie == that.Cookie +} + func BeforeEntrySerialization(chunks []*FileChunk) { for _, chunk := range chunks {