Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wshwsh12 committed Sep 21, 2022
1 parent 75d0191 commit 9826ae0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1820,8 +1820,8 @@ func (do *Domain) ExpensiveQueryHandle() *expensivequery.Handle {
return do.expensiveQueryHandle
}

// ServerMemoryQuotaHandle returns the expensive query handle.
func (do *Domain) ServerMemoryQuotaHandle() *servermemorylimit.Handle {
// ServerMemoryLimitHandle returns the expensive query handle.
func (do *Domain) ServerMemoryLimitHandle() *servermemorylimit.Handle {
return do.serverMemoryLimitHandle
}

Expand Down
4 changes: 2 additions & 2 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6023,8 +6023,8 @@ func TestGlobalMemoryControl(t *testing.T) {
sm := &testkit.MockSessionManager{
PS: []*util.ProcessInfo{tk1.Session().ShowProcess(), tk2.Session().ShowProcess(), tk3.Session().ShowProcess()},
}
dom.ServerMemoryQuotaHandle().SetSessionManager(sm)
go dom.ServerMemoryQuotaHandle().Run()
dom.ServerMemoryLimitHandle().SetSessionManager(sm)
go dom.ServerMemoryLimitHandle().Run()

tracker1.Consume(100 << 20) // 100 MB
tracker2.Consume(200 << 20) // 200 MB
Expand Down
6 changes: 3 additions & 3 deletions sessionctx/variable/sysvar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ func TestSetTIDBDiskQuota(t *testing.T) {
require.Equal(t, strconv.FormatInt(pb, 10), val)
}

func TestTiDBServerMemoryQuota(t *testing.T) {
func TestTiDBServerMemoryLimit(t *testing.T) {
vars := NewSessionVars()
mock := NewMockGlobalAccessor4Tests()
mock.SessionVars = vars
Expand All @@ -759,9 +759,9 @@ func TestTiDBServerMemoryQuota(t *testing.T) {
val string
)
// Test tidb_server_memory_limit
serverMemoryQuota := GetSysVar(TiDBServerMemoryLimit)
serverMemoryLimit := GetSysVar(TiDBServerMemoryLimit)
// Check default value
require.Equal(t, serverMemoryQuota.Value, strconv.FormatUint(DefTiDBServerMemoryLimit, 10))
require.Equal(t, serverMemoryLimit.Value, strconv.FormatUint(DefTiDBServerMemoryLimit, 10))

// MinValue is 512 MB
err = mock.SetGlobalSysVar(TiDBServerMemoryLimit, strconv.FormatUint(100*mb, 10))
Expand Down
2 changes: 1 addition & 1 deletion tidb-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ func createServer(storage kv.Storage, dom *domain.Domain) *server.Server {
svr.SetDomain(dom)
svr.InitGlobalConnID(dom.ServerID)
go dom.ExpensiveQueryHandle().SetSessionManager(svr).Run()
go dom.ServerMemoryQuotaHandle().SetSessionManager(svr).Run()
go dom.ServerMemoryLimitHandle().SetSessionManager(svr).Run()
dom.InfoSyncer().SetSessionManager(svr)
return svr
}
Expand Down
2 changes: 1 addition & 1 deletion util/servermemorylimit/servermemoryquota.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/pingcap/tidb/util/memory"
)

// Handle is the handler for server memory quota.
// Handle is the handler for server memory limit.
type Handle struct {
exitCh chan struct{}
sm atomic.Value
Expand Down

0 comments on commit 9826ae0

Please sign in to comment.