admin: make the cluster lock's fairness window configurable (#12426)

* admin: make the cluster lock's fairness window configurable

Scheduled jobs hold the cluster admin lock for their whole run. Once the
lock had been held for a minute, every new job waited until all running
jobs had released it, so with hour-long EC jobs dispatch ran in waves and
most workers sat idle between them.

-adminLock.fairnessWindow keeps the one-minute default; 0 lets new jobs
join the shared hold, and shell clients get the lock when the scheduler
next drains.

Claude-Session: https://claude.ai/code/session_011UpvafcfUuC2mLxNAXLQJi

* admin: wait for the blocked acquire before disabling the fairness window

The wake-up test slept 50 ms before SetFairnessWindow(0), so a late
acquire that started after the change joined without exercising the
Broadcast. Wait until it is registered as a waiter instead.

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:
Chris LuandClaude Opus 5.5 authored and GitHub committed 2026-11-05 05:02:41 -08:00
1 parent 8c8d0f1cdf
commit c971252871
4 files changed
+110 -6

No files matched your search

+9
View File
@@ -1708,6 +1708,15 @@ func (s *AdminServer) GetPlugin() *adminplugin.Plugin {
return s.plugin
}
// SetAdminLockFairnessWindow sets the cluster admin lock's fairness window
// (see AdminLockManager.SetFairnessWindow).
func (s *AdminServer) SetAdminLockFairnessWindow(window time.Duration) {
if s == nil || s.pluginLock == nil {
return
}
s.pluginLock.SetFairnessWindow(window)
}
func (s *AdminServer) acquirePluginLock(reason string) (func(), error) {
if s == nil || s.pluginLock == nil {
return func() {}, nil