[migration] batch task by task type
This commit is contained in:
parent
492bd7dd66
commit
651c86feff
|
@ -111,7 +111,8 @@ func (p *DispatcherProcessor) Process(ctx *pipeline.Context) error {
|
||||||
if ctx.IsCanceled() {
|
if ctx.IsCanceled() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
tasks, err := p.getMigrationTasks(p.config.TaskBatchSize)
|
for _, taskType := range []string{"cluster_migration", "index_migration", "pipeline"} {
|
||||||
|
tasks, err := p.getMigrationTasks(taskType, p.config.TaskBatchSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("failed to get migration tasks, err: %v", err)
|
log.Errorf("failed to get migration tasks, err: %v", err)
|
||||||
return err
|
return err
|
||||||
|
@ -175,6 +176,7 @@ func (p *DispatcherProcessor) Process(ctx *pipeline.Context) error {
|
||||||
}, fmt.Sprintf("error handling task [%s]", t.ID))
|
}, fmt.Sprintf("error handling task [%s]", t.ID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//es index refresh
|
//es index refresh
|
||||||
time.Sleep(time.Millisecond * 1200)
|
time.Sleep(time.Millisecond * 1200)
|
||||||
}
|
}
|
||||||
|
@ -741,7 +743,7 @@ func (p *DispatcherProcessor) getPreferenceInstance(majorTaskID string) (instanc
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *DispatcherProcessor) getMigrationTasks(size int) ([]task2.Task, error) {
|
func (p *DispatcherProcessor) getMigrationTasks(taskType string, size int) ([]task2.Task, error) {
|
||||||
queryDsl := util.MapStr{
|
queryDsl := util.MapStr{
|
||||||
"size": size,
|
"size": size,
|
||||||
"sort": []util.MapStr{
|
"sort": []util.MapStr{
|
||||||
|
@ -759,6 +761,13 @@ func (p *DispatcherProcessor) getMigrationTasks(size int) ([]task2.Task, error)
|
||||||
"status": []string{task2.StatusReady, task2.StatusRunning, task2.StatusPendingStop},
|
"status": []string{task2.StatusReady, task2.StatusRunning, task2.StatusPendingStop},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"term": util.MapStr{
|
||||||
|
"metadata.type": util.MapStr{
|
||||||
|
"value": taskType,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue