diff --git a/Makefile b/Makefile index 37b71a11124a2..793d44b7ca930 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ GOBUILDCOVERAGE := GOPATH=$(GOPATH) cd tidb-server; $(GO) test -coverpkg="../... GOTEST := $(GO) test -p $(P) OVERALLS := GO111MODULE=on overalls STATICCHECK := GO111MODULE=on staticcheck +TIDB_EDITION ?= Community ARCH := "`uname -s`" LINUX := "Linux" @@ -47,6 +48,7 @@ LDFLAGS += -X "github.com/pingcap/parser/mysql.TiDBReleaseVersion=$(shell git de LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBBuildTS=$(shell date -u '+%Y-%m-%d %I:%M:%S')" LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitHash=$(shell git rev-parse HEAD)" LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitBranch=$(shell git rev-parse --abbrev-ref HEAD)" +LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBEdition=$(TIDB_EDITION)" TEST_LDFLAGS = -X "github.com/pingcap/tidb/config.checkBeforeDropLDFlag=1" COVERAGE_SERVER_LDFLAGS = -X "github.com/pingcap/tidb/tidb-server.isCoverageServer=1" diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index 95d52c84cf41f..a89949b9d03ff 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -22,6 +22,7 @@ import ( "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/util/logutil" + "github.com/pingcap/tidb/util/printer" ) // ScopeFlag is for system variable whether can be changed in global/session dynamically or not. @@ -385,7 +386,7 @@ var defaultSysVars = []*SysVar{ {ScopeGlobal | ScopeSession, "binlog_format", "STATEMENT"}, {ScopeGlobal | ScopeSession, "optimizer_trace", "enabled=off,one_line=off"}, {ScopeGlobal | ScopeSession, "read_rnd_buffer_size", "262144"}, - {ScopeNone, "version_comment", "TiDB Server (Apache License 2.0), MySQL 5.7 compatible"}, + {ScopeNone, "version_comment", "TiDB Server (Apache License 2.0) " + printer.TiDBEdition + " Edition, MySQL 5.7 compatible"}, {ScopeGlobal | ScopeSession, NetWriteTimeout, "60"}, {ScopeGlobal, InnodbBufferPoolLoadAbort, "0"}, {ScopeGlobal | ScopeSession, TxnIsolation, "REPEATABLE-READ"}, diff --git a/util/printer/printer.go b/util/printer/printer.go index c689d93ba2cb4..ff655338ee16a 100644 --- a/util/printer/printer.go +++ b/util/printer/printer.go @@ -32,6 +32,7 @@ var ( TiDBBuildTS = "None" TiDBGitHash = "None" TiDBGitBranch = "None" + TiDBEdition = "None" // TiKVMinVersion is the minimum version of TiKV that can be compatible with the current TiDB. TiKVMinVersion = "v3.0.0-60965b006877ca7234adaced7890d7b029ed1306" ) @@ -40,6 +41,7 @@ var ( func PrintTiDBInfo() { logutil.BgLogger().Info("Welcome to TiDB.", zap.String("Release Version", mysql.TiDBReleaseVersion), + zap.String("Edition", TiDBEdition), zap.String("Git Commit Hash", TiDBGitHash), zap.String("Git Branch", TiDBGitBranch), zap.String("UTC Build Time", TiDBBuildTS), @@ -57,6 +59,7 @@ func PrintTiDBInfo() { // GetTiDBInfo returns the git hash and build time of this tidb-server binary. func GetTiDBInfo() string { return fmt.Sprintf("Release Version: %s\n"+ + "Edition: %s\n"+ "Git Commit Hash: %s\n"+ "Git Branch: %s\n"+ "UTC Build Time: %s\n"+ @@ -65,6 +68,7 @@ func GetTiDBInfo() string { "TiKV Min Version: %s\n"+ "Check Table Before Drop: %v", mysql.TiDBReleaseVersion, + TiDBEdition, TiDBGitHash, TiDBGitBranch, TiDBBuildTS,