From cf89e30804218dd8c7d2d78525d7c891979d0267 Mon Sep 17 00:00:00 2001 From: Tobias Schottdorf Date: Tue, 10 May 2016 20:11:18 -0400 Subject: [PATCH] force blind puts into non-empty key range The insert workload is randomized, so the blind puts were computed but nothing was actually written blindly. benchmark old ns/op new ns/op delta BenchmarkTrackChoices1280_Cockroach-8 171532 65505 -61.81% benchmark old allocs new allocs delta BenchmarkTrackChoices1280_Cockroach-8 142 130 -8.45% benchmark old bytes new bytes delta BenchmarkTrackChoices1280_Cockroach-8 27241 26018 -4.49% ``` 2016/05/10 20:15:44.886244 0.006944 node 1 20:15:44.886246 . 3 ... node 1 20:15:44.886253 . 6 ... read has no clock uncertainty 20:15:44.886334 . 81 ... executing 1282 requests 20:15:44.886543 . 209 ... read-write path 20:15:44.886544 . 1 ... command queue 20:15:44.886963 . 420 ... left command queue 20:15:44.886966 . 3 ... request leader lease (attempt #1) 20:15:44.887265 . 298 ... prep for ts cache 20:15:44.887266 . 1 ... applied ts cache 20:15:44.887268 . 2 ... start marshal 20:15:44.887772 . 504 ... end marshal 20:15:44.887835 . 63 ... begin prop 20:15:44.887852 . 17 ... done prop 20:15:44.887855 . 3 ... proposed to Raft 20:15:44.888949 . 1094 ... applying batch 20:15:44.889015 . 67 ... checked aborted txn 20:15:44.889197 . 181 ... checked leadership 20:15:44.889199 . 2 ... executing as 1PC txn 20:15:44.889644 . 445 ... 1280 blind puts 20:15:44.892245 . 2601 ... executeBatch returns 20:15:44.892308 . 63 ... executed batch 20:15:44.892360 . 52 ... prep for commit 20:15:44.893101 . 741 ... committed 20:15:44.893154 . 53 ... processed async intents 20:15:44.893155 . 1 ... applied batch 20:15:44.893173 . 18 ... response obtained 20:15:44.893174 . 1 ... endCmds begins 20:15:44.893175 . 1 ... begin update tsCache 20:15:44.893176 . 1 ... end update tsCache 20:15:44.893177 . 2 ... removed from cmdQ 20:15:44.893178 . 1 ... endCmds ends 20:15:44.893180 . 1 ... Send returns ``` --- out.allblind.10s | 3 +++ out.allblind.1s | 3 +++ out.allblind.20s | 3 +++ storage/replica.go | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 out.allblind.10s create mode 100644 out.allblind.1s create mode 100644 out.allblind.20s diff --git a/out.allblind.10s b/out.allblind.10s new file mode 100644 index 000000000000..ccc60d275896 --- /dev/null +++ b/out.allblind.10s @@ -0,0 +1,3 @@ +PASS +BenchmarkTrackChoices1280_Cockroach-8 200000 65505 ns/op 26018 B/op 130 allocs/op +ok github.com/cockroachdb/cockroach/sql 14.236s diff --git a/out.allblind.1s b/out.allblind.1s new file mode 100644 index 000000000000..198238958387 --- /dev/null +++ b/out.allblind.1s @@ -0,0 +1,3 @@ +PASS +BenchmarkTrackChoices1280_Cockroach-8 20000 63429 ns/op 26003 B/op 130 allocs/op +ok github.com/cockroachdb/cockroach/sql 2.359s diff --git a/out.allblind.20s b/out.allblind.20s new file mode 100644 index 000000000000..844223c3e3b2 --- /dev/null +++ b/out.allblind.20s @@ -0,0 +1,3 @@ +PASS +BenchmarkTrackChoices1280_Cockroach-8 500000 79451 ns/op 29265 B/op 145 allocs/op +ok github.com/cockroachdb/cockroach/sql 40.904s diff --git a/storage/replica.go b/storage/replica.go index 4cdb03917cf1..48981fde44a2 100644 --- a/storage/replica.go +++ b/storage/replica.go @@ -1994,7 +1994,7 @@ func optimizePuts(ctx context.Context, batch engine.Engine, reqs []roachpb.Reque iter.Seek(engine.MakeMVCCMetadataKey(minKey)) var iterKey roachpb.Key if iter.Valid() && bytes.Compare(iter.Key().Key, maxKey) <= 0 { - iterKey = iter.Key().Key + // iterKey = iter.Key().Key } // Set the prefix of the run which is being written to virgin // keyspace to "blindly" put values.