Skip to content

Commit

Permalink
enhance: Remove partition load infos with prefix
Browse files Browse the repository at this point in the history
Signed-off-by: bigsheeper <[email protected]>
  • Loading branch information
bigsheeper committed Dec 5, 2023
1 parent 43ec2c2 commit b315856
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions internal/metastore/kv/querycoord/kv_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,26 +192,14 @@ func (s Catalog) GetResourceGroups() ([]*querypb.ResourceGroup, error) {
}

func (s Catalog) ReleaseCollection(collection int64) error {
// obtain partitions of this collection
_, values, err := s.cli.LoadWithPrefix(fmt.Sprintf("%s/%d", PartitionLoadInfoPrefix, collection))
if err != nil {
return err
}
partitionIDs := make([]int64, 0)
for _, v := range values {
info := querypb.PartitionLoadInfo{}
if err = proto.Unmarshal([]byte(v), &info); err != nil {
return err
}
partitionIDs = append(partitionIDs, (&info).GetPartitionID())
}
// remove collection and obtained partitions
collectionKey := EncodeCollectionLoadInfoKey(collection)
err = s.cli.Remove(collectionKey)
err := s.cli.Remove(collectionKey)
if err != nil {
return err
}
return s.ReleasePartition(collection, partitionIDs...)
partitionsPrefix := fmt.Sprintf("%s/%d", PartitionLoadInfoPrefix, collection)
return s.cli.RemoveWithPrefix(partitionsPrefix)
}

func (s Catalog) ReleasePartition(collection int64, partitions ...int64) error {
Expand Down

0 comments on commit b315856

Please sign in to comment.