mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
volume: fix needle checking for deleted needles
This commit is contained in:
parent
bd76ad0ff1
commit
f567777d64
|
@ -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…
Reference in a new issue