@@ -264,6 +264,12 @@ func runSysbench(ctx context.Context, t test.Test, c cluster.Cluster, opts sysbe
264
264
return err
265
265
}
266
266
267
+ // The remainder of this method collects profiles and applies only to CRDB,
268
+ // so exit early if benchmarking postgres.
269
+ if opts .usePostgres {
270
+ return nil
271
+ }
272
+
267
273
t .Status ("running 75 second workload to collect profiles" )
268
274
{
269
275
// We store profiles in the perf directory. That way, they're not zipped
@@ -350,30 +356,38 @@ func registerSysbench(r registry.Registry) {
350
356
}
351
357
352
358
for _ , d := range []struct {
353
- n , cpus int
354
- pick func (sysbenchWorkload ) bool // nil means true for all
355
- extra extraSetup
359
+ n , cpus int
360
+ transform func (opts * sysbenchOptions ) bool // false = skip
356
361
}{
357
362
{n : 1 , cpus : 32 },
358
363
{n : 3 , cpus : 32 },
359
- {n : 3 , cpus : 8 , pick : coreThree },
360
- {n : 3 , cpus : 8 , pick : coreThree ,
361
- extra : extraSetup {
362
- nameSuffix : "-settings" ,
363
- stmts : []string {
364
- `set cluster setting sql.stats.flush.enabled = false` ,
365
- `set cluster setting sql.metrics.statement_details.enabled = false` ,
366
- `set cluster setting kv.split_queue.enabled = false` ,
367
- `set cluster setting kv.transaction.write_buffering.enabled = true` ,
368
- },
369
- useDRPC : true ,
364
+ {n : 3 , cpus : 8 ,
365
+ transform : func (opts * sysbenchOptions ) bool {
366
+ // Only run core three.
367
+ return coreThree (opts .workload )
368
+ },
369
+ },
370
+ {n : 3 , cpus : 8 ,
371
+ transform : func (opts * sysbenchOptions ) bool {
372
+ // Only run core three.
373
+ if ! coreThree (opts .workload ) {
374
+ return false
375
+ }
376
+ opts .extra = extraSetup {
377
+ nameSuffix : "-settings" ,
378
+ stmts : []string {
379
+ `set cluster setting sql.stats.flush.enabled = false` ,
380
+ `set cluster setting sql.metrics.statement_details.enabled = false` ,
381
+ `set cluster setting kv.split_queue.enabled = false` ,
382
+ `set cluster setting kv.transaction.write_buffering.enabled = true` ,
383
+ },
384
+ useDRPC : true ,
385
+ }
386
+ return true
370
387
},
371
388
},
372
389
} {
373
390
for w := sysbenchWorkload (0 ); w < numSysbenchWorkloads ; w ++ {
374
- if d .pick != nil && ! d .pick (w ) {
375
- continue
376
- }
377
391
concPerCPU := d .n * 3 - 1
378
392
conc := d .cpus * concPerCPU
379
393
opts := sysbenchOptions {
@@ -382,15 +396,17 @@ func registerSysbench(r registry.Registry) {
382
396
concurrency : conc ,
383
397
tables : 10 ,
384
398
rowsPerTable : 10000000 ,
385
- extra : d .extra ,
399
+ }
400
+ if d .transform != nil && ! d .transform (& opts ) {
401
+ continue
386
402
}
387
403
388
404
benchname := "sysbench"
389
- if d .extra .nameSuffix != "" {
390
- benchname += d .extra .nameSuffix
405
+ if opts .extra .nameSuffix != "" {
406
+ benchname += opts .extra .nameSuffix
391
407
}
392
408
393
- r . Add ( registry.TestSpec {
409
+ spec := registry.TestSpec {
394
410
Name : fmt .Sprintf ("%s/%s/nodes=%d/cpu=%d/conc=%d" , benchname , w , d .n , d .cpus , conc ),
395
411
Benchmark : true ,
396
412
Owner : registry .OwnerTestEng ,
@@ -401,23 +417,21 @@ func registerSysbench(r registry.Registry) {
401
417
Run : func (ctx context.Context , t test.Test , c cluster.Cluster ) {
402
418
runSysbench (ctx , t , c , opts )
403
419
},
404
- })
420
+ }
421
+ r .Add (spec )
405
422
406
- // Add a variant of each test that uses PostgreSQL instead of CockroachDB.
423
+ // Add a variant of the single-node tests that uses PostgreSQL instead of CockroachDB.
407
424
if d .n == 1 {
408
425
pgOpts := opts
409
426
pgOpts .usePostgres = true
410
- r .Add (registry.TestSpec {
411
- Name : fmt .Sprintf ("sysbench/%s/postgres/cpu=%d/conc=%d" , w , d .cpus , conc ),
412
- Benchmark : true ,
413
- Owner : registry .OwnerTestEng ,
414
- Cluster : r .MakeClusterSpec (d .n + 1 , spec .CPU (d .cpus ), spec .WorkloadNode (), spec .WorkloadNodeCPU (16 )),
415
- CompatibleClouds : registry .OnlyGCE ,
416
- Suites : registry .ManualOnly ,
417
- Run : func (ctx context.Context , t test.Test , c cluster.Cluster ) {
418
- runSysbench (ctx , t , c , pgOpts )
419
- },
420
- })
427
+ pgSpec := spec
428
+ pgSpec .Name = fmt .Sprintf ("%s/%s/postgres/cpu=%d/conc=%d" , benchname , w , d .cpus , conc )
429
+ pgSpec .Suites = registry .Suites (registry .Weekly )
430
+ pgSpec .TestSelectionOptOutSuites = registry .Suites (registry .Weekly )
431
+ pgSpec .Run = func (ctx context.Context , t test.Test , c cluster.Cluster ) {
432
+ runSysbench (ctx , t , c , pgOpts )
433
+ }
434
+ r .Add (pgSpec )
421
435
}
422
436
}
423
437
}
0 commit comments