Skip to content

Commit

Permalink
enhance: resource group declarative api
Browse files Browse the repository at this point in the history
- Add resource group configuration proto.

- Add UpdateResourceGroups and modify AddResourceGroup api.

Signed-off-by: chyezh <[email protected]>
  • Loading branch information
chyezh committed Feb 6, 2024
1 parent c57cb8f commit 4d6c24e
Show file tree
Hide file tree
Showing 7 changed files with 1,168 additions and 730 deletions.
512 changes: 289 additions & 223 deletions go-api/commonpb/common.pb.go

Large diffs are not rendered by default.

1,132 changes: 626 additions & 506 deletions go-api/milvuspb/milvus.pb.go

Large diffs are not rendered by default.

193 changes: 193 additions & 0 deletions go-api/rgpb/rg.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ enum MsgType {
DescribeResourceGroup = 1703;
TransferNode = 1704;
TransferReplica = 1705;
UpdateResourceGroups = 1706;

/* Database group */
CreateDatabase = 1801;
Expand Down Expand Up @@ -395,6 +396,8 @@ enum ObjectPrivilege {
PrivilegeDropAlias = 45;
PrivilegeDescribeAlias = 46;
PrivilegeListAliases = 47;

PrivilegeUpdateResourceGroup = 48;
}

message PrivilegeExt {
Expand Down Expand Up @@ -449,3 +452,10 @@ message ServerInfo {
// reserved for newly-added feature if necessary.
map<string, string> reserved = 6;
}

// NodeInfo is used to describe the node information.
message NodeInfo {
int64 nodeID = 1;
string address = 2;
string hostname = 3;
}
19 changes: 18 additions & 1 deletion proto/milvus.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ option java_generate_equals_and_hash = true;
option csharp_namespace = "Milvus.Client.Grpc";

import "common.proto";
import "rg.proto";
import "schema.proto";
import "feder.proto";
import "msg.proto";
Expand Down Expand Up @@ -113,6 +114,7 @@ service MilvusService {

rpc CreateResourceGroup(CreateResourceGroupRequest) returns (common.Status) {}
rpc DropResourceGroup(DropResourceGroupRequest) returns (common.Status) {}
rpc UpdateResourceGroups(UpdateResourceGroupsRequest) returns (common.Status) {}
rpc TransferNode(TransferNodeRequest) returns (common.Status) {}
rpc TransferReplica(TransferReplicaRequest) returns (common.Status) {}
rpc ListResourceGroups(ListResourceGroupsRequest) returns (ListResourceGroupsResponse) {}
Expand Down Expand Up @@ -1623,6 +1625,17 @@ message CreateResourceGroupRequest {
};
common.MsgBase base = 1;
string resource_group = 2;
rg.ResourceGroupConfig config = 3;
}

message UpdateResourceGroupsRequest {
option (common.privilege_ext_obj) = {
object_type: Global
object_privilege: PrivilegeUpdateResourceGroup
object_name_index: -1
};
common.MsgBase base = 1;
map<string, rg.ResourceGroupConfig> resource_groups = 2;
}

message DropResourceGroupRequest {
Expand Down Expand Up @@ -1700,8 +1713,12 @@ message ResourceGroup {
map<string, int32> num_loaded_replica = 4;
// collection name -> accessed other rg's node num
map<string, int32> num_outgoing_node = 5;
// collection name -> be accessed node num by other rg
// collection name -> be accessed node num by other rg
map<string, int32> num_incoming_node = 6;
// resource group configuration.
rg.ResourceGroupConfig config = 7;
// query node belong to this resource group now.
repeated common.NodeInfo nodes = 8;
}

message RenameCollectionRequest {
Expand Down
29 changes: 29 additions & 0 deletions proto/rg.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
syntax = "proto3";
package milvus.proto.rg;

option go_package = "github.com/milvus-io/milvus-proto/go-api/v2/rgpb";

option java_multiple_files = true;
option java_package = "io.milvus.grpc";
option java_outer_classname = "ResourceGroupProto";
option java_generate_equals_and_hash = true;

option csharp_namespace = "Milvus.Client.Grpc";

message ResourceGroupLimit {
int32 nodeNum = 1;
// preserve for other limit.
}

message ResourceGroupTransfer {
string resource_group = 1; // resource groups can be transfered with current resource group.
// preserve for other option, such as lazy transfer, disable default resource group transfer or affinity setup.
}

message ResourceGroupConfig {
ResourceGroupLimit requests = 1; // requests node num in resource group, if node num is less than requests.nodeNum, it will be transfer from other resource group.
ResourceGroupLimit limits = 2; // limited node num in resource group, if node num is more than limits.nodeNum, it will be transfer to other resource group.
repeated ResourceGroupTransfer from = 3; // missing node should be transfer from given resource group at high priority in repeated list.
repeated ResourceGroupTransfer to = 4; // redundant node should be transfer to given resource group at high priority in repeated list.
}

3 changes: 3 additions & 0 deletions scripts/proto_gen_go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,7 @@ $protoc --proto_path="${GOOGLE_PROTO_DIR}" --proto_path=. \
--go_opt="Mmessage.proto=github.com/milvus-io/milvus-proto/go-api/v2/federpb;federpb" \
--go_out=plugins=grpc,paths=source_relative:./../go-api/federpb feder.proto

$protoc --proto_path="${GOOGLE_PROTO_DIR}" --proto_path=. \
--go_out=plugins=grpc,paths=source_relative:./../go-api/rgpb rg.proto

popd

0 comments on commit 4d6c24e

Please sign in to comment.