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

Introduced cluster::vcluster_id type underlied by XID #16538

Merged
merged 3 commits into from
Feb 23, 2024

Conversation

mmaslankaprv
Copy link
Member

@mmaslankaprv mmaslankaprv commented Feb 8, 2024

Defined a type representing a virtual cluster label. The vcluster_id is going to be used to identify partitions and connections and enrich them with virtual cluster context.

Virtual cluster id is underlaid by XID type as defined in https://github.com/rs/xid.

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
  • v23.3.x
  • v23.2.x
  • v23.1.x

Release Notes

  • none

@mmaslankaprv mmaslankaprv force-pushed the introduced-vcluster-id branch 2 times, most recently from 3fda493 to 5ad109c Compare February 8, 2024 10:47
bharathv
bharathv previously approved these changes Feb 20, 2024
Copy link
Contributor

@bharathv bharathv left a comment

Choose a reason for hiding this comment

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

lgtm.

const char* what() const noexcept final { return _msg.c_str(); }

private:
ss::sstring _msg;
Copy link
Contributor

Choose a reason for hiding this comment

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

if the code points are static, i.e.: throw invalid_xid("foo-bar-baz") then you could simply take a string_view

maybe a invalid_xid_view that takes in a stringview rather than a copy w/ allocation.

Copy link
Member Author

Choose a reason for hiding this comment

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

in this case the message is formatted when instantiating the exception object.

*
* Based on (https://github.com/rs/xid)
*/
class xid {
Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder if all namespace-topic-partitions should just be xids now ? maybe the flywheight pattern travis had in mind is better for partition ids (ints are cheaper)

Copy link
Member Author

Choose a reason for hiding this comment

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

this is good idea, it would require a lot of changes, we have numeric ntps planned.

@mmaslankaprv
Copy link
Member Author

/ci-repeat 1

@vbotbuildovich
Copy link
Collaborator

Copy link
Member

@dotnwat dotnwat left a comment

Choose a reason for hiding this comment

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

lgtm i think there i just some missing coverage in the test.

src/v/utils/xid.h Show resolved Hide resolved
src/v/utils/xid.h Outdated Show resolved Hide resolved
b32_alphabet[((id._data[2] >> 4) & mask) | ((id._data[1] << 4) & mask)],
b32_alphabet[id._data[3] >> 7 | ((id._data[2] << 1) & mask)],
b32_alphabet[(id._data[3] >> 2) & mask],
b32_alphabet[id._data[4] >> 5 | ((id._data[3] << 3) & mask)],
Copy link
Member

Choose a reason for hiding this comment

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

Is this producing the same format as https://github.com/rs/xid/blob/master/id.go#L170 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

src/v/utils/xid.cc Show resolved Hide resolved
src/v/utils/xid.cc Show resolved Hide resolved
src/v/utils/xid.cc Outdated Show resolved Hide resolved
Signed-off-by: Michal Maslanka <michal@redpanda.com>
Signed-off-by: Michal Maslanka <michal@redpanda.com>
Defined a type representing a virtual cluster label. The `vcluster_id`
is going to be used to identify partitions and connections and enrich
them with virtual cluster context.

Signed-off-by: Michal Maslanka <michal@redpanda.com>
@dotnwat dotnwat merged commit 00e2e28 into redpanda-data:dev Feb 23, 2024
16 checks passed
@mmaslankaprv mmaslankaprv deleted the introduced-vcluster-id branch February 23, 2024 06:31
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.

None yet

5 participants