Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
Signed-off-by: hehechen <[email protected]>
  • Loading branch information
hehechen committed Dec 20, 2022
1 parent fd0a6f7 commit 7316f8c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
3 changes: 1 addition & 2 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import (
"github.com/pingcap/tidb/parser/ast"
"github.com/pingcap/tidb/parser/model"
"github.com/pingcap/tidb/parser/mysql"
"github.com/pingcap/tidb/planner/core"
plannercore "github.com/pingcap/tidb/planner/core"
plannerutil "github.com/pingcap/tidb/planner/util"
"github.com/pingcap/tidb/sessionctx"
Expand Down Expand Up @@ -134,7 +133,7 @@ func newExecutorBuilder(ctx sessionctx.Context, is infoschema.InfoSchema, ti *Te
txnScope: txnManager.GetTxnScope(),
readReplicaScope: txnManager.GetReadReplicaScope(),
queryTS: uint64(time.Now().UnixNano()),
localQueryID: core.AllocMPPQueryID(),
localQueryID: plannercore.AllocMPPQueryID(),
}
}

Expand Down
8 changes: 1 addition & 7 deletions executor/tiflashtest/tiflash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,8 @@ func TestMppExecution(t *testing.T) {
tk.MustExec("begin")
tk.MustQuery("select count(*) from ( select * from t2 group by a, b) A group by A.b").Check(testkit.Rows("3"))
tk.MustQuery("select count(*) from t1 where t1.a+100 > ( select count(*) from t2 where t1.a=t2.a and t1.b=t2.b) group by t1.b").Check(testkit.Rows("4"))
txn, err := tk.Session().Txn(true)
require.NoError(t, err)
ts := txn.StartTS()
taskID := tk.Session().GetSessionVars().AllocMPPTaskID(ts)
require.Equal(t, int64(6), taskID)

tk.MustExec("commit")
taskID = tk.Session().GetSessionVars().AllocMPPTaskID(ts + 1)
require.Equal(t, int64(1), taskID)

failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(3)`)
// all the data is related to one store, so there are three tasks.
Expand Down
8 changes: 4 additions & 4 deletions planner/core/fragment.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ func GenerateRootMPPTasks(ctx sessionctx.Context, startTs uint64, queryTs uint64

var mppTaskID int64 = 1

// allocMPPTaskID allocates task id for mpp tasks.
// AllocMPPTaskID allocates task id for mpp tasks.
// In TiFlash, MPP task manager will use this MPPTaskID and MPPQueryID to distinguish mpp queries.
func allocMPPTaskID() int64 {
func AllocMPPTaskID() int64 {
return atomic.AddInt64(&mppTaskID, 1)
}

Expand Down Expand Up @@ -155,7 +155,7 @@ func (e *mppTaskGenerator) constructMPPTasksByChildrenTasks(tasks []*kv.MPPTask)
if !ok {
mppTask := &kv.MPPTask{
Meta: &mppAddr{addr: addr},
ID: allocMPPTaskID(),
ID: AllocMPPTaskID(),
QueryTs: e.queryTS,
LocalQueryID: e.localQueryID,
ServerID: domain.GetDomain(e.ctx).ServerID(),
Expand Down Expand Up @@ -411,7 +411,7 @@ func (e *mppTaskGenerator) constructMPPTasksImpl(ctx context.Context, ts *Physic
tasks := make([]*kv.MPPTask, 0, len(metas))
for _, meta := range metas {
task := &kv.MPPTask{Meta: meta,
ID: allocMPPTaskID(),
ID: AllocMPPTaskID(),
StartTs: e.startTS,
QueryTs: e.queryTS,
LocalQueryID: e.localQueryID,
Expand Down
10 changes: 4 additions & 6 deletions sessionctx/variable/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/pingcap/tidb/parser"
"github.com/pingcap/tidb/parser/auth"
"github.com/pingcap/tidb/parser/mysql"
"github.com/pingcap/tidb/planner/core"
plannercore "github.com/pingcap/tidb/planner/core"
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/sessionctx/variable"
Expand Down Expand Up @@ -134,12 +135,9 @@ func TestAllocMPPID(t *testing.T) {
seVar := ctx.GetSessionVars()
require.NotNil(t, seVar)

require.Equal(t, int64(1), seVar.AllocMPPTaskID(1))
require.Equal(t, int64(2), seVar.AllocMPPTaskID(1))
require.Equal(t, int64(3), seVar.AllocMPPTaskID(1))
require.Equal(t, int64(1), seVar.AllocMPPTaskID(2))
require.Equal(t, int64(2), seVar.AllocMPPTaskID(2))
require.Equal(t, int64(3), seVar.AllocMPPTaskID(2))
require.Equal(t, int64(1), core.AllocMPPTaskID())
require.Equal(t, int64(2), core.AllocMPPTaskID())
require.Equal(t, int64(3), core.AllocMPPTaskID())
}

func TestSlowLogFormat(t *testing.T) {
Expand Down

0 comments on commit 7316f8c

Please sign in to comment.