fix: try best to get enough query results (#33178)

issue: https://github.com/milvus-io/milvus/issues/33137

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/33184/head
Jiquan Long 2024-05-21 11:57:51 +08:00 committed by GitHub
parent 0f8c6f49ff
commit 9f81290c63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -633,7 +633,7 @@ func reduceRetrieveResults(ctx context.Context, retrieveResults []*internalpb.Re
var retSize int64
maxOutputSize := paramtable.Get().QuotaConfig.MaxOutputSize.GetAsInt64()
for j := 0; j < loopEnd; j++ {
for j := 0; j < loopEnd; {
sel, drainOneResult := typeutil.SelectMinPK(retrieveLimit, validRetrieveResults, cursors)
if sel == -1 || (reduceStopForBest && drainOneResult) {
break
@ -643,6 +643,7 @@ func reduceRetrieveResults(ctx context.Context, retrieveResults []*internalpb.Re
if _, ok := idSet[pk]; !ok {
retSize += typeutil.AppendFieldData(ret.FieldsData, validRetrieveResults[sel].GetFieldsData(), cursors[sel])
idSet[pk] = struct{}{}
j++
} else {
// primary keys duplicate
skipDupCnt++