volume: fix needle checking for deleted needles

This commit is contained in:
Chris Lu 2019-04-15 21:58:43 -07:00
parent bd76ad0ff1
commit f567777d64

View file

@ -21,11 +21,11 @@ func (v *Volume) isFileUnchanged(n *Needle) bool {
return false
}
nv, ok := v.nm.Get(n.Id)
if ok && !nv.Offset.IsZero() {
if ok && !nv.Offset.IsZero() && nv.Size != TombstoneFileSize {
oldNeedle := new(Needle)
err := oldNeedle.ReadData(v.dataFile, nv.Offset.ToAcutalOffset(), nv.Size, v.Version())
if err != nil {
glog.V(0).Infof("Failed to check updated file %v", err)
glog.V(0).Infof("Failed to check updated file at offset %d size %d: %v", nv.Offset.ToAcutalOffset(), nv.Size, err)
return false
}
if oldNeedle.Checksum == n.Checksum && bytes.Equal(oldNeedle.Data, n.Data) {