Files
seaweedfs/weed/shell/command_volume_growth_resume.go
T
Chris Lu 2874bd05fb Freeze volume growth on topology id mismatch (#11763) (#11820)
* pb: ResumeVolumeGrowth rpc for operator-driven growth resume (#11763)

* master: freeze volume growth on topology id mismatch (#11763)

* shell: volume.growth.resume command (#11763)

* master: replicate the growth freeze and gate it on veteran heartbeats (#11763)

* master: block allocation while the topology id is being minted

DeferAllocation only armed after the topology id persisted, so growth
requests arriving during init ran ahead of the warmup window. Gate
NextVolumeId on an init-pending flag spanning the whole mint.

* master: stash reported topology ids until the local id is minted (#11763)

* drain stashed topology id reports when the id arrives outside the mint path

* persist the growth-freeze flag in the mirror file and raft snapshots

* log hashicorp raft marshal and apply errors in applyGrowthFreeze
2026-10-20 07:34:31 -07:00

53 lines
1.3 KiB
Go

package shell
import (
"context"
"fmt"
"io"
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
)
func init() {
Commands = append(Commands, &commandVolumeGrowthResume{})
}
type commandVolumeGrowthResume struct {
}
func (c *commandVolumeGrowthResume) Name() string {
return "volume.growth.resume"
}
func (c *commandVolumeGrowthResume) Help() string {
return `resume volume growth frozen after detected master state loss
volume.growth.resume
Volume growth freezes automatically when a volume server reports a
topology id that differs from this cluster's, which means the master
state was rebuilt and max volume id knowledge may be incomplete. Run
this after verifying the cluster inventory so new ids are not reused.
`
}
func (c *commandVolumeGrowthResume) HasTag(CommandTag) bool {
return false
}
func (c *commandVolumeGrowthResume) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
return commandEnv.MasterClient.WithClient(context.Background(), false, func(client master_pb.SeaweedClient) error {
resp, err := client.ResumeVolumeGrowth(context.Background(), &master_pb.ResumeVolumeGrowthRequest{})
if err != nil {
return err
}
if resp.WasFrozen {
fmt.Fprintf(writer, "volume growth resumed\n")
} else {
fmt.Fprintf(writer, "volume growth was not frozen\n")
}
return nil
})
}