Skip to content

Commit

Permalink
update tipb and address comment
Browse files Browse the repository at this point in the history
Signed-off-by: crazycs <[email protected]>
  • Loading branch information
crazycs520 committed Jun 28, 2021
1 parent f9f1067 commit 0c3a765
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ const (
DefTiDBTopSQLEnable = false
DefTiDBTopSQLAgentAddress = ""
DefTiDBTopSQLPrecisionSeconds = 1
DefTiDBTopSQLMaxStatementCount = 2000
DefTiDBTopSQLMaxStatementCount = 200
DefTiDBTopSQLMaxCollect = 10000
DefTiDBTopSQLReportIntervalSeconds = 60
DefTiDBEnableGlobalTemporaryTable = false
Expand Down
8 changes: 4 additions & 4 deletions util/topsql/reporter/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ func (r *GRPCReportClient) sendBatchCPUTimeRecord(ctx context.Context, records [
}
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
Expand Down
4 changes: 2 additions & 2 deletions util/topsql/reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func encodeKey(buf *bytes.Buffer, sqlDigest, planDigest []byte) string {
return buf.String()
}

func (tsr *RemoteTopSQLReporter) getTopNRecords(records []tracecpu.SQLCPUTimeRecord) (topn, evicted []tracecpu.SQLCPUTimeRecord) {
func (tsr *RemoteTopSQLReporter) getTopNRecords(records []tracecpu.SQLCPUTimeRecord) (topN, shouldEvict []tracecpu.SQLCPUTimeRecord) {
maxStmt := int(variable.TopSQLVariable.MaxStatementCount.Load())
if len(records) <= maxStmt {
return records, nil
Expand All @@ -233,7 +233,7 @@ func (tsr *RemoteTopSQLReporter) getTopNRecords(records []tracecpu.SQLCPUTimeRec
return records[:maxStmt], records[maxStmt:]
}

func (tsr *RemoteTopSQLReporter) getTopNDataPoints(records []*dataPoints) (topn, evicted []*dataPoints) {
func (tsr *RemoteTopSQLReporter) getTopNDataPoints(records []*dataPoints) (topN, shouldEvict []*dataPoints) {
maxStmt := int(variable.TopSQLVariable.MaxStatementCount.Load())
if len(records) <= maxStmt {
return records, nil
Expand Down

0 comments on commit 0c3a765

Please sign in to comment.