Skip to content

Commit 11e8a24

Browse files
committed
bench: update
Signed-off-by: ekexium <[email protected]>
1 parent 449b84e commit 11e8a24

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

pkg/session/bench_test.go

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,8 +2012,6 @@ func BenchmarkPipelinedInsertIgnoreNoDuplicates(b *testing.B) {
20122012
}
20132013

20142014
func BenchmarkPipelinedInsertOnDuplicate(b *testing.B) {
2015-
require.NoError(b, failpoint.Enable("tikvclient/pipelinedSkipResolveLock", "return"))
2016-
defer require.NoError(b, failpoint.Disable("tikvclient/pipelinedSkipResolveLock"))
20172015
logutil.InitLogger(&logutil.LogConfig{Config: log.Config{Level: "fatal"}})
20182016
se, do, st := prepareBenchSession()
20192017
defer func() {
@@ -2048,8 +2046,6 @@ func BenchmarkPipelinedInsertOnDuplicate(b *testing.B) {
20482046
}
20492047

20502048
func BenchmarkPipelinedDelete(b *testing.B) {
2051-
require.NoError(b, failpoint.Enable("tikvclient/pipelinedSkipResolveLock", "return"))
2052-
defer require.NoError(b, failpoint.Disable("tikvclient/pipelinedSkipResolveLock"))
20532049
logutil.InitLogger(&logutil.LogConfig{Config: log.Config{Level: "fatal"}})
20542050
se, do, st := prepareBenchSession()
20552051
defer func() {
@@ -2111,3 +2107,37 @@ func BenchmarkPipelinedReplaceNoDuplicates(b *testing.B) {
21112107
b.StopTimer()
21122108
b.ReportMetric(float64(b.Elapsed().Nanoseconds()/int64(b.N*batchSize*batchNum)), "ns/row")
21132109
}
2110+
2111+
func BenchmarkPipelinedUpdate(b *testing.B) {
2112+
logutil.InitLogger(&logutil.LogConfig{Config: log.Config{Level: "fatal"}})
2113+
se, do, st := prepareBenchSession()
2114+
defer func() {
2115+
se.Close()
2116+
do.Close()
2117+
st.Close()
2118+
}()
2119+
mustExecute(se, `create table src (id int, dt varchar(128))`)
2120+
for i := 0; i < batchNum; i++ {
2121+
mustExecute(se, "begin")
2122+
for lines := 0; lines < batchSize; lines++ {
2123+
mustExecute(se, "insert into src values (42, repeat('x', 128))")
2124+
}
2125+
mustExecute(se, "commit")
2126+
}
2127+
2128+
se.GetSessionVars().BulkDMLEnabled = true
2129+
se.GetSessionVars().StmtCtx.InUpdateStmt = true
2130+
2131+
b.StopTimer()
2132+
b.ResetTimer()
2133+
for i := 0; i < b.N; i++ {
2134+
b.StartTimer()
2135+
if i%2 == 0 {
2136+
se.Execute(context.Background(), "update src set dt = left(concat('y', dt), 128)")
2137+
} else {
2138+
se.Execute(context.Background(), "update src set dt = left(concat('z', dt), 128)")
2139+
}
2140+
b.StopTimer()
2141+
}
2142+
b.ReportMetric(float64(b.Elapsed().Nanoseconds()/int64(b.N*batchSize*batchNum)), "ns/row")
2143+
}

0 commit comments

Comments
 (0)