node-clickhouse icon indicating copy to clipboard operation
node-clickhouse copied to clipboard

ON CLUSTER syntax makes the query execution hang

Open databrecht opened this issue 6 years ago • 1 comments

I've set up multiple 'replicas' and 'shards' with docker compose. If you use the clickhouse 'ON CLUSTER' syntax, clickhouse sends back a simple text (not json) which contains the information about the replicas. The library expects JSON but does not handle this gracefully. The result is that the response will never come since no 'end' or 'error' is send.

What clickhouse sends back: clickhouse-shard1-replica1 9000 0 3 0 clickhouse-shard2-replica1 9000 0 2 0 clickhouse-shard2-replica2 9000 0 1 0 clickhouse-shard1-replica2 9000 0 0 0

In order to send an end an just make it work (without providing results) I assume you need to add a stream.push(null) in clickhouse.js at line 160. I don't know how you want to tackle something like that though.

databrecht avatar Mar 13 '19 10:03 databrecht

I don't have a cluster, so you can provide response from cluster or (even better) make PR.

apla avatar May 08 '19 18:05 apla