Skip to content

Commit

Permalink
workload/bank: reset payload column before reuse
Browse files Browse the repository at this point in the history
Without this change, running the bank workload on a non-trivial number
of rows causes cockroach to fail with this error message:

`panic: cannot overwrite value on flat Bytes: maxSetIndex=999, setIndex=0, consider using Reset`

Release note: None
  • Loading branch information
ajkr committed Aug 26, 2019
1 parent d0f2003 commit 466fb1a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/workload/bank/bank.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ func (b *bank) Tables() []workload.Table {
idCol := cb.ColVec(0).Int64()
balanceCol := cb.ColVec(1).Int64()
payloadCol := cb.ColVec(2).Bytes()
// coldata.Bytes only allows appends so we have to reset it
payloadCol.Reset()
for rowIdx := rowBegin; rowIdx < rowEnd; rowIdx++ {
var payload []byte
*a, payload = a.Alloc(b.payloadBytes, 0 /* extraCap */)
Expand Down

0 comments on commit 466fb1a

Please sign in to comment.