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

feat: TCloud负载均衡同步优化 #1147

Open
wants to merge 13 commits into
base: feat-loadbalancer
Choose a base branch
from

Conversation

chenjr15
Copy link
Collaborator

No description provided.

@chenjr15 chenjr15 requested a review from fxdgg October 31, 2024 10:00
scripts/sql/9999_clb_optimize_index.sql Outdated Show resolved Hide resolved
scripts/sql/9999_clb_optimize_index.sql Outdated Show resolved Hide resolved
scripts/sql/9999_clb_optimize_index.sql Outdated Show resolved Hide resolved
scripts/sql/9999_clb_optimize_index.sql Show resolved Hide resolved
cmd/hc-service/service/sync/handler/handler.go Outdated Show resolved Hide resolved
}

allCloudIDMap := make(map[string]struct{}, 1024)
for {
Copy link
Collaborator

Choose a reason for hiding this comment

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

顺序需要调整,目前会存在两个问题:

  1. 如果等整个region同步完,再去删除本地的数据,时间会比较久,在这中间用户新增加的本地数据,会被删除;
  2. Next完就需要去删除本地数据,最后再去统一的Sync,不然在执行Sync方法时,可能会存在一些唯一性校验的内容,由于没有先把region下需要删除的资源删掉,导致添加或者更新不进来。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

如果是这样的话,

  1. 缓存全部云上clb列表(约几万个长度的实例列表)
  2. 重新拉一次云上数据(双倍时间)

cmd/hc-service/service/sync/handler/handler.go Outdated Show resolved Hide resolved
}
for _, idBatch := range slice.Split(delCloudIDs, constant.BatchOperationMaxLimit) {
if err := cli.deleteLoadBalancer(kt, params.AccountID, params.Region, idBatch); err != nil {
logs.Errorf("fail to delete removed clb, err: %s, account: %s, region: %s, cloudIds: %v, rid: %s",
Copy link
Collaborator

Choose a reason for hiding this comment

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

"err: %v"

if params.CloudIDs[i] == lbFromCloud[i].GetCloudID() {
continue
}
logs.Warnf("params.CloudIDs[%d] mismatch prefetched lb cloud id, params: %s, opt: %s, rid: %s",
Copy link
Collaborator

Choose a reason for hiding this comment

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

"params: %s, opt: %s"
这里只打印了云ID吧?这里叫params、opt感觉不太合适

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

params,opt 是简写,打出来的是对应的 cloud id ,不然太长了

pkg/adaptor/tcloud/clb.go Outdated Show resolved Hide resolved
pkg/adaptor/tcloud/target.go Outdated Show resolved Hide resolved
pkg/rest/client/client.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants