Skip to content

Commit

Permalink
*: support mpp partition for tiflash (#31043)
Browse files Browse the repository at this point in the history
close #32347
  • Loading branch information
wshwsh12 authored Mar 15, 2022
1 parent ecffe84 commit 3393cf9
Show file tree
Hide file tree
Showing 25 changed files with 547 additions and 116 deletions.
6 changes: 6 additions & 0 deletions distsql/request_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ func (builder *RequestBuilder) SetAllowBatchCop(batchCop bool) *RequestBuilder {
return builder
}

// SetPartitionIDAndRanges sets `PartitionIDAndRanges` property.
func (builder *RequestBuilder) SetPartitionIDAndRanges(PartitionIDAndRanges []kv.PartitionIDAndRanges) *RequestBuilder {
builder.PartitionIDAndRanges = PartitionIDAndRanges
return builder
}

func (builder *RequestBuilder) getIsolationLevel() kv.IsoLevel {
switch builder.Tp {
case kv.ReqTypeAnalyze:
Expand Down
9 changes: 6 additions & 3 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3199,15 +3199,18 @@ func (b *executorBuilder) buildTableReader(v *plannercore.PhysicalTableReader) E
}
})
if useMPPExecution(b.ctx, v) {
plannercore.SetMppOrBatchCopForTableScan(v.GetTablePlan())
return b.buildMPPGather(v)
}
ret, err := buildNoRangeTableReader(b, v)
ts, err := v.GetTableScan()
if err != nil {
b.err = err
return nil
}

ts, err := v.GetTableScan()
if v.BatchCop {
ts.IsMPPOrBatchCop = true
}
ret, err := buildNoRangeTableReader(b, v)
if err != nil {
b.err = err
return nil
Expand Down
6 changes: 5 additions & 1 deletion executor/mpp_gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ func (e *MPPGather) appendMPPDispatchReq(pf *plannercore.Fragment) error {
dagReq.EncodeType = tipb.EncodeType_TypeChunk
}
for _, mppTask := range pf.ExchangeSender.Tasks {
err := updateExecutorTableID(context.Background(), dagReq.RootExecutor, mppTask.TableID, true)
if mppTask.PartitionTableIDs != nil {
err = updateExecutorTableID(context.Background(), dagReq.RootExecutor, true, mppTask.PartitionTableIDs)
} else {
err = updateExecutorTableID(context.Background(), dagReq.RootExecutor, true, []int64{mppTask.TableID})
}
if err != nil {
return errors.Trace(err)
}
Expand Down
12 changes: 7 additions & 5 deletions executor/partition_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ import (
"github.com/pingcap/tipb/go-tipb"
)

func updateExecutorTableID(ctx context.Context, exec *tipb.Executor, partitionID int64, recursive bool) error {
func updateExecutorTableID(ctx context.Context, exec *tipb.Executor, recursive bool, partitionIDs []int64) error {
var child *tipb.Executor
switch exec.Tp {
case tipb.ExecType_TypeTableScan:
exec.TblScan.TableId = partitionID
exec.TblScan.TableId = partitionIDs[0]
// For test coverage.
if tmp := ctx.Value("nextPartitionUpdateDAGReq"); tmp != nil {
m := tmp.(map[int64]struct{})
m[partitionID] = struct{}{}
m[partitionIDs[0]] = struct{}{}
}
case tipb.ExecType_TypePartitionTableScan:
exec.PartitionTableScan.PartitionIds = partitionIDs
case tipb.ExecType_TypeIndexScan:
exec.IdxScan.TableId = partitionID
exec.IdxScan.TableId = partitionIDs[0]
case tipb.ExecType_TypeSelection:
child = exec.Selection.Child
case tipb.ExecType_TypeAggregation, tipb.ExecType_TypeStreamAgg:
Expand All @@ -54,7 +56,7 @@ func updateExecutorTableID(ctx context.Context, exec *tipb.Executor, partitionID
return errors.Trace(fmt.Errorf("unknown new tipb protocol %d", exec.Tp))
}
if child != nil && recursive {
return updateExecutorTableID(ctx, child, partitionID, recursive)
return updateExecutorTableID(ctx, child, recursive, partitionIDs)
}
return nil
}
69 changes: 58 additions & 11 deletions executor/table_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,20 +263,32 @@ func (e *TableReaderExecutor) Close() error {
// to fetch all results.
func (e *TableReaderExecutor) buildResp(ctx context.Context, ranges []*ranger.Range) (distsql.SelectResult, error) {
if e.storeType == kv.TiFlash && e.kvRangeBuilder != nil {
// TiFlash cannot support to access multiple tables/partitions within one KVReq, so we have to build KVReq for each partition separately.
kvReqs, err := e.buildKVReqSeparately(ctx, ranges)
if err != nil {
return nil, err
}
var results []distsql.SelectResult
for _, kvReq := range kvReqs {
result, err := e.SelectResult(ctx, e.ctx, kvReq, retTypes(e), e.feedback, getPhysicalPlanIDs(e.plans), e.id)
if !e.batchCop {
// TiFlash cannot support to access multiple tables/partitions within one KVReq, so we have to build KVReq for each partition separately.
kvReqs, err := e.buildKVReqSeparately(ctx, ranges)
if err != nil {
return nil, err
}
results = append(results, result)
var results []distsql.SelectResult
for _, kvReq := range kvReqs {
result, err := e.SelectResult(ctx, e.ctx, kvReq, retTypes(e), e.feedback, getPhysicalPlanIDs(e.plans), e.id)
if err != nil {
return nil, err
}
results = append(results, result)
}
return distsql.NewSerialSelectResults(results), nil
}
return distsql.NewSerialSelectResults(results), nil
// Use PartitionTable Scan
kvReq, err := e.buildKVReqForPartitionTableScan(ctx, ranges)
if err != nil {
return nil, err
}
result, err := e.SelectResult(ctx, e.ctx, kvReq, retTypes(e), e.feedback, getPhysicalPlanIDs(e.plans), e.id)
if err != nil {
return nil, err
}
return result, nil
}

kvReq, err := e.buildKVReq(ctx, ranges)
Expand All @@ -300,7 +312,7 @@ func (e *TableReaderExecutor) buildKVReqSeparately(ctx context.Context, ranges [
kvReqs := make([]*kv.Request, 0, len(kvRanges))
for i, kvRange := range kvRanges {
e.kvRanges = append(e.kvRanges, kvRange...)
if err := updateExecutorTableID(ctx, e.dagPB.RootExecutor, pids[i], true); err != nil {
if err := updateExecutorTableID(ctx, e.dagPB.RootExecutor, true, []int64{pids[i]}); err != nil {
return nil, err
}
var builder distsql.RequestBuilder
Expand All @@ -325,6 +337,41 @@ func (e *TableReaderExecutor) buildKVReqSeparately(ctx context.Context, ranges [
return kvReqs, nil
}

func (e *TableReaderExecutor) buildKVReqForPartitionTableScan(ctx context.Context, ranges []*ranger.Range) (*kv.Request, error) {
pids, kvRanges, err := e.kvRangeBuilder.buildKeyRangeSeparately(ranges)
if err != nil {
return nil, err
}
partitionIDAndRanges := make([]kv.PartitionIDAndRanges, 0, len(pids))
for i, kvRange := range kvRanges {
partitionIDAndRanges = append(partitionIDAndRanges, kv.PartitionIDAndRanges{
ID: pids[i],
KeyRanges: kvRange,
})
}
if err := updateExecutorTableID(ctx, e.dagPB.RootExecutor, true, pids); err != nil {
return nil, err
}
var builder distsql.RequestBuilder
reqBuilder := builder.SetPartitionIDAndRanges(partitionIDAndRanges)
kvReq, err := reqBuilder.
SetDAGRequest(e.dagPB).
SetStartTS(e.startTS).
SetDesc(e.desc).
SetKeepOrder(e.keepOrder).
SetStreaming(e.streaming).
SetReadReplicaScope(e.readReplicaScope).
SetFromSessionVars(e.ctx.GetSessionVars()).
SetFromInfoSchema(e.ctx.GetInfoSchema()).
SetMemTracker(e.memTracker).
SetStoreType(e.storeType).
SetAllowBatchCop(e.batchCop).Build()
if err != nil {
return nil, err
}
return kvReq, nil
}

func (e *TableReaderExecutor) buildKVReq(ctx context.Context, ranges []*ranger.Range) (*kv.Request, error) {
var builder distsql.RequestBuilder
var reqBuilder *distsql.RequestBuilder
Expand Down
62 changes: 57 additions & 5 deletions executor/tiflash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ func TestPartitionTable(t *testing.T) {
// mock executor does not support use outer table as build side for outer join, so need to
// force the inner table as build side
tk.MustExec("set tidb_opt_mpp_outer_join_fixed_build_side=1")
failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(4)`)
failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(1)`)
tk.MustQuery("select count(*) from t").Check(testkit.Rows("4"))
failpoint.Disable("github.com/pingcap/tidb/executor/checkTotalMPPTasks")
tk.MustExec("set @@session.tidb_partition_prune_mode='static-only'")
Expand All @@ -489,7 +489,7 @@ func TestPartitionTable(t *testing.T) {
tk.MustExec("set @@session.tidb_isolation_read_engines=\"tiflash\"")
tk.MustExec("set @@session.tidb_allow_mpp=ON")
// test if it is really work.
failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(8)`)
failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(2)`)
tk.MustQuery("select count(*) from t1 , t where t1.a = t.a").Check(testkit.Rows("4"))
// test partition prune
tk.MustQuery("select count(*) from t1 , t where t1.a = t.a and t1.a < 2 and t.a < 2").Check(testkit.Rows("1"))
Expand All @@ -507,7 +507,7 @@ func TestPartitionTable(t *testing.T) {
tk.MustExec("insert into t2 values(3,0)")
tk.MustExec("insert into t2 values(4,0)")
// test with no partition table
failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(9)`)
failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(3)`)
tk.MustQuery("select count(*) from t1 , t, t2 where t1.a = t.a and t2.a = t.a").Check(testkit.Rows("4"))
failpoint.Disable("github.com/pingcap/tidb/executor/checkTotalMPPTasks")

Expand All @@ -527,10 +527,10 @@ func TestPartitionTable(t *testing.T) {
tk.MustExec("insert into t3 values(3,4)")
tk.MustExec("insert into t3 values(4,6)")

failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(7)`)
failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(2)`)
tk.MustQuery("select count(*) from t, t3 where t3.a = t.a and t3.b <= 4").Check(testkit.Rows("3"))
failpoint.Disable("github.com/pingcap/tidb/executor/checkTotalMPPTasks")
failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(5)`)
failpoint.Enable("github.com/pingcap/tidb/executor/checkTotalMPPTasks", `return(2)`)
tk.MustQuery("select count(*) from t, t3 where t3.a = t.a and t3.b > 10").Check(testkit.Rows("0"))
failpoint.Disable("github.com/pingcap/tidb/executor/checkTotalMPPTasks")
failpoint.Disable("github.com/pingcap/tidb/executor/checkUseMPP")
Expand Down Expand Up @@ -1142,3 +1142,55 @@ func TestForbidTiFlashIfExtraPhysTableIDIsNeeded(t *testing.T) {
require.NotContains(t, res, "tikv")
tk.MustExec("rollback")
}

func TestTiflashPartitionTableScan(t *testing.T) {
store, clean := createTiFlashStore(t)
defer clean()
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test;")
tk.MustExec("drop table if exists t")
tk.MustExec("create table t(\n a int,\n primary key(a)\n) partition by range(a) (\n partition p1 values less than (10),\n partition p2 values less than (20),\n partition p3 values less than (30),\n partition p4 values less than (40),\n partition p5 values less than (50)\n);")
tk.MustExec("alter table t set tiflash replica 1")
tb := external.GetTableByName(t, tk, "test", "t")
err := domain.GetDomain(tk.Session()).DDL().UpdateTableReplicaInfo(tk.Session(), tb.Meta().ID, true)
require.NoError(t, err)
time.Sleep(2 * time.Second)
tk.MustExec("insert into t values(1),(11),(21),(31),(41);")
tk.MustExec("set @@tidb_partition_prune_mode = 'dynamic';")
tk.MustExec("set @@session.tidb_isolation_read_engines=\"tiflash\";")
// MPP
tk.MustExec("set @@session.tidb_allow_mpp=ON;")
tk.MustQuery("select count(*) from t where a < 12;").Check(testkit.Rows("2"))

// BatchCop
tk.MustExec("set @@session.tidb_allow_mpp=OFF;")
tk.MustExec("set @@tidb_allow_batch_cop = 2;")
tk.MustQuery("select count(*) from t where a < 12;").Check(testkit.Rows("2"))

// test retry batch cop
// MPP
wg := sync.WaitGroup{}
wg.Add(1)
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/store/mockstore/unistore/rpcServerBusy", `return(true)`))
go func() {
time.Sleep(100 * time.Millisecond)
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/store/mockstore/unistore/rpcServerBusy"))
wg.Done()
}()
tk.MustExec("set @@session.tidb_allow_mpp=ON;")
tk.MustQuery("select count(*) from t where a < 12;").Check(testkit.Rows("2"))
wg.Wait()

// BatchCop
wg.Add(1)
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/store/mockstore/unistore/rpcServerBusy", `return(true)`))
go func() {
time.Sleep(100 * time.Millisecond)
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/store/mockstore/unistore/rpcServerBusy"))
wg.Done()
}()
tk.MustExec("set @@session.tidb_allow_mpp=OFF;")
tk.MustExec("set @@tidb_allow_batch_cop = 2;")
tk.MustQuery("select count(*) from t where a < 12;").Check(testkit.Rows("2"))
wg.Wait()
}
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ require (
github.com/pingcap/sysutil v0.0.0-20220114020952-ea68d2dbf5b4
github.com/pingcap/tidb-tools v6.0.0-alpha.0.20220309081549-563c2a342f9c+incompatible
github.com/pingcap/tidb/parser v0.0.0-20211011031125-9b13dc409c5e
github.com/pingcap/tipb v0.0.0-20220110031732-29e23c62eeac
github.com/pingcap/tipb v0.0.0-20220215045658-d12dec7a7609
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.26.0
Expand Down Expand Up @@ -90,10 +90,10 @@ require (
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f
golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5
golang.org/x/text v0.3.7
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
golang.org/x/tools v0.1.8
golang.org/x/tools v0.1.9
google.golang.org/api v0.54.0
google.golang.org/grpc v1.43.0
gopkg.in/yaml.v2 v2.4.0
Expand Down
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,8 @@ github.com/pingcap/sysutil v0.0.0-20220114020952-ea68d2dbf5b4 h1:HYbcxtnkN3s5tqr
github.com/pingcap/sysutil v0.0.0-20220114020952-ea68d2dbf5b4/go.mod h1:sDCsM39cGiv2vwunZkaFA917vVkqDTGSPbbV7z4Oops=
github.com/pingcap/tidb-tools v6.0.0-alpha.0.20220309081549-563c2a342f9c+incompatible h1:oJa/SdxUweAwihGI83pBRle0LBrGPXMPkp2eElH6sF8=
github.com/pingcap/tidb-tools v6.0.0-alpha.0.20220309081549-563c2a342f9c+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM=
github.com/pingcap/tipb v0.0.0-20220110031732-29e23c62eeac h1:bVklq/Np5uHUylW4Htyhi92TNrvIqVwht/+bHk0R/Tk=
github.com/pingcap/tipb v0.0.0-20220110031732-29e23c62eeac/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs=
github.com/pingcap/tipb v0.0.0-20220215045658-d12dec7a7609 h1:BiCS1ZRnW0szOvTAa3gCqWIhyo+hv83SVaBgrUghXIU=
github.com/pingcap/tipb v0.0.0-20220215045658-d12dec7a7609/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs=
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98=
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down Expand Up @@ -1025,8 +1025,9 @@ golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng=
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down Expand Up @@ -1110,8 +1111,8 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w=
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
9 changes: 9 additions & 0 deletions kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ type Request struct {
Data []byte
KeyRanges []KeyRange

// For PartitionTableScan used by tiflash.
PartitionIDAndRanges []PartitionIDAndRanges

// Concurrency is 1, if it only sends the request to a single storage unit when
// ResponseIterator.Next is called. If concurrency is greater than 1, the request will be
// sent to multiple storage units concurrently.
Expand Down Expand Up @@ -360,6 +363,12 @@ type Request struct {
Paging bool
}

// PartitionIDAndRanges used by PartitionTableScan in tiflash.
type PartitionIDAndRanges struct {
ID int64
KeyRanges []KeyRange
}

const (
// GlobalReplicaScope indicates the default replica scope for tidb to request
GlobalReplicaScope = oracle.GlobalTxnScope
Expand Down
4 changes: 4 additions & 0 deletions kv/mpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ type MPPTask struct {
ID int64 // mppTaskID
StartTs uint64
TableID int64 // physical table id

PartitionTableIDs []int64
}

// ToPB generates the pb structure.
Expand Down Expand Up @@ -89,4 +91,6 @@ type MPPClient interface {
type MPPBuildTasksRequest struct {
KeyRanges []KeyRange
StartTS uint64

PartitionIDAndRanges []PartitionIDAndRanges
}
4 changes: 4 additions & 0 deletions planner/core/explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/pingcap/tidb/expression"
"github.com/pingcap/tidb/expression/aggregation"
"github.com/pingcap/tidb/infoschema"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/parser/ast"
"github.com/pingcap/tidb/parser/model"
"github.com/pingcap/tidb/parser/mysql"
Expand Down Expand Up @@ -289,6 +290,9 @@ func (p *PhysicalTableScan) OperatorInfo(normalized bool) string {
if p.stats.StatsVersion == statistics.PseudoVersion && !normalized {
buffer.WriteString(", stats:pseudo")
}
if p.StoreType == kv.TiFlash && p.Table.GetPartitionInfo() != nil && p.IsMPPOrBatchCop && p.ctx.GetSessionVars().UseDynamicPartitionPrune() {
buffer.WriteString(", PartitionTableScan:true")
}
return buffer.String()
}

Expand Down
Loading

0 comments on commit 3393cf9

Please sign in to comment.