plugin scheduler: run iceberg and lifecycle lanes concurrently (#8821)
* plugin scheduler: run iceberg and lifecycle lanes concurrently The default lane serialises job types under a single admin lock because volume-management operations share global state. Iceberg and lifecycle lanes have no such constraint, so run each of their job types independently in separate goroutines. * Fix concurrent lane scheduler status * plugin scheduler: address review feedback - Extract collectDueJobTypes helper to deduplicate policy loading between locked and concurrent iteration paths. - Use atomic.Bool instead of sync.Mutex for hadJobs in the concurrent path. - Set lane loop state to "busy" before launching concurrent goroutines so the lane is not reported as idle while work runs. - Convert TestLaneRequiresLock to table-driven style. - Add TestRunLaneSchedulerIterationLockBehavior to verify the scheduler acquires the admin lock only for lanes that require it. - Fix flaky TestGetLaneSchedulerStatusShowsActiveConcurrentLaneWork by not starting background scheduler goroutines that race with the direct runJobTypeIteration call.
This commit is contained in:
@@ -195,6 +195,21 @@ func (r *Plugin) setSchedulerLoopState(jobType, phase string) {
|
||||
r.schedulerLoopMu.Unlock()
|
||||
}
|
||||
|
||||
// setSchedulerLoopStateForJobType keeps the aggregate scheduler state and the
|
||||
// owning lane state in sync while a specific job type is active.
|
||||
func (r *Plugin) setSchedulerLoopStateForJobType(jobType, phase string) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
r.setSchedulerLoopState(jobType, phase)
|
||||
if jobType == "" {
|
||||
return
|
||||
}
|
||||
if ls := r.lanes[JobTypeLane(jobType)]; ls != nil {
|
||||
r.setLaneLoopState(ls, jobType, phase)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Plugin) recordSchedulerIterationComplete(hadJobs bool) {
|
||||
if r == nil {
|
||||
return
|
||||
@@ -251,7 +266,6 @@ func (r *Plugin) aggregateLaneLoopStates() schedulerLoopState {
|
||||
return agg
|
||||
}
|
||||
|
||||
|
||||
// --- Per-lane loop state helpers ---
|
||||
|
||||
func (r *Plugin) setLaneLoopState(ls *schedulerLaneState, jobType, phase string) {
|
||||
|
||||
Reference in New Issue
Block a user