Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix remove bulkinsert job command #335

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions states/etcd/common/bulkinsert.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,25 @@ func ListImportJobs(ctx context.Context, cli clientv3.KV, basePath string, filte
return nil, nil, err
}

return lo.FilterMap(jobs, func(job datapb.ImportJob, idx int) (*datapb.ImportJob, bool) {
resultJobs := make([]*datapb.ImportJob, 0, len(jobs))
resultKeys := make([]string, 0, len(keys))

filterFn := func(job datapb.ImportJob) bool {
for _, filter := range filters {
if !filter(&job) {
return nil, false
return false
}
}
return &job, true
}), keys, nil
return true
}
for i, job := range jobs {
if ok := filterFn(job); ok {
resultJobs = append(resultJobs, &jobs[i])
resultKeys = append(resultKeys, keys[i])
}
}

return resultJobs, resultKeys, nil
}

// ListPreImportTasks list pre-import tasks.
Expand Down
Loading