-
Notifications
You must be signed in to change notification settings - Fork 31
config: dynamic proxy config #56
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
Conversation
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
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.
https://github.com/pingcap/TiProxy/blob/a9b15514f5f0bc282b35678df69b0ab07f053b61/cmd/weirctl/util.go#L46
I think it should be for _, i := range rand.Perm(len(bctx.CUrls)) {
?
Nope, I am using it as |
for i := range rand.Perm(len(bctx.CUrls)) {
req.URL.Host = bctx.CUrls[i] is just equivalent to for _, host := bctx.CUrls {
req.URL.Host = host because |
Co-authored-by: djshow832 <zhangming@pingcap.com>
Addressed. |
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Co-authored-by: djshow832 <zhangming@pingcap.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
} | ||
|
||
type ConfigManager struct { | ||
IgnoreWrongNamespace bool `yaml:"ignore_wrong_namespace"` | ||
IgnoreWrongNamespace bool `yaml:"ignore_wrong_namespace" toml:"ignore_wrong_namespace" json:"ignore_wrong_namespace"` | ||
WatchInterval string `yaml:"watch_interval" toml:"watch_interval" json:"watch_interval"` |
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.
I thought about this, it's hard to explain what this really means to the user.
For common cases, the config will be refreshed once updated. This interval is only used for defensive programming.
As for TiDB, the refresh interval for privileges and global variables are not exposed to users either, and nobody complains about it.
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.
We could categorize them into KNOW WHAT YOU ARE DOING options and provide a resonable default. If one don't understand, just don't set.
You can choose to use the default good config, or make one step further into the internal. That is users' freedom. BTW, these are possibly useful for debugging online.
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.
As for TiDB, the refresh interval for privileges and global variables are not exposed to users either, and nobody complains about it.
There is no choice. They don't even know about that. Maybe they have a guess in their mind, and thought it is correct. If we have a documentation said the priv interval is XXX. Maybe someone will complain that it is too short or too long.
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.
As for TiDB, the refresh interval for privileges and global variables are not exposed to users either, and nobody complains about it.
There is no choice. They don't even know about that. Maybe they have a guess in their mind, and thought it is correct. If we have a documentation said the priv interval is XXX. Maybe someone will complain that it is too short or too long.
If we make it as a config, we must document it, and then users are confused and complain. I sometimes encounter the situation where a user saw a config and doesn't understand what it means and then asks us. It just brings us trouble. If we're removing it, it again brings compatibility problems.
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.
I would not consider it a problem. First of all, TiProxy will have much less options. It is much simpler and not that hard to understand.
My point is that documentation of complex options can be highlighted, in another section or another page with a large NOTE. The example for these options can be separated into another file, or commented by default.
If users feel normal options are enough, they surely won't dig deep into these complicated options. Moreover, we recommend you not to use these options unless you understand it. TiDB docs has none of these guidance or classifications. And description for system variables usually do not have any external link to the related page or doc.
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe xw897002528@gmail.com
What problem does this PR solve?
Issue Number: ref #11
Problem Summary: Dynamic config
keep alive
andmax connections
for proxy server.What is changed and how it works:
/api/admin/config/proxy
for online proxy config.yaml, toml, json
all struct tagserrors.Wrap(f)
will return nil for nil errorCheck List
Tests
Notable changes
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.