Skip to content

Commit

Permalink
set tidb_log_bin after bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
WangXiangUSTC committed Mar 11, 2019
1 parent 5eeb1b1 commit 27d17e6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,14 @@ func BootstrapSession(store kv.Storage) (*domain.Domain, error) {
return nil, errors.Trace(err)
}

// get global system tidb_log_bin from mysql.GLOBAL_VARIABLES
tidbLogBin, err := se1.GetGlobalSysVar(variable.TiDBLogBin)
if err != nil {
return nil, errors.Trace(err)
}
variable.SysVars[variable.TiDBLogBin].Value = tidbLogBin


if len(cfg.Plugin.Load) > 0 {
plugin.InitWatchLoops(dom.GetEtcdClient())
}
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/binloginfo/binloginfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func SetIgnoreError(on bool) {

// ShouldEnableBinlog returns true if binlog.enable is "on", or binlog.enable is "auto" and tidb_log_bin's value is "1"
func ShouldEnableBinlog() bool {
return config.GetGlobalConfig().Binlog.Enable == "on" || (config.GetGlobalConfig().Binlog.Enable == "auto" && variable.SysVars[variable.TiDBLogBin].Value == "1")
return config.GetGlobalConfig().Binlog.Enable == "on" || (config.GetGlobalConfig().Binlog.Enable == "auto" && variable.SysVars[variable.TiDBLogBin].Value=="1")
}

// WriteBinlog writes a binlog to Pump.
Expand Down
3 changes: 2 additions & 1 deletion tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ func main() {
setupLog()
setupTracing() // Should before createServer and after setup config.
printInfo()
setupBinlogClient()
setupMetrics()
createStoreAndDomain()
// setupBinlogClient should run after bootstrap
setupBinlogClient()
createServer()
signal.SetupSignalHandler(serverShutdown)
runServer()
Expand Down

0 comments on commit 27d17e6

Please sign in to comment.