mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
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>
This commit is contained in:
1 parent
413fdf1968
commit
b09dc423cd
2 files changed
+15
-1
No files matched your search
@@ -443,6 +443,7 @@ func (s *AdminServer) publishMaintenanceMetrics(ctx context.Context) {
|
||||
// Seed one sample so the dashboard has something to draw before the first tick.
|
||||
s.recordDashboardSample()
|
||||
|
||||
var ecBalancerOverlap string
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
@@ -450,6 +451,7 @@ func (s *AdminServer) publishMaintenanceMetrics(ctx context.Context) {
|
||||
case <-ticker.C:
|
||||
s.collectMaintenanceMetrics()
|
||||
s.recordDashboardSample()
|
||||
ecBalancerOverlap = s.warnOnECBalancerOverlap(ecBalancerOverlap)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
const (
|
||||
ecBalancerPlugin = "plugin ec_balance job"
|
||||
ecBalancerLegacy = "legacy maintenance ec_balance task"
|
||||
ecBalancerLegacy = "legacy maintenance ec_balance task (turn off with enabled = false under [maintenance] in admin.toml)"
|
||||
ecBalancerAdminScript = "admin_script job running ec.balance -apply"
|
||||
|
||||
pluginECBalanceJobType = "ec_balance"
|
||||
@@ -101,3 +101,15 @@ func (s *AdminServer) collectECBalancerState() ecBalancerState {
|
||||
func (s *AdminServer) ActiveECBalancers() []string {
|
||||
return activeECBalancers(s.collectECBalancerState())
|
||||
}
|
||||
|
||||
func (s *AdminServer) warnOnECBalancerOverlap(previous string) string {
|
||||
active := s.ActiveECBalancers()
|
||||
if len(active) < 2 {
|
||||
return ""
|
||||
}
|
||||
current := strings.Join(active, ", ")
|
||||
if current != previous {
|
||||
glog.Warningf("%d EC balancers are active and plan shard moves independently: %s. Keep only one enabled.", len(active), current)
|
||||
}
|
||||
return current
|
||||
}
|
||||
Reference in new issue
Block a user