Add the `TotalRows` value for the DescribeIndex (#19759)

Signed-off-by: SimFG <bang.fu@zilliz.com>

Signed-off-by: SimFG <bang.fu@zilliz.com>
pull/19766/head
SimFG 2022-10-13 17:43:24 +08:00 committed by GitHub
parent 857bd1fd68
commit 5091a7f362
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -616,6 +616,12 @@ func (i *IndexCoord) completeIndexInfo(ctx context.Context, indexInfo *indexpb.I
break break
} }
totalRow, err := calculateTotalRow()
if err != nil {
return err
}
indexInfo.TotalRows = totalRow
indexStates, indexStateCnt := i.metaTable.GetIndexStates(indexID, createTs) indexStates, indexStateCnt := i.metaTable.GetIndexStates(indexID, createTs)
allCnt := len(indexStates) allCnt := len(indexStates)
switch { switch {
@ -624,14 +630,11 @@ func (i *IndexCoord) completeIndexInfo(ctx context.Context, indexInfo *indexpb.I
indexInfo.IndexStateFailReason = indexStateCnt.FailReason indexInfo.IndexStateFailReason = indexStateCnt.FailReason
case indexStateCnt.Finished == allCnt: case indexStateCnt.Finished == allCnt:
indexInfo.State = commonpb.IndexState_Finished indexInfo.State = commonpb.IndexState_Finished
indexInfo.IndexedRows = totalRow
default: default:
indexInfo.State = commonpb.IndexState_InProgress indexInfo.State = commonpb.IndexState_InProgress
indexInfo.IndexedRows = i.metaTable.GetIndexBuildProgress(indexID, createTs) 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), log.Debug("IndexCoord completeIndexInfo success", zap.Int64("collID", collectionID),