diff --git a/go.mod b/go.mod index 8c899a662712b..4e25817d439bf 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( github.com/pingcap/parser v0.0.0-20210618053735-57843e8185c4 github.com/pingcap/sysutil v0.0.0-20210315073920-cc0985d983a3 github.com/pingcap/tidb-tools v4.0.9-0.20201127090955-2707c97b3853+incompatible - github.com/pingcap/tipb v0.0.0-20210603161937-cfb5a9225f95 + github.com/pingcap/tipb v0.0.0-20210628060001-1793e022b962 github.com/prometheus/client_golang v1.5.1 github.com/prometheus/client_model v0.2.0 github.com/prometheus/common v0.9.1 @@ -76,7 +76,6 @@ require ( golang.org/x/tools v0.1.0 google.golang.org/grpc v1.27.1 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - honnef.co/go/tools v0.2.0 // indirect modernc.org/mathutil v1.2.2 // indirect sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 diff --git a/go.sum b/go.sum index d52e75c750529..644b8299e9f52 100644 --- a/go.sum +++ b/go.sum @@ -451,8 +451,8 @@ github.com/pingcap/sysutil v0.0.0-20210315073920-cc0985d983a3/go.mod h1:tckvA041 github.com/pingcap/tidb-dashboard v0.0.0-20210312062513-eef5d6404638/go.mod h1:OzFN8H0EDMMqeulPhPMw2i2JaiZWOKFQ7zdRPhENNgo= github.com/pingcap/tidb-tools v4.0.9-0.20201127090955-2707c97b3853+incompatible h1:ceznmu/lLseGHP/jKyOa/3u/5H3wtLLLqkH2V3ssSjg= github.com/pingcap/tidb-tools v4.0.9-0.20201127090955-2707c97b3853+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM= -github.com/pingcap/tipb v0.0.0-20210603161937-cfb5a9225f95 h1:Cj7FhGvYn8hrXDNcaHi0aTl0KdV67KTL+P5gBp3vqT4= -github.com/pingcap/tipb v0.0.0-20210603161937-cfb5a9225f95/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs= +github.com/pingcap/tipb v0.0.0-20210628060001-1793e022b962 h1:9Y9Eci9LwAEhyXAlAU0bSix7Nemm3G267oyN3GVK+j0= +github.com/pingcap/tipb v0.0.0-20210628060001-1793e022b962/go.mod h1:A7mrd7WHBl1o63LE2bIBGEJMTNWXqhgmYiOvMLxozfs= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/util/topsql/reporter/client.go b/util/topsql/reporter/client.go index 87504d646902b..41d71400c3959 100644 --- a/util/topsql/reporter/client.go +++ b/util/topsql/reporter/client.go @@ -110,10 +110,10 @@ func (r *GRPCReportClient) sendBatchCPUTimeRecord(ctx context.Context, records m } for _, record := range records { record := &tipb.CPUTimeRecord{ - TimestampList: record.TimestampList, - CpuTimeMsList: record.CPUTimeMsList, - SqlDigest: record.SQLDigest, - PlanDigest: record.PlanDigest, + RecordListTimestampSec: record.TimestampList, + RecordListCpuTimeMs: record.CPUTimeMsList, + SqlDigest: record.SQLDigest, + PlanDigest: record.PlanDigest, } if err := stream.Send(record); err != nil { return err diff --git a/util/topsql/reporter/reporter_test.go b/util/topsql/reporter/reporter_test.go index 7e4d2b2ddc9b5..8daa6997cdb2d 100644 --- a/util/topsql/reporter/reporter_test.go +++ b/util/topsql/reporter/reporter_test.go @@ -111,13 +111,13 @@ func (s *testTopSQLReporter) TestCollectAndSendBatch(c *C) { c.Assert(err, IsNil) id = n } - c.Assert(req.CpuTimeMsList, HasLen, 1) - for i := range req.CpuTimeMsList { - c.Assert(req.CpuTimeMsList[i], Equals, uint32(id)) + c.Assert(req.RecordListCpuTimeMs, HasLen, 1) + for i := range req.RecordListCpuTimeMs { + c.Assert(req.RecordListCpuTimeMs[i], Equals, uint32(id)) } - c.Assert(req.TimestampList, HasLen, 1) - for i := range req.TimestampList { - c.Assert(req.TimestampList[i], Equals, uint64(1)) + c.Assert(req.RecordListTimestampSec, HasLen, 1) + for i := range req.RecordListTimestampSec { + c.Assert(req.RecordListTimestampSec[i], Equals, uint64(1)) } normalizedSQL, exist := agentServer.GetSQLMetaByDigestBlocking(req.SqlDigest, time.Second) c.Assert(exist, IsTrue) @@ -152,13 +152,13 @@ func (s *testTopSQLReporter) TestCollectAndEvicted(c *C) { id = n } c.Assert(id >= maxSQLNum, IsTrue) - c.Assert(req.CpuTimeMsList, HasLen, 1) - for i := range req.CpuTimeMsList { - c.Assert(req.CpuTimeMsList[i], Equals, uint32(id)) + c.Assert(req.RecordListCpuTimeMs, HasLen, 1) + for i := range req.RecordListCpuTimeMs { + c.Assert(req.RecordListCpuTimeMs[i], Equals, uint32(id)) } - c.Assert(req.TimestampList, HasLen, 1) - for i := range req.TimestampList { - c.Assert(req.TimestampList[i], Equals, uint64(2)) + c.Assert(req.RecordListTimestampSec, HasLen, 1) + for i := range req.RecordListTimestampSec { + c.Assert(req.RecordListTimestampSec[i], Equals, uint64(2)) } normalizedSQL, exist := agentServer.GetSQLMetaByDigestBlocking(req.SqlDigest, time.Second) c.Assert(exist, IsTrue) diff --git a/util/topsql/topsql_test.go b/util/topsql/topsql_test.go index 0663a4f307b95..88748e110cff9 100644 --- a/util/topsql/topsql_test.go +++ b/util/topsql/topsql_test.go @@ -167,9 +167,9 @@ func (s *testSuite) TestTopSQLReporter(c *C) { records := server.GetLatestRecords() checkSQLPlanMap := map[string]struct{}{} for _, req := range records { - c.Assert(len(req.CpuTimeMsList) > 0, IsTrue) - c.Assert(req.CpuTimeMsList[0] > 0, IsTrue) - c.Assert(req.TimestampList[0] > 0, IsTrue) + c.Assert(len(req.RecordListCpuTimeMs) > 0, IsTrue) + c.Assert(req.RecordListCpuTimeMs[0] > 0, IsTrue) + c.Assert(req.RecordListCpuTimeMs[0] > 0, IsTrue) normalizedSQL, exist := server.GetSQLMetaByDigestBlocking(req.SqlDigest, time.Second) c.Assert(exist, IsTrue) expectedNormalizedSQL, exist := sqlMap[string(req.SqlDigest)]