mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Do not try to send query if it was canceled in RemoteSource
With optimize_distributed_group_by_sharding_key it is possible to get enough rows even before sending query to another shard and in this case it shouldn't send anything to others. This reduces NETWORK_ERROR in the 01563_distributed_query_finish from 2 to 1.
This commit is contained in:
parent
ed64f2ad67
commit
8f42144097
@ -21,6 +21,10 @@ RemoteSource::~RemoteSource() = default;
|
||||
|
||||
Chunk RemoteSource::generate()
|
||||
{
|
||||
/// onCancel() will do the cancel if the query was sent.
|
||||
if (was_query_canceled)
|
||||
return {};
|
||||
|
||||
if (!was_query_sent)
|
||||
{
|
||||
/// Progress method will be called on Progress packet.
|
||||
@ -62,6 +66,7 @@ Chunk RemoteSource::generate()
|
||||
|
||||
void RemoteSource::onCancel()
|
||||
{
|
||||
was_query_canceled = true;
|
||||
query_executor->cancel();
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ protected:
|
||||
void onCancel() override;
|
||||
|
||||
private:
|
||||
bool was_query_canceled = false;
|
||||
bool was_query_sent = false;
|
||||
bool add_aggregation_info = false;
|
||||
RemoteQueryExecutorPtr query_executor;
|
||||
|
Loading…
Reference in New Issue
Block a user