Commit Graph

5437 Commits

Author SHA1 Message Date
Kruglov Pavel
720310fcf1
Merge branch 'master' into http-buffer-skip-not-found-url-for-globs 2022-02-08 16:56:22 +03:00
kssenii
eba3011ada Fix 2022-02-07 20:40:47 +01:00
avogar
975ba9146f Fix tests naming, remove code duplication 2022-02-07 14:12:19 +03:00
Maksim Kita
bc6328e573 Fixed tests 2022-02-04 20:56:49 +00:00
Maksim Kita
629c8ae915
Merge pull request #34284 from CurtizJ/async-insert-in-client
Minor fixes for #34267
2022-02-04 13:13:47 +01:00
Alexander Tokmakov
3e700e854d cancel merges before acquiring lock for truncate 2022-02-03 23:44:53 +03:00
Anton Popov
9b844c6b42
Merge pull request #32748 from CurtizJ/read-in-order-fixed-prefix
Support `optimize_read_in_order` if prefix of sorting key is already sorted
2022-02-03 18:17:08 +03:00
Anton Popov
0755cfa584 minor fixes 2022-02-03 15:04:13 +03:00
alexey-milovidov
a6d1fcadcb
Merge pull request #34267 from CurtizJ/async-insert-in-client
Support async inserts in clickhouse-client for queries with inlined data
2022-02-03 05:14:47 +03:00
Maksim Kita
02c6cfba6a
Merge pull request #34225 from vitlibar/fix-checking-grants-for-show-grants
Fix checking grants for SHOW GRANTS
2022-02-02 22:51:51 +01:00
Anton Popov
5bb1b3ce77 support async inserts in clickhouse-client for queries with inlined data 2022-02-02 20:59:37 +03:00
Vitaly Baranov
30557aebfb Add helper class to cache the result of checking access. 2022-02-02 22:22:41 +07:00
Nikolay Degterinsky
29c15f8c65
Merge pull request #33723 from FrankChen021/trace_id_order
Parse and store opentelemetry trace-id in big-endian order
2022-02-02 14:59:46 +03:00
tavplubix
7304fd654a
Merge pull request #34224 from CurtizJ/fix-query-metric
Fix metric `Query`
2022-02-02 13:39:07 +03:00
Anton Popov
a4aa1f37ce remove unused code 2022-02-01 17:44:23 +03:00
Vitaly Baranov
1f81e43f1e Fix checking grants for SHOW GRANTS. 2022-02-01 19:55:24 +07:00
Anton Popov
c28255850a fix metric Query 2022-02-01 15:06:49 +03:00
Azat Khuzhin
bedf208cbd Use fmt::runtime() for LOG_* for non constexpr
Here is oneliner:

    $ gg 'LOG_\(DEBUG\|TRACE\|INFO\|TEST\|WARNING\|ERROR\|FATAL\)([^,]*, [a-zA-Z]' -- :*.cpp :*.h | cut -d: -f1 | sort -u | xargs -r sed -E -i 's#(LOG_[A-Z]*)\(([^,]*), ([A-Za-z][^,)]*)#\1(\2, fmt::runtime(\3)#'

Note, that I tried to do this with coccinelle (tool for semantic
patchin), but it cannot parse C++:

    $ cat fmt.cocci
    @@
    expression log;
    expression var;
    @@

    -LOG_DEBUG(log, var)
    +LOG_DEBUG(log, fmt::runtime(var))

I've also tried to use some macros/templates magic to do this implicitly
in logger_useful.h, but I failed to do so, and apparently it is not
possible for now.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>

v2: manual fixes
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-02-01 14:30:03 +03:00
Amos Bird
ec7d367814
DiskLocal checker
Add DiskLocal checker so that ReplicatedMergeTree can recover data when some of its disks are broken.
2022-02-01 05:55:27 +08:00
Maksim Kita
5ef83deaa6 Update sort to pdqsort 2022-01-30 19:49:48 +00:00
Maksim Kita
9c91a50050 Sort block refactoring 2022-01-29 15:50:55 +00:00
Maksim Kita
f3453024ff
Merge pull request #34060 from amosbird/optimizetupleorderby
Make ORDER BY tuple almost as fast as ORDER BY columns
2022-01-29 15:58:09 +01:00
Amos Bird
04cff632db
Revise 2022-01-29 20:55:52 +08:00
alexey-milovidov
6535b75322
Merge pull request #34001 from azat/memory-tracker-fix
Fix memory accounting for queries that uses < max_untracker_memory
2022-01-29 00:59:53 +03:00
Amos Bird
2b3ce910c6
Fix collation check 2022-01-29 04:49:58 +08:00
Federico Rodriguez
c0a5bd187a ExecuteScalarSubqueriesVisitor missing static const
Added string_view
2022-01-28 15:00:04 -05:00
Amos Bird
09a3ab79b7
Fix all const 2022-01-29 01:37:39 +08:00
Azat Khuzhin
162f96f8e1 Get back detachQueryIfNotDetached() into ExternalLoader
ExternalLoader from ThreadPool (async loading) is done from the server
context, not from the query context, and the context will already go
away, so we should detachQueryIfNotDetached() to avoid trigger assertion
in ThreadStatus.

CI: https://s3.amazonaws.com/clickhouse-test-reports/34001/8cace291d17fa9553a98b2a1e8bf15b30fe5a1bd/stateless_tests__debug__actions__[3/3].html

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-28 16:25:33 +03:00
Azat Khuzhin
b0c862c297 Fix memory accounting for queries that uses < max_untracker_memory
MemoryTracker starts accounting memory directly only after per-thread
allocation exceeded max_untracker_memory (or memory_profiler_step).

But even memory under this limit should be accounted too, and there is
code to do this in ThreadStatus dtor, however due to
PullingAsyncPipelineExecutor detached the query from thread group that
memory was not accounted.

So remove CurrentThread::detachQueryIfNotDetached() from threads that
uses ThreadFromGlobalPool since it has ThreadStatus, and the query will
be detached using CurrentThread::defaultThreadDeleter.

Note, that before this patch memory accounting works for HTTP queries
due to it had been accounted from ParallelFormattingOutputFormat, but
not for TCP.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-28 16:25:33 +03:00
Nikolai Kochetov
94999e86c2
Merge pull request #33392 from azat/_shard_num
Replace old _shard_num implementation with shardNum() function
2022-01-28 11:02:19 +03:00
alexey-milovidov
63d8d75001
Merge pull request #33957 from azat/fix-getauxval
Fix getauxval() in glibc-compatibility and fix some leaks (after LSan started to work)
2022-01-27 23:05:23 +03:00
tavplubix
8c9266b24c
Merge pull request #33978 from amosbird/separatesystemlog
Separate base parts out of SystemLog
2022-01-27 20:07:55 +03:00
Amos Bird
faee95b897
Make ORDER BY tuple almost as fast as ORDER BY columns
We have special optimizations for multiple column ORDER BY: https://github.com/ClickHouse/ClickHouse/pull/10831 . It's beneficial to also apply to tuple columns.

Before:

select * from numbers(300000000) order by (1 - number , number + 1 , number) limit 10;
2.613 sec.

After:

select * from numbers(300000000) order by (1 - number , number + 1 , number) limit 10;
0.755 sec

No tuple:

select * from numbers(300000000) order by 1 - number , number + 1 , number limit 10;
0.755 sec
2022-01-27 21:42:08 +08:00
Azat Khuzhin
af9910b518 Fix leak of demangle result (for opentelementry)
LSan found [1]:

    Direct leak of 5170176 byte(s) in 5049 object(s) allocated from:
        0 0xc598edd in malloc (/usr/bin/clickhouse+0xc598edd)
        1 0x39679739 in (anonymous namespace)::itanium_demangle::initializeOutputStream(char*, unsigned long*, (anonymous namespace)::itanium_demangle::OutputStream&, unsigned long) obj-x86_64-linux-gnu/../contrib/libcxxabi/src/demangle/Utility.h:178:31
        2 0x39679739 in __cxa_demangle obj-x86_64-linux-gnu/../contrib/libcxxabi/src/cxa_demangle.cpp:351:13
        3 0x28f6f3ed in DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:662:44

  [1]:
https://s3.amazonaws.com/clickhouse-test-reports/33957/08f4f45fd9da923ae3e3fdd8a527c297d35247eb/stress_test__address__actions_.html

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-27 13:46:37 +03:00
tavplubix
9e91a9dfd1
Merge pull request #33429 from zzsmdfj/MaterializeMySQL_support_set_and_other_dataType
MaterializeMySQL support SET YEAR TIME GEOMETRY dataType
2022-01-26 11:29:46 +03:00
Maksim Kita
bf768a94e8
Merge pull request #33971 from Avogar/fix-ipv6
Fix parsing IPv6 from query parameter and fix IPv6 to string conversion
2022-01-25 22:45:11 +01:00
Vitaly Baranov
cc38fe3fb6 Fix checking access for the SYSTEM command. 2022-01-25 18:54:59 +07:00
Amos Bird
385caa3e0a
Separate base parts out of SystemLog 2022-01-25 18:48:43 +08:00
avogar
ab49472155 Add comment 2022-01-25 10:10:04 +03:00
avogar
ad01d68f36 Fix parsing IPv6 from query parameter and fix IPv6 to string conversion 2022-01-25 10:09:17 +03:00
Ilya Yatsishin
35c03b317e
Merge pull request #33639 from Algunenano/async_metrics_handle_failures
AsynchronousMetrics: Ignore inaccessible sensors
2022-01-24 14:04:07 +03:00
tavplubix
da9a38655b
Merge pull request #33847 from ClickHouse/fix_33806
Fix logical error on RESTORE REPLICA
2022-01-24 13:28:37 +03:00
Maksim Kita
7fffe5846f
Merge pull request #33924 from kitaisreal/sql-user-defined-functions-invalid-lambda-crash-fix
SQLUserDefinedFunctions invalid lambda additional cases
2022-01-23 22:06:49 +01:00
Maksim Kita
243a280936 Updated tests 2022-01-23 17:02:43 +00:00
alexey-milovidov
d7a63dfda6
Merge pull request #33677 from ucasfl/fix-sumif
Fix sumIf rewrite
2022-01-22 17:12:13 +03:00
Maksim Kita
1bc3f086b1
Merge pull request #33889 from kitaisreal/sql-user-defined-functions-invalid-lambda-crash-fix
SQLUserDefinedFunctions invalid lambda additional fixes
2022-01-22 12:09:42 +01:00
alexey-milovidov
eb6849f7c7
Merge pull request #33842 from azat/cmake-contrib-fixes
More cmake external modules cleanups
2022-01-22 10:34:54 +03:00
mergify[bot]
7734f9d629
Merge branch 'master' into fix-sumif 2022-01-22 06:08:47 +00:00
Maksim Kita
3a252cd3a0 Updated tests 2022-01-21 20:49:42 +00:00
Maksim Kita
330987a64b
Merge pull request #33868 from kitaisreal/sql-user-defined-functions-invalid-lambda-crash-fix
SQLUserDefinedFunctions invalid lambda crash fix
2022-01-21 16:23:12 +01:00