Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: declarative resource group api #31930

Merged

Conversation

chyezh
Copy link
Contributor

@chyezh chyezh commented Apr 6, 2024

issue: #30647

  • Add declarative resource group api

  • Add config for resource group management

  • Resource group recovery enhancement

@sre-ci-robot sre-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines. label Apr 6, 2024
@sre-ci-robot sre-ci-robot added area/dependency Pull requests that update a dependency file area/internal-api labels Apr 6, 2024
@mergify mergify bot added dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement labels Apr 6, 2024
Copy link
Contributor

mergify bot commented Apr 6, 2024

@chyezh ut workflow job failed, comment rerun ut can trigger the job again.

Copy link
Contributor

mergify bot commented Apr 7, 2024

@chyezh ut workflow job failed, comment rerun ut can trigger the job again.

@chyezh chyezh force-pushed the feat_milvus_resource_group_enhancement branch from 0aeb5c2 to 5e5f394 Compare April 7, 2024 15:35
Copy link
Contributor

mergify bot commented Apr 7, 2024

@chyezh ut workflow job failed, comment rerun ut can trigger the job again.

@chyezh chyezh force-pushed the feat_milvus_resource_group_enhancement branch 2 times, most recently from ec7c37c to 1a479ea Compare April 8, 2024 02:34
Copy link
Contributor

mergify bot commented Apr 8, 2024

@chyezh E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

@chyezh chyezh force-pushed the feat_milvus_resource_group_enhancement branch 2 times, most recently from 068087d to a905127 Compare April 8, 2024 09:47
Copy link
Contributor

mergify bot commented Apr 8, 2024

@chyezh E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

@chyezh chyezh force-pushed the feat_milvus_resource_group_enhancement branch from 5a8ba03 to 37e1994 Compare April 8, 2024 14:06
Copy link

codecov bot commented Apr 8, 2024

Codecov Report

Attention: Patch coverage is 82.30769% with 138 lines in your changes are missing coverage. Please review.

Project coverage is 81.75%. Comparing base (3d5fe7b) to head (b061234).
Report is 21 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #31930      +/-   ##
==========================================
+ Coverage   81.69%   81.75%   +0.06%     
==========================================
  Files         991      993       +2     
  Lines      122136   122555     +419     
==========================================
+ Hits        99777   100197     +420     
+ Misses      18530    18519      -11     
- Partials     3829     3839      +10     
Files Coverage Δ
internal/distributed/proxy/service.go 83.92% <100.00%> (+0.04%) ⬆️
internal/distributed/querycoord/client/client.go 97.47% <100.00%> (+0.06%) ⬆️
internal/distributed/querycoord/service.go 77.92% <100.00%> (+0.19%) ⬆️
internal/querycoordv2/meta/resource_group.go 100.00% <100.00%> (ø)
...nternal/querycoordv2/observers/replica_observer.go 95.23% <100.00%> (+0.15%) ⬆️
internal/querycoordv2/server.go 83.36% <100.00%> (+0.97%) ⬆️
pkg/util/constant.go 93.33% <ø> (ø)
pkg/util/merr/errors.go 86.95% <ø> (ø)
pkg/util/merr/utils.go 89.39% <100.00%> (+0.46%) ⬆️
pkg/util/paramtable/quota_param.go 83.69% <100.00%> (+0.15%) ⬆️
... and 8 more

... and 30 files with indirect coverage changes

@mergify mergify bot added the ci-passed label Apr 8, 2024
@@ -315,6 +315,17 @@ func (c *Client) CreateResourceGroup(ctx context.Context, req *milvuspb.CreateRe
})
}

func (c *Client) UpdateResourceGroups(ctx context.Context, req *milvuspb.UpdateResourceGroupsRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not recommend to use milvus.pbMsg between milvus internal rpc. milvus.pbMsg should only be used between sdk and proxy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

req = typeutil.Clone(req)
commonpbutil.UpdateMsgBase(
req.GetBase(),
commonpbutil.FillMsgBaseFromClient(paramtable.GetNodeID(), commonpbutil.WithTargetID(c.grpcClient.GetNodeID())),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to set target_id here, server id check already be done in server_id_intercepter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All api in internal grpc client add it.
I will keep the coding convention until some PR fix it all.

log.Warn("UpdateResourceGroups failed",
zap.Error(err),
)
return getErrResponse(err, method, "", ""), nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's weird to pass two empty string value here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra parameter of getErrReponse is produced by database and collection level metric.
It's a bad implementation, all related code should be removed to somewhere like grpc interceptor.
But I still keep it in this PR. code refactor of getErrResponse should be produced by other pr.


log.Info("UpdateResourceGroups received")

if err := node.sched.ddQueue.Enqueue(t); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task in ddQueue will be processed one by one, so UpdateResourceGroup may be blocked by CreateCollection/LoadCollection

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateResourceGroup and DropResourceGroup is still use the queue to execute task.
I will keep using the queue in this PR.
Remove the related API from ddQueue in other PR if necessary.

nodeMgr: nodeMgr,
for _, meta := range rgs {
rg := NewResourceGroupFromMeta(meta)
rm.groups[rg.GetName()] = rg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should update new version rg meta to catalog, to avoid the old version rg meta exist forever.

Copy link
Contributor Author

@chyezh chyezh Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old and new version meta compatible problem is resolved by resource_group.go.
We can always recover the old version meta in meta storage into new version meta in memory.
So I think that update new version back into meta storage is not needed here.

}
// transfer node from source resource group to target resource group at high priority.
targetCfg.TransferFrom = append(targetCfg.TransferFrom, &rgpb.ResourceGroupTransfer{
ResourceGroup: sourceRGName,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any details about the high priority?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In current implementation, there's no high priority here.
We may add attribute like boost... in future to enable priority.

}
// After recovering, all node assigned to these rg has been removed.
// no secondary index need to be removed.
delete(rm.groups, rgName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should clear nodeIDMap here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After last recovering, all node assigned to these rg has been removed.
no secondary index need to be removed.

newNodes = append(newNodes, nid)
for nodeID := range rm.nodeIDMap {
if node := rm.nodeMgr.Get(nodeID); node == nil || node.IsStoppingState() {
// unassignNode failure can be skip.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove stopping node from rm maybe not safe here? if a stopping node is executing balance, what will happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In current implementation, it's safe.
In replica manager, the node will be set into RO node, and balancer will start to remove all segment and channel on it.

func (rm *ResourceManager) recoverMissingNodeRG(rgName string) error {
for rm.groups[rgName].MissingNumOfNodes() > 0 {
rg := rm.groups[rgName]
sourceRG := rm.selectMissingRecoverSourceRG(rg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of select the sourceRG again and again, it's recommend to sort the sourceRGs by priority

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried to fix it with weight-order-based select policy.
It's Ok when recoverMissingNodeRG, but difficult to implement in recoverRedundant.
Low human-readable codes are produced after fix.
At most of time, a recover operation is applied to a small set of query node, May never greater than 10 for milvus cluster size.
So, I prefer to keep current implementation for human-read.

for _, rg := range rm.groups {
for _, transferCfg := range rg.GetConfig().GetTransferFrom() {
if transferCfg.GetResourceGroup() == rgName {
return errors.Wrapf(ErrDeleteInUsedRG, "resource group %s is used by %s's `from`, remove that configuration first", rgName, rg.name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommend to define a error in merr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix it soon

@chyezh chyezh force-pushed the feat_milvus_resource_group_enhancement branch from 37e1994 to e4f97c0 Compare April 10, 2024 09:50
@mergify mergify bot removed the ci-passed label Apr 10, 2024
@chyezh chyezh force-pushed the feat_milvus_resource_group_enhancement branch from e4f97c0 to 511f897 Compare April 10, 2024 13:02
@chyezh
Copy link
Contributor Author

chyezh commented Apr 10, 2024

rebase master and remove conflict

Copy link
Contributor

mergify bot commented Apr 10, 2024

@chyezh E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

@chyezh chyezh force-pushed the feat_milvus_resource_group_enhancement branch from 511f897 to 35343b4 Compare April 11, 2024 07:45
@chyezh
Copy link
Contributor Author

chyezh commented Apr 11, 2024

@chyezh chyezh added this to the 2.4.1 milestone Apr 11, 2024
- Add declarative resource group api

- Add config for resource group management

- resource group recovery enhancement

Signed-off-by: chyezh <chyezh@outlook.com>
Signed-off-by: chyezh <chyezh@outlook.com>
Signed-off-by: chyezh <chyezh@outlook.com>
Signed-off-by: chyezh <chyezh@outlook.com>
Signed-off-by: chyezh <chyezh@outlook.com>
Signed-off-by: chyezh <chyezh@outlook.com>
…over

Signed-off-by: chyezh <chyezh@outlook.com>
@chyezh chyezh force-pushed the feat_milvus_resource_group_enhancement branch from 35343b4 to b061234 Compare April 11, 2024 11:56
@chyezh
Copy link
Contributor Author

chyezh commented Apr 11, 2024

Fix conflict at resource_manager.go
Update commit fix: upgrade resource group meta into latest version when startup rec…

Copy link
Contributor

mergify bot commented Apr 11, 2024

@chyezh E2e jenkins job failed, comment /run-cpu-e2e can trigger the job again.

@chyezh
Copy link
Contributor Author

chyezh commented Apr 11, 2024

/run-cpu-e2e

@weiliu1031
Copy link
Contributor

/lgtm

@xiaofan-luan
Copy link
Contributor

/lgtm
/approve

@sre-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chyezh, xiaofan-luan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot sre-ci-robot merged commit 48fe977 into milvus-io:master Apr 15, 2024
15 checks passed
@chyezh chyezh deleted the feat_milvus_resource_group_enhancement branch April 15, 2024 02:03
czs007 pushed a commit that referenced this pull request Apr 15, 2024
issue: #31930

Signed-off-by: chyezh <chyezh@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/dependency Pull requests that update a dependency file area/internal-api area/test ci-passed dco-passed DCO check passed. kind/enhancement Issues or changes related to enhancement lgtm sig/testing size/XXL Denotes a PR that changes 1000+ lines. test/integration integration test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants