We need to reset signals that had been installed in the
setupSignalHandler() (SIGINT/SIGQUIT), like other such tools dies (i.e.
less and open file in editor) since terminal will send signals to both
processes and so signals will be delivered to the
clickhouse-client/local as well, which will be terminated when signal
will be delivered second time.
So a simple `clickhouse-client --pager less` will be terminated on a
second C-C press. And it is really annoying when you are using this way
to analyze logs.
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
* Release more num_streams if data is small
Besides the sum_marks and min_marks_for_concurrent_read, we could also involve the
system cores to get the num_streams if the data is small. Increasing the num_streams
and decreasing the min_marks_for_concurrent_read would improve the parallel performance
if the system has plentiful cores.
Test the patch on 2x80 vCPUs system. Q39 of clickbench has got 3.3x performance improvement.
Q36 has got 2.6x performance improvement. The overall geomean has got 9% gain.
Signed-off-by: Jiebin Sun <jiebin.sun@intel.com>
* Release more num_streams if data is small
Change the min marks from 4 to 8 as the profit is small and 8 granules
is the default block size.
Signed-off-by: Jiebin Sun <jiebin.sun@intel.com>
---------
Signed-off-by: Jiebin Sun <jiebin.sun@intel.com>
After the previous patch "x OR 1" will not execute "x", and because of
this test_system_merges::test_mutation_simple started to fail since
"sleep" function did not executed.
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
The problem with the initial implementation #52653 was:
- OR can have multiple arguments
- It simply not correct to assume that if there are two arguments this is OK.
Consider the following example:
"WHERE (column_not_from_partition_by = 1) OR false OR false"
Will be converted to:
"WHERE false OR false"
And it will simply read nothing.
Yes, we could apply some optimization for bool, but this will not always
work, since to optimize things like "0 = 1" we need to execute it.
And the only way to make handle this correctly (with ability to ignore
some commands during filtering) is to make is_constant() function return
has it use something from the input block, so that we can be sure, that
we have some sensible, and not just "false".
Plus we cannot simply ignore the difference of the input and output
arguments of handling OR, we need to add always-true (1/true) if the
size is different, since otherwise it could break invariants (see
comment in the code).
This includes (but not limited to):
- _part* filtering for MergeTree
- _path/_file for various File/HDFS/... engines
- _table for Merge
- ...
P.S. analyzer does not have this bug, since it execute expression as
whole, and this is what filterBlockWithQuery() should do actually
instead, but this will be a more complex patch.
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
(cherry picked from commit b107712e0c)