Skip to content

Commit

Permalink
enhance: Add filter for remove compaction command (#327)
Browse files Browse the repository at this point in the history
Add task state & collection, partition id filter for remove compaction
command.

Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Nov 11, 2024
1 parent 041ae24 commit f64ea49
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions states/etcd/remove/compaction_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type CompactionTaskParam struct {
CompactionType string `name:"type" default:"ClusteringCompaction" desc:"compaction type to remove"`
JobID string `name:"jobID" default:"" desc:"jobID also known as triggerID"`
TaskID string `name:"taskID" default:"" desc:"taskID also known as planID"`
State string `name:"state" default:"" desc:"task state"`
CollectionID int64 `name:"collectionID" default:"0" desc:"collection id to filter"`
PartitionID int64 `name:"partitionID" default:"0" desc:"partitionID id to filter"`
Run bool `name:"run" default:"false" desc:"flag to control actually run or dry"`
}

Expand All @@ -32,6 +35,15 @@ func (c *ComponentRemove) RemoveCompactionTaskCommand(ctx context.Context, p *Co
if p.TaskID != "" && fmt.Sprint(task.GetPlanID()) != p.TaskID {
return false
}
if p.State != "" && task.State.String() != p.State {
return false
}
if p.CollectionID > 0 && task.GetCollectionID() != p.CollectionID {
return false
}
if p.PartitionID > 0 && task.GetPartitionID() != p.PartitionID {
return false
}
return true
})
if err != nil {
Expand Down

0 comments on commit f64ea49

Please sign in to comment.