Commit Graph

82269 Commits

Author SHA1 Message Date
Azat Khuzhin
0e1c6b6b9c Make 01810_max_part_removal_threads_long more accurate
v0: After parts removing stop attach/detach for each remove, there are only
    11 threads, primary query and 10 for removal.

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

v2: Make 01810_max_part_removal_threads_long more deterministic

    Sometimes, if removing parts will be too fast (like in [1]), then it may
    use less threads, since thread pool will reuse existing, so increase
    number of rows per part and compare threads directly w/o throwIf().

      [1]: https://s3.amazonaws.com/clickhouse-test-reports/34001/e74b6379a58c4607bdb54cd4c457410166e869ca/stateless_tests_flaky_check__address__actions_.html

v3: Less flaky 01810_max_part_removal_threads_long
v4: Make check not strict in 01810_max_part_removal_threads_long

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-28 16:25:33 +03: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
1519985c98 Fix possible "Can't attach query to the thread, it is already attached"
After detachQueryIfNotDetached() had been removed it is not enough to
use attachTo() for ThreadPool (scheduleOrThrowOnError()) since the query
may be already attached, if the thread doing multiple jobs, so
CurrentThread::attachToIfDetached() should be used instead.

This should fix all the places from the failures on CI [1]:

    $ fgrep DB::CurrentThread::attachTo -A1 ~/Downloads/47.txt  | fgrep -v attachTo | cut -d' ' -f5,6 | sort | uniq -c
         92 --
          2 /fasttest-workspace/build/../../ClickHouse/contrib/libcxx/include/deque:1393: DB::ParallelParsingInputFormat::parserThreadFunction(std::__1::shared_ptr<DB::ThreadGroupStatus>,
          4 /fasttest-workspace/build/../../ClickHouse/src/Storages/MergeTree/MergeTreeData.cpp:1595: void
         87 /fasttest-workspace/build/../../ClickHouse/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp:993: void

  [1]: https://github.com/ClickHouse/ClickHouse/runs/4954466034?check_suite_focus=true

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
tavplubix
277fe4e1c4
Merge pull request #34090 from ClickHouse/tavplubix-patch-1
Fix builds
2022-01-28 13:41:02 +03:00
tavplubix
b92958815a
Update LineReader.cpp 2022-01-28 13:38:36 +03:00
lgbo-ustc
c576393143 fixed code styles 2022-01-28 18:34:54 +08:00
alexey-milovidov
f6684dbc62
Merge pull request #32304 from devcrafter/deduplication_token_7461
insert_deduplication_token setting for INSERT statement
2022-01-28 13:03:55 +03:00
Vitaly Baranov
484743edff
Merge pull request #33201 from azat/client-interactive-suggest
Client interactive suggest (extract info from CREATE queries)
2022-01-28 16:30:16 +07:00
Kruglov Pavel
842de427d8
Merge pull request #33984 from Avogar/fix-orc
Fix segfault while parsing corrupted ORC file
2022-01-28 12:03:38 +03:00
Kruglov Pavel
efa8775ea6
Merge pull request #33960 from Avogar/autodetect-format
Detect format and schema from stdin in clickhouse-local
2022-01-28 12:02:15 +03:00
lgbo-ustc
f5ffdaac21 fixed code styles 2022-01-28 16:55:17 +08: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
510ec8803e
Merge pull request #34075 from azat/agg-func-cleanup
Tiny cleanup of AggregateFunctionSimpleState/AggregateFunctionState
2022-01-28 10:37:32 +03:00
alexey-milovidov
ad69f6c3df
Merge pull request #34072 from ramazanpolat/patch-3
Add commands to download clickhouse-diagnostics folder
2022-01-28 10:35:48 +03:00
cnmade
f469df6076 Fixed zh...statements/set: translate to zh and remove bak file 2022-01-28 15:32:11 +08:00
cnmade
438e0ab001 Fixed zh...statements/set: rename old file to bak 2022-01-28 15:25:52 +08:00
lgbo-ustc
7a3324b29a add expire() in PoolBase 2022-01-28 14:03:34 +08:00
Azat Khuzhin
bfef9663ca Tiny cleanup of AggregateFunctionSimpleState/AggregateFunctionState
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-28 08:10:08 +03:00
Azat Khuzhin
4e07122079 Slightly optimize ColumnArray::get()/operator[] (by using reserve over resize)
Note, that simple "SELECT range(100)" will execute
ColumnArray::operator[] 14 times (most of them from
DB::checkColumnStructure())

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-28 08:08:14 +03:00
Anton Popov
6c0959b907 fix asynchronous inserts with Native format 2022-01-28 03:25:15 +03:00
Ramazan Polat
bfc47e1dee
Add commands download clickhouse-diagnostics folder 2022-01-28 00:13:48 +03:00
mergify[bot]
ebbfc0fd2f
Merge branch 'master' into remove-decimal-padded-pod-array 2022-01-27 20:12:41 +00:00
alexey-milovidov
6bcac01021
Update 02124_insert_deduplication_token_multiple_blocks_replica.sh 2022-01-27 23:07:09 +03:00
alexey-milovidov
855db84a22
Update 02124_insert_deduplication_token_multiple_blocks.sh 2022-01-27 23:06:55 +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
alexey-milovidov
4060290eb6
Merge pull request #33925 from benbiti/USE_DEBUG_HELPERS-OFF
when not DEBUG set USE_DEBUG_HELPERS OFF
2022-01-27 22:59:55 +03:00
alexey-milovidov
ea55c9a0ae
Merge pull request #33938 from CurtizJ/fix-mismatched-columns
Fix 'Not found column' exception in distributed queries with arrays and tuples
2022-01-27 22:58:48 +03:00
alexey-milovidov
cd2305eb57
Merge pull request #33956 from CurtizJ/fix-nested-tuples
Fix reading of nested tuples
2022-01-27 22:58:11 +03:00
alexey-milovidov
2c85373966
Merge pull request #34058 from FArthur-cmd/26686_test_final_modifier
Small test for `FINAL`
2022-01-27 22:55:41 +03:00
alexey-milovidov
5a4ad04ae6
Merge pull request #33505 from zvonand/issue_14648
Fix fromUnixTimestamp64 functions
2022-01-27 22:54:53 +03:00
FArthur-cmd
dc8de1577a remove executable mode from sql file 2022-01-27 18:35:24 +00:00
FArthur-cmd
5970f622d6 Rewrite to SQL test 2022-01-27 18:35:22 +00:00
FArthur-cmd
84565cf464 Add test to prevent error in future 2022-01-27 18:35:13 +00:00
mergify[bot]
3f9ed4fb0b
Merge branch 'master' into fix-orc 2022-01-27 18:22:52 +00:00
Amos Bird
6adb3aa49a
Fix missing -Werror 2022-01-28 02:07:43 +08:00
Raúl Marín
91878b97e4
Address AggregateFunctionIf.cpp warnings
/mnt/ch/ClickHouse/src/AggregateFunctions/AggregateFunctionIf.cpp:75:79: warning: declaration shadows a field of 'AggregateFunctionIfNullUnary<result_is_nullable, serialize_flag>' [-Wshadow]
    inline bool singleFilter(const IColumn ** columns, size_t row_num, size_t num_arguments) const
                                                                              ^
/mnt/ch/ClickHouse/src/AggregateFunctions/AggregateFunctionIf.cpp:53:12: note: previous declaration is here
    size_t num_arguments;
           ^
2022-01-28 02:07:42 +08:00
tavplubix
8c9266b24c
Merge pull request #33978 from amosbird/separatesystemlog
Separate base parts out of SystemLog
2022-01-27 20:07:55 +03:00
Maksim Kita
24267c8cfb Fixed tests 2022-01-27 16:02:31 +00:00
Maksim Kita
b3adf714e6
Merge pull request #34059 from vahid-sohrabloo/patch-1
add chconn to Client Libraries
2022-01-27 16:58:33 +01:00
Kruglov Pavel
b35ce685b2
Merge pull request #33992 from HarryLeeIBM/hlee-issue-7334
Fixed UTF-8 string case-insensitive search when lowercase and uppercase characters are represented by different number of bytes.
2022-01-27 18:52:29 +03:00
mergify[bot]
260942e0f0
Merge branch 'master' into hlee-issue-7334 2022-01-27 14:30:13 +00:00
Nikolay Degterinsky
c5ca5b608e
Merge pull request #33314 from evillique/classification
Merge functions for text classification
2022-01-27 17:15:08 +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
vahid-sohrabloo
50fb1da2fa
add chconn to Client Libraries 2022-01-27 14:28:04 +01:00
mergify[bot]
ad146a67ff
Merge branch 'master' into _shard_num 2022-01-27 13:11:42 +00:00
Azat Khuzhin
e04b862673 Add echo for 01570_aggregator_combinator_simple_state
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-27 15:24:17 +03:00
mergify[bot]
eb1bf824be
Merge branch 'master' into fix-mismatched-columns 2022-01-27 12:23:48 +00:00
Azat Khuzhin
4e4e70ec6e Fix leak in SimpleState function (due to recrusive reference)
CI reports [1]:

    Indirect leak of 648 byte(s) in 9 object(s) allocated from:
    ...
        2 0x12b96503 in DB::AggregateFunctionSimpleState::getReturnType() const obj-x86_64-linux-gnu/../src/AggregateFunctions/AggregateFunctionSimpleState.h:47:15
    ...

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

After we can get this query by using query_log artifact:

    $ wget https://s3.amazonaws.com/clickhouse-test-reports/33957/08f4f45fd9da923ae3e3fdd8a527c297d35247eb/stress_test__address__actions_/query_log_dump.tar
    $ tar -xf query_log_dump.tar
    $ clickhouse-local --path var/lib/clickhouse/
    SELECT query
    FROM system.query_log
    ARRAY JOIN used_aggregate_function_combinators AS func
    WHERE has(used_aggregate_functions, 'groupBitOr') AND has(used_aggregate_function_combinators, 'SimpleState') AND (type != 'QueryStart')

    Query id: 5b7722b3-f77e-4e7e-bd0b-586d6d32a899

    ┌─query────────────────────────────────────────────────────────────────────────────┐
    │ with groupBitOrSimpleState(number) as c select toTypeName(c), c from numbers(1); │
    └──────────────────────────────────────────────────────────────────────────────────┘

Fixes: 01570_aggregator_combinator_simple_state.sql
Fixes: #16853
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-27 15:23:04 +03:00
mergify[bot]
e47cbf76aa
Merge branch 'master' into PF202201271450 2022-01-27 12:13:45 +00:00