fix issue 986

fix issue 986
This commit is contained in:
Chris Lu 2019-06-21 13:06:04 -07:00
parent ff97acae62
commit 059ef879a8
2 changed files with 5 additions and 1 deletions

View file

@ -78,7 +78,7 @@ func (f *Filer) deleteChunksIfNotNew(oldEntry, newEntry *Entry) {
for _, oldChunk := range oldEntry.Chunks { for _, oldChunk := range oldEntry.Chunks {
found := false found := false
for _, newChunk := range newEntry.Chunks { for _, newChunk := range newEntry.Chunks {
if oldChunk.FileId == newChunk.FileId { if oldChunk.Fid.Equals(newChunk.Fid) {
found = true found = true
break break
} }

View file

@ -21,6 +21,10 @@ func (fid *FileId) toFileId() string {
return needle.NewFileId(needle.VolumeId(fid.VolumeId), fid.FileKey, fid.Cookie).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) { func BeforeEntrySerialization(chunks []*FileChunk) {
for _, chunk := range chunks { for _, chunk := range chunks {