From 5091a7f3625ab5862397ea64b508b083db31e559 Mon Sep 17 00:00:00 2001 From: SimFG Date: Thu, 13 Oct 2022 17:43:24 +0800 Subject: [PATCH] Add the `TotalRows` value for the DescribeIndex (#19759) Signed-off-by: SimFG Signed-off-by: SimFG --- internal/indexcoord/index_coord.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/internal/indexcoord/index_coord.go b/internal/indexcoord/index_coord.go index 7f6ebd571..7f5c18391 100644 --- a/internal/indexcoord/index_coord.go +++ b/internal/indexcoord/index_coord.go @@ -616,6 +616,12 @@ func (i *IndexCoord) completeIndexInfo(ctx context.Context, indexInfo *indexpb.I break } + totalRow, err := calculateTotalRow() + if err != nil { + return err + } + indexInfo.TotalRows = totalRow + indexStates, indexStateCnt := i.metaTable.GetIndexStates(indexID, createTs) allCnt := len(indexStates) switch { @@ -624,14 +630,11 @@ func (i *IndexCoord) completeIndexInfo(ctx context.Context, indexInfo *indexpb.I indexInfo.IndexStateFailReason = indexStateCnt.FailReason case indexStateCnt.Finished == allCnt: indexInfo.State = commonpb.IndexState_Finished + indexInfo.IndexedRows = totalRow default: indexInfo.State = commonpb.IndexState_InProgress indexInfo.IndexedRows = i.metaTable.GetIndexBuildProgress(indexID, createTs) - totalRow, err := calculateTotalRow() - if err != nil { - return err - } - indexInfo.TotalRows = totalRow + } log.Debug("IndexCoord completeIndexInfo success", zap.Int64("collID", collectionID), -- GitLab