fix: empty internal InsertMsg caues panic[2.6] (#44906)

issue: https://github.com/milvus-io/milvus/issues/44901
pr: https://github.com/milvus-io/milvus/pull/44903

Signed-off-by: SpadeA <tangchenjie1210@gmail.com>
This commit is contained in:
Spade A 2025-10-17 10:32:01 +08:00 committed by GitHub
parent 2b5c2f7303
commit cfd748f50d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,7 +75,7 @@ func genInsertMsgsByPartition(ctx context.Context,
}
// if insertMsg's size is greater than the threshold, split into multiple insertMsgs
if requestSize+curRowMessageSize >= threshold {
if requestSize+curRowMessageSize >= threshold && msg.NumRows > 0 {
repackedMsgs = append(repackedMsgs, msg)
msg = createInsertMsg(segmentID, channelName)
requestSize = 0
@ -88,7 +88,9 @@ func genInsertMsgsByPartition(ctx context.Context,
msg.NumRows++
requestSize += curRowMessageSize
}
repackedMsgs = append(repackedMsgs, msg)
if msg.NumRows > 0 {
repackedMsgs = append(repackedMsgs, msg)
}
return repackedMsgs, nil
}