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

[WIP] Implement proper payload chunked encoding in HTTP api_v3 #6479

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

chahatsagarmain
Copy link
Contributor

@chahatsagarmain chahatsagarmain commented Jan 4, 2025

Which problem is this PR solving?

Description of the changes

  • Added a handler function

How was this change tested?

Checklist

Signed-off-by: chahatsagarmain <[email protected]>
Signed-off-by: chahatsagarmain <[email protected]>
@chahatsagarmain chahatsagarmain requested a review from a team as a code owner January 4, 2025 12:47
@chahatsagarmain chahatsagarmain marked this pull request as draft January 4, 2025 12:54
Copy link

codecov bot commented Jan 4, 2025

Codecov Report

Attention: Patch coverage is 72.22222% with 10 lines in your changes missing coverage. Please review.

Project coverage is 96.15%. Comparing base (e7a0205) to head (1c3c247).
Report is 90 commits behind head on main.

Files with missing lines Patch % Lines
cmd/query/app/apiv3/http_gateway.go 72.22% 7 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6479      +/-   ##
==========================================
- Coverage   96.23%   96.15%   -0.09%     
==========================================
  Files         368      375       +7     
  Lines       20978    21433     +455     
==========================================
+ Hits        20189    20608     +419     
- Misses        604      629      +25     
- Partials      185      196      +11     
Flag Coverage Δ
badger_v1 ?
badger_v2 2.78% <ø> (+0.35%) ⬆️
cassandra-4.x-v1-manual 16.64% <ø> (+0.18%) ⬆️
cassandra-4.x-v2-auto 2.72% <ø> (+0.36%) ⬆️
cassandra-4.x-v2-manual 2.72% <ø> (+0.36%) ⬆️
cassandra-5.x-v1-manual 16.64% <ø> (+0.18%) ⬆️
cassandra-5.x-v2-auto 2.72% <ø> (+0.36%) ⬆️
cassandra-5.x-v2-manual 2.72% <ø> (+0.36%) ⬆️
elasticsearch-6.x-v1 20.43% <ø> (+0.23%) ⬆️
elasticsearch-7.x-v1 20.51% <ø> (+0.24%) ⬆️
elasticsearch-8.x-v1 20.67% <ø> (+0.24%) ⬆️
elasticsearch-8.x-v2 2.78% <ø> (+0.36%) ⬆️
grpc_v1 12.19% <ø> (-0.03%) ⬇️
grpc_v2 9.06% <ø> (+0.24%) ⬆️
kafka-3.x-v1 10.36% <ø> (-0.05%) ⬇️
kafka-3.x-v2 2.78% <ø> (+0.35%) ⬆️
memory_v2 2.78% <ø> (+0.35%) ⬆️
opensearch-1.x-v1 20.56% <ø> (+0.23%) ⬆️
opensearch-2.x-v1 20.56% <ø> (+0.23%) ⬆️
opensearch-2.x-v2 2.77% <ø> (+0.35%) ⬆️
tailsampling-processor 0.51% <ø> (+0.11%) ⬆️
unittests 95.03% <72.22%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: chahatsagarmain <[email protected]>
Signed-off-by: chahatsagarmain <[email protected]>
Signed-off-by: chahatsagarmain <[email protected]>
@chahatsagarmain chahatsagarmain marked this pull request as ready for review January 22, 2025 18:34
n, err := resp.Body.Read(buf)

if n > 0 {
fullResponse.Write(buf[:n])
Copy link
Member

Choose a reason for hiding this comment

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

if you concatenate the chunks you will end up with invalid JSON

// Set chunked transfer encoding before any writes
w.Header().Set("Transfer-Encoding", "chunked")
w.Header().Set("Content-Encoding", "gzip")
w.Header().Set("Vary", "Accept-Encoding")
Copy link
Member

Choose a reason for hiding this comment

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

what is this?

}

// Set chunked transfer encoding before any writes
w.Header().Set("Transfer-Encoding", "chunked")
Copy link
Member

Choose a reason for hiding this comment

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

chunked encoding requires each chunk to be prefixed with its size

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.

Implement proper payload chunked encoding in HTTP api_v3
2 participants