From 9c2aeaa258b07cd5905258352b154a5881010677 Mon Sep 17 00:00:00 2001 From: Spade A <71589810+SpadeA-Tang@users.noreply.github.com> Date: Fri, 17 Oct 2025 10:28:01 +0800 Subject: [PATCH] fix: empty internal InsertMsg caues panic (#44903) fix: https://github.com/milvus-io/milvus/issues/44901 Signed-off-by: SpadeA --- internal/proxy/msg_pack.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/proxy/msg_pack.go b/internal/proxy/msg_pack.go index fe6a508a60..c28d1e6cce 100644 --- a/internal/proxy/msg_pack.go +++ b/internal/proxy/msg_pack.go @@ -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 }