Skip to content

workload/bank: running with --rows=1 causes panic #153849

@andyyang890

Description

@andyyang890

This line panics when rows is 1 because it passes 0 to rand.IntN:

to := rng.IntN(b.rows - 1)

We should require rows to be at least 2. If we don't, then this update query will need to be updated, otherwise the balance will just continuously decrease:

updateStmt, err := db.Prepare(fmt.Sprintf(`
UPDATE %s
SET balance = CASE id WHEN $1 THEN balance-$3 WHEN $2 THEN balance+$3 END
WHERE id IN ($1, $2)
`, b.tableName("bank", tableIdx)))

Jira issue: CRDB-54632

Metadata

Metadata

Assignees

Labels

A-testeng-perfA-testingTesting tools and infrastructureC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-testengTestEng Team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions