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

Add query size parameter to IPA queries #703

Merged
merged 8 commits into from
Jun 26, 2023

Conversation

akoshelev
Copy link
Collaborator

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

Copy link
Member

@martinthomson martinthomson left a 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).

) -> Result<Self, QueryConfigError>
where
<S as TryInto<usize>>::Error: Debug,
S: TryInto<usize> + TryInto<u32>,
Copy link
Member

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?)

.and_then(NonZeroU32::try_from)
.map_err(|_| QueryConfigError::BadQuerySize {
actual_size: sz,
max_size: MAX_QUERY_SIZE,
Copy link
Member

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.

@@ -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,
Copy link
Member

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.

Copy link
Collaborator Author

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

@akoshelev akoshelev merged commit ef97d17 into private-attribution:main Jun 26, 2023
@akoshelev akoshelev deleted the record-count branch June 26, 2023 17:53
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.

2 participants