-
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
*: Make token limit into an instance variable #34324
Conversation
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Sunny Bains seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Welcome @subains! |
Please follow PR Title Format:
Or if the count of mainly changed packages are more than 3, use
After you have format title, you can leave a comment |
) | ||
|
||
// Process global variables. | ||
var ( | ||
ProcessGeneralLog = atomic.NewBool(false) | ||
GlobalLogMaxDays = atomic.NewInt32(int32(config.GetGlobalConfig().Log.File.MaxDays)) | ||
EnablePProfSQLCPU = atomic.NewBool(false) | ||
TokenLimit = atomic.NewInt32(1000) |
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.
This will be overwritten, but just to save duplication better to use the const for 1000
here:
TokenLimit = atomic.NewInt32(1000) | |
TokenLimit = atomic.NewInt32(DefTiDBTokenLimit) |
ival, _ := strconv.Atoi(val) | ||
TokenLimit.Store((int32)(ival)) | ||
return nil |
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.
Some linters complain about uncaught errors. Because the validation is run based on "TypeInt" before this code is called, it will always be a valid number. So we can use our own helper function which doesn't return errors:
ival, _ := strconv.Atoi(val) | |
TokenLimit.Store((int32)(ival)) | |
return nil | |
ival := tidbOptPositiveInt32(val, DefTiDBTokenLimit) | |
TokenLimit.Store(int32(ival)) | |
return nil |
TokenLimit: 1000, | ||
OOMUseTmpStorage: true, |
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.
There should be a line in config.go for deprecated variables. If you add "token-limit" to it, it will mean a cleaner error for users.
@subains: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
As discussed on Slack - we need to discuss this one more, because it probably should be renamed and not global scope. So I am going to close this PR for now. Thank you for your contribution! Sorry, we could not merge it this time. |
What problem does this PR solve?
Issue Number: ref #33769
Problem Summary:
The option
token-limit
has historically been a config option. But based on requirements from cloud & PM it should instead be a sysvar.What is changed and how it works?
This does the minimum work to convert token-limit to a global (cluster-wide) sysvar, and removes the config option (placing it in the previously deprecated list).
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.