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

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

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/33216/head
Jiquan Long 2024-05-21 14:07:45 +08:00 committed by GitHub
parent 5370c39a23
commit a27a2e8021
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++