Add MessageId (progress towards cleaning up transform invariants) #1476
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a
MessageId
type and assigns a uniqueMessageId
to every message that goes through shotover.Additionally responses now hold the MessageId of their corresponding request.
The API for this is exposed as methods on the
Message
type:This will eventually replace the "requests are in the same order as responses" invariant but for now it is just in addition to it.
I updated the
Transform::transform
docs where we document such invariants and it is rendered below.The important sections are "Request/Response invariants" and "Deprecated invariants".
I have not observed any regressions in benchmark results with this PR and the call to rand doesnt even show up when profiling.
Benefits
transform_pushed
Downsides
Review
I've included a port of the
protect
andCassandraSinkCluster
transforms to the message id approach, but I've left other ports out of the PR to keep scope down.I am fairly confident that this approach will work well for all of our transforms.
But if you have a specific transform you would like me to include in the PR to see how it fares, just let me know.
With "hide whitespace" enabled the protect transform has a very small diff, so for the typical user implemented rewrite transform not much has changed.