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.
MAJOR IMPROVEMENT: Tasks now conflict by volume ID, not globally by task type
Changes:
- PRIMARY RULE: Tasks on the same volume ID always conflict (prevents race conditions)
- SECONDARY RULE: Minimal global task type conflicts (currently none)
- Add isDiskAvailableForVolume() for volume-specific availability checking
- Add GetAvailableDisksForVolume() and GetDisksWithEffectiveCapacityForVolume()
- Remove overly restrictive global task type conflicts
- Update planning functions to focus on capacity, not conflicts
Benefits:
✅ Multiple vacuum tasks can run on different volumes simultaneously
✅ Balance and erasure coding can run on different volumes
✅ Still prevents dangerous concurrent operations on same volume
✅ Much more efficient resource utilization
✅ Maintains data integrity and prevents race conditions
This addresses the user feedback that task conflicts should be volume-specific,
not global task type restrictions.
- Replace ioutil.WriteFile with os.WriteFile
- Replace ioutil.ReadFile with os.ReadFile
- Remove deprecated io/ioutil import
- Aligns with Go 1.16+ best practices and modern Go standards
- Replace O(n²) bubble sort implementation with efficient sort.Slice
- More concise, readable, and performant for larger slices
- Uses idiomatic Go sorting pattern
- Fix CodeQL security issue: Add bounds checking for int64 to uint8 conversion in disk_location_ec.go
- Replace goto with idiomatic map approach in ec_shard_management.go
- Fix EC volume handling in maintenance_scanner.go: add support for EC-only volumes
- Fix test failures in master_grpc_ec_generation_test.go: handle raft leadership issues