mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
admin: warn when more than one scheduler runs the same maintenance work (#13065)
* admin/maintenance: report whether the running manager queues a task type Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: list the EC balancers that are active at the same time The plugin ec_balance job, the legacy maintenance manager's ec_balance task and an admin_script job that runs ec.balance -apply each plan shard moves from the same topology without knowing about the others. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: log a warning while more than one EC balancer is active The check runs on the maintenance metrics tick and logs again only when the set of active balancers changes. The legacy maintenance entry names the admin.toml switch that turns it off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: warn on the plugin pages when more than one EC balancer is active The scheduler status API returns the active EC balancers, and the scheduler banner on the plugin and lane pages lists them when there are two or more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin/maintenance: count a task type only when a registered worker can run it Only legacy maintenance workers pull tasks from the legacy queue. With plugin workers alone, the queued ec_balance tasks never run, so they do not compete with the plugin ec_balance job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: parse ec.balance apply flags like the flag package A value counts only when strconv.ParseBool reads it as true, and a # token ends the arguments, as it does for the shell command's flag parser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin/maintenance: skip legacy workers past their heartbeat timeout A disconnected worker keeps its queue record until the cleanup loop removes it, so the capability check also requires a heartbeat within the worker timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: count ec.balance only when its flags parse the way the command parses them An invalid boolean in -apply or -force fails the whole command, the last value of a flag wins, -force overrides -apply, and parsing stops at the first non-flag argument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: share ec.balance's flag set and report whether its arguments apply the plan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: count an admin_script ec.balance only when ec.balance accepts its flags Unknown flags and invalid values of any flag fail the command before it can move shards, so they no longer count as an active balancer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell, plugin/worker: move admin_script command tokenizing into the shell package Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: split admin_script ec.balance arguments with the executor's tokenizer A quoted value with spaces is one argument to ec.balance, so flags after it are still seen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report through one lookup whether a command's arguments change the cluster ec.balance now also rejects an invalid -volumeIds, as its Do does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report whether volume.balance arguments apply its plan Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report whether ec.encode accepts its arguments ec.encode has no dry run, so any accepted invocation changes the cluster. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shell: report whether volume.vacuum accepts its arguments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: report overlap for every maintenance work that more than one scheduler runs The plugin scheduler, the legacy maintenance manager, and an admin_script can each run volume balance, EC balance, EC encoding, and vacuum. Check all four from one table and report each work with two or more active runners, in the log and in the scheduler-status API as maintenance_overlaps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * admin: show each maintenance overlap on the plugin pages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e4739f97a
commit
b53f6d4b5e
18 files changed
+608
-107
No files matched your search
@@ -98,20 +98,10 @@ func (c *commandEcEncode) HasTag(CommandTag) bool {
|
||||
|
||||
func (c *commandEcEncode) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
|
||||
|
||||
encodeCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
|
||||
volumeId := encodeCommand.Int("volumeId", 0, "the volume id")
|
||||
volumeIdsStr := encodeCommand.String("volumeIds", "", "comma-separated volume ids")
|
||||
collection := encodeCommand.String("collection", "", "comma-separated collection names, wildcards, or regex patterns; empty matches the collection with no name")
|
||||
fullPercentage := encodeCommand.Float64("fullPercent", 95, "the volume reaches the percentage of max volume size")
|
||||
quietPeriod := encodeCommand.Duration("quietFor", time.Hour, "select volumes without no writes for this period")
|
||||
maxParallelization := encodeCommand.Int("maxParallelization", DefaultMaxParallelization, "run up to X tasks in parallel, whenever possible")
|
||||
batchSize := encodeCommand.Int("batchSize", DefaultEcBatchSize, "encode/re-balance/verify/delete up to this many volumes at a time (0 = all in one batch)")
|
||||
forceChanges := encodeCommand.Bool("force", false, "force the encoding even if the cluster has less than recommended 4 nodes")
|
||||
shardReplicaPlacement := encodeCommand.String("shardReplicaPlacement", "", "replica placement for EC shards, or master default if empty")
|
||||
sourceDiskTypeStr := encodeCommand.String("sourceDiskType", "", "filter source volumes by disk type (hdd, ssd, or empty for all)")
|
||||
diskTypeStr := encodeCommand.String("diskType", "", "target disk type for EC shards (hdd, ssd, or empty for default hdd)")
|
||||
applyBalancing := encodeCommand.Bool("rebalance", true, "re-balance EC shards after creation (default: true)")
|
||||
verbose := encodeCommand.Bool("verbose", false, "show detailed reasons why volumes are not selected for encoding")
|
||||
encodeCommand, f := newEcEncodeFlagSet(c.Name())
|
||||
volumeId, volumeIdsStr, collection, fullPercentage, quietPeriod := f.volumeId, f.volumeIdsStr, f.collection, f.fullPercentage, f.quietPeriod
|
||||
maxParallelization, batchSize, forceChanges, shardReplicaPlacement := f.maxParallelization, f.batchSize, f.forceChanges, f.shardReplicaPlacement
|
||||
sourceDiskTypeStr, diskTypeStr, applyBalancing, verbose := f.sourceDiskTypeStr, f.diskTypeStr, f.applyBalancing, f.verbose
|
||||
|
||||
if err = encodeCommand.Parse(args); err != nil {
|
||||
return err
|
||||
@@ -197,6 +187,48 @@ func (c *commandEcEncode) Do(args []string, commandEnv *CommandEnv, writer io.Wr
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type ecEncodeFlags struct {
|
||||
volumeId *int
|
||||
volumeIdsStr *string
|
||||
collection *string
|
||||
fullPercentage *float64
|
||||
quietPeriod *time.Duration
|
||||
maxParallelization *int
|
||||
batchSize *int
|
||||
forceChanges *bool
|
||||
shardReplicaPlacement *string
|
||||
sourceDiskTypeStr *string
|
||||
diskTypeStr *string
|
||||
applyBalancing *bool
|
||||
verbose *bool
|
||||
}
|
||||
|
||||
func newEcEncodeFlagSet(name string) (*flag.FlagSet, *ecEncodeFlags) {
|
||||
fs := flag.NewFlagSet(name, flag.ContinueOnError)
|
||||
return fs, &ecEncodeFlags{
|
||||
volumeId: fs.Int("volumeId", 0, "the volume id"),
|
||||
volumeIdsStr: fs.String("volumeIds", "", "comma-separated volume ids"),
|
||||
collection: fs.String("collection", "", "comma-separated collection names, wildcards, or regex patterns; empty matches the collection with no name"),
|
||||
fullPercentage: fs.Float64("fullPercent", 95, "the volume reaches the percentage of max volume size"),
|
||||
quietPeriod: fs.Duration("quietFor", time.Hour, "select volumes without no writes for this period"),
|
||||
maxParallelization: fs.Int("maxParallelization", DefaultMaxParallelization, "run up to X tasks in parallel, whenever possible"),
|
||||
batchSize: fs.Int("batchSize", DefaultEcBatchSize, "encode/re-balance/verify/delete up to this many volumes at a time (0 = all in one batch)"),
|
||||
forceChanges: fs.Bool("force", false, "force the encoding even if the cluster has less than recommended 4 nodes"),
|
||||
shardReplicaPlacement: fs.String("shardReplicaPlacement", "", "replica placement for EC shards, or master default if empty"),
|
||||
sourceDiskTypeStr: fs.String("sourceDiskType", "", "filter source volumes by disk type (hdd, ssd, or empty for all)"),
|
||||
diskTypeStr: fs.String("diskType", "", "target disk type for EC shards (hdd, ssd, or empty for default hdd)"),
|
||||
applyBalancing: fs.Bool("rebalance", true, "re-balance EC shards after creation (default: true)"),
|
||||
verbose: fs.Bool("verbose", false, "show detailed reasons why volumes are not selected for encoding"),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *commandEcEncode) argsApply(args []string) bool {
|
||||
fs, _ := newEcEncodeFlagSet(c.Name())
|
||||
fs.SetOutput(io.Discard)
|
||||
return fs.Parse(args) == nil
|
||||
}
|
||||
|
||||
func collectVolumeIdsForEcEncode(commandEnv *CommandEnv, collectionPattern string, sourceDiskType *types.DiskType, fullPercentage float64, quietPeriod time.Duration, verbose bool) (vids []needle.VolumeId, matchedCollections []string, err error) {
|
||||
// compile regex pattern for collection matching
|
||||
collectionMatcher, err := compileCollectionPattern(collectionPattern)
|
||||
|
||||
Reference in new issue
Block a user