Skip to content

Commit

Permalink
enhance: improve ut cov of clustering compaction task
Browse files Browse the repository at this point in the history
Signed-off-by: wayblink <[email protected]>
  • Loading branch information
wayblink committed Aug 5, 2024
1 parent 7f49476 commit be868a4
Show file tree
Hide file tree
Showing 2 changed files with 426 additions and 156 deletions.
7 changes: 6 additions & 1 deletion internal/datacoord/compaction_task_clustering.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,15 @@ func (t *clusteringCompactionTask) processMetaSaved() error {
func (t *clusteringCompactionTask) processIndexing() error {
// wait for segment indexed
collectionIndexes := t.meta.GetIndexMeta().GetIndexesForCollection(t.GetCollectionID(), "")
if len(collectionIndexes) == 0 {
log.Debug("the collection has no index, no need to do indexing")
return t.completeTask()
}
indexed := func() bool {
for _, collectionIndex := range collectionIndexes {
for _, segmentID := range t.ResultSegments {
segmentIndexState := t.meta.GetIndexMeta().GetSegmentIndexState(t.GetCollectionID(), segmentID, collectionIndex.IndexID)
log.Debug("segment index state", zap.String("segment", segmentIndexState.String()))
if segmentIndexState.GetState() != commonpb.IndexState_Finished {
return false
}
Expand All @@ -292,7 +297,7 @@ func (t *clusteringCompactionTask) processIndexing() error {
}()
log.Debug("check compaction result segments index states", zap.Bool("indexed", indexed), zap.Int64("planID", t.GetPlanID()), zap.Int64s("segments", t.ResultSegments))
if indexed {
t.completeTask()
return t.completeTask()
}
return nil
}
Expand Down
Loading

0 comments on commit be868a4

Please sign in to comment.