-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
*: replace cost model factor constants with system variable #12367
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12367 +/- ##
===========================================
Coverage ? 80.7625%
===========================================
Files ? 454
Lines ? 99431
Branches ? 0
===========================================
Hits ? 80303
Misses ? 13336
Partials ? 5792 |
// tidb_opt_memory_factor is the memory cost of storing one tuple. | ||
TiDBOptMemoryFactor = "tidb_opt_memory_factor" | ||
// tidb_opt_concurrency_factor is the CPU cost of additional one goroutine. | ||
TiDBOptConcurrencyFactor = "tidb_opt_concurrency_factor" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about renaming them in the format of tidb_opt_factor_xxx
? So that we can search all the factors with a simple sql like show variables like "tidb_opt_factor%
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would look strange for variables like tidb_opt_factor_cpu
, we can use show variables like "tidb_opt_%_factor"
to query all the values instead?
} | ||
if v < 0 { | ||
return value, ErrWrongValueForVar.GenWithStackByArgs(name, value) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we validate the upper limit for each variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should we set the upper limit for the variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
What problem does this PR solve?
As the title said, replace hard-coded cost model factor constants with system variables, to make it more flexible for re-configuration to fit into customized environments.
What is changed and how it works?
Add 7 system variables corresponding to the constant factors, and use them in cost computing.
Check List
Tests
Code changes
Side effects
N/A
Related changes
Release note
N/A