Skip to content

Conversation

@yeya24
Copy link
Contributor

@yeya24 yeya24 commented Mar 8, 2023

What this PR does:

To prevent reading the reader multiple times in #5201, instead we first parse the form to read the body if it is a POST request, then we set body to the buffer we copied. This could make sure we read the buf later only once.

I have added integration test cases for query frontend with vertical sharding enabled. Tests should pass after this fix.

Note:
If it is a GET request and it sets body to non empty, in this case the buffer is nil so we will set body to nil. But I think this is fine as ParseForm method only cares about url params and ignores body if it is a GET request.

Which issue(s) this PR fixes:
Fixes #5201

Checklist

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

@alanprot
Copy link
Member

alanprot commented Mar 8, 2023

Thanks for fixing this!

Can you add the changelog?

@yeya24 yeya24 force-pushed the fix-multiple-times-reader branch from 5a53009 to 716fb42 Compare March 8, 2023 19:08
@yeya24
Copy link
Contributor Author

yeya24 commented Mar 8, 2023

Can you add the changelog?

The bug was introduced by a change that we haven't released #5062 . Is it fine to skip the changelog?

Signed-off-by: Ben Ye <[email protected]>
@alanprot alanprot merged commit 0bcbced into cortexproject:master Mar 8, 2023
@yeya24 yeya24 deleted the fix-multiple-times-reader branch March 8, 2023 20:08
alexqyle pushed a commit to alexqyle/cortex that referenced this pull request May 2, 2023
* fix read reader multiple times in QFE

Signed-off-by: Ben Ye <[email protected]>

* write to error

Signed-off-by: Ben Ye <[email protected]>

---------

Signed-off-by: Ben Ye <[email protected]>
Signed-off-by: Alex Le <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: POST query got query no expression error if vertical sharding is enabled.

2 participants