Skip to content

Commit

Permalink
do not use time as a variable name; defer expression in function
Browse files Browse the repository at this point in the history
  • Loading branch information
feitian124 committed Aug 9, 2021
1 parent 10c33b5 commit d69505f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions util/stmtsummary/statement_summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ func TestToDatum(t *testing.T) {
require.Equal(t, 1, len(datums))
n := types.NewTime(types.FromGoTime(time.Unix(ssMap.beginTimeForCurInterval, 0)), mysql.TypeTimestamp, types.DefaultFsp)
e := types.NewTime(types.FromGoTime(time.Unix(ssMap.beginTimeForCurInterval+1800, 0)), mysql.TypeTimestamp, types.DefaultFsp)
time := types.NewTime(types.FromGoTime(stmtExecInfo1.StartTime), mysql.TypeTimestamp, types.DefaultFsp)
f := types.NewTime(types.FromGoTime(stmtExecInfo1.StartTime), mysql.TypeTimestamp, types.DefaultFsp)
stmtExecInfo1.ExecDetail.CommitDetail.Mu.Lock()
expectedDatum := []interface{}{n, e, "Select", stmtExecInfo1.SchemaName, stmtExecInfo1.Digest, stmtExecInfo1.NormalizedSQL,
"db1.tb1,db2.tb2", "a", stmtExecInfo1.User, 1, 0, 0, int64(stmtExecInfo1.TotalLatency),
Expand Down Expand Up @@ -789,7 +789,7 @@ func TestToDatum(t *testing.T) {
stmtExecInfo1.ExecDetail.CommitDetail.TxnRetry, stmtExecInfo1.ExecDetail.CommitDetail.TxnRetry, 0, 0, 1,
fmt.Sprintf("%s:1", boTxnLockName), stmtExecInfo1.MemMax, stmtExecInfo1.MemMax, stmtExecInfo1.DiskMax, stmtExecInfo1.DiskMax,
0, 0, 0, 0, 0, stmtExecInfo1.StmtCtx.AffectedRows(),
time, time, 0, 0, 0, stmtExecInfo1.OriginalSQL, stmtExecInfo1.PrevSQL, "plan_digest", ""}
f, f, 0, 0, 0, stmtExecInfo1.OriginalSQL, stmtExecInfo1.PrevSQL, "plan_digest", ""}
stmtExecInfo1.ExecDetail.CommitDetail.Mu.Unlock()
match(t, datums[0], expectedDatum...)
datums = reader.GetStmtSummaryHistoryRows()
Expand Down Expand Up @@ -837,7 +837,7 @@ func TestToDatum(t *testing.T) {
stmtExecInfo1.ExecDetail.CommitDetail.TxnRetry, stmtExecInfo1.ExecDetail.CommitDetail.TxnRetry, 0, 0, 1,
fmt.Sprintf("%s:1", boTxnLockName), stmtExecInfo1.MemMax, stmtExecInfo1.MemMax, stmtExecInfo1.DiskMax, stmtExecInfo1.DiskMax,
0, 0, 0, 0, 0, stmtExecInfo1.StmtCtx.AffectedRows(),
time, time, 0, 0, 0, "", "", "", ""}
f, f, 0, 0, 0, "", "", "", ""}
expectedDatum[4] = stmtExecInfo2.Digest
match(t, datums[0], expectedDatum...)
match(t, datums[1], expectedEvictedDatum...)
Expand Down Expand Up @@ -1012,7 +1012,10 @@ func TestSetMaxStmtCountParallel(t *testing.T) {
go addStmtFunc()
}

defer require.Nil(t, ssMap.SetMaxStmtCount("", true))
defer func() {
require.Nil(t, ssMap.SetMaxStmtCount("", true))
}()

setStmtCountFunc := func() {
defer wg.Done()
// Turn down MaxStmtCount one by one.
Expand Down

0 comments on commit d69505f

Please sign in to comment.