aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/disk_location_ec.go
diff options
context:
space:
mode:
authoraugustazz <102299780+augustazz@users.noreply.github.com>2024-08-16 15:20:00 +0800
committerGitHub <noreply@github.com>2024-08-16 00:20:00 -0700
commit0b00706454478abbb246af2f0d30d34c79b09b40 (patch)
treebe46e19b7a2afa26b8e2f388b456cee05e95bb2b /weed/storage/disk_location_ec.go
parent8f1f1730e9925c2f9e5e01867f806dcaac3dde11 (diff)
downloadseaweedfs-0b00706454478abbb246af2f0d30d34c79b09b40.tar.xz
seaweedfs-0b00706454478abbb246af2f0d30d34c79b09b40.zip
EC volume supports expiration and displays expiration message when executing volume.list (#5895)
* ec volume expire * volume.list show DestroyTime * comments * code optimization --------- Co-authored-by: xuwenfeng <xuwenfeng1@zto.com>
Diffstat (limited to 'weed/storage/disk_location_ec.go')
-rw-r--r--weed/storage/disk_location_ec.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go
index 4050a7930..bb5738897 100644
--- a/weed/storage/disk_location_ec.go
+++ b/weed/storage/disk_location_ec.go
@@ -72,14 +72,14 @@ func (l *DiskLocation) FindEcShard(vid needle.VolumeId, shardId erasure_coding.S
return nil, false
}
-func (l *DiskLocation) LoadEcShard(collection string, vid needle.VolumeId, shardId erasure_coding.ShardId) (err error) {
+func (l *DiskLocation) LoadEcShard(collection string, vid needle.VolumeId, shardId erasure_coding.ShardId) (*erasure_coding.EcVolume, error) {
ecVolumeShard, err := erasure_coding.NewEcVolumeShard(l.DiskType, l.Directory, collection, vid, shardId)
if err != nil {
if err == os.ErrNotExist {
- return os.ErrNotExist
+ return nil, os.ErrNotExist
}
- return fmt.Errorf("failed to create ec shard %d.%d: %v", vid, shardId, err)
+ return nil, fmt.Errorf("failed to create ec shard %d.%d: %v", vid, shardId, err)
}
l.ecVolumesLock.Lock()
defer l.ecVolumesLock.Unlock()
@@ -87,13 +87,13 @@ func (l *DiskLocation) LoadEcShard(collection string, vid needle.VolumeId, shard
if !found {
ecVolume, err = erasure_coding.NewEcVolume(l.DiskType, l.Directory, l.IdxDirectory, collection, vid)
if err != nil {
- return fmt.Errorf("failed to create ec volume %d: %v", vid, err)
+ return nil, fmt.Errorf("failed to create ec volume %d: %v", vid, err)
}
l.ecVolumes[vid] = ecVolume
}
ecVolume.AddEcVolumeShard(ecVolumeShard)
- return nil
+ return ecVolume, nil
}
func (l *DiskLocation) UnloadEcShard(vid needle.VolumeId, shardId erasure_coding.ShardId) bool {
@@ -124,7 +124,7 @@ func (l *DiskLocation) loadEcShards(shards []string, collection string, vid need
return fmt.Errorf("failed to parse ec shard name %v: %v", shard, err)
}
- err = l.LoadEcShard(collection, vid, erasure_coding.ShardId(shardId))
+ _, err = l.LoadEcShard(collection, vid, erasure_coding.ShardId(shardId))
if err != nil {
return fmt.Errorf("failed to load ec shard %v: %v", shard, err)
}