-
Notifications
You must be signed in to change notification settings - Fork 552
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
schemata: use chunked_vector for createable_topic #16529
schemata: use chunked_vector for createable_topic #16529
Conversation
* In the same manner as the corresponding std::vector method. | ||
*/ | ||
fragmented_vector(std::initializer_list<value_type> elems) | ||
: fragmented_vector(elems.begin(), elems.end()) {} |
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.
This is the only new code, the other constructor was just moved to keep all constructors together at the start of the member list.
e99567b
to
879ae45
Compare
@@ -199,7 +199,8 @@ ss::future<response_ptr> create_topics_handler::handle( | |||
} | |||
|
|||
if (!ctx.audit()) { | |||
request.data.topics.erase(valid_range_end, request.data.topics.end()); |
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.
chunked_vector does not have erase()
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 wonder if an chunked_vector::erase_to_end(iterator)
would be an easier drop in replacement instead of pop_back_n
.
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.
Yes, I had the same thought and this comment pushed me over the the edge to add it, it's in this PR as of the latest push.
@@ -24,7 +24,8 @@ | |||
class create_topic_fixture : public redpanda_thread_fixture { | |||
public: | |||
kafka::create_topics_request make_req( | |||
std::vector<kafka::creatable_topic> topics, bool validate_only = false) { | |||
chunked_vector<kafka::creatable_topic> topics, |
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.
The edits in this file are because chunked_vector does not have a copy constructor, so we need to move the request object around now.
This means copying some stuff out here where we used the request after passing it down, and more use of std::move
.
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
@@ -199,7 +199,8 @@ ss::future<response_ptr> create_topics_handler::handle( | |||
} | |||
|
|||
if (!ctx.audit()) { | |||
request.data.topics.erase(valid_range_end, request.data.topics.end()); |
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 wonder if an chunked_vector::erase_to_end(iterator)
would be an easier drop in replacement instead of pop_back_n
.
* | ||
* This has the same semantics as the corresponding std::vector | ||
* constructor. | ||
*/ | ||
template<typename Iter> | ||
requires std::input_iterator<Iter> | ||
fragmented_vector(Iter begin, Iter end) |
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.
nit: would it be possible to change commit message to keep the naming consistent i.e. fragemented_vector
?
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.
Sure, updated to use fragmented_vector
.
879ae45
to
a2bff73
Compare
We add a std::initalizer_list constructor to fragmented_vector. This is present in std::vector making some swap-outs more difficult.
a2bff73
to
1377c44
Compare
1377c44
to
bb23a02
Compare
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
This is similar to pop_back_n but takes an iterator and is a more directly replacement for use cases which are already using iterators. Additionally, allow const_iterator to be converted to iterator, which is what standard containers do and is important for ergonomics.
bb23a02
to
fda1625
Compare
Override the decode path to use chunked_vector for creatable_topic as we may have 10,000s of these in a single API request. Arguably, we could use chunked_vector everywhere now in schemata and get rid of this override, but let's do that later. Fixes redpanda-data#16521.
fda1625
to
51fda27
Compare
ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/44914#018d8ac1-b3d6-4ab1-a1e3-f38e4139937c |
/backport v23.3.x |
Failed to create a backport PR to v23.3.x branch. I tried:
|
/backport v23.3.x |
Override the decode path to use chunked_vector for createable_topic as we may have 10,000s of these in a single API request.
Arguably, we could use chunked_vector everywhere now in schemata and get rid of this override, but let's do that later.
Fixes #16521.
Backports Required
Release Notes
Bug Fixes