@@ -389,6 +389,12 @@ func splitFinder(i, splits int, r keyRange, k keyTransformer) interface{} {
389
389
return k .getKey (splitPoint )
390
390
}
391
391
392
+ func insertCountKey (idx , count int64 , kr keyRange ) int64 {
393
+ stride := kr .max / (count + 1 ) - kr .min / (count + 1 )
394
+ key := kr .min + (idx + 1 )* stride
395
+ return key
396
+ }
397
+
392
398
// Tables implements the Generator interface.
393
399
func (w * kv ) Tables () []workload.Table {
394
400
// Tables should only run on initialized workload, safe to call create without
@@ -430,9 +436,6 @@ func (w *kv) Tables() []workload.Table {
430
436
// INSERT ... ON CONFLICT DO NOTHING statements.
431
437
MayContainDuplicates : ! w .sequential ,
432
438
FillBatch : func (batchIdx int , cb coldata.Batch , a * bufalloc.ByteAllocator ) {
433
- // Grab a new state for each batch, under the assumption that
434
- // FillBatch may be called concurrently.
435
- ks := kg .newState ()
436
439
rowBegin , rowEnd := batchIdx * batchSize , (batchIdx + 1 )* batchSize
437
440
if rowEnd > w .insertCount {
438
441
rowEnd = w .insertCount
@@ -448,11 +451,11 @@ func (w *kv) Tables() []workload.Table {
448
451
{
449
452
seq := rowBegin
450
453
kg .transformer .fillColumnBatch (cb , a , func () (s int64 , ok bool ) {
451
- if seq >= rowEnd {
452
- return 0 , false
454
+ if seq < rowEnd {
455
+ seq ++
456
+ return insertCountKey (int64 (seq - 1 ), int64 (w .insertCount ), kg .kr ), true
453
457
}
454
- seq ++
455
- return ks .mapKey .mapKey (int64 (seq )), true
458
+ return 0 , false
456
459
})
457
460
}
458
461
0 commit comments