mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
volume: avoid inifinite loop reading ec volume info if error happens
This commit is contained in:
parent
0b822a6fb5
commit
ee2072dff9
|
@ -120,8 +120,13 @@ func (s *Store) ReadEcShardNeedle(ctx context.Context, vid needle.VolumeId, n *n
|
|||
if localEcVolume, found := location.FindEcVolume(vid); found {
|
||||
|
||||
// read the volume version
|
||||
readCounter := 0
|
||||
for localEcVolume.Version == 0 {
|
||||
err := s.readEcVolumeVersion(ctx, vid, localEcVolume)
|
||||
readCounter++
|
||||
if readCounter > 10 && err != nil {
|
||||
return 0, fmt.Errorf("fail to read ec volume %d: %v", vid, err)
|
||||
}
|
||||
time.Sleep(1357 * time.Millisecond)
|
||||
glog.V(0).Infof("ReadEcShardNeedle vid %d version:%v: %v", vid, localEcVolume.Version, err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue