diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-11-27 23:07:53 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-11-27 23:07:53 -0800 |
| commit | ee2072dff921fdb5e71ce421a7c11fdcbcafa41c (patch) | |
| tree | b3fdafe9b8ca3c135efd947c68ff3d1f8bad7c81 | |
| parent | 0b822a6fb546e642daaf81947a2f943f396e255b (diff) | |
| download | seaweedfs-ee2072dff921fdb5e71ce421a7c11fdcbcafa41c.tar.xz seaweedfs-ee2072dff921fdb5e71ce421a7c11fdcbcafa41c.zip | |
volume: avoid inifinite loop reading ec volume info if error happens
| -rw-r--r-- | weed/storage/store_ec.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/weed/storage/store_ec.go b/weed/storage/store_ec.go index 7e3f1a46c..208560b7e 100644 --- a/weed/storage/store_ec.go +++ b/weed/storage/store_ec.go @@ -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) } |
