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

Support get bulk insert progress #392

Merged
merged 1 commit into from
Feb 10, 2023
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
15 changes: 15 additions & 0 deletions entity/bulkinsert.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package entity

import "strconv"

type BulkInsertState int32

const (
Expand All @@ -9,6 +11,8 @@ const (
BulkInsertPersisted BulkInsertState = 5 // all data files have been parsed and data already persisted
BulkInsertCompleted BulkInsertState = 6 // all indexes are successfully built and segments are able to be compacted as normal.
BulkInsertFailedAndCleaned BulkInsertState = 7 // the task failed and all segments it generated are cleaned up.

ImportProgress = "progress_percent"
)

type BulkInsertTaskState struct {
Expand All @@ -21,3 +25,14 @@ type BulkInsertTaskState struct {
SegmentIDs []int64 // a list of segment IDs created by the import task.
CreateTs int64 //timestamp when the import task is created.
}

func (state BulkInsertTaskState) Progress() int {
if val, ok := state.Infos[ImportProgress]; ok {
progress, err := strconv.Atoi(val)
if err != nil {
return 0
}
return progress
}
return 0
}