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 TIDB_CLUSTER_CONFIG virtual table to retrieve all instance config #13063
Conversation
Codecov Report
@@ Coverage Diff @@
## master #13063 +/- ##
================================================
+ Coverage 80.1498% 80.2235% +0.0736%
================================================
Files 469 469
Lines 111823 112012 +189
================================================
+ Hits 89626 89860 +234
+ Misses 15308 15287 -21
+ Partials 6889 6865 -24 |
…tances config Signed-off-by: Lonng <heng@lonng.org>
Co-Authored-By: djshow832 <873581766@qq.com>
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
@@ -1971,6 +1985,145 @@ func dataForTiDBClusterInfo(ctx sessionctx.Context) ([][]types.Datum, error) { | |||
return rows, nil | |||
} | |||
|
|||
func dataForClusterConfig(ctx sessionctx.Context) ([][]types.Datum, error) { | |||
sql := "SELECT type, name, address, status_address FROM INFORMATION_SCHEMA.TIDB_CLUSTER_INFO ORDER BY type" | |||
rows, _, err := ctx.(sqlexec.RestrictedSQLExecutor).ExecRestrictedSQL(sql) |
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.
How about use dataForTiDBClusterInfo
directly?
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 caller cannot assume the dataForTiDBClusterInfo
results and prefer to use ORDER BY
clause instead of sorting results manually.
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 |
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 configuration information. We need to use different HTTP interfaces of different components to retrieve them.
eg.
/pd/api/v1/config
/config
Furthermore, there is no an utility way to filter configuration items or aggregate them.
What is changed and how it works?
This PR introduces the
information_schema.tidb_cluster_config
and make the user can retrieve cluster configuration easier viaselect * from information_schema.tidb_cluster_config
.And we can filter them easily:
select * from information_schema.tidb_cluster_config where type='tikv' and `key` like 'raft%'
Check List
Tests
Release note
select * from information_schema.tidb_cluster_config