Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --tombstone-probability and --compacted #60

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

WillemKauf
Copy link

Adds two flags to kgo-repeater and kgo-verifier:

--tombstone-probability, which allows for random production of tombstone records per the input parameter.

--compacted, which indicates that the topic to be verified is compacted. A warning about gaps in consumed offsets will not be shown if this is true.

Allows the `producer_worker` and `repeater_worker` to generate tombstone
records.
@@ -108,7 +109,10 @@ func (pw *ProducerWorker) newRecord(producerId int, sequence int64) *kgo.Record
pw.Status.AbortedTransactionMessages += 1
}

payload := make([]byte, pw.config.messageSize)
payload := pw.config.valueGenerator.Generate()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why valueGenerator wasn't used here before instead of an empty make([]byte)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😨

Copy link
Contributor

@nvartolomei nvartolomei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a PR to redpanda and check that it works as expect by pointing kgo at this commit sha before merging this PR. Otherwise if we merge and detect a problem we get a "head of line blocking" on making concurrent changes to kgo.

Suggestion: For testing compacted topics I think we can do more. kgo-verifier should keep track of the keys and and the end checkpoint the expected set of keys and associated values (last values produced for a key minus tombstones). Then during consumption we can track the same and compare at the end.

Or maybe we have a test like this already?

@@ -108,7 +109,10 @@ func (pw *ProducerWorker) newRecord(producerId int, sequence int64) *kgo.Record
pw.Status.AbortedTransactionMessages += 1
}

payload := make([]byte, pw.config.messageSize)
payload := pw.config.valueGenerator.Generate()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😨

@@ -53,7 +53,7 @@ type ValidatorStatus struct {
lastLeaderEpoch map[int32]int32
}

func (cs *ValidatorStatus) ValidateRecord(r *kgo.Record, validRanges *TopicOffsetRanges) {
func (cs *ValidatorStatus) ValidateRecord(r *kgo.Record, validRanges *TopicOffsetRanges, compacted bool) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall this be a field on the ValidatorStatus struct instead? it doesn't change for the lifetime entire lifetime anyway why pass it as a param then?

@WillemKauf
Copy link
Author

WillemKauf commented Nov 14, 2024

Please make a PR to redpanda and check that it works as expect by pointing kgo at this commit sha before merging this PR. Otherwise if we merge and detect a problem we get a "head of line blocking" on making concurrent changes to kgo.

Ack, will do with an upcoming PR.

Suggestion: For testing compacted topics I think we can do more. kgo-verifier should keep track of the keys and and the end checkpoint the expected set of keys and associated values (last values produced for a key minus tombstones). Then during consumption we can track the same and compare at the end.

Yes, this is possible. Will push some follow up commits to this PR.

Offset gaps exist in compacted topics. Suppress a warning log
in the read workers if the user passes a `--compacted` flag
as a parameter.
For verification of compacted topics, we can track the last
expected key-value pair that will be seen after the log has been
fully compacted.
As a means to verify the results along with `LatestValueProduced`
for a compacted topic.
@WillemKauf
Copy link
Author

Force push to:

  • Move compacted flag to the ValidatorStatus struct
  • Add LatestValueProduced and LatestValueConsumed to the ProducerWorkerStatus and ValidatorStatus structs respectively. These nested maps track the latest (and expected) key-value pair per partition for compacted topic verification.
  • Because these are nested map structures, JSON output may grow very large. Alter the String() function for both ProducerWorkerStatus and ValidatorStatus so that they are excluded from output. There will have to be changes on the ducktape side in the redpanda repo to ensure this output isn't in the logs there as well.

WillemKauf added a commit to WillemKauf/redpanda that referenced this pull request Nov 15, 2024
See redpanda-data/kgo-verifier#60,
which added `--tombstone-probability`, `--compacted` as input parameters,
and `LatestValueProduced`/`LatestValueConsumed` as return values in
producer/worker status structs.
WillemKauf added a commit to WillemKauf/redpanda that referenced this pull request Nov 15, 2024
See redpanda-data/kgo-verifier#60,
which added `--tombstone-probability`, `--compacted` as input parameters,
and `LatestValueProduced`/`LatestValueConsumed` as return values in
producer/worker status structs.
WillemKauf added a commit to WillemKauf/redpanda that referenced this pull request Nov 15, 2024
See redpanda-data/kgo-verifier#60,
which added `--tombstone-probability`, `--compacted` as input parameters,
and `LatestValueProduced`/`LatestValueConsumed` as return values in
producer/worker status structs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants