-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add query size parameter to IPA queries #703
Conversation
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, though please fix the bug I identified (or open an issue for it, we're not likely to need 2 billion inputs for a while).
src/helpers/transport/query.rs
Outdated
) -> Result<Self, QueryConfigError> | ||
where | ||
<S as TryInto<usize>>::Error: Debug, | ||
S: TryInto<usize> + TryInto<u32>, |
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.
Don't you only need one of these? (The latter?)
src/helpers/transport/query.rs
Outdated
.and_then(NonZeroU32::try_from) | ||
.map_err(|_| QueryConfigError::BadQuerySize { | ||
actual_size: sz, | ||
max_size: MAX_QUERY_SIZE, |
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.
Are you relying on MAX_QUERY_SIZE
being equal to NonZeroU32::MAX
?
... and I just saw that it is not. We'll need a new type for this, with a TryFrom
implementation that doesn't accept 231, as this does.
src/net/http_serde.rs
Outdated
@@ -109,10 +109,13 @@ pub mod query { | |||
async fn from_request(req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> { | |||
#[derive(serde::Deserialize)] | |||
struct QueryTypeParam { | |||
// TODO: serde custom error? | |||
size: NonZeroU32, |
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.
We might need a new type for this is MAX_QUERY_SIZE
changes.
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.
added a new type QuerySize
- made it cleaner
IPA needs to know how many records will be submitted inside a query. It is important for multiple reasons, one of them is to be able to tune the size of send/receive buffer