enhance: filter out the not needed collections while listing (#29690)

this improves performance while many collections exist
resolve #29631

Signed-off-by: yah01 <yang.cen@zilliz.com>
pull/28427/head
yah01 2024-01-10 15:18:48 +08:00 committed by GitHub
parent d506d33a8d
commit e8496d4d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -19,6 +19,8 @@ package rootcoord
import (
"context"
"github.com/samber/lo"
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
"github.com/milvus-io/milvus/pkg/util/merr"
@ -53,6 +55,10 @@ func (t *showCollectionTask) Execute(ctx context.Context) error {
return err
}
for _, coll := range colls {
if len(t.Req.GetCollectionNames()) > 0 && !lo.Contains(t.Req.GetCollectionNames(), coll.Name) {
continue
}
t.Rsp.CollectionNames = append(t.Rsp.CollectionNames, coll.Name)
t.Rsp.CollectionIds = append(t.Rsp.CollectionIds, coll.CollectionID)
t.Rsp.CreatedTimestamps = append(t.Rsp.CreatedTimestamps, coll.CreateTime)