diff --git a/ddl/ddl.go b/ddl/ddl.go index aa9b461a65453..50c426763340a 100644 --- a/ddl/ddl.go +++ b/ddl/ddl.go @@ -114,7 +114,7 @@ func newDDL(store kv.Storage, infoHandle *infoschema.Handle, hook Callback, leas d.start() - variable.RegisterStatist(d) + variable.RegisterStatistics(d) return d } diff --git a/domain/domain.go b/domain/domain.go index ae34278520f1c..98b52e67a3f53 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -108,7 +108,7 @@ func (do *Domain) SetLease(lease time.Duration) { do.ddl.SetLease(lease) } -// Stats returns the DDL statistic. +// Stats returns the domain statistic. func (do *Domain) Stats() (map[string]interface{}, error) { m := make(map[string]interface{}) m[ddlLastReloadSchemaTS] = atomic.LoadInt64(&do.lastLeaseTS) @@ -195,7 +195,7 @@ func NewDomain(store kv.Storage, lease time.Duration) (d *Domain, err error) { log.Fatalf("load schema err %v", err) } - variable.RegisterStatist(d) + variable.RegisterStatistics(d) go d.loadSchemaInLoop(lease) diff --git a/plan/plans/show_test.go b/plan/plans/show_test.go index 4e117ab37c2d7..b0c65463ccd8e 100644 --- a/plan/plans/show_test.go +++ b/plan/plans/show_test.go @@ -58,7 +58,7 @@ func (p *testShowSuit) SetUpSuite(c *C) { p.ctx = nc variable.BindSessionVars(p.ctx) variable.BindGlobalVarAccessor(p.ctx, nc) - variable.RegisterStatist(p.ms) + variable.RegisterStatistics(p.ms) p.dbName = "testshowplan" p.store = newStore(c, p.dbName) diff --git a/sessionctx/variable/statusvar.go b/sessionctx/variable/statusvar.go index e1db3e3128231..f260d976dfcbe 100644 --- a/sessionctx/variable/statusvar.go +++ b/sessionctx/variable/statusvar.go @@ -25,8 +25,8 @@ var globalStatusScopes = make(map[string]ScopeFlag) // DefaultScopeFlag is the status default scope. var DefaultScopeFlag = ScopeGlobal | ScopeSession -// Statists is the set of all statists. -var Statists []Statist +// StatisticsList is the set of all statistics. +var StatisticsList []Statistics // StatusVal is the value of the corresponding status variable. type StatusVal struct { @@ -34,32 +34,32 @@ type StatusVal struct { Value interface{} } -// Statist is the interface of statist. -type Statist interface { +// Statistics is the interface of statistics. +type Statistics interface { // GetScope gets the status variables scope. GetScope(status string) ScopeFlag - // Stats returns the statist statistics. + // Stats returns the statistics status variables. Stats() (map[string]interface{}, error) } -// RegisterStatist registers statist. -func RegisterStatist(s Statist) { - Statists = append(Statists, s) +// RegisterStatistics registers statistics. +func RegisterStatistics(s Statistics) { + StatisticsList = append(StatisticsList, s) } -// GetStatusVars gets registered statists status variables. +// GetStatusVars gets registered statistics status variables. func GetStatusVars() (map[string]*StatusVal, error) { statusVars = make(map[string]*StatusVal) ret := make(map[string]*StatusVal) - for _, statist := range Statists { - vals, err := statist.Stats() + for _, statistics := range StatisticsList { + vals, err := statistics.Stats() if err != nil { return nil, errors.Trace(err) } for name, val := range vals { - scope := statist.GetScope(name) + scope := statistics.GetScope(name) statusVars[name] = &StatusVal{Value: val, Scope: scope} ret[name] = &StatusVal{Value: val, Scope: scope} } diff --git a/sessionctx/variable/statusvar_test.go b/sessionctx/variable/statusvar_test.go index 8d4630b5ce132..fb5046d25c419 100644 --- a/sessionctx/variable/statusvar_test.go +++ b/sessionctx/variable/statusvar_test.go @@ -25,7 +25,7 @@ type testStatusVarSuite struct { func (s *testStatusVarSuite) SetUpSuite(c *C) { s.ms = &mockStatist{} - RegisterStatist(s.ms) + RegisterStatistics(s.ms) } // mockStatist represents mocked statist.