Skip to content

Commit

Permalink
Fix release version (pingcap#37)
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoguang Sun <sunxiaoguang@gmail.com>

Signed-off-by: Xiaoguang Sun <sunxiaoguang@gmail.com>
  • Loading branch information
sunxiaoguang authored Aug 24, 2022
1 parent 1f3a028 commit 5d17be9
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 15 deletions.
5 changes: 1 addition & 4 deletions br/pkg/version/build/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ var (
)

func getReleaseVersion() string {
if mysql.TiDBReleaseVersion != "None" {
return mysql.TiDBReleaseVersion
}
return "v6.0.0-master"
return mysql.TiDBReleaseVersionFixed
}

// AppName is a name of a built binary.
Expand Down
2 changes: 1 addition & 1 deletion ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func (dc *ddlCtx) isOwner() bool {
isOwner := dc.ownerManager.IsOwner()
logutil.BgLogger().Debug("[ddl] check whether is the DDL owner", zap.Bool("isOwner", isOwner), zap.String("selfID", dc.uuid))
if isOwner {
metrics.DDLCounter.WithLabelValues(metrics.DDLOwner + "_" + mysql.TiDBReleaseVersion).Inc()
metrics.DDLCounter.WithLabelValues(metrics.DDLOwner + "_" + mysql.TiDBReleaseVersionFixed).Inc()
}
return isOwner
}
Expand Down
4 changes: 2 additions & 2 deletions domain/infosync/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ func (is *InfoSyncer) getTopologyInfo() TopologyInfo {
dir := path.Dir(s)
return TopologyInfo{
ServerVersionInfo: ServerVersionInfo{
Version: mysql.TiDBReleaseVersion,
Version: mysql.TiDBReleaseVersionFixed,
GitHash: is.info.ServerVersionInfo.GitHash,
},
IP: is.info.IP,
Expand Down Expand Up @@ -940,7 +940,7 @@ func getServerInfo(id string, serverIDGetter func() uint64) *ServerInfo {
info.Version = mysql.ServerVersion
info.GitHash = versioninfo.TiDBGitHash

metrics.ServerInfo.WithLabelValues(mysql.TiDBReleaseVersion, info.GitHash).Set(float64(info.StartTimestamp))
metrics.ServerInfo.WithLabelValues(mysql.TiDBReleaseVersionFixed, info.GitHash).Set(float64(info.StartTimestamp))

failpoint.Inject("mockServerInfo", func(val failpoint.Value) {
if val.(bool) {
Expand Down
2 changes: 1 addition & 1 deletion expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ func TestInfoBuiltin(t *testing.T) {
tidbVersionResult += fmt.Sprint(line)
}
lines := strings.Split(tidbVersionResult, "\n")
assert.Equal(t, true, strings.Split(lines[0], " ")[2] == mysql.TiDBReleaseVersion, "errors in 'select tidb_version()'")
assert.Equal(t, true, strings.Split(lines[0], " ")[2] == mysql.TiDBReleaseVersionFixed, "errors in 'select tidb_version()'")
assert.Equal(t, true, strings.Split(lines[1], " ")[1] == versioninfo.TiDBEdition, "errors in 'select tidb_version()'")

// for row_count
Expand Down
5 changes: 3 additions & 2 deletions parser/mysql/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ func newInvalidModeErr(s string) error {
// Version information.
var (
// TiDBReleaseVersion is initialized by (git describe --tags) in Makefile.
TiDBReleaseVersion = "None"
TiDBReleaseVersion = "None"
TiDBReleaseVersionFixed = "v6.2.0"

// ServerVersion is the version information of this tidb-server in MySQL's format.
ServerVersion = fmt.Sprintf("5.7.25-TiDB-%s", TiDBReleaseVersion)
ServerVersion = fmt.Sprintf("5.7.25-TiDB-%s", TiDBReleaseVersionFixed)
)

// Header information.
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ func (cc *clientConn) connectInfo() *variable.ConnectionInfo {
User: cc.user,
ServerOSLoginUser: osUser,
OSVersion: osVersion,
ServerVersion: mysql.TiDBReleaseVersion,
ServerVersion: mysql.TiDBReleaseVersionFixed,
SSLVersion: "v1.2.0", // for current go version
PID: serverPID,
DB: cc.dbname,
Expand Down
2 changes: 1 addition & 1 deletion telemetry/data_slow_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func init() {
lastSQBInfo["+Inf"] = 0
currentSQBInfo["+Inf"] = 0

if mysql.TiDBReleaseVersion != "None" {
if mysql.TiDBReleaseVersionFixed != "None" {
logutil.BgLogger().Debug("Telemetry slow query stats initialized", zap.String("currentSQBInfo", currentSQBInfo.String()), zap.String("lastSQBInfo", lastSQBInfo.String()))
}
}
Expand Down
4 changes: 2 additions & 2 deletions tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ func setVersions() {
versioninfo.TiDBEdition = cfg.TiDBEdition
}
if len(cfg.TiDBReleaseVersion) > 0 {
mysql.TiDBReleaseVersion = cfg.TiDBReleaseVersion
mysql.TiDBReleaseVersionFixed = cfg.TiDBReleaseVersion
}
}

Expand Down Expand Up @@ -648,7 +648,7 @@ func setGlobalVars() {
variable.SetSysVar(variable.VersionComment, cfg.VersionComment)
}
if len(cfg.TiDBReleaseVersion) > 0 {
mysql.TiDBReleaseVersion = cfg.TiDBReleaseVersion
mysql.TiDBReleaseVersionFixed = cfg.TiDBReleaseVersion
}

variable.SetSysVar(variable.TiDBForcePriority, mysql.Priority2Str[priority])
Expand Down
2 changes: 1 addition & 1 deletion util/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
// PrintTiDBInfo prints the TiDB version information.
func PrintTiDBInfo() {
logutil.BgLogger().Info("Welcome to TiDB.",
zap.String("Release Version", mysql.TiDBReleaseVersion),
zap.String("Release Version", mysql.TiDBReleaseVersionFixed),
zap.String("Edition", versioninfo.TiDBEdition),
zap.String("Git Commit Hash", versioninfo.TiDBGitHash),
zap.String("Git Branch", versioninfo.TiDBGitBranch),
Expand Down

0 comments on commit 5d17be9

Please sign in to comment.