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

hrpc, region: Allow setting priority on Scan and Get requests #267

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

aaronbee
Copy link
Collaborator

Provide an option for setting the priority on a Scan or Get request. The priority is set on the RequestHeader, so must be set by the region code when serializing the request.

Provide an option for setting the priority on a Scan or Get request.
The priority is set on the RequestHeader, so must be set by the region
code when serializing the request.
@dethi dethi merged commit e08f807 into master Aug 14, 2024
2 checks passed
@dethi dethi deleted the priority branch August 14, 2024 18:56
func (bq *baseQuery) setPriority(priority uint32) {
bq.priority = priority
}
func (bq *baseQuery) Priority() *uint32 {
Copy link
Owner

Choose a reason for hiding this comment

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

Returning by point here is weird. I understand that when we marshal to proto it wants pointers-to-int and maybe doing it this way avoids an allocation (because otherwise in marshalProto() you'd have to create an int and take its address thereby causing a heap allocation of a new integer), but from an API perspective it's odd. Did you do it this way to avoid an allocation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, to avoid an allocation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And now this has become slightly awkward in #268, which fixes something I missed here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh I didn't notice that. I think returning just uint32 make more sense. Returning a pointer or a uint32 is the same in the end

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's same except for the added allocation. The extra allocation is not a big deal, so I'll just clean this up in #268.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated #268

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

Successfully merging this pull request may close these issues.

3 participants