@@ -197,9 +197,15 @@ func runSysbench(ctx context.Context, t test.Test, c cluster.Cluster, opts sysbe
197197 var start time.Time
198198 runWorkload := func (ctx context.Context ) error {
199199 t .Status ("preparing workload" )
200- cmd := opts .cmd (useHAProxy /* haproxy */ )
201200 {
202- result , err := c .RunWithDetailsSingleNode (ctx , t .L (), option .WithNodes (c .WorkloadNode ()), roachtestutil .PrefixCmdOutputWithTimestamp (cmd + " prepare" ))
201+ opts := opts
202+ // We often see the prepare phase hit `result is ambiguous: error=replica unavailable`
203+ // due to io overload. Sysbench prepare parallelizes work based on number of tables,
204+ // so limit concurrency to half the number of tables so we aren't inserting into every
205+ // table at once.
206+ opts .concurrency = opts .tables / 2
207+
208+ result , err := c .RunWithDetailsSingleNode (ctx , t .L (), option .WithNodes (c .WorkloadNode ()), roachtestutil .PrefixCmdOutputWithTimestamp (opts .cmd (useHAProxy )+ " prepare" ))
203209 if err != nil {
204210 return err
205211 } else if msg , crashed := detectSysbenchCrash (result ); crashed {
@@ -231,7 +237,7 @@ func runSysbench(ctx context.Context, t test.Test, c cluster.Cluster, opts sysbe
231237
232238 t .Status ("running workload" )
233239 start = timeutil .Now ()
234- result , err := c .RunWithDetailsSingleNode (ctx , t .L (), option .WithNodes (c .WorkloadNode ()), roachtestutil .PrefixCmdOutputWithTimestamp (cmd + " run" ))
240+ result , err := c .RunWithDetailsSingleNode (ctx , t .L (), option .WithNodes (c .WorkloadNode ()), roachtestutil .PrefixCmdOutputWithTimestamp (opts . cmd ( useHAProxy ) + " run" ))
235241
236242 if msg , crashed := detectSysbenchCrash (result ); crashed {
237243 t .Skipf ("%s; skipping test" , msg )
0 commit comments