-
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
infoschema: add information_schema.tidb_cluster_info to retrieve cluster topology. #13035
Conversation
…ter topology. Signed-off-by: Lonng <heng@lonng.org>
Signed-off-by: Lonng <heng@lonng.org>
Signed-off-by: Lonng <heng@lonng.org>
Codecov Report
@@ Coverage Diff @@
## master #13035 +/- ##
================================================
- Coverage 80.2271% 80.0246% -0.2025%
================================================
Files 468 468
Lines 111208 110146 -1062
================================================
- Hits 89219 88144 -1075
- Misses 15212 15217 +5
- Partials 6777 6785 +8 |
if err != nil { | ||
return nil, errors.Trace(err) | ||
} | ||
terror.Log(resp.Body.Close()) |
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.
In this way, it always calls an extra function.
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.
terror.Log
it a utility function equals if err != nil {...}
.
Signed-off-by: Lonng <heng@lonng.org>
Signed-off-by: Lonng <heng@lonng.org>
Signed-off-by: Lonng <heng@lonng.org>
LGTM |
infoschema/tables.go
Outdated
|
||
// Get PD git_hash | ||
url = fmt.Sprintf("http://%s%s", addr, pdapi.Status) | ||
resp, err = http.Get(url) |
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 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.
Nice catch, seems PD should not redirect all request to leader.
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.
Signed-off-by: Lonng <heng@lonng.org>
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
/merge |
/run-all-tests |
1 similar comment
/run-all-tests |
Signed-off-by: Lonng heng@lonng.org
What problem does this PR solve?
In the current version, we don't have a simple way to get cluster information. We need to use different interfaces of different components or even different ways to get topology information.
What is changed and how it works?
This PR introduces the
information_schema.tidb_cluster_info
and make the user can retrieve cluster topology easier viaselect * from information_schema.tidb_cluster_info
.Check List
Tests
Release note
select * from information_schema.tidb_cluster_info