Skip to content

Commit

Permalink
enhance: improve ut cov of clustering compaction task (#35242)
Browse files Browse the repository at this point in the history
#34792

Signed-off-by: wayblink <[email protected]>
  • Loading branch information
wayblink authored Aug 7, 2024
1 parent bb15ecd commit c6253f9
Show file tree
Hide file tree
Showing 2 changed files with 426 additions and 158 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 @@ -290,10 +290,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 @@ -303,7 +308,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 c6253f9

Please sign in to comment.