From 0fb3bf43cd0b3720a66d8070c157bd0a97b66009 Mon Sep 17 00:00:00 2001 From: XuanYang-cn Date: Wed, 14 Aug 2024 10:16:58 +0800 Subject: [PATCH] enhance: Init ChannelCP when creating a channel (#35388) pr: #35387 Signed-off-by: yangxuan --- internal/datacoord/services.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/datacoord/services.go b/internal/datacoord/services.go index 2077c830a9855..2e84a82005b72 100644 --- a/internal/datacoord/services.go +++ b/internal/datacoord/services.go @@ -1209,6 +1209,17 @@ func (s *Server) WatchChannels(ctx context.Context, req *datapb.WatchChannelsReq resp.Status = merr.Status(err) return resp, nil } + + // try to init channel checkpoint, if failed, we will log it and continue + startPos := toMsgPosition(channelName, req.GetStartPositions()) + if startPos != nil { + startPos.Timestamp = req.GetCreateTimestamp() + if err := s.meta.UpdateChannelCheckpoint(channelName, startPos); err != nil { + log.Warn("failed to init channel checkpoint, meta update error", zap.String("channel", channelName), zap.Error(err)) + } + } else { + log.Info("skip to init channel checkpoint for nil startPosition", zap.String("channel", channelName)) + } } return resp, nil