Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

conditionally fresh the shard locations

Chris Lude1a35acdd44
diff --git a/weed/storage/store_ec.go b/weed/storage/store_ec.go
index e293ebe5a5..9f6609ec63 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
}