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

kafka: fix fetching from partitions with negative indexes #23301

Merged
merged 2 commits into from
Sep 13, 2024

Conversation

bharathv
Copy link
Contributor

@bharathv bharathv commented Sep 12, 2024

Since 24.2.x this was triggering an assert. Added a regression test.

Fixes #23296

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.2.x
  • v24.1.x
  • v23.3.x

Release Notes

Bug Fixes

  • Fixes crash when consuming from topic partitions with negative indexes

Some of the inputs may be directly from user requests, avoid asserting
when encountering such malformed requests. Particularly requests like
contains() and find() don't need to assert on non existent keys.
@vbotbuildovich
Copy link
Collaborator

vbotbuildovich commented Sep 12, 2024

@piyushredpanda piyushredpanda merged commit 0341050 into redpanda-data:dev Sep 13, 2024
19 checks passed
@vbotbuildovich
Copy link
Collaborator

/backport v24.2.x

key);
static bool valid_key(KeyT key) {
// map keys must be positive.
return key >= 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

why use a generic type if it must be convertible to int?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Template definition restricts it to integral types

template<std::integral KeyT, typename ValueT>
class contiguous_range_map {

Copy link
Member

Choose a reason for hiding this comment

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

yeh i guess if we had a fixed integral type then we'd end up with various narrowing conversion warnings etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

24.2 crashes when consuming from partition -1
6 participants