convert error header into request error #182
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We recently noticed that the clickhouse http interface can return Status 200 ok for failing queries. In particular when clickhouse runs into a socket read timeout for inserts, it will return a 200 but not write any data. In these cases it injects an error header, which remains unevaluated in the libs current implementation. Also it's not possible to evaluate the response client-side because the response is discarded here: https://github.com/mailru/go-clickhouse/blob/master/stmt.go#L111
In order not to change the libs interface we suggest to raise an error, if the error header is present in the connection request code
The underlying issue is the same as for https://github.com/mailru/go-clickhouse/pull/107/files (which was closed). But the fix then (wait_query_end=1) won't help in our case, because the response body is not returned and doesn't contain an error. The error is only in the exception header