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

sessionctx: show correct TiDB port instead of 3306 #9365

Merged
merged 3 commits into from
Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ var defaultSysVars = []*SysVar{
{ScopeGlobal, "innodb_buffer_pool_load_now", "OFF"},
{ScopeNone, "performance_schema_max_rwlock_classes", "40"},
{ScopeNone, "binlog_gtid_simple_recovery", "OFF"},
{ScopeNone, "port", "3306"},
{ScopeNone, "port", strconv.FormatUint(uint64(config.GetGlobalConfig().Port), 10)},
morgo marked this conversation as resolved.
Show resolved Hide resolved
{ScopeNone, "performance_schema_digests_size", "10000"},
{ScopeGlobal | ScopeSession, "profiling", "OFF"},
{ScopeNone, "lower_case_table_names", "2"},
Expand Down Expand Up @@ -798,6 +798,8 @@ const (
PluginDir = "plugin_dir"
// PluginLoad is the name of 'plugin_load' system variable.
PluginLoad = "plugin_load"
// Port is the name for 'port' system variable.
Port = "port"
)

// GlobalVarAccessor is the interface for accessing global scope system and status variables.
Expand Down
5 changes: 5 additions & 0 deletions sessionctx/variable/sysvar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ func (*testSysVarSuite) TestSysVar(c *C) {
f = GetSysVar("explicit_defaults_for_timestamp")
c.Assert(f, NotNil)
c.Assert(f.Value, Equals, "ON")

f = GetSysVar("port")
c.Assert(f, NotNil)
c.Assert(f.Value, Equals, "4000")

}