diff --git a/statistics/feedback.go b/statistics/feedback.go index 55b9abb9d8..d61999d03c 100644 --- a/statistics/feedback.go +++ b/statistics/feedback.go @@ -128,17 +128,8 @@ func (q *QueryFeedback) Update(startKey kv.Key, counts []int64) { q.Invalidate() return } - length := len(counts) - // The `counts` was the output count of each push down executor. - if counts[length-1] != -1 { - metrics.DistSQLScanKeysPartialHistogram.Observe(float64(counts[0])) - q.actual += counts[0] - return - } - // The counts is the scan count of each range now. sum := int64(0) - rangeCounts := counts[:length-1] - for _, count := range rangeCounts { + for _, count := range counts { sum += count } metrics.DistSQLScanKeysPartialHistogram.Observe(float64(sum)) @@ -162,13 +153,13 @@ func (q *QueryFeedback) Update(startKey kv.Key, counts []int64) { } // If the desc is true, the counts is reversed, so here we need to reverse it back. if q.desc { - for i := 0; i < len(rangeCounts)/2; i++ { - j := len(rangeCounts) - i - 1 - rangeCounts[i], rangeCounts[j] = rangeCounts[j], rangeCounts[i] + for i := 0; i < len(counts)/2; i++ { + j := len(counts) - i - 1 + counts[i], counts[j] = counts[j], counts[i] } } // Update the feedback count info. - for i, count := range rangeCounts { + for i, count := range counts { if i+idx >= len(q.feedback) { q.Invalidate() break diff --git a/store/mockstore/mocktikv/cop_handler_dag.go b/store/mockstore/mocktikv/cop_handler_dag.go index adbaecbe49..fc10ea2669 100644 --- a/store/mockstore/mocktikv/cop_handler_dag.go +++ b/store/mockstore/mocktikv/cop_handler_dag.go @@ -534,11 +534,6 @@ func (mock *mockCopStreamClient) readBlockFromExecutor() (tipb.Chunk, bool, *cop func buildResp(chunks []tipb.Chunk, counts []int64, err error, warnings []error) *coprocessor.Response { resp := &coprocessor.Response{} - // The counts was the output count of each executor, but now it is the scan count of each range, - // so we need a flag to tell them apart. - if counts != nil { - counts = append(counts, -1) - } selResp := &tipb.SelectResponse{ Error: toPBError(err), Chunks: chunks, diff --git a/util/printer/printer.go b/util/printer/printer.go index f391ce5554..843e287591 100644 --- a/util/printer/printer.go +++ b/util/printer/printer.go @@ -30,7 +30,7 @@ var ( TiDBGitBranch = "None" GoVersion = "None" // TiKVMinVersion is the minimum version of TiKV that can be compatible with the current TiDB. - TiKVMinVersion = "1.1.0-dev.2" + TiKVMinVersion = "2.0.0-rc.4.1" ) // PrintTiDBInfo prints the TiDB version information.