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

mysql protocol does not support error during query execution #21184

Closed
superceix opened this issue Feb 25, 2021 · 3 comments · Fixed by #26051
Closed

mysql protocol does not support error during query execution #21184

superceix opened this issue Feb 25, 2021 · 3 comments · Fixed by #26051
Assignees
Labels
bug Confirmed user-visible misbehaviour in official release comp-mysql

Comments

@superceix
Copy link

superceix commented Feb 25, 2021

Describe the bug
sql cannot read error msg by mysql client if table is on cluster

Does it reproduce on recent release?
server: clickhouse 21.2.4.6
client: mysql client 8.0.20、msyql client 5.7.26 access through mysql_port

How to reproduce

  • create table on cluster
CREATE TABLE `test`.`t7_all` ON CLUSTER cluster_1 (`id` Int64, `createtime` Date)  ENGINE = ReplicatedMergeTree('/clickhouse/cluster1/{layer}-{shard}/t7', '{replica}')  PARTITION BY createtime ORDER BY id SETTINGS index_granularity=8192;
  • create table names test.t7_all again
CREATE TABLE `test`.`t7_all` ON CLUSTER cluster_1 (`id` Int64, `createtime` Date)  ENGINE = ReplicatedMergeTree('/clickhouse/cluster1/{layer}-{shard}/t7', '{replica}')  PARTITION BY createtime ORDER BY id SETTINGS index_granularity=8192;

Expected behavior
mysql client get error message same with clickhouse client: Table test.t7_all already exists

Error message and/or stacktrace
mysql client cannot read err message and report:

Lost connection to MySQL server during query

Additional context
Add any other context about the problem here.

@superceix superceix added the bug Confirmed user-visible misbehaviour in official release label Feb 25, 2021
@tavplubix
Copy link
Member

It's because ON CLUSTER queries return table with query execution status. Seems like mysql client does not expect that DDL query may return some data.

@superceix
Copy link
Author

It's because ON CLUSTER queries return table with query execution status. Seems like mysql client does not expect that DDL query may return some data.

Will you support this in the future?

@tavplubix tavplubix self-assigned this Jul 6, 2021
@tavplubix
Copy link
Member

The reason is that ClickHouse sends ERR_Packet with incorrect sequence number, so MySQL client does not recognize it as a part of COM_QUERY_Response and resets connection. It happens if exception is thrown during query execution:

mysql> select throwIf(number) from numbers(2) settings max_block_size=1;
ERROR 2013 (HY000): Lost connection to MySQL server during query

I will try to fix it

@tavplubix tavplubix changed the title mysql protocol not support error code with table on cluster mysql protocol does not support error during query execution Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed user-visible misbehaviour in official release comp-mysql
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants