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.
Update to the recently released kafka-protocol 0.13.0
The largest change was tychedelia/kafka-protocol-rs#90 which converted all IndexMap fields to use Vec instead.
This change was required due to the protocol actually supporting duplicate keys at the protocol level. (Its up to the broker to reject responses that are invalid due to duplicate keys)
The easiest way to fix this is to change those fields to Vecs and store the key in the struct.
This approach also comes with some performance benefits at the decode stage as can be seen by the improvement to the
decode_request_produce_create
benchmark.Due to the replacement of IndexMap with Vec there was only 1 lookup that would have to be turned into an O(N) lookup.
To avoid it becoming an O(N) lookup I've added an intermediate hashmap which is converted to a vec at the end.
I'm not entirely sure its needed but its the safer option (better worst case) so I took it.