From 5958b429413f2d338776e06aaa21db2bf777501b Mon Sep 17 00:00:00 2001 From: wayblink Date: Tue, 30 May 2023 20:03:28 +0800 Subject: [PATCH] Add retry on getChannelLatestMsgID (#24518) Signed-off-by: wayblink --- internal/datanode/services.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/datanode/services.go b/internal/datanode/services.go index 4e81222875..2854eae37e 100644 --- a/internal/datanode/services.go +++ b/internal/datanode/services.go @@ -557,7 +557,12 @@ func (node *DataNode) AddImportSegment(ctx context.Context, req *datapb.AddImpor }, nil } // Get the current dml channel position ID, that will be used in segments start positions and end positions. - posID, err := ds.getChannelLatestMsgID(context.Background(), req.GetChannelName(), req.GetSegmentId()) + var posID []byte + err = retry.Do(ctx, func() error { + id, innerError := ds.getChannelLatestMsgID(context.Background(), req.GetChannelName(), req.GetSegmentId()) + posID = id + return innerError + }, retry.Attempts(30)) if err != nil { return &datapb.AddImportSegmentResponse{ Status: merr.Status(merr.WrapErrChannelNotFound(