mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-12-18 12:47:50 +08:00
some changes to prepare fix after failed reads
This commit is contained in:
parent
78859e35fc
commit
bd8b9b0c2e
@ -93,6 +93,10 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
|
||||
} else if hasEcVolume {
|
||||
count, err = vs.store.ReadEcShardNeedle(volumeId, n)
|
||||
}
|
||||
if err != nil && err != storage.ErrorDeleted && r.FormValue("type") != "replicate" && hasVolume {
|
||||
glog.V(4).Infoln("read needle: %v", err)
|
||||
// start to fix it from other replicas, if not deleted and hasVolume and is not a replicated request
|
||||
}
|
||||
// glog.V(4).Infoln("read bytes", count, "error", err)
|
||||
if err != nil || count < 0 {
|
||||
glog.V(3).Infof("read %s isNormalVolume %v error: %v", r.URL.Path, hasVolume, err)
|
||||
|
@ -128,7 +128,7 @@ func (s *Store) ReadEcShardNeedle(vid needle.VolumeId, n *needle.Needle) (int, e
|
||||
return 0, fmt.Errorf("locate in local ec volume: %v", err)
|
||||
}
|
||||
if size.IsDeleted() {
|
||||
return 0, fmt.Errorf("entry %s is deleted", n.Id)
|
||||
return 0, ErrorDeleted
|
||||
}
|
||||
|
||||
glog.V(3).Infof("read ec volume %d offset %d size %d intervals:%+v", vid, offset.ToAcutalOffset(), size, intervals)
|
||||
@ -141,7 +141,7 @@ func (s *Store) ReadEcShardNeedle(vid needle.VolumeId, n *needle.Needle) (int, e
|
||||
return 0, fmt.Errorf("ReadEcShardIntervals: %v", err)
|
||||
}
|
||||
if isDeleted {
|
||||
return 0, fmt.Errorf("ec entry %s is deleted", n.Id)
|
||||
return 0, ErrorDeleted
|
||||
}
|
||||
|
||||
err = n.ReadBytes(bytes, offset.ToAcutalOffset(), size, localEcVolume.Version)
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
)
|
||||
|
||||
var ErrorNotFound = errors.New("not found")
|
||||
var ErrorDeleted = errors.New("already deleted")
|
||||
|
||||
// isFileUnchanged checks whether this needle to write is same as last one.
|
||||
// It requires serialized access in the same volume.
|
||||
@ -266,7 +267,7 @@ func (v *Volume) readNeedle(n *needle.Needle, readOption *ReadOption) (int, erro
|
||||
glog.V(3).Infof("reading deleted %s", n.String())
|
||||
readSize = -readSize
|
||||
} else {
|
||||
return -1, errors.New("already deleted")
|
||||
return -1, ErrorDeleted
|
||||
}
|
||||
}
|
||||
if readSize == 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user