-
Notifications
You must be signed in to change notification settings - Fork 32
*: introduce etcd and cli #1
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 <[email protected]>
1. add `util/cmd` to use cobra. It also introduced a non-global logger passing down to all instances. `util/cmd/encoder.go` is a new encoder that is consitent with the `pingcap/log`. 2. replace `proxy/server.go` with `server/server.go`. 3. replace `proxy/api.go` with the package `server/api`, which is splitted into smaller packages for further development. 4. introduce etcd. Now HTTP API will start with etcd, share the same port 2379, like PD. 5. move `pkg/proxy/metrics` to `pkg/metrics`. 6. rewrite configcenter to an etcd-based manager. Signed-off-by: xhe <[email protected]>
1. introduce weirctl like pdctl 2. add namespace control subcommand to ctl 3. refine namespace HTTP api on server 4. resolve namespace manager deadlock, introduced by removing util/sync2 Signed-off-by: xhe <[email protected]>
|
|
||
| type BackendObserver struct { | ||
| backendInfo map[string]*BackendInfo | ||
| client *clientv3.Client |
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.
The global etcd client is removed and it is inserted here. There was only one client for session manager demo. But it should be configured in namespace to support multi-cluster proxy as the original weir. It is worth doing because it is simple and more flexible.
Signed-off-by: xhe <[email protected]>
Signed-off-by: xhe <[email protected]>
| return nil | ||
| } | ||
|
|
||
| func (e *ConfigManager) get(ctx context.Context, ns, key string) (*mvccpb.KeyValue, error) { |
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.
No global configuration applied for all the namespaces?
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.
No, we can do that later. This is merely a demonstration of how this will work. We can add a section in yaml config, and do the validation in SetNamespace.
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 don't want this PR to be too large. Or I don't want to do it in one PR.
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.
BTW, this method is an abstraction for various configurations. It is not for namespace only.
|
|
||
| // This is the tricky part. While HTTP services rely on managers, managers also rely on the etcd server. | ||
| // Etcd server is used to bring up the config manager and HTTP services itself. | ||
| // That means we have cyclic dependencies. Here's the solution: |
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.
What are the other dependencies? Etcd server relies on whom?
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.
Etcd server is used to bring up the config manager and HTTP services itself. implies that etcd relies on HTTP services or HTTP handlers.
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.
etcd server -> http -> config manager -> etcd database(but it can not be split from etcd server)
<------------------------------- the loop -----------------------
This is how we can integrate etcd client api and our weirproxy api into one single port. I prefer the method, it also simplifies the management of user-config and code.
Signed-off-by: xhe <[email protected]>
cmd: introduce waitgroup wrapper a big refactor to take an approach like PD introduce weirctl time format is part of pingcap/log format spec no config/logger in struct, pass down as needed add missing license Signed-off-by: xhe <[email protected]>
What problem does this PR solve?
Introduce etcd, and cli, as following:
What is changed and how it works?
Check List
Tests
Code changes
Release note