mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-11-24 16:53:14 +08:00
CRITICAL: Check ALL task states for volume conflicts
Fix major scheduling bug where only active tasks were checked for conflicts. Changes: - Check PENDING tasks: Prevent scheduling if task is queued for same volume - Check ASSIGNED/ACTIVE tasks: Prevent scheduling if task is running on same volume - Check RECENT tasks: Prevent immediate re-scheduling on same volume after completion This prevents dangerous scenarios like: ❌ Scheduling vacuum while another vacuum is pending on same volume ❌ Scheduling balance while erasure coding is queued for same volume ❌ Immediately re-scheduling failed tasks without cooldown period Critical safety improvement ensuring comprehensive volume-level task isolation.
This commit is contained in:
@@ -84,13 +84,28 @@ func (at *ActiveTopology) isDiskAvailableForVolume(disk *activeDisk, taskType Ta
|
||||
return false
|
||||
}
|
||||
|
||||
// Check for volume-specific conflicts
|
||||
// Check for volume-specific conflicts in ALL task states:
|
||||
// 1. Pending tasks (queued but not yet started)
|
||||
for _, task := range disk.pendingTasks {
|
||||
if at.areTasksConflicting(task, taskType, volumeID) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Assigned/Active tasks (currently running)
|
||||
for _, task := range disk.assignedTasks {
|
||||
if at.areTasksConflicting(task, taskType, volumeID) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Recent tasks (just completed - avoid immediate re-scheduling on same volume)
|
||||
for _, task := range disk.recentTasks {
|
||||
if at.areTasksConflicting(task, taskType, volumeID) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user