diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-05-31 02:22:12 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-05-31 02:22:12 -0700 |
| commit | de1a35acdd44a2a186486a35d3662bd13a443628 (patch) | |
| tree | 4001c41b120637c73f0bdc6ed54ce416d29e6e30 | |
| parent | 47f1901843b11c76fb64c8152ce2cedb80b9127b (diff) | |
| download | seaweedfs-de1a35acdd44a2a186486a35d3662bd13a443628.tar.xz seaweedfs-de1a35acdd44a2a186486a35d3662bd13a443628.zip | |
conditionally fresh the shard locations
| -rw-r--r-- | weed/storage/store_ec.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/weed/storage/store_ec.go b/weed/storage/store_ec.go index e293ebe5a..9f6609ec6 100644 --- a/weed/storage/store_ec.go +++ b/weed/storage/store_ec.go @@ -210,7 +210,13 @@ func forgetShardId(ecVolume *erasure_coding.EcVolume, shardId erasure_coding.Sha func (s *Store) cachedLookupEcShardLocations(ctx context.Context, ecVolume *erasure_coding.EcVolume) (err error) { - if ecVolume.ShardLocationsRefreshTime.Add(10 * time.Minute).After(time.Now()) { + shardCount := len(ecVolume.ShardLocations) + if shardCount < erasure_coding.DataShardsCount && + ecVolume.ShardLocationsRefreshTime.Add(11 * time.Second).After(time.Now()) || + shardCount == erasure_coding.TotalShardsCount && + ecVolume.ShardLocationsRefreshTime.Add(37 * time.Minute).After(time.Now()) || + shardCount >= erasure_coding.DataShardsCount && + ecVolume.ShardLocationsRefreshTime.Add(7 * time.Minute).After(time.Now()) { // still fresh return nil } |
