From 61c7b0990da273de1f4233e1546633e01cbf815d Mon Sep 17 00:00:00 2001 From: Jiquan Long Date: Wed, 6 Sep 2023 14:29:40 +0800 Subject: [PATCH] Workaround fix ChannelManager holding mutex too long (#26870) Signed-off-by: longjiquan --- internal/datacoord/handler.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/datacoord/handler.go b/internal/datacoord/handler.go index ce05ed4b31..a344e36944 100644 --- a/internal/datacoord/handler.go +++ b/internal/datacoord/handler.go @@ -366,7 +366,7 @@ func trimSegmentInfo(info *datapb.SegmentInfo) *datapb.SegmentInfo { // HasCollection returns whether the collection exist from user's perspective. func (h *ServerHandler) HasCollection(ctx context.Context, collectionID UniqueID) (bool, error) { var hasCollection bool - ctx2, cancel := context.WithTimeout(ctx, time.Minute*30) + ctx2, cancel := context.WithTimeout(ctx, time.Second*10) defer cancel() if err := retry.Do(ctx2, func() error { has, err := h.s.broker.HasCollection(ctx2, collectionID) @@ -376,9 +376,13 @@ func (h *ServerHandler) HasCollection(ctx context.Context, collectionID UniqueID } hasCollection = has return nil - }, retry.Attempts(500)); err != nil { - log.Ctx(ctx2).Error("datacoord ServerHandler HasCollection finally failed", zap.Int64("collectionID", collectionID)) - log.Panic("datacoord ServerHandler HasCollection finally failed") + }, retry.Attempts(5)); err != nil { + log.Ctx(ctx2).Error("datacoord ServerHandler HasCollection finally failed", + zap.Int64("collectionID", collectionID), + zap.Error(err)) + // A workaround for https://github.com/milvus-io/milvus/issues/26863. The collection may be considered as not + // dropped when any exception happened, but there are chances that finally the collection will be cleaned. + return true, nil } return hasCollection, nil }