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
zhagnlu 2024-04-17 01:20:10 +08:00 committed by GitHub
parent 919df4cd02
commit 4586bcef9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 5 deletions

View File

@ -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

View File

@ -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))