fix load collection with rg (#22083)

Signed-off-by: Wei Liu <wei.liu@zilliz.com>
This commit is contained in:
wei liu 2023-02-09 16:24:31 +08:00 committed by GitHub
parent b1f31da77a
commit d085abbd56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 18 deletions

View File

@ -1364,12 +1364,13 @@ func (lct *loadCollectionTask) Execute(ctx context.Context) (err error) {
lct.Base,
commonpbutil.WithMsgType(commonpb.MsgType_LoadCollection),
),
DbID: 0,
CollectionID: collID,
Schema: collSchema,
ReplicaNumber: lct.ReplicaNumber,
FieldIndexID: fieldIndexIDs,
Refresh: lct.Refresh,
DbID: 0,
CollectionID: collID,
Schema: collSchema,
ReplicaNumber: lct.ReplicaNumber,
FieldIndexID: fieldIndexIDs,
Refresh: lct.Refresh,
ResourceGroups: lct.ResourceGroups,
}
log.Debug("send LoadCollectionRequest to query coordinator",
zap.Any("schema", request.Schema))
@ -1590,13 +1591,14 @@ func (lpt *loadPartitionsTask) Execute(ctx context.Context) error {
lpt.Base,
commonpbutil.WithMsgType(commonpb.MsgType_LoadPartitions),
),
DbID: 0,
CollectionID: collID,
PartitionIDs: partitionIDs,
Schema: collSchema,
ReplicaNumber: lpt.ReplicaNumber,
FieldIndexID: fieldIndexIDs,
Refresh: lpt.Refresh,
DbID: 0,
CollectionID: collID,
PartitionIDs: partitionIDs,
Schema: collSchema,
ReplicaNumber: lpt.ReplicaNumber,
FieldIndexID: fieldIndexIDs,
Refresh: lpt.Refresh,
ResourceGroups: lpt.ResourceGroups,
}
lpt.result, err = lpt.queryCoord.LoadPartitions(ctx, request)
return err

View File

@ -207,13 +207,14 @@ func (s *Server) ShowPartitions(ctx context.Context, req *querypb.ShowPartitions
func (s *Server) LoadCollection(ctx context.Context, req *querypb.LoadCollectionRequest) (*commonpb.Status, error) {
log := log.Ctx(ctx).With(
zap.Int64("collectionID", req.GetCollectionID()),
zap.Int32("replicaNumber", req.GetReplicaNumber()),
zap.Strings("resourceGroups", req.GetResourceGroups()),
zap.Bool("refreshMode", req.GetRefresh()),
)
log.Info("load collection request received",
zap.Any("schema", req.Schema),
zap.Int32("replicaNumber", req.ReplicaNumber),
zap.Int64s("fieldIndexes", lo.Values(req.GetFieldIndexID())),
zap.Bool("refreshMode", req.GetRefresh()),
)
metrics.QueryCoordLoadCount.WithLabelValues(metrics.TotalLabel).Inc()
@ -307,7 +308,6 @@ func (s *Server) LoadPartitions(ctx context.Context, req *querypb.LoadPartitions
log.Info("received load partitions request",
zap.Any("schema", req.Schema),
zap.Int32("replicaNumber", req.ReplicaNumber),
zap.Int64s("partitions", req.GetPartitionIDs()))
metrics.QueryCoordLoadCount.WithLabelValues(metrics.TotalLabel).Inc()
@ -356,7 +356,7 @@ func (s *Server) checkResourceGroup(collectionID int64, resourceGroups []string)
if len(resourceGroups) != 0 {
collectionUsedRG := s.meta.ReplicaManager.GetResourceGroupByCollection(collectionID)
for _, rgName := range resourceGroups {
if !collectionUsedRG.Contain(rgName) {
if len(collectionUsedRG) > 0 && !collectionUsedRG.Contain(rgName) {
return ErrLoadUseWrongRG
}
}

View File

@ -1062,7 +1062,7 @@ func (p *queryCoordConfig) init(base *BaseTable) {
p.CheckResourceGroupInterval = ParamItem{
Key: "queryCoord.checkResourceGroupInterval",
Version: "2.2.3",
DefaultValue: "30",
DefaultValue: "10",
PanicIfEmpty: true,
}
p.CheckResourceGroupInterval.Init(base.mgr)