Skip to content

Commit ecb50a7

Browse files
committed
improve region request log for diagnose (tikv#1300)
Signed-off-by: crazycs520 <[email protected]> --------- Signed-off-by: crazycs520 <[email protected]>
1 parent 491e9b1 commit ecb50a7

File tree

10 files changed

+420
-123
lines changed

10 files changed

+420
-123
lines changed

integration_tests/main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func TestMain(m *testing.M) {
2727
opts := []goleak.Option{
2828
goleak.IgnoreTopFunction("github.com/pingcap/goleveldb/leveldb.(*DB).mpoolDrain"),
2929
goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), // TODO: fix ttlManager goroutine leak
30+
goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/config/retry.(*Config).createBackoffFn.newBackoffFn.func2"),
3031
}
3132

3233
goleak.VerifyTestMain(m, opts...)

integration_tests/snapshot_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,13 @@ func (s *testSnapshotSuite) TestSnapshotThreadSafe() {
287287

288288
func (s *testSnapshotSuite) TestSnapshotRuntimeStats() {
289289
reqStats := tikv.NewRegionRequestRuntimeStats()
290-
tikv.RecordRegionRequestRuntimeStats(reqStats.Stats, tikvrpc.CmdGet, time.Second)
291-
tikv.RecordRegionRequestRuntimeStats(reqStats.Stats, tikvrpc.CmdGet, time.Millisecond)
290+
reqStats.RecordRPCRuntimeStats(tikvrpc.CmdGet, time.Second)
291+
reqStats.RecordRPCRuntimeStats(tikvrpc.CmdGet, time.Millisecond)
292292
snapshot := s.store.GetSnapshot(0)
293-
snapshot.SetRuntimeStats(&txnkv.SnapshotRuntimeStats{})
294-
snapshot.MergeRegionRequestStats(reqStats.Stats)
295-
snapshot.MergeRegionRequestStats(reqStats.Stats)
293+
runtimeStats := &txnkv.SnapshotRuntimeStats{}
294+
snapshot.SetRuntimeStats(runtimeStats)
295+
snapshot.MergeRegionRequestStats(reqStats)
296+
snapshot.MergeRegionRequestStats(reqStats)
296297
bo := tikv.NewBackofferWithVars(context.Background(), 2000, nil)
297298
err := bo.BackoffWithMaxSleepTxnLockFast(5, errors.New("test"))
298299
s.Nil(err)

0 commit comments

Comments
 (0)