@@ -46,7 +46,6 @@ import (
46
46
"github.com/pingcap/tipb/go-tipb"
47
47
tikvmetrics "github.com/tikv/client-go/v2/metrics"
48
48
"github.com/tikv/client-go/v2/tikv"
49
- "github.com/tikv/client-go/v2/tikvrpc"
50
49
"go.uber.org/zap"
51
50
"golang.org/x/exp/maps"
52
51
)
@@ -549,7 +548,7 @@ func (r *selectResult) updateCopRuntimeStats(ctx context.Context, copStats *copr
549
548
if r .stats == nil {
550
549
r .stats = & selectResultRuntimeStats {
551
550
backoffSleep : make (map [string ]time.Duration ),
552
- rpcStat : tikv .NewRegionRequestRuntimeStats (),
551
+ reqStat : tikv .NewRegionRequestRuntimeStats (),
553
552
distSQLConcurrency : r .distSQLConcurrency ,
554
553
}
555
554
if ci , ok := r .resp .(copr.CopInfo ); ok {
@@ -659,7 +658,7 @@ type selectResultRuntimeStats struct {
659
658
backoffSleep map [string ]time.Duration
660
659
totalProcessTime time.Duration
661
660
totalWaitTime time.Duration
662
- rpcStat tikv.RegionRequestRuntimeStats
661
+ reqStat * tikv.RegionRequestRuntimeStats
663
662
distSQLConcurrency int
664
663
extraConcurrency int
665
664
CoprCacheHitNum int64
@@ -678,7 +677,7 @@ func (s *selectResultRuntimeStats) mergeCopRuntimeStats(copStats *copr.CopRuntim
678
677
maps .Copy (s .backoffSleep , copStats .BackoffSleep )
679
678
s .totalProcessTime += copStats .TimeDetail .ProcessTime
680
679
s .totalWaitTime += copStats .TimeDetail .WaitTime
681
- s .rpcStat .Merge (copStats .RegionRequestRuntimeStats )
680
+ s .reqStat .Merge (copStats .ReqStats )
682
681
if copStats .CoprCacheHit {
683
682
s .CoprCacheHitNum ++
684
683
}
@@ -689,7 +688,7 @@ func (s *selectResultRuntimeStats) Clone() execdetails.RuntimeStats {
689
688
copRespTime : execdetails.Percentile [execdetails.Duration ]{},
690
689
procKeys : execdetails.Percentile [execdetails.Int64 ]{},
691
690
backoffSleep : make (map [string ]time.Duration , len (s .backoffSleep )),
692
- rpcStat : tikv .NewRegionRequestRuntimeStats (),
691
+ reqStat : tikv .NewRegionRequestRuntimeStats (),
693
692
distSQLConcurrency : s .distSQLConcurrency ,
694
693
extraConcurrency : s .extraConcurrency ,
695
694
CoprCacheHitNum : s .CoprCacheHitNum ,
@@ -704,7 +703,7 @@ func (s *selectResultRuntimeStats) Clone() execdetails.RuntimeStats {
704
703
}
705
704
newRs .totalProcessTime += s .totalProcessTime
706
705
newRs .totalWaitTime += s .totalWaitTime
707
- maps . Copy ( newRs .rpcStat . Stats , s . rpcStat . Stats )
706
+ newRs .reqStat = s . reqStat . Clone ( )
708
707
return & newRs
709
708
}
710
709
@@ -721,7 +720,7 @@ func (s *selectResultRuntimeStats) Merge(rs execdetails.RuntimeStats) {
721
720
}
722
721
s .totalProcessTime += other .totalProcessTime
723
722
s .totalWaitTime += other .totalWaitTime
724
- s .rpcStat .Merge (other .rpcStat )
723
+ s .reqStat .Merge (other .reqStat )
725
724
s .CoprCacheHitNum += other .CoprCacheHitNum
726
725
if other .distSQLConcurrency > s .distSQLConcurrency {
727
726
s .distSQLConcurrency = other .distSQLConcurrency
@@ -736,7 +735,7 @@ func (s *selectResultRuntimeStats) Merge(rs execdetails.RuntimeStats) {
736
735
737
736
func (s * selectResultRuntimeStats ) String () string {
738
737
buf := bytes .NewBuffer (nil )
739
- rpcStat := s .rpcStat
738
+ reqStat := s .reqStat
740
739
if s .copRespTime .Size () > 0 {
741
740
size := s .copRespTime .Size ()
742
741
if size == 1 {
@@ -767,15 +766,6 @@ func (s *selectResultRuntimeStats) String() string {
767
766
buf .WriteString (execdetails .FormatDuration (s .totalWaitTime ))
768
767
}
769
768
}
770
- copRPC := rpcStat .Stats [tikvrpc .CmdCop ]
771
- if copRPC != nil && copRPC .Count > 0 {
772
- rpcStat = rpcStat .Clone ()
773
- delete (rpcStat .Stats , tikvrpc .CmdCop )
774
- buf .WriteString (", rpc_num: " )
775
- buf .WriteString (strconv .FormatInt (copRPC .Count , 10 ))
776
- buf .WriteString (", rpc_time: " )
777
- buf .WriteString (execdetails .FormatDuration (time .Duration (copRPC .Consume )))
778
- }
779
769
if config .GetGlobalConfig ().TiKVClient .CoprCache .CapacityMB > 0 {
780
770
fmt .Fprintf (buf , ", copr_cache_hit_ratio: %v" ,
781
771
strconv .FormatFloat (s .calcCacheHit (), 'f' , 2 , 64 ))
@@ -805,10 +795,11 @@ func (s *selectResultRuntimeStats) String() string {
805
795
buf .WriteString ("}" )
806
796
}
807
797
808
- rpcStatsStr := rpcStat .String ()
798
+ rpcStatsStr := reqStat .String ()
809
799
if len (rpcStatsStr ) > 0 {
810
- buf .WriteString (", " )
800
+ buf .WriteString (", rpc_info:{ " )
811
801
buf .WriteString (rpcStatsStr )
802
+ buf .WriteString ("}" )
812
803
}
813
804
814
805
if len (s .backoffSleep ) > 0 {
0 commit comments