mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-26 23:10:44 +01:00
feat(shell): parallelize volume balance moves (#10737)
* chore: volume.balance parallelization * chore: volume.balance add ioBytePerSecond --------- Co-authored-by: Konstantin Lebedev <whitefox@mayflower.work>
This commit is contained in:
1 parent
0de7ff5eb8
commit
9386a25a4a
5 files changed
+485
-113
No files matched your search
@@ -27,6 +27,26 @@ type ErrorWaitGroup struct {
|
||||
|
||||
type ErrorWaitGroupTask func() error
|
||||
|
||||
// executeParallelTaskGroups runs tasks from each group sequentially and runs
|
||||
// independent groups with up to maxParallelization concurrency. EC balancing
|
||||
// uses one group per volume because its shard sidecar files are shared; volume
|
||||
// balancing uses one group per already-reserved volume move.
|
||||
func executeParallelTaskGroups(maxParallelization int, taskGroups [][]ErrorWaitGroupTask) error {
|
||||
ewg := NewErrorWaitGroup(maxParallelization)
|
||||
for _, taskGroup := range taskGroups {
|
||||
taskGroup := taskGroup
|
||||
ewg.Add(func() error {
|
||||
for _, task := range taskGroup {
|
||||
if err := task(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
return ewg.Wait()
|
||||
}
|
||||
|
||||
func NewErrorWaitGroup(maxConcurrency int) *ErrorWaitGroup {
|
||||
if maxConcurrency <= 0 {
|
||||
// no concurrency = one task at the time
|
||||
|
||||
Reference in new issue
Block a user