Browse Source

fix: restore volume mount when VolumeConfigure fails (#7669)

* fix: restore volume mount when VolumeConfigure fails

When volume.configure.replication command fails (e.g., due to corrupted
.vif file), the volume was left unmounted and the master was already
notified that the volume was deleted, causing the volume to disappear.

This fix attempts to re-mount the volume when ConfigureVolume fails,
restoring the volume state and preventing data loss.

Fixes #7666

* include mount restore error in response message
pull/7674/head
Chris Lu 3 weeks ago
committed by GitHub
parent
commit
772459f93c
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      weed/server/volume_grpc_admin.go

5
weed/server/volume_grpc_admin.go

@ -134,6 +134,11 @@ func (vs *VolumeServer) VolumeConfigure(ctx context.Context, req *volume_server_
if err := vs.store.ConfigureVolume(needle.VolumeId(req.VolumeId), req.Replication); err != nil {
glog.Errorf("volume configure %v: %v", req, err)
resp.Error = fmt.Sprintf("volume configure %v: %v", req, err)
// Try to re-mount to restore the volume state
if mountErr := vs.store.MountVolume(needle.VolumeId(req.VolumeId)); mountErr != nil {
glog.Errorf("volume configure failed to restore mount %v: %v", req, mountErr)
resp.Error += fmt.Sprintf(". Also failed to restore mount: %v", mountErr)
}
return resp, nil
}

Loading…
Cancel
Save