Skip to content

Commit

Permalink
add more params
Browse files Browse the repository at this point in the history
Signed-off-by: husharp <[email protected]>
  • Loading branch information
HuSharp committed Aug 16, 2024
1 parent 2045418 commit db7e3f5
Show file tree
Hide file tree
Showing 22 changed files with 12,742 additions and 11,263 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ replace (
// fix potential security issue(CVE-2020-26160) introduced by indirect dependency.
github.com/dgrijalva/jwt-go => github.com/form3tech-oss/jwt-go v3.2.6-0.20210809144907-32ab6a8243d7+incompatible
github.com/go-ldap/ldap/v3 => github.com/YangKeao/ldap/v3 v3.4.5-0.20230421065457-369a3bab1117
github.com/pingcap/kvproto => github.com/HuSharp/kvproto v0.0.0-20240814090713-f53317ae8f49
github.com/pingcap/tidb/pkg/parser => ./pkg/parser

// TODO: `sourcegraph.com/sourcegraph/appdash` has been archived, and the original host has been removed.
Expand Down
1,253 changes: 1,245 additions & 8 deletions go.sum

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions pkg/ddl/resource_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,20 @@ func SetDirectResourceGroupRunawayOption(resourceGroupSettings *model.ResourceGr
settings := resourceGroupSettings.Runaway
switch opt.Tp {
case ast.RunawayRule:
// because execute time won't be too long, we use `time` pkg which does not support to parse unit 'd'.
dur, err := time.ParseDuration(opt.RuleOption.ExecElapsed)
if err != nil {
return err
switch opt.RuleOption.Tp {
case ast.RunawayRuleExecElapsed:
// because execute time won't be too long, we use `time` pkg which does not support to parse unit 'd'.
dur, err := time.ParseDuration(opt.RuleOption.ExecElapsed)
if err != nil {
return err
}
settings.ExecElapsedTimeMs = uint64(dur.Milliseconds())
case ast.RunawayRuleProcessedKeys:
settings.ProcessedKeys = opt.RuleOption.ProcessedKeys
case ast.RunawayRuleRequestUnit:
settings.RequestUnit = opt.RuleOption.RequestUnit
}
settings.ExecElapsedTimeMs = uint64(dur.Milliseconds())

case ast.RunawayAction:
settings.Action = opt.ActionOption.Type
case ast.RunawayWatch:
Expand Down
2 changes: 2 additions & 0 deletions pkg/ddl/resourcegroup/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ func NewGroupFromOptions(groupName string, options *model.ResourceGroupSettings)
return nil, ErrInvalidResourceGroupRunawayExecElapsedTime
}
runaway.Rule.ExecElapsedTimeMs = options.Runaway.ExecElapsedTimeMs
runaway.Rule.ProcessKeys = options.Runaway.ProcessedKeys
runaway.Rule.RequestUnit = options.Runaway.RequestUnit
if options.Runaway.Action == model.RunawayActionNone {
return nil, ErrUnknownResourceGroupRunawayAction
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/domain/resourcegroup/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ go_library(
deps = [
"//pkg/metrics",
"//pkg/util/dbterror/exeerrors",
"//pkg/util/execdetails",
"//pkg/util/generic",
"//pkg/util/logutil",
"@com_github_jellydator_ttlcache_v3//:ttlcache",
"@com_github_pingcap_kvproto//pkg/resource_manager",
"@com_github_prometheus_client_golang//prometheus",
"@com_github_tikv_client_go_v2//tikv",
"@com_github_tikv_client_go_v2//tikvrpc",
"@com_github_tikv_client_go_v2//util",
"@com_github_tikv_pd_client//resource_group/controller",
"@org_uber_go_zap//:zap",
],
Expand Down
Loading

0 comments on commit db7e3f5

Please sign in to comment.