Skip to content
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

infosync, router: register TiProxy to ETCD #309

Merged
merged 3 commits into from
Jun 13, 2023
Merged

Conversation

djshow832
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #307

Problem Summary:
If we support self-hosted deployment, we need to support TiDB Dashboard and information_schema.cluster_xxx tables. These features require fetching TiProxy addresses. The most straightforward way is to register TiProxy in the ectd of PD, just like what TiDB does.

What is changed and how it works:

  • Register info and ttl into PD by InfoSyncer
  • Move InitEtcdClient from router to infosync

TODO:

  • Move more etcd code from router to infosync. PDFetcher should call infosync to get TiDB topology.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Start TiProxy and check etcd entry from PD:

etcdctl get --prefix /topology/tiproxy
/topology/tiproxy/192.168.0.101:6000/info
{"version":"topo","git_hash":"66d42d553315fd26a3bbd677036ec211e2b49d86-dirty","ip":"192.168.0.101","port":"6000","status_port":"3080","deploy_path":"/Users/zhangming/gopath/src/github.com/pingcap/TiProxy/bin","start_timestamp":1686390578}
/topology/tiproxy/192.168.0.101:6000/ttl
1686390578299853000

And then shutdown TiProxy and check it again after 1 min:

/topology/tiproxy/192.168.0.101:6000/info
{"version":"topo","git_hash":"66d42d553315fd26a3bbd677036ec211e2b49d86-dirty","ip":"192.168.0.101","port":"6000","status_port":"3080","deploy_path":"/Users/zhangming/gopath/src/github.com/pingcap/TiProxy/bin","start_timestamp":1686390578}

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change
  • Has tiproxyctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@djshow832 djshow832 requested a review from xhebox June 10, 2023 09:57
pkg/manager/infosync/info.go Outdated Show resolved Hide resolved
pkg/manager/infosync/info_test.go Show resolved Hide resolved
@djshow832 djshow832 requested a review from xhebox June 13, 2023 03:34
Copy link
Collaborator

@xhebox xhebox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

pkg/manager/infosync/info.go Show resolved Hide resolved
pkg/manager/infosync/info.go Show resolved Hide resolved
@djshow832 djshow832 merged commit d418199 into pingcap:main Jun 13, 2023
@djshow832 djshow832 deleted the topo branch June 13, 2023 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Register TiProxy into PD
2 participants