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

distributor: pass write request size via metadata #6490

Merged
merged 3 commits into from
Oct 27, 2023

Conversation

pstibrany
Copy link
Member

@pstibrany pstibrany commented Oct 26, 2023

What this PR does

This PR makes distributor to pass size of WriteRequest in gRPC request metadata. That allows ingester to check for the size before reading request into memory.

Changelog will be added after implementing request size check on ingesters. (#6492)

Checklist

  • Tests updated
  • [na] Documentation added
  • [na] CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
@pstibrany pstibrany requested a review from a team as a code owner October 26, 2023 15:03
Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
require.NoError(t, err)

// Verify that d.send added message size to metadata.
require.NotEmpty(t, strconv.Itoa(req.Size()), mock.md[grpcutil.MetadataMessageSize])
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this is asserting what we want it to be asserting?

We're asserting that strconv.Itoa(size) is not empty but even a request size of 0 will be converted to "0" which isn't an empty string. Also I don't understand why we're passing the metadata as the msgAndArgs argument to require.NotEmpty().

Copy link
Member Author

@pstibrany pstibrany Oct 27, 2023

Choose a reason for hiding this comment

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

I'm not sure this is asserting what we want it to be asserting?

You're right, it should be equality test. Fixed in 5ff6b54.

Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
Copy link
Contributor

@56quarters 56quarters left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@pstibrany pstibrany enabled auto-merge (squash) October 27, 2023 15:23
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Yes!

@pstibrany pstibrany merged commit fa4bc64 into main Oct 27, 2023
28 checks passed
@pstibrany pstibrany deleted the distributor-pass-write-request-size-to-ingester branch October 27, 2023 15:32
francoposa pushed a commit that referenced this pull request Oct 30, 2023
* Distributor: pass size of write request in grpc metadata.

Signed-off-by: Peter Štibraný <pstibrany@gmail.com>
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