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

Remove redundant code the from response formatter and fix CloseNotify #7163

Merged
merged 2 commits into from
Aug 17, 2016

Conversation

jsternberg
Copy link
Contributor

@jsternberg jsternberg commented Aug 16, 2016

The query killing functionality depends on the ResponseWriter exposing a
CloseNotify method. Since we wrap the http.ResponseWriter, the new
struct does not have that method and the HTTP handler would skip past
calling that method.

Instead of duplicating Flush() and CloseNotify() for every response
formatter, we will unify all of that under a single struct and create
formatters instead.

Also, fixes a bug where the header information from a query would not be
returned until some other data was returned with it because of
buffering and another bug in the gzipResponseWriter that wouldn't flush
the actual underlying ResponseWriter.

@mention-bot
Copy link

@jsternberg, thanks for your PR! By analyzing the annotation information on this pull request, we identified @e-dard, @gunnaraasen and @joelegasse to be potential reviewers

@jsternberg jsternberg force-pushed the js-close-notify-fix branch 2 times, most recently from 5fe0102 to 0375954 Compare August 16, 2016 20:53
The query killing functionality depends on the ResponseWriter exposing a
CloseNotify method. Since we wrap the http.ResponseWriter, the new
struct does not have that method and the HTTP handler would skip past
calling that method.

Instead of duplicating `Flush()` and `CloseNotify()` for every response
formatter, we will unify all of that under a single struct and create
formatters instead.

Also, fixes a bug where the header information from a query would not be
returned until some other data was returned with it because of
buffering and another bug in the gzipResponseWriter that wouldn't flush
the actual underlying ResponseWriter.
@jwilder
Copy link
Contributor

jwilder commented Aug 17, 2016

@joelegasse Can you take a look?

Previously, we implicitly added a newline and had to add one to the
number of bytes transmitted because we added that byte. That was removed
at some point and the metric was not updated to record the correct
value.
@jsternberg
Copy link
Contributor Author

I also added a trailing commit to this to fix the statistic for query response bytes. We used to add an extra newline so a piece of code added one to that byte. That newline got moved to a new section of the code, but the addition wasn't removed so it accounted for that added newline twice instead of just once. I performed one query and retrieved the number of bytes it returned and then used SHOW STATS to verify the numbers were the same.

@jwilder
Copy link
Contributor

jwilder commented Aug 17, 2016

LGTM 👍

@jwilder jwilder added this to the 1.0.0 milestone Aug 17, 2016
@jsternberg jsternberg merged commit 58afeb0 into 1.0 Aug 17, 2016
@jsternberg jsternberg deleted the js-close-notify-fix branch August 17, 2016 17:28
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