mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-01-18 06:30:07 +08:00
Add error checking for file reads.
This commit is contained in:
parent
c28d55d343
commit
49d639ecab
@ -152,7 +152,11 @@ func (v *Volume) isFileUnchanged(n *Needle) bool {
|
|||||||
nv, ok := v.nm.Get(n.Id)
|
nv, ok := v.nm.Get(n.Id)
|
||||||
if ok && nv.Offset > 0 {
|
if ok && nv.Offset > 0 {
|
||||||
oldNeedle := new(Needle)
|
oldNeedle := new(Needle)
|
||||||
oldNeedle.Read(v.dataFile, int64(nv.Offset)*NeedlePaddingSize, nv.Size, v.Version())
|
_, err := oldNeedle.Read(v.dataFile, int64(nv.Offset)*NeedlePaddingSize, nv.Size, v.Version())
|
||||||
|
if err != nil {
|
||||||
|
glog.V(0).Infof("Failed to check updated file %v", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
if oldNeedle.Checksum == n.Checksum && bytes.Equal(oldNeedle.Data, n.Data) {
|
if oldNeedle.Checksum == n.Checksum && bytes.Equal(oldNeedle.Data, n.Data) {
|
||||||
n.DataSize = oldNeedle.DataSize
|
n.DataSize = oldNeedle.DataSize
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user