-
Notifications
You must be signed in to change notification settings - Fork 592
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
Made client id parsing vcluster aware #18464
Made client id parsing vcluster aware #18464
Conversation
Signed-off-by: Michał Maślanka <michal@redpanda.com>
When using mpx protocol extension actual client id is only a part of the whole client id buffer sent by MPX to Redpanda. Added a method allowing overriding client id. Signed-off-by: Michał Maślanka <michal@redpanda.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, have some questions about input validation
vcluster_connection_id parse_vcluster_connection_id(std::string_view str) { | ||
vcluster_connection_id cid; | ||
std::stringstream sstream(str.data()); | ||
sstream >> std::hex >> cid; | ||
return cid; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be some validation to ensure that the vcluster_connection_id contains only valid hex characters. The streaming operation won't throw any exception if an invalid character is encountered and will simply stop processing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple questions but generally lgtm. I agree with @michael-redpanda - some DT tests for junk input might be nice.
Previously Redpanda virtualized Kafka connections based on the full client_id string and the string was used as a client id in all downstream processing. Change the parsing logic to add context to the parsed client id. The client id format expected by Redpanda has the following structure: ``` [vcluster_id][connection_id][actual client id] ``` where: `vcluster_id` - string encoded XID representing virtual cluster (20 characters) `connection_id` - hex encoded 32 bit integer representing virtual connection id (8 characters) `client_id` - standard protocol defined client id If Redpanda fails to parse the client id while working with virtualized connections the whole connection is closed. Signed-off-by: Michał Maślanka <michal@redpanda.com>
Signed-off-by: Michał Maślanka <michal@redpanda.com>
Signed-off-by: Michał Maślanka <michal@redpanda.com>
b28ebec
to
953135b
Compare
Replaced `node_hash_map` keeping state of virtualized connections with `chunked_hash_map`. The change will allow us to avoid large allocations when dealing with large virtual connection number. Signed-off-by: Michał Maślanka <michal@redpanda.com>
cb96979
to
187dcbf
Compare
ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/49168#018f7d6c-bd71-4c32-8bfe-1f25bc06addd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
/backport v24.1.x |
Previously Redpanda virtualized Kafka connections based on the full
client_id string and the string was used as a client id in all
downstream processing.
Change the parsing logic to add context to the parsed client id.
The client id format expected by Redpanda has the following structure:
where:
vcluster_id
- string encoded XID representing virtual cluster(20 characters)
connection_id
- hex encoded 32 bit integer representing virtualconnection id (8 characters)
client_id
- standard protocol defined client idIf Redpanda fails to parse the client id while working with virtualized
connections the whole connection is closed.
Backports Required
Release Notes