volume: also check cookie for possible duplicates

This commit is contained in:
Chris Lu 2019-04-21 13:31:45 -07:00
parent 132921ad41
commit 0302b9496c
2 changed files with 2 additions and 2 deletions

View file

@ -120,7 +120,7 @@ func (vs *VolumeServer) doHeartbeat(ctx context.Context, masterNode, masterGrpcA
return "", err return "", err
} }
case <-tickChan: case <-tickChan:
glog.V(1).Infof("volume server %s:%d heartbeat", vs.store.Ip, vs.store.Port) glog.V(2).Infof("volume server %s:%d heartbeat", vs.store.Ip, vs.store.Port)
if err = stream.Send(vs.store.CollectHeartbeat()); err != nil { if err = stream.Send(vs.store.CollectHeartbeat()); err != nil {
glog.V(0).Infof("Volume Server Failed to talk with master %s: %v", masterNode, err) glog.V(0).Infof("Volume Server Failed to talk with master %s: %v", masterNode, err)
return "", err return "", err

View file

@ -29,7 +29,7 @@ func (v *Volume) isFileUnchanged(n *needle.Needle) bool {
glog.V(0).Infof("Failed to check updated file at offset %d size %d: %v", nv.Offset.ToAcutalOffset(), nv.Size, 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.Cookie == n.Cookie && oldNeedle.Checksum == n.Checksum && bytes.Equal(oldNeedle.Data, n.Data) {
n.DataSize = oldNeedle.DataSize n.DataSize = oldNeedle.DataSize
return true return true
} }