fix: empty internal InsertMsg caues panic (#44903)

fix: https://github.com/milvus-io/milvus/issues/44901

Signed-off-by: SpadeA <tangchenjie1210@gmail.com>
This commit is contained in:
Spade A 2025-10-17 10:28:01 +08:00 committed by GitHub
parent 6c8e353439
commit 9c2aeaa258
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
}