aboutsummaryrefslogtreecommitdiff
path: root/weed/pb
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-06-21 20:56:27 -0700
committerChris Lu <chris.lu@gmail.com>2019-06-21 20:56:27 -0700
commita111f26fe618c5872b8b133bd2233fe6dafdf6c8 (patch)
treeec0302a5135c1d81a0e666636da8ceb916874174 /weed/pb
parent308102f0233ca019e7b48f97f7fdfc30ee606f54 (diff)
downloadseaweedfs-a111f26fe618c5872b8b133bd2233fe6dafdf6c8.tar.xz
seaweedfs-a111f26fe618c5872b8b133bd2233fe6dafdf6c8.zip
avoid nil
fix https://github.com/chrislusf/seaweedfs/issues/988
Diffstat (limited to 'weed/pb')
-rw-r--r--weed/pb/filer_pb/filer_pb_helper.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/weed/pb/filer_pb/filer_pb_helper.go b/weed/pb/filer_pb/filer_pb_helper.go
index be59089dd..361b0f57d 100644
--- a/weed/pb/filer_pb/filer_pb_helper.go
+++ b/weed/pb/filer_pb/filer_pb_helper.go
@@ -21,8 +21,14 @@ 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 ChunkEquals(this, that *FileChunk) bool {
+ if this.Fid == nil{
+ this.Fid, _ = toFileId(this.FileId)
+ }
+ if that.Fid == nil{
+ that.Fid, _ = toFileId(that.FileId)
+ }
+ return this.Fid.FileKey == that.Fid.FileKey && this.Fid.VolumeId == that.Fid.VolumeId && this.Fid.Cookie == that.Fid.Cookie
}
func BeforeEntrySerialization(chunks []*FileChunk) {