Skip to content

Commit

Permalink
Merge pull request #63 from WillemKauf/tombstones
Browse files Browse the repository at this point in the history
`producer_worker`: revert use of `ValueGenerator::Generate()`
  • Loading branch information
WillemKauf authored Dec 13, 2024
2 parents bdc41ee + 3c87c1c commit fd8b208
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pkg/worker/verifier/producer_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,25 @@ func (pw *ProducerWorker) newRecord(producerId int, sequence int64) *kgo.Record
pw.Status.AbortedTransactionMessages += 1
}

payload := pw.config.valueGenerator.Generate()
if payload == nil {
var payload []byte
isTombstone := rand.Float64() < pw.config.valueGenerator.TombstoneProbability
if isTombstone {
payload = nil
pw.Status.TombstonesProduced += 1
} else {
if pw.validateLatestValues {
var value bytes.Buffer
fmt.Fprintf(&value, "value-%018d", sequence)
paddingSize := pw.config.messageSize - value.Len()
if paddingSize > 0 {
value.Write(make([]byte, paddingSize))
}
payload = value.Bytes()
} else {
payload = make([]byte, pw.config.messageSize)
}
}

var r *kgo.Record

if pw.config.keySetCardinality < 0 {
Expand Down

0 comments on commit fd8b208

Please sign in to comment.