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

*: Show edition information when mysql client login (#17170) #17187

Merged
merged 1 commit into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"},
Expand Down
4 changes: 4 additions & 0 deletions util/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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),
Expand All @@ -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"+
Expand All @@ -65,6 +68,7 @@ func GetTiDBInfo() string {
"TiKV Min Version: %s\n"+
"Check Table Before Drop: %v",
mysql.TiDBReleaseVersion,
TiDBEdition,
TiDBGitHash,
TiDBGitBranch,
TiDBBuildTS,
Expand Down