mirror of https://github.com/milvus-io/milvus.git
fix: correct AssignSegmentID return and add retry for loadCollectionF… (#32335)
#32322 #31942 Signed-off-by: luzhang <luzhang@zilliz.com> Co-authored-by: luzhang <luzhang@zilliz.com>pull/32351/head
parent
919df4cd02
commit
4586bcef9f
|
@ -394,10 +394,19 @@ func (h *ServerHandler) GetCollection(ctx context.Context, collectionID UniqueID
|
|||
if coll != nil {
|
||||
return coll, nil
|
||||
}
|
||||
err := h.s.loadCollectionFromRootCoord(ctx, collectionID)
|
||||
if err != nil {
|
||||
log.Warn("failed to load collection from rootcoord", zap.Int64("collectionID", collectionID), zap.Error(err))
|
||||
return nil, err
|
||||
ctx2, cancel := context.WithTimeout(ctx, time.Second*10)
|
||||
defer cancel()
|
||||
if err := retry.Do(ctx2, func() error {
|
||||
err := h.s.loadCollectionFromRootCoord(ctx, collectionID)
|
||||
if err != nil {
|
||||
log.Warn("failed to load collection from rootcoord", zap.Int64("collectionID", collectionID), zap.Error(err))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}, retry.Attempts(5)); err != nil {
|
||||
log.Ctx(ctx2).Warn("datacoord ServerHandler GetCollection finally failed",
|
||||
zap.Int64("collectionID", collectionID),
|
||||
zap.Error(err))
|
||||
}
|
||||
|
||||
return h.s.meta.GetCollection(collectionID), nil
|
||||
|
|
|
@ -194,7 +194,7 @@ func (s *Server) AssignSegmentID(ctx context.Context, req *datapb.AssignSegmentI
|
|||
r.CollectionID, r.PartitionID, r.ChannelName, int64(r.Count))
|
||||
if err != nil {
|
||||
log.Warn("failed to alloc segment", zap.Any("request", r), zap.Error(err))
|
||||
continue
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Info("success to assign segments", zap.Int64("collectionID", r.GetCollectionID()), zap.Any("assignments", segmentAllocations))
|
||||
|
|
Loading…
Reference in New Issue