Skip to content

Commit

Permalink
Cherry-pick command improvement and bump version to v1.0.3 (#192)
Browse files Browse the repository at this point in the history
Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Aug 18, 2023
1 parent a4f381c commit 93aa440
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import "github.com/blang/semver/v4"
var Version semver.Version

func init() {
Version = semver.MustParse("1.0.2")
Version = semver.MustParse("1.0.3")
}
9 changes: 8 additions & 1 deletion states/etcd/show/collection_loaded.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/milvus-io/birdwatcher/models"
"github.com/milvus-io/birdwatcher/states/etcd/common"
etcdversion "github.com/milvus-io/birdwatcher/states/etcd/version"
"github.com/samber/lo"
)

const (
Expand All @@ -18,7 +19,7 @@ const (

type CollectionLoadedParam struct {
framework.ParamBase `use:"show collection-loaded" desc:"display information of loaded collection from querycoord" alias:"collection-load"`
//CollectionID int64 `name:""`
CollectionID int64 `name:"collection" default:"0" desc:"collection id to check"`
}

// CollectionLoadedCommand return show collection-loaded command.
Expand All @@ -32,6 +33,12 @@ func (c *ComponentShow) CollectionLoadedCommand(ctx context.Context, p *Collecti
return nil, errors.Wrap(err, "failed to list collection load info")
}

if p.CollectionID > 0 {
infos = lo.Filter(infos, func(info *models.CollectionLoaded, _ int) bool {
return info.CollectionID == p.CollectionID
})
}

return framework.NewListResult[CollectionsLoaded](infos), nil
}

Expand Down
9 changes: 6 additions & 3 deletions states/etcd/show/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

type IndexParam struct {
framework.ParamBase `use:"show index" desc:"" alias:"indexes"`
CollectionID int64 `name:"collection" default:"0" desc:"collection id to list index on"`
}

// IndexCommand returns show index command.
Expand All @@ -39,7 +40,9 @@ func (c *ComponentShow) IndexCommand(ctx context.Context, p *IndexParam) {
}

for _, index := range fieldIndexes {
printIndexV2(index)
if p.CollectionID == 0 || p.CollectionID == index.IndexInfo.GetCollectionID() {
printIndexV2(index)
}
}
}

Expand Down Expand Up @@ -73,7 +76,7 @@ func (c *ComponentShow) listIndexMetaV2(ctx context.Context) ([]indexpbv2.FieldI

func printIndex(index IndexInfoV1) {
fmt.Println("==================================================================")
fmt.Printf("Index ID: %d\tIndex Name: %s\tCollectionID:%d\n", index.info.GetIndexID(), index.info.GetIndexName(), index.collectionID)
fmt.Printf("Index ID: %d\tIndex Name: %s\tCollectionID: %d\n", index.info.GetIndexID(), index.info.GetIndexName(), index.collectionID)
indexParams := index.info.GetIndexParams()
fmt.Printf("Index Type: %s\tMetric Type: %s\n",
common.GetKVPair(indexParams, "index_type"),
Expand All @@ -85,7 +88,7 @@ func printIndex(index IndexInfoV1) {

func printIndexV2(index indexpbv2.FieldIndex) {
fmt.Println("==================================================================")
fmt.Printf("Index ID: %d\tIndex Name: %s\tCollectionID:%d\n", index.GetIndexInfo().GetIndexID(), index.GetIndexInfo().GetIndexName(), index.GetIndexInfo().GetCollectionID())
fmt.Printf("Index ID: %d\tIndex Name: %s\tCollectionID: %d\tFieldID: %d\n", index.GetIndexInfo().GetIndexID(), index.GetIndexInfo().GetIndexName(), index.GetIndexInfo().GetCollectionID(), index.GetIndexInfo().GetFieldID())
createTime, _ := utils.ParseTS(index.GetCreateTime())
fmt.Printf("Create Time: %s\tDeleted: %t\n", createTime.Format(tsPrintFormat), index.GetDeleted())
indexParams := index.GetIndexInfo().GetIndexParams()
Expand Down

0 comments on commit 93aa440

Please sign in to comment.