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

cluster_info table: it's better to show v4.0.0-rc instead of 5.7.25-TiDB-v4.0.0-rc #16302

Closed
zz-jason opened this issue Apr 11, 2020 · 3 comments
Assignees
Labels
sig/execution SIG execution type/enhancement The issue or PR belongs to an enhancement.

Comments

@zz-jason
Copy link
Member

Description

start a cluster, then show the cluster info:

select * from information_schema.cluster_info;

the result is:

mysql> select * from information_schema.cluster_info;
+------+-----------------+-----------------+-----------------------+------------------------------------------+---------------------------+------------------+
| TYPE | INSTANCE        | STATUS_ADDRESS  | VERSION               | GIT_HASH                                 | START_TIME                | UPTIME           |
+------+-----------------+-----------------+-----------------------+------------------------------------------+---------------------------+------------------+
| tidb | 127.0.0.1:4000  | 127.0.0.1:10080 | 5.7.25-TiDB-v4.0.0-rc | 79db9e30ab8f98ac07c8ae55c66dfecc24b43d56 | 2020-04-11T02:10:17-04:00 | 12m11.024353044s |
| pd   | 127.0.0.1:2379  | 127.0.0.1:2379  | 4.0.0-rc              | 6f06805f3b0070107fcb4af68b2fc224dee0714d | 2020-04-11T02:10:11-04:00 | 12m17.024356408s |
| tikv | 127.0.0.1:20160 | 127.0.0.1:20180 | 4.0.0-rc              | f45d0c963df3ee4b1011caf5eb146cacd1fbbad8 | 2020-04-11T02:10:15-04:00 | 12m13.02435805s  |
+------+-----------------+-----------------+-----------------------+------------------------------------------+---------------------------+------------------+
3 rows in set (0.00 sec)

As you can see, VERSION of tidb is different from tikv and pd. I think it's better to show the same version info.

@zz-jason zz-jason added the type/enhancement The issue or PR belongs to an enhancement. label Apr 11, 2020
@zz-jason
Copy link
Member Author

@crazycs520 PTAL

@zz-jason zz-jason added the sig/execution SIG execution label Apr 15, 2020
@crazycs520
Copy link
Contributor

Already fix in #16003

@dveeden
Copy link
Contributor

dveeden commented Jul 6, 2023

This is fixed here:

tidb/infoschema/tables.go

Lines 1762 to 1784 in 967699a

// FormatTiDBVersion make TiDBVersion consistent to TiKV and PD.
// The default TiDBVersion is 5.7.25-TiDB-${TiDBReleaseVersion}.
func FormatTiDBVersion(TiDBVersion string, isDefaultVersion bool) string {
var version, nodeVersion string
// The user hasn't set the config 'ServerVersion'.
if isDefaultVersion {
nodeVersion = TiDBVersion[strings.Index(TiDBVersion, "TiDB-")+len("TiDB-"):]
if len(nodeVersion) > 0 && nodeVersion[0] == 'v' {
nodeVersion = nodeVersion[1:]
}
nodeVersions := strings.Split(nodeVersion, "-")
if len(nodeVersions) == 1 {
version = nodeVersions[0]
} else if len(nodeVersions) >= 2 {
version = fmt.Sprintf("%s-%s", nodeVersions[0], nodeVersions[1])
}
} else { // The user has already set the config 'ServerVersion',it would be a complex scene, so just use the 'ServerVersion' as version.
version = TiDBVersion
}
return version
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

3 participants