From 6f0ebb55182c95604d489789f5a5fbb0cbd6e093 Mon Sep 17 00:00:00 2001 From: ti-srebot <66930949+ti-srebot@users.noreply.github.com> Date: Mon, 8 Mar 2021 16:38:54 +0800 Subject: [PATCH 1/2] brie/: add GetVersion function for tidbGlueSession (#22731) (#23143) --- .github/labeler.yml | 4 ++++ executor/brie.go | 5 +++++ executor/brie_test.go | 28 ++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 executor/brie_test.go diff --git a/.github/labeler.yml b/.github/labeler.yml index 5040b7cfc9da0..12a5b495d6a0e 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,6 +1,7 @@ component/executor: - distsql/* - executor/* + - !executor/brie* - util/chunk/* - util/disk/* - util/execdetails/* @@ -31,3 +32,6 @@ component/DDL: component/config: - config/* + +sig/migrate: + - executor/brie* diff --git a/executor/brie.go b/executor/brie.go index 4dd86aa9fdb1b..0d14265a8fd0e 100644 --- a/executor/brie.go +++ b/executor/brie.go @@ -42,6 +42,7 @@ import ( "github.com/pingcap/tidb/sessionctx/variable" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util/chunk" + "github.com/pingcap/tidb/util/printer" "github.com/pingcap/tidb/util/sqlexec" ) @@ -465,3 +466,7 @@ func (gs *tidbGlueSession) Record(name string, value uint64) { gs.info.archiveSize = value } } + +func (gs *tidbGlueSession) GetVersion() string { + return "TiDB\n" + printer.GetTiDBInfo() +} diff --git a/executor/brie_test.go b/executor/brie_test.go new file mode 100644 index 0000000000000..0116009efc368 --- /dev/null +++ b/executor/brie_test.go @@ -0,0 +1,28 @@ +// Copyright 2021 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package executor + +import . "github.com/pingcap/check" + +type testBRIESuite struct{} + +var _ = Suite(&testBRIESuite{}) + +func (s *testBRIESuite) TestGlueGetVersion(c *C) { + g := tidbGlueSession{} + version := g.GetVersion() + c.Assert(version, Matches, `(.|\n)*Release Version(.|\n)*`) + c.Assert(version, Matches, `(.|\n)*Git Commit Hash(.|\n)*`) + c.Assert(version, Matches, `(.|\n)*GoVersion(.|\n)*`) +} From a7199ff916489749b0fd279f74a63e5d9ac7cebc Mon Sep 17 00:00:00 2001 From: Chunzhu Li Date: Mon, 8 Mar 2021 19:04:54 +0800 Subject: [PATCH 2/2] misc: Update kvproto (#23174) --- go.mod | 2 +- go.sum | 4 ++-- store/tikv/batch_coprocessor.go | 4 ++-- store/tikv/coprocessor.go | 16 ++++++++-------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index b9ea7f5039c62..fcf11d9da816a 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,7 @@ require ( github.com/pingcap/failpoint v0.0.0-20200702092429-9f69995143ce github.com/pingcap/fn v0.0.0-20200306044125-d5540d389059 github.com/pingcap/goleveldb v0.0.0-20191226122134-f82aafb29989 - github.com/pingcap/kvproto v0.0.0-20201126113434-70db5fb4b0dc + github.com/pingcap/kvproto v0.0.0-20210308075244-560097d1309b github.com/pingcap/log v0.0.0-20201112100606-8f1e84a3abc8 github.com/pingcap/parser v0.0.0-20210303062609-d1d977c9ceed github.com/pingcap/sysutil v0.0.0-20201130064824-f0c8aa6a6966 diff --git a/go.sum b/go.sum index 3c777e84def96..9d904cff63883 100644 --- a/go.sum +++ b/go.sum @@ -396,8 +396,8 @@ github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO github.com/pingcap/kvproto v0.0.0-20200411081810-b85805c9476c/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= github.com/pingcap/kvproto v0.0.0-20200907074027-32a3a0accf7d h1:gvJScINTd/HFasp82W1paGTfbYe2Bnzn8QBOJXckLwY= github.com/pingcap/kvproto v0.0.0-20200907074027-32a3a0accf7d/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= -github.com/pingcap/kvproto v0.0.0-20201126113434-70db5fb4b0dc h1:BtszN3YR5EScxiGGTD3tAf4CQE90bczkOY0lLa07EJA= -github.com/pingcap/kvproto v0.0.0-20201126113434-70db5fb4b0dc/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= +github.com/pingcap/kvproto v0.0.0-20210308075244-560097d1309b h1:Jp0V5PDzdOy666n4XbDDaEjOKHsp2nk7b2uR6qjFI0s= +github.com/pingcap/kvproto v0.0.0-20210308075244-560097d1309b/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= github.com/pingcap/log v0.0.0-20200511115504-543df19646ad/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= diff --git a/store/tikv/batch_coprocessor.go b/store/tikv/batch_coprocessor.go index 56b1b1fed9f3e..118f3dffebdb6 100644 --- a/store/tikv/batch_coprocessor.go +++ b/store/tikv/batch_coprocessor.go @@ -350,8 +350,8 @@ func (b *batchCopIterator) handleTaskOnce(ctx context.Context, bo *Backoffer, ta IsolationLevel: pbIsolationLevel(b.req.IsolationLevel), Priority: kvPriorityToCommandPri(b.req.Priority), NotFillCache: b.req.NotFillCache, - HandleTime: true, - ScanDetail: true, + RecordTimeStat: true, + RecordScanStat: true, TaskId: b.req.TaskID, }) req.StoreTp = kv.TiFlash diff --git a/store/tikv/coprocessor.go b/store/tikv/coprocessor.go index 9022e877d53d6..7dbdcda6e0309 100644 --- a/store/tikv/coprocessor.go +++ b/store/tikv/coprocessor.go @@ -872,8 +872,8 @@ func (worker *copIteratorWorker) handleTaskOnce(bo *Backoffer, task *copTask, ch IsolationLevel: pbIsolationLevel(worker.req.IsolationLevel), Priority: kvPriorityToCommandPri(worker.req.Priority), NotFillCache: worker.req.NotFillCache, - HandleTime: true, - ScanDetail: true, + RecordTimeStat: true, + RecordScanStat: true, TaskId: worker.req.TaskID, }) req.StoreTp = task.storeType @@ -1013,9 +1013,9 @@ func (worker *copIteratorWorker) logTimeCopTask(costTime time.Duration, task *co } } - if detail != nil && detail.HandleTime != nil { - processMs := detail.HandleTime.ProcessMs - waitMs := detail.HandleTime.WaitMs + if detail != nil && detail.TimeDetail != nil { + processMs := detail.TimeDetail.ProcessWallTimeMs + waitMs := detail.TimeDetail.WaitWallTimeMs if processMs > minLogKVProcessTime { logStr += fmt.Sprintf(" kv_process_ms:%d", processMs) if detail.ScanDetail != nil { @@ -1150,9 +1150,9 @@ func (worker *copIteratorWorker) handleCopResponse(bo *Backoffer, rpcCtx *RPCCon } resp.respTime = costTime if pbDetails := resp.pbResp.ExecDetails; pbDetails != nil { - if handleTime := pbDetails.HandleTime; handleTime != nil { - resp.detail.WaitTime = time.Duration(handleTime.WaitMs) * time.Millisecond - resp.detail.ProcessTime = time.Duration(handleTime.ProcessMs) * time.Millisecond + if timeDetail := pbDetails.TimeDetail; timeDetail != nil { + resp.detail.WaitTime = time.Duration(timeDetail.WaitWallTimeMs) * time.Millisecond + resp.detail.ProcessTime = time.Duration(timeDetail.ProcessWallTimeMs) * time.Millisecond } if scanDetail := pbDetails.ScanDetail; scanDetail != nil { if scanDetail.Write != nil {