diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2025-12-08 16:43:35 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-08 16:43:35 -0800 |
| commit | 772459f93ca5d77160c4b827a781a53ef91cc31c (patch) | |
| tree | f72cb592d1bb38c95cf9ea988185c876976966d8 | |
| parent | 086ab3e28cffccfd71c49b0e3f88074d099a7e9b (diff) | |
| download | seaweedfs-772459f93ca5d77160c4b827a781a53ef91cc31c.tar.xz seaweedfs-772459f93ca5d77160c4b827a781a53ef91cc31c.zip | |
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
| -rw-r--r-- | weed/server/volume_grpc_admin.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/weed/server/volume_grpc_admin.go b/weed/server/volume_grpc_admin.go index 52e085684..4125f503a 100644 --- a/weed/server/volume_grpc_admin.go +++ b/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 } |
