mirror of https://github.com/milvus-io/milvus.git
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
parent
d506d33a8d
commit
e8496d4d49
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue