mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 16:37:25 +08:00
Delete volumes online without restarting volume server
This commit is contained in:
@@ -152,7 +152,15 @@ func (l *DiskLocation) LoadVolume(vid VolumeId, needleMapKind NeedleMapType) boo
|
||||
return false
|
||||
}
|
||||
|
||||
func (l *DiskLocation) UnloadVolume(vid VolumeId) (e error) {
|
||||
func (l *DiskLocation) DeleteVolume(vid VolumeId) (error) {
|
||||
_, ok := l.volumes[vid]
|
||||
if !ok {
|
||||
return fmt.Errorf("Volume not found, VolumeId: %d", vid)
|
||||
}
|
||||
return l.deleteVolumeById(vid)
|
||||
}
|
||||
|
||||
func (l *DiskLocation) UnloadVolume(vid VolumeId) (error) {
|
||||
_, ok := l.volumes[vid]
|
||||
if !ok {
|
||||
return fmt.Errorf("Volume not loaded, VolumeId: %d", vid)
|
||||
|
@@ -338,3 +338,13 @@ func (s *Store) UnmountVolume(i VolumeId) error {
|
||||
return fmt.Errorf("Volume %d not found on disk", i)
|
||||
}
|
||||
|
||||
func (s *Store) DeleteVolume(i VolumeId) error {
|
||||
for _, location := range s.Locations {
|
||||
if error := location.deleteVolumeById(i); error == nil {
|
||||
s.updateMaster()
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("Volume %d not found on disk", i)
|
||||
}
|
||||
|
Reference in New Issue
Block a user