Browse Source

volume: fix needle checking for deleted needles

pull/934/head
Chris Lu 6 years ago
parent
commit
f567777d64
  1. 4
      weed/storage/volume_read_write.go

4
weed/storage/volume_read_write.go

@ -21,11 +21,11 @@ func (v *Volume) isFileUnchanged(n *Needle) bool {
return false return false
} }
nv, ok := v.nm.Get(n.Id) nv, ok := v.nm.Get(n.Id)
if ok && !nv.Offset.IsZero() {
if ok && !nv.Offset.IsZero() && nv.Size != TombstoneFileSize {
oldNeedle := new(Needle) oldNeedle := new(Needle)
err := oldNeedle.ReadData(v.dataFile, nv.Offset.ToAcutalOffset(), nv.Size, v.Version()) err := oldNeedle.ReadData(v.dataFile, nv.Offset.ToAcutalOffset(), nv.Size, v.Version())
if err != nil { 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 return false
} }
if oldNeedle.Checksum == n.Checksum && bytes.Equal(oldNeedle.Data, n.Data) { if oldNeedle.Checksum == n.Checksum && bytes.Equal(oldNeedle.Data, n.Data) {

Loading…
Cancel
Save