From e49c2d9590d8fa560b199bb2fb63377434eb2b1f Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Mon, 26 Sep 2022 14:25:18 +0800 Subject: [PATCH 1/2] executor,sessionctx: enable coprocessor paging and make TestCoprocessorPagingSize stable --- executor/distsql_test.go | 3 +++ sessionctx/variable/tidb_vars.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/executor/distsql_test.go b/executor/distsql_test.go index 1f895a6703420..59b3aecc2bb6a 100644 --- a/executor/distsql_test.go +++ b/executor/distsql_test.go @@ -431,6 +431,9 @@ func TestCoprocessorPagingSize(t *testing.T) { tk.MustExec(fmt.Sprintf("insert into t_paging values %v", strings.Join(values, ", "))) tk.MustQuery("select @@tidb_min_paging_size").Check(testkit.Rows(strconv.FormatUint(paging.MinPagingSize, 10))) + // Enable the coprocessor paging protocol. + tk.MustExec("set @@tidb_enable_paging = on") + // When the min paging size is small, we need more RPC roundtrip! // Check 'rpc_num' in the execution information // diff --git a/sessionctx/variable/tidb_vars.go b/sessionctx/variable/tidb_vars.go index 6a011a92f7bc1..625038397a0b3 100644 --- a/sessionctx/variable/tidb_vars.go +++ b/sessionctx/variable/tidb_vars.go @@ -1051,7 +1051,7 @@ const ( DefTiDBPrepPlanCacheMemoryGuardRatio = 0.1 DefTiDBEnableConcurrentDDL = concurrencyddl.TiDBEnableConcurrentDDL DefTiDBSimplifiedMetrics = false - DefTiDBEnablePaging = false + DefTiDBEnablePaging = true DefTiFlashFineGrainedShuffleStreamCount = 0 DefStreamCountWhenMaxThreadsNotSet = 8 DefTiFlashFineGrainedShuffleBatchSize = 8192 From ebf1d79bb75998d53c274d60978215ac2f3a16de Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Tue, 27 Sep 2022 21:09:39 +0800 Subject: [PATCH 2/2] address comment --- planner/core/testdata/plan_suite_out.json | 34 +++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/planner/core/testdata/plan_suite_out.json b/planner/core/testdata/plan_suite_out.json index 9a22e2db30e6c..81b5676a30614 100644 --- a/planner/core/testdata/plan_suite_out.json +++ b/planner/core/testdata/plan_suite_out.json @@ -6026,11 +6026,11 @@ " │ ├─IndexRangeScan(Build) 250.00 cop[tikv] table:ta, index:idx_ta_name(name) range:[\"chad999\",\"chad99:\"), keep order:false, stats:pseudo", " │ └─TableRowIDScan(Probe) 250.00 cop[tikv] table:ta keep order:false, stats:pseudo", " └─MaxOneRow(Probe) 1.00 root ", - " └─HashAgg 1.00 root funcs:sum(Column#17)->Column#13", - " └─IndexLookUp 1.00 root ", - " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", - " └─HashAgg(Probe) 1.00 cop[tikv] funcs:sum(test.tb.code)->Column#17", - " └─TableRowIDScan 10.00 cop[tikv] table:tb keep order:false, stats:pseudo" + " └─StreamAgg 1.00 root funcs:sum(Column#21)->Column#13", + " └─Projection 10.00 root cast(test.tb.code, decimal(10,0) BINARY)->Column#21", + " └─IndexLookUp 10.00 root ", + " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:tb, index:idx_tb_id(id) range: decided by [eq(test.ta.id, test.tb.id)], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 10.00 cop[tikv] table:tb keep order:false, stats:pseudo" ], "Result": null, "Warning": null @@ -6223,12 +6223,12 @@ " └─Selection(Probe) 0.80 root gt(Column#19, 100)", " └─MaxOneRow 1.00 root ", " └─StreamAgg 1.00 root funcs:max(test.td.id)->Column#19", - " └─TopN 0.25 root test.td.id:desc, offset:0, count:1", - " └─IndexLookUp 0.25 root ", - " ├─Selection(Build) 9.99 cop[tikv] eq(test.ta.id, test.td.id)", - " │ └─IndexFullScan 9990.00 cop[tikv] table:td, index:idx_tc_id(id) keep order:false, stats:pseudo", - " └─TopN(Probe) 0.25 cop[tikv] test.td.id:desc, offset:0, count:1", - " └─Selection 0.25 cop[tikv] like(test.td.name, \"chad999%\", 92)", + " └─Limit 0.25 root offset:0, count:1", + " └─Projection 0.25 root test.td.id, test.td.name", + " └─IndexLookUp 0.25 root ", + " ├─Selection(Build) 9.99 cop[tikv] eq(test.ta.id, test.td.id)", + " │ └─IndexFullScan 9990.00 cop[tikv] table:td, index:idx_tc_id(id) keep order:true, desc, stats:pseudo", + " └─Selection(Probe) 0.25 cop[tikv] like(test.td.name, \"chad999%\", 92)", " └─TableRowIDScan 9.99 cop[tikv] table:td keep order:false, stats:pseudo" ], "Result": null, @@ -6260,12 +6260,12 @@ " └─Selection(Probe) 0.80 root gt(Column#19, 100)", " └─MaxOneRow 1.00 root ", " └─StreamAgg 1.00 root funcs:max(test.td.id)->Column#19", - " └─TopN 0.25 root test.td.id:desc, offset:0, count:1", - " └─IndexLookUp 0.25 root ", - " ├─Selection(Build) 9.99 cop[tikv] eq(test.ta.id, test.td.id)", - " │ └─IndexFullScan 9990.00 cop[tikv] table:td, index:idx_tc_id(id) keep order:false, stats:pseudo", - " └─TopN(Probe) 0.25 cop[tikv] test.td.id:desc, offset:0, count:1", - " └─Selection 0.25 cop[tikv] like(test.td.name, \"chad999%\", 92)", + " └─Limit 0.25 root offset:0, count:1", + " └─Projection 0.25 root test.td.id, test.td.name", + " └─IndexLookUp 0.25 root ", + " ├─Selection(Build) 9.99 cop[tikv] eq(test.ta.id, test.td.id)", + " │ └─IndexFullScan 9990.00 cop[tikv] table:td, index:idx_tc_id(id) keep order:true, desc, stats:pseudo", + " └─Selection(Probe) 0.25 cop[tikv] like(test.td.name, \"chad999%\", 92)", " └─TableRowIDScan 9.99 cop[tikv] table:td keep order:false, stats:pseudo" ], "Result": null,