Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
XuHuaiyu committed Dec 23, 2019
1 parent 99a6574 commit c6f9e29
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions distsql/distsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func Select(ctx context.Context, sctx sessionctx.Context, kvReq *kv.Request, fie
label = metrics.LblInternal
}

// kvReq.MemTracker is used to trace and control memory usage in DistSQL layer;
// kvReq.memTracker is used to trace and control memory usage in DistSQL layer;
// for streamResult, since it is a pipeline which has no buffer, it's not necessary to trace it;
// for selectResult, we just use the kvReq.MemTracker prepared for co-processor
// for selectResult, we just use the kvReq.memTracker prepared for co-processor
// instead of creating a new one for simplification.
if kvReq.Streaming {
return &streamResult{
Expand Down
14 changes: 7 additions & 7 deletions executor/distsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ type lookupTableTask struct {
duplicatedIndexOrder map[int64]int

// memUsage records the memory usage of this task calculated by table worker.
// MemTracker is used to release memUsage after task is done and unused.
// memTracker is used to release memUsage after task is done and unused.
//
// The sequence of function calls are:
// 1. calculate task.memUsage.
// 2. task.MemTracker = tableWorker.MemTracker
// 3. task.MemTracker.Consume(task.memUsage)
// 4. task.MemTracker.Consume(-task.memUsage)
// 2. task.memTracker = tableWorker.memTracker
// 3. task.memTracker.Consume(task.memUsage)
// 4. task.memTracker.Consume(-task.memUsage)
//
// Step 1~3 are completed in "tableWorker.executeTask".
// Step 4 is completed in "IndexLookUpExecutor.Next".
Expand Down Expand Up @@ -345,7 +345,7 @@ type IndexLookUpExecutor struct {
resultCurr *lookupTableTask
feedback *statistics.QueryFeedback

// MemTracker is used to track the memory usage of this executor.
// memTracker is used to track the memory usage of this executor.
memTracker *memory.Tracker

// checkIndexValue is used to check the consistency of the index data.
Expand Down Expand Up @@ -390,7 +390,7 @@ func (e *IndexLookUpExecutor) Open(ctx context.Context) error {
}

func (e *IndexLookUpExecutor) open(ctx context.Context) error {
// We have to initialize "MemTracker" and other execution resources in here
// We have to initialize "memTracker" and other execution resources in here
// instead of in function "Open", because this "IndexLookUpExecutor" may be
// constructed by a "IndexLookUpJoin" and "Open" will not be called in that
// situation.
Expand Down Expand Up @@ -787,7 +787,7 @@ type tableWorker struct {
keepOrder bool
handleIdx int

// MemTracker is used to track the memory usage of this executor.
// memTracker is used to track the memory usage of this executor.
memTracker *memory.Tracker

// checkIndexValue is used to check the consistency of the index data.
Expand Down
2 changes: 1 addition & 1 deletion executor/hash_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ type hashRowContainer struct {
// hashTable stores the map of hashKey and RowPtr
hashTable *rowHashMap

// MemTracker is the reference of records.GetMemTracker().
// memTracker is the reference of records.GetMemTracker().
// records would be set to nil for garbage collection when spilling is activated
// so we need this reference.
memTracker *memory.Tracker
Expand Down
6 changes: 3 additions & 3 deletions executor/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type InsertExec struct {
row4Update []types.Datum

Priority mysql.PriorityEnum
MemTracker *memory.Tracker
memTracker *memory.Tracker
}

func (e *InsertExec) exec(ctx context.Context, rows [][]types.Datum, memTracker *memory.Tracker) error {
Expand Down Expand Up @@ -269,8 +269,8 @@ func (e *InsertExec) Close() error {

// Open implements the Executor Open interface.
func (e *InsertExec) Open(ctx context.Context) error {
e.MemTracker = memory.NewTracker(e.id, -1)
e.MemTracker.AttachTo(e.ctx.GetSessionVars().StmtCtx.MemTracker)
e.memTracker = memory.NewTracker(e.id, -1)
e.memTracker.AttachTo(e.ctx.GetSessionVars().StmtCtx.MemTracker)

if e.OnDuplicate != nil {
e.initEvalBuffer4Dup()
Expand Down
4 changes: 2 additions & 2 deletions executor/insert_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func insertRows(ctx context.Context, base insertCommon) (err error) {
}
var memTracker *memory.Tracker
if insertExec, ok := base.(*InsertExec); ok {
memTracker = insertExec.MemTracker
memTracker = insertExec.memTracker
} else {
replaceExec := base.(*ReplaceExec)
memTracker = replaceExec.MemTracker
Expand Down Expand Up @@ -401,7 +401,7 @@ func insertRowsFromSelect(ctx context.Context, base insertCommon) error {
rows := make([][]types.Datum, 0, chk.Capacity())
var memTracker *memory.Tracker
if insertExec, ok := base.(*InsertExec); ok {
memTracker = insertExec.MemTracker
memTracker = insertExec.memTracker
} else {
replaceExec := base.(*ReplaceExec)
memTracker = replaceExec.MemTracker
Expand Down
2 changes: 1 addition & 1 deletion kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ type Request struct {
IsolationLevel IsoLevel
// Priority is the priority of this KV request, its value may be PriorityNormal/PriorityLow/PriorityHigh.
Priority int
// MemTracker is used to trace and control memory usage in co-processor layer.
// memTracker is used to trace and control memory usage in co-processor layer.
MemTracker *memory.Tracker
// KeepOrder is true, if the response should be returned in order.
KeepOrder bool
Expand Down
1 change: 0 additions & 1 deletion session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import (
"github.com/pingcap/tidb/util/timeutil"
"github.com/pingcap/tipb/go-binlog"
"go.uber.org/zap"
"github.com/pingcap/tidb/util/memory"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion session/tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func runStmt(ctx context.Context, sctx sessionctx.Context, s sqlexec.Statement)
if err != nil {
sctx.StmtRollback()
} else {
err = sctx.StmtCommit(nil)
err = sctx.StmtCommit(sctx.GetSessionVars().StmtCtx.MemTracker)
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion table/tables/tables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func (ts *testSuite) TestUnsignedPK(c *C) {
c.Assert(err, IsNil)
c.Assert(len(row), Equals, 2)
c.Assert(row[0].Kind(), Equals, types.KindUint64)
c.Assert(ts.se.StmtCommit(), IsNil)
c.Assert(ts.se.StmtCommit(nil), IsNil)
txn, err := ts.se.Txn(true)
c.Assert(err, IsNil)
c.Assert(txn.Commit(context.Background()), IsNil)
Expand Down

0 comments on commit c6f9e29

Please sign in to comment.