Skip to content

Cherry pick #21643 to 21.2: Fix distributed requests cancellation with async_socket_for_remote=1#21783

Merged
robot-clickhouse merged 3 commits intobackport/21.2/21643from
cherrypick/21.2/0ffea300acb5d7e7e82e28b8dc20e18046eec3b0
Mar 16, 2021
Merged

Cherry pick #21643 to 21.2: Fix distributed requests cancellation with async_socket_for_remote=1#21783
robot-clickhouse merged 3 commits intobackport/21.2/21643from
cherrypick/21.2/0ffea300acb5d7e7e82e28b8dc20e18046eec3b0

Conversation

@robot-clickhouse
Copy link
Copy Markdown
Member

Original pull-request #21643

This pull-request is a first step of an automated backporting.
It contains changes like after calling a local command git cherry-pick.
If you intend to continue backporting this changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.
Also this pull-request will be merged automatically as it reaches the mergeable state, but you always can merge it manually.

azat and others added 2 commits March 11, 2021 21:55
Before this patch for distributed queries, that requires cancellation
(simple select from multiple shards with limit, i.e. `select * from
remote('127.{2,3}', system.numbers) limit 100`) it is very easy to
trigger the situation when remote shard is in the middle of sending Data
block while the initiator already send Cancel and expecting some new
packet, but it will receive not new packet, but part of the Data block
that was in the middle of sending before cancellation, and this will
lead to some various errors, like:
- Unknown packet X from server Y
- Unexpected packet from server Y
- and a lot more...

Fix this, by correctly waiting for the pending packet before
cancellation.

It is not very easy to write a test, since localhost is too fast.

Also note, that it is not possible to get these errors with hedged
requests (use_hedged_requests=1) since handle fibers correctly.

But it had been disabled by default for 21.3 in #21534, while
async_socket_for_remote is enabled by default.
Fix distributed requests cancellation with async_socket_for_remote=1
@robot-clickhouse robot-clickhouse added do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! labels Mar 16, 2021
@robot-clickhouse robot-clickhouse merged this pull request into backport/21.2/21643 Mar 16, 2021
@robot-clickhouse robot-clickhouse deleted the cherrypick/21.2/0ffea300acb5d7e7e82e28b8dc20e18046eec3b0 branch March 16, 2021 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants