-
Notifications
You must be signed in to change notification settings - Fork 824
add zstd and snappy compression for query api #6848
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Ahmed Hassan <[email protected]>
Signed-off-by: Ahmed Hassan <[email protected]>
Signed-off-by: Ahmed Hassan <[email protected]>
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 small nit, but overall looks good to me.
Thanks.
Signed-off-by: Ahmed Hassan <[email protected]>
Signed-off-by: Ahmed Hassan <[email protected]>
@yeya24 @SungJin1212 could someone take a look when you have some time? Thanks! |
@afhassan |
Signed-off-by: Ahmed Hassan <[email protected]>
Signed-off-by: Ahmed Hassan <[email protected]>
Signed-off-by: Ahmed Hassan <[email protected]>
@SungJin1212 Thanks for the review, I added unit tests and an integration test for compression. The change done to QFE response size limit is already covered by this test https://github.com/afhassan/cortex/blob/master/integration/query_frontend_test.go#L977 |
@@ -102,8 +110,23 @@ func (c instantQueryCodec) DecodeResponse(ctx context.Context, r *http.Response, | |||
return nil, err | |||
} | |||
|
|||
responseSize := 0 | |||
responseSizeHeader := r.Header.Get("X-Uncompressed-Length") |
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.
This change means that we need a two phase deployment for querier to return this header for Query Frontend to properly apply the response size limit. Otherwise, the value is 0.
I think we should find a way (maybe a flag) to properly maintain the previous behavior during rollout.
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.
I didn't quite get it, do you mean during deployment if Query Frontend is updated first then the limit wouldn't apply because the header is not being returned from Querier?
The old behaviour only works for gzip which is why I changed it. I can reverse it to use the old behaviour when gzip is used and the new one for other compression types.
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.
Yes. If we use gzip then this limiter won't work until Querier is updated, which is a breaking behavior.
We just need a way to fallback to the old behavior if it is gzip. Other types are fine since they are new
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.
If header is missing we now fallback to applying limit using size of the response after decoding it. I think this is a cleaner way to still apply the limit and avoid a breaking change if the header is not there.
Applying the limit before decoding response was an optimization in the old behaviour, but I don't think it is considered breaking if we are still applying the limit.
Signed-off-by: Ahmed Hassan <[email protected]>
What this PR does:
X-Uncompressed-Length
to enforce QFE response size limit before decompressing responseWhich issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]