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

Commit fd8b208

Browse files
authored
Merge pull request #63 from WillemKauf/tombstones
`producer_worker`: revert use of `ValueGenerator::Generate()`
2 parents bdc41ee + 3c87c1c commit fd8b208

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

pkg/worker/verifier/producer_worker.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,25 @@ 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+
if pw.validateLatestValues {
131+
var value bytes.Buffer
132+
fmt.Fprintf(&value, "value-%018d", sequence)
133+
paddingSize := pw.config.messageSize - value.Len()
134+
if paddingSize > 0 {
135+
value.Write(make([]byte, paddingSize))
136+
}
137+
payload = value.Bytes()
138+
} else {
139+
payload = make([]byte, pw.config.messageSize)
140+
}
127141
}
142+
128143
var r *kgo.Record
129144

130145
if pw.config.keySetCardinality < 0 {

0 commit comments

Comments
 (0)