Skip to content

Commit

Permalink
main: update variable.Version equals to ServerVersion which set in th…
Browse files Browse the repository at this point in the history
…e configuration file(#27210) (#27731)
  • Loading branch information
Defined2014 authored Sep 2, 2021
1 parent b0c9d19 commit 207eb3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ func setGlobalVars() {
variable.SetSysVar(variable.Port, fmt.Sprintf("%d", cfg.Port))
variable.SetSysVar(variable.Socket, cfg.Socket)
variable.SetSysVar(variable.DataDir, cfg.Path)
variable.SetSysVar(variable.Version, cfg.ServerVersion)
variable.SetSysVar(variable.TiDBSlowQueryFile, cfg.Log.SlowQueryFile)
variable.SetSysVar(variable.TiDBIsolationReadEngines, strings.Join(cfg.IsolationRead.Engines, ","))
variable.SetSysVar(variable.TiDBEnforceMPPExecution, variable.BoolToOnOff(config.GetGlobalConfig().Performance.EnforceMPP))
Expand Down
3 changes: 3 additions & 0 deletions tidb-server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ func TestRunMain(t *testing.T) {
func TestSetGlobalVars(t *testing.T) {
require.Equal(t, "tikv,tiflash,tidb", variable.GetSysVar(variable.TiDBIsolationReadEngines).Value)
require.Equal(t, "1073741824", variable.GetSysVar(variable.TiDBMemQuotaQuery).Value)
require.NotEqual(t, "test", variable.GetSysVar(variable.Version).Value)

config.UpdateGlobal(func(conf *config.Config) {
conf.IsolationRead.Engines = []string{"tikv", "tidb"}
conf.MemQuotaQuery = 9999999
conf.ServerVersion = "test"
})
setGlobalVars()

require.Equal(t, "tikv,tidb", variable.GetSysVar(variable.TiDBIsolationReadEngines).Value)
require.Equal(t, "9999999", variable.GetSysVar(variable.TiDBMemQuotaQuery).Value)
require.Equal(t, "test", variable.GetSysVar(variable.Version).Value)
}

0 comments on commit 207eb3b

Please sign in to comment.