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

*: Supports create/alter/drop resource group #40188

Merged
merged 15 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 87 additions & 18 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ def go_deps():
sum = "h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to=",
version = "v0.0.0-20180808171621-7fddfc383310",
)
go_repository(
name = "com_github_armon_go_socks5",
build_file_proto_mode = "disable",
importpath = "github.com/armon/go-socks5",
sum = "h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=",
version = "v0.0.0-20160902184237-e75332964ef5",
)

go_repository(
name = "com_github_ashanbrown_forbidigo",
build_file_proto_mode = "disable",
Expand Down Expand Up @@ -864,6 +872,14 @@ def go_deps():
sum = "h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=",
version = "v1.0.0",
)
go_repository(
name = "com_github_elazarl_goproxy",
build_file_proto_mode = "disable",
importpath = "github.com/elazarl/goproxy",
sum = "h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc=",
version = "v0.0.0-20180725130230-947c36da3153",
)

go_repository(
name = "com_github_emirpasic_gods",
build_file_proto_mode = "disable",
Expand Down Expand Up @@ -919,8 +935,8 @@ def go_deps():
name = "com_github_evanphx_json_patch",
build_file_proto_mode = "disable",
importpath = "github.com/evanphx/json-patch",
sum = "h1:K1MDoo4AZ4wU0GIU/fPmtZg7VpzLjCxu+UwBD1FvwOc=",
version = "v4.1.0+incompatible",
sum = "h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=",
version = "v4.12.0+incompatible",
)
go_repository(
name = "com_github_facebookgo_clock",
Expand Down Expand Up @@ -1153,6 +1169,14 @@ def go_deps():
sum = "h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=",
version = "v0.5.1",
)
go_repository(
name = "com_github_go_logr_logr",
build_file_proto_mode = "disable",
importpath = "github.com/go-logr/logr",
sum = "h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=",
version = "v1.2.3",
)

go_repository(
name = "com_github_go_martini_martini",
build_file_proto_mode = "disable_global",
Expand Down Expand Up @@ -1473,6 +1497,14 @@ def go_deps():
sum = "h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU=",
version = "v1.1.2",
)
go_repository(
name = "com_github_google_gnostic",
build_file_proto_mode = "disable",
importpath = "github.com/google/gnostic",
sum = "h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54=",
version = "v0.5.7-v3refs",
)

go_repository(
name = "com_github_google_go_cmp",
build_file_proto_mode = "disable_global",
Expand All @@ -1491,8 +1523,8 @@ def go_deps():
name = "com_github_google_gofuzz",
build_file_proto_mode = "disable_global",
importpath = "github.com/google/gofuzz",
sum = "h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=",
version = "v1.0.0",
sum = "h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=",
version = "v1.1.0",
)
go_repository(
name = "com_github_google_martian",
Expand Down Expand Up @@ -2563,6 +2595,13 @@ def go_deps():
sum = "h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE=",
version = "v1.0.1",
)
go_repository(
name = "com_github_moby_spdystream",
build_file_proto_mode = "disable",
importpath = "github.com/moby/spdystream",
sum = "h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=",
version = "v0.2.0",
)

go_repository(
name = "com_github_modern_go_concurrent",
Expand Down Expand Up @@ -2615,6 +2654,14 @@ def go_deps():
sum = "h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=",
version = "v0.0.0-20190716064945-2f068394615f",
)
go_repository(
name = "com_github_mxk_go_flowrate",
build_file_proto_mode = "disable",
importpath = "github.com/mxk/go-flowrate",
sum = "h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=",
version = "v0.0.0-20140419014527-cca7078d478f",
)

go_repository(
name = "com_github_nakabonne_nestif",
build_file_proto_mode = "disable",
Expand Down Expand Up @@ -2743,15 +2790,15 @@ def go_deps():
name = "com_github_onsi_ginkgo_v2",
build_file_proto_mode = "disable_global",
importpath = "github.com/onsi/ginkgo/v2",
sum = "h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ=",
version = "v2.0.0",
sum = "h1:+Ig9nvqgS5OBSACXNk15PLdp0U9XPYROt9CFzVdFGIs=",
version = "v2.4.0",
)
go_repository(
name = "com_github_onsi_gomega",
build_file_proto_mode = "disable_global",
importpath = "github.com/onsi/gomega",
sum = "h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=",
version = "v1.18.1",
sum = "h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys=",
version = "v1.23.0",
)
go_repository(
name = "com_github_openpeedeep_depguard",
Expand Down Expand Up @@ -2923,8 +2970,8 @@ def go_deps():
name = "com_github_pingcap_kvproto",
build_file_proto_mode = "disable_global",
importpath = "github.com/pingcap/kvproto",
sum = "h1:v0Z0nC0knwWHn3e9br8EMNfLBB14QDULn142UGjiTMQ=",
version = "v0.0.0-20221213093948-9ccc6beaf0aa",
sum = "h1:jw4NjEiCleRJPPpHM7K6l8OKzOjnZAj62eKteCAY6ro=",
version = "v0.0.0-20230105060948-64890fa4f6c1",
)
go_repository(
name = "com_github_pingcap_log",
Expand Down Expand Up @@ -4176,8 +4223,8 @@ def go_deps():
name = "io_k8s_apimachinery",
build_file_proto_mode = "disable",
importpath = "k8s.io/apimachinery",
sum = "h1:Jmdtdt1ZnoGfWWIIik61Z7nKYgO3J+swQJtPYsP9wHA=",
version = "v0.0.0-20190404173353-6a84e37a896d",
sum = "h1:1feANjElT7MvPqp0JT6F3Ss6TWDwmcjLypwoPpEf7zg=",
version = "v0.26.0",
)
go_repository(
name = "io_k8s_client_go",
Expand All @@ -4193,27 +4240,49 @@ def go_deps():
sum = "h1:0VPpR+sizsiivjIfIAQH/rl8tan6jvWkS7lU+0di3lE=",
version = "v0.3.0",
)
go_repository(
name = "io_k8s_klog_v2",
build_file_proto_mode = "disable",
importpath = "k8s.io/klog/v2",
sum = "h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=",
version = "v2.80.1",
)

go_repository(
name = "io_k8s_kube_openapi",
build_file_proto_mode = "disable",
importpath = "k8s.io/kube-openapi",
sum = "h1:tHgpQvrWaYfrnC8G4N0Oszw5HHCsZxKilDi2R7HuCSM=",
version = "v0.0.0-20180629012420-d83b052f768a",
sum = "h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E=",
version = "v0.0.0-20221012153701-172d655c2280",
)
go_repository(
name = "io_k8s_sigs_json",
build_file_proto_mode = "disable",
importpath = "sigs.k8s.io/json",
sum = "h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=",
version = "v0.0.0-20220713155537-f223a00ba0e2",
)
go_repository(
name = "io_k8s_sigs_structured_merge_diff_v4",
build_file_proto_mode = "disable",
importpath = "sigs.k8s.io/structured-merge-diff/v4",
sum = "h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=",
version = "v4.2.3",
)

go_repository(
name = "io_k8s_sigs_yaml",
build_file_proto_mode = "disable_global",
importpath = "sigs.k8s.io/yaml",
sum = "h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=",
version = "v1.2.0",
sum = "h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=",
version = "v1.3.0",
)
go_repository(
name = "io_k8s_utils",
build_file_proto_mode = "disable",
importpath = "k8s.io/utils",
sum = "h1:8r+l4bNWjRlsFYlQJnKJ2p7s1YQPj4XyXiJVqDHRx7c=",
version = "v0.0.0-20190308190857-21c4ce38f2a7",
sum = "h1:0Smp/HP1OH4Rvhe+4B8nWGERtlqAGSftbSbbmm45oFs=",
version = "v0.0.0-20221107191617-1a15be271d1d",
)

go_repository(
Expand Down
4 changes: 4 additions & 0 deletions br/pkg/backup/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,10 @@ func skipUnsupportedDDLJob(job *model.Job) bool {
model.ActionAlterTableAttributes,
model.ActionAlterTablePartitionAttributes:
return true
case model.ActionCreateResourceGroup,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better to let br support resource group DDL. Is there any problem to do so?

Copy link
Member Author

@nolouch nolouch Jan 4, 2023

Choose a reason for hiding this comment

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

I see placement policy not supported, I just following it. Both of them are look like configuration.

Copy link
Contributor

Choose a reason for hiding this comment

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

They are not the same. Because placement policy is relate to the cluster topology, so restore the placement rule to a different cluster may be not very useful. But resource group is not, I think it's useful to just restore the resource group settings. BTW, if we want to not ignore the resource group DDL, we should also skip the user bind resource group name attribute to let it in a consistent state, it seems hard to do so.

Copy link
Member Author

Choose a reason for hiding this comment

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

I skip this check first, and will do more after this PR. record in #40371.

model.ActionAlterResourceGroup,
model.ActionDropResourceGroup:
return true
default:
return false
}
Expand Down
4 changes: 4 additions & 0 deletions ddl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ go_library(
"partition.go",
"placement_policy.go",
"reorg.go",
"resource_group.go",
"rollingback.go",
"sanity_check.go",
"schema.go",
Expand All @@ -57,6 +58,7 @@ go_library(
"//ddl/ingest",
"//ddl/label",
"//ddl/placement",
"//ddl/resourcegroup",
"//ddl/syncer",
"//ddl/util",
"//distsql",
Expand Down Expand Up @@ -186,6 +188,7 @@ go_test(
"placement_sql_test.go",
"primary_key_handle_test.go",
"repair_table_test.go",
"resource_group_test.go",
"restart_test.go",
"rollingback_test.go",
"schema_test.go",
Expand All @@ -206,6 +209,7 @@ go_test(
"//config",
"//ddl/ingest",
"//ddl/placement",
"//ddl/resourcegroup",
"//ddl/schematracker",
"//ddl/testutil",
"//ddl/util",
Expand Down
3 changes: 3 additions & 0 deletions ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ type DDL interface {
CreatePlacementPolicy(ctx sessionctx.Context, stmt *ast.CreatePlacementPolicyStmt) error
DropPlacementPolicy(ctx sessionctx.Context, stmt *ast.DropPlacementPolicyStmt) error
AlterPlacementPolicy(ctx sessionctx.Context, stmt *ast.AlterPlacementPolicyStmt) error
CreateResourceGroup(ctx sessionctx.Context, stmt *ast.CreateResourceGroupStmt) error
AlterResourceGroup(ctx sessionctx.Context, stmt *ast.AlterResourceGroupStmt) error
DropResourceGroup(ctx sessionctx.Context, stmt *ast.DropResourceGroupStmt) error
FlashbackCluster(ctx sessionctx.Context, flashbackTS uint64) error

// CreateSchemaWithInfo creates a database (schema) given its database info.
Expand Down
Loading