-
Notifications
You must be signed in to change notification settings - Fork 7.7k
no auto write buffer finalization in destructors #68800
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
Conversation
This is an automated comment for commit 7b37bdd with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
Successful checks
|
6465088
to
6283287
Compare
ed7a3d8
to
950ec61
Compare
8238141
to
53528ba
Compare
696ec8c
to
298de78
Compare
I found out that
But the base class
I fixed it here by introducing |
6327449
to
e0236ef
Compare
f212ad8
to
3dc3fc5
Compare
a9bb99d
to
a4ccfb5
Compare
…tors](ClickHouse/ClickHouse#68800) - Make LocalPartitionWriter::evictPartitions called, e.g. set(GlutenConfig.COLUMNAR_CH_SHUFFLE_SPILL_THRESHOLD.key, (1024*1024).toString)
* [GLUTEN-1632][CH]Daily Update Clickhouse Version (20241129) * Fix Build AND UT Due to [Added cache for primary index](ClickHouse/ClickHouse#72102) * Fix Build and UT due to [no auto write buffer finalization in destructors](ClickHouse/ClickHouse#68800) - Make LocalPartitionWriter::evictPartitions called, e.g. set(GlutenConfig.COLUMNAR_CH_SHUFFLE_SPILL_THRESHOLD.key, (1024*1024).toString) * Fix Build due to [Save several minutes of build time](ClickHouse/ClickHouse#72046) * Fix Benchmark Build due to [Scatter blocks in hash join without copying](ClickHouse/ClickHouse#67782) (cherry picked from commit 8d566d6a8b8785e4072ffd6f774eb83b07ac3d8d) * Fix Benchmark Build * Fix endless loop due to ClickHouse/ClickHouse#70598 * [Refactor #8100] using CHConf.setCHConfig() * fix style --------- Co-authored-by: kyligence-git <gluten@kyligence.io> Co-authored-by: Chang Chen <baibaichen@gmail.com>
Hi @CheSema . I found the header X-ClickHouse-Exception-Code in the response:
However, I didn't find it in another case:
I have a cluster with 2 hosts and 1 fake host (which doesn't exist). I expected to recieve the response with header X-ClickHouse-Exception-Code in both cases. The reason for the question is a problem in requests (python lib) for the second example. I encounter an error for this request:
I’m encountering an issue with the response in the second case, where I'm not receiving the expected header. Could you please help me troubleshoot this problem? Any suggestions you might have would be greatly appreciated. |
Clickhouse has started to send response to a client. The first You could use formats that are able to write errors with the data. Like 'JSON' format. Or you could enable settings which enable bufferisation for |
Unfortunately, it's not suitable for CREATE TABLE.
How can we tell the difference between the problem when I have a |
You can't distinguish that cases only by exception on your client. They are both an error. There is a possibility to extract same debug info from the last HTTP chunk. But that should not define your further actions. You have to treat it as an error. Like in case when a network error occur, the state of operation is unknown. |
You have a HTTP header Check the comment how to check correctness of a response with HTTP: |
I see, server may not get a chance to send X-ClickHouse-Exception-Code That explains the various tests that have max execution time set The three-point test (code, header, transmission) in that comment would actually be useful as documentation – I'm happy to raise a PR for it |
…les (#8847) * fix for ClickHouse/ClickHouse#68800 * Refactor: Move gluten_test_util.h * Refactor: write(DB::Block & block) => write(const DB::Block & block) * [Refactor] Adding `formatSettings()`, so we needn't define friend class VectorizedParquetBlockInputFormat for VectorizedParquetRecordReader * [Test] set path to "./" instead of default path "/" * [Test] Add IcebergTest * [Refactor] Remove move `BlockUtil::buildHeader` and rename to `toSampleBlock` * [Feature] EqualityDeleteFileReader * [Refactor] Move BaseReader and its child class to FileReader.cpp/.h * [Feature] Add IcebergReader * [Feature] Add EqualityDeleteActionBuilder to supprot notIn when there is only one delete column * cmake fix * style * fix per review
The rule: write buffer has to be either finalized or canceled.
One exception from this rule: destroying write buffer when uncaught exception rewind the stack.
The goal is to make things easier.
When we are sure that we always explicitly finalize the buffers, we could make all the buffers auto-cancelable at the d-tor. This reduces the number of code lines.
I made a lot of cases more simple when server tries to send the exception error to the client over HTTP.
The logic is really simple in that places:
We have some HTTP connection, it is usually wrapped inside
WriteBufferFromHTTPServerResponse
.If we have not send anything to the socket yet, than we could do it gracefully by sending proper HTTP code, which indicates about error, proper headers with some details (
X-ClickHouse-Exception-Code
) and the full details with stack trace as a body. That makes sure that client sees the error correctly.If clickhouse sends the data in the
JSON
format than the error is embedded to the message. The client has to parse it correctly.If some data has been send and it is not 'JSON` format than we have the most dangerous situation. That partial data could be parsed as a full valid response on the client. We have to prevent this.
I made the HTTP client truly fail when server faces the error.
I achieved that by breaking the transport HTTP layer. Clickhouse sends the error details and the stack traces and closes the HTTP connection in a way that breaks internal HTTP protocol.
Clickhouse never answers with plain data unknown size. It does it ether with
Context-Length
header or withTransfer-Encoding: chunked
header. ForTransfer-Encoding: chunked
Clickhouse does not send the last final empty chunk. ForContext-Length
Clickhouse makes sure that the socket is closed and the last byte (or more) is never sent.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Write buffer has to be canceled or finalized explicitly. Exceptions break the HTTP protocol in order to alert the client about error.
Documentation entry for user-facing changes
CI Settings (Only check the boxes if you know what you are doing):