Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit b5cc3b1

Browse files
committed
producer_worker: revert use of ValueGenerator::Generate()
Using the modified `Generate()` function was a lot slower than just simply making an empty payload.
1 parent bffac1f commit b5cc3b1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/worker/verifier/producer_worker.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,15 @@ func (pw *ProducerWorker) newRecord(producerId int, sequence int64) *kgo.Record
121121
pw.Status.AbortedTransactionMessages += 1
122122
}
123123

124-
payload := pw.config.valueGenerator.Generate()
125-
if payload == nil {
124+
var payload []byte
125+
isTombstone := rand.Float64() < pw.config.valueGenerator.TombstoneProbability
126+
if isTombstone {
127+
payload = nil
126128
pw.Status.TombstonesProduced += 1
129+
} else {
130+
payload = make([]byte, pw.config.messageSize)
127131
}
132+
128133
var r *kgo.Record
129134

130135
if pw.config.keySetCardinality < 0 {

0 commit comments

Comments
 (0)