From d9431266bb2dba8edd71ab9533af7f83928c0edf Mon Sep 17 00:00:00 2001 From: "yihao.dai" Date: Fri, 13 Oct 2023 16:31:35 +0800 Subject: [PATCH] Fix panic at loadSegment during rolling upgrade (#27671) Signed-off-by: bigsheeper --- internal/querynodev2/delegator/delegator_data.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/querynodev2/delegator/delegator_data.go b/internal/querynodev2/delegator/delegator_data.go index 15a051e486..b538f61a9e 100644 --- a/internal/querynodev2/delegator/delegator_data.go +++ b/internal/querynodev2/delegator/delegator_data.go @@ -435,11 +435,16 @@ func (sd *shardDelegator) loadStreamDelete(ctx context.Context, defer sd.deleteMut.Unlock() // apply buffered delete for new segments // no goroutines here since qnv2 has no load merging logic - for i, info := range infos { + for _, info := range infos { candidate := idCandidates[info.GetSegmentID()] position := info.GetDeltaPosition() if position == nil { // for compatibility of rolling upgrade from 2.2.x to 2.3 - position = deltaPositions[i] + // During rolling upgrade, Querynode(2.3) may receive merged LoadSegmentRequest + // from QueryCoord(2.2); In version 2.2.x, only segments with the same dmlChannel + // can be merged, and deltaPositions will be merged into a single deltaPosition, + // so we should use `deltaPositions[0]` as the seek position for all the segments + // within the same LoadSegmentRequest. + position = deltaPositions[0] } deleteData := &storage.DeleteData{}