Commit Graph

51318 Commits

Author SHA1 Message Date
Azat Khuzhin
35231662b3 Improve performance of AggregatingMergeTree w/ SimpleAggregateFunction(String)
While reading from AggregatingMergeTree with
SimpleAggregateFunction(String) in primary key and
optimize_aggregation_in_order perf top shows:

    Samples: 1M of event 'cycles', 4000 Hz, Event count (approx.): 287759760270 lost: 0/0 drop: 0/0
      Children      Self  Shared Object         Symbol
    +   12.64%    11.39%  clickhouse            [.] memcpy
    +    9.08%     0.23%  [unknown]             [.] 0000000000000000
    +    8.45%     8.40%  clickhouse            [.] ProfileEvents::increment    # <-- this, and in debug it has not 0.08x overhead, but 5.8x overhead
    +    7.68%     7.67%  clickhouse            [.] LZ4_compress_fast_extState
    +    5.29%     5.22%  clickhouse            [.] DB::IAggregateFunctionHelper<DB::AggregateFunctionNullUnary<true, true> >::addFree

The reason is obvious, ProfileEvents is atomic counters (and also they
are nested):

<details>

```
    Samples: 7M of event 'cycles', 4000 Hz, Event count (approx.): 450726149337
    ProfileEvents::increment  /usr/bin/clickhouse [Percent: local period]
    Percent│
           │
           │
           │    Disassembly of section .text:
           │
           │    00000000078d8900 <ProfileEvents::increment(unsigned long, unsigned long)@@Base>:
           │    ProfileEvents::increment(unsigned long, unsigned long):
      0.17 │      push  %rbp
      0.00 │      mov   %rsi,%rbp
      0.04 │      push  %rbx
      0.20 │      mov   %rdi,%rbx
      0.17 │      sub   $0x8,%rsp
      0.26 │    → callq DB::CurrentThread::getProfileEvents
           │    ProfileEvents::Counters::increment(unsigned long, unsigned long):
      0.00 │      lea   0x0(,%rbx,8),%rdi
      0.05 │      nop
           │    unsigned long std::__1::__cxx_atomic_fetch_add<unsigned long, unsigned long>(std::__1::__cxx_atomic_base_impl<unsigned long>*, unsigned long, std::__1::memory_order):
      1.02 │      mov   (%rax),%rdx
     97.04 │      lock  add   %rbp,(%rdx,%rdi,1)
           │    ProfileEvents::Counters::increment(unsigned long, unsigned long):
      0.21 │      mov   0x10(%rax),%rax
      0.04 │      test  %rax,%rax
      0.00 │    → jne   78d8920 <ProfileEvents::increment(unsigned long, unsigned long)@@Base+0x20>
           │    ProfileEvents::increment(unsigned long, unsigned long):
      0.38 │      add   $0x8,%rsp
      0.00 │      pop   %rbx
      0.04 │      pop   %rbp
      0.38 │    ← retq
```

</details>

These ProfileEvents was ArenaAllocChunks (it shows ~1.5M events per
second), and the reason is that the table has
SimpleAggregateFunction(String) in PK, which requires Arena.
But most of the time there Arena wasn't even used, so avoid this cost by
re-creating Arena only if it was "used" (i.e. has new chunks).

Another possibility is to avoid populating Arena::head in ctor, but this
will make the Arena code more complex, so for now this was preferred.

Also as a long-term solution it worth looking at implementing them via
RCU (to move the extra overhead out from the write code path into read
side).
2020-11-19 23:06:12 +03:00
alesapin
0bc60e2d53
Merge pull request #17089 from ClickHouse/fix_ddl_worker_non_leader
Fix ON CLUSTER queries hung for non leader replicas
2020-11-18 10:21:35 +03:00
alexey-milovidov
0d17e79a8f
Merge pull request #17161 from vzakaznikov/fix_for_login_after_ldap_external_user_directory_is_removed
Fixing unstable test in tests/testflows/ldap/external_user_directory/tests/authentications.py
2020-11-18 07:31:58 +03:00
Vitaliy Zakaznikov
dbb5f6722e Moving to using TestFlows version 1.6.65
Fixing unstable test in tests/testflows/ldap/external_user_directory/tests/authentications.py
2020-11-17 20:22:43 -05:00
Kruglov Pavel
ffb83155d7
Merge pull request #16680 from hrissan/hrissan/prevent_tdigest_uncontrolled_growth
Hrissan/prevent tdigest uncontrolled growth
2020-11-17 22:10:35 +03:00
Nikita Mikhaylov
f207d5dc21
Merge pull request #16769 from nikitamikhaylov/better_exception_ddl
Better exception DDL
2020-11-17 19:26:34 +03:00
nikitamikhaylov
6f4e5bcaac style 2020-11-17 17:39:34 +03:00
nikitamikhaylov
ee8b3339a1 done 2020-11-17 17:39:34 +03:00
Nikita Mikhaylov
68b6f08e36
Merge pull request #16721 from nikitamikhaylov/parsing-constraints
Turn off parallel parsing when memory limit is small.
2020-11-17 17:37:14 +03:00
gyuton
fcae0d0f0a
DOCSUP-3845: documented new encrypt and decrypt functions (#16930)
* Added first draft of description

* Added toc_priority

* Updated description

* Updated documentation

* Added examples

* Fixed links

* variable fixes

* minor fixes

* added translation

* fixed typos in translation

* changed toc_title in translation

* minor change

* added various fixes

* fixed typos

* Deleted unnecessary file

* Deleted extra files

Co-authored-by: George <gyuton@yandex-team.ru>
2020-11-17 17:05:33 +03:00
Grigory Buteyko
81b9d6a948 Merge branch 'master' into hrissan/prevent_tdigest_uncontrolled_growth 2020-11-17 14:40:34 +03:00
alesapin
d4dbf928b4
Update src/Interpreters/DDLWorker.cpp
Co-authored-by: tavplubix <avtokmakov@yandex-team.ru>
2020-11-17 14:04:27 +03:00
Pavel Kruglov
7ecd207eac Remove unnecessary QuantileTDigest layer 2020-11-17 14:01:51 +03:00
gyuton
4d602afd28
DOCSUP-3538: Documeted the tid and logTrace funtions (#16884)
* Added tid and logTrace functions description

* Added minor fixes

* Minor fixes and added ru translation

* Added links

Co-authored-by: George <gyuton@yandex-team.ru>
2020-11-17 13:03:39 +03:00
tavplubix
b251478d98
Merge pull request #17072 from ClickHouse/fix_crash_16944
Fix crash in CREATE TABLE AS
2020-11-17 12:51:37 +03:00
Nikolai Kochetov
013c582abf
Merge pull request #17095 from ClickHouse/actions-dag-addition
Move ActionsDAG into separate file
2020-11-17 11:17:55 +03:00
Nikolai Kochetov
86395e11a2
Merge pull request #17006 from azat/fix-distributed-queries-finish
Fix Distributed queries finishing (avoid connection resets)
2020-11-17 11:11:27 +03:00
Nikolai Kochetov
9814da3291 Add empty commit. 2020-11-17 10:03:11 +03:00
alexey-milovidov
b494b18748
Merge pull request #17108 from ClickHouse/ya-make-owners
Add "OWNER" to ya.make files.
2020-11-17 05:19:46 +03:00
Alexey Milovidov
24f4fa6edf Follow Arcadia ya.make rules 2020-11-17 00:16:50 +03:00
alesapin
5dd32819f5 Merge branch 'master' into fix_ddl_worker_non_leader 2020-11-16 22:34:16 +03:00
Alexey Milovidov
3df04ce0c2 Follow Arcadia ya.make rules 2020-11-16 21:24:58 +03:00
Nikolai Kochetov
3a1e6a5c7f Remove some more code. 2020-11-16 18:50:56 +03:00
Nikolai Kochetov
82e8e74bcd Fix includes. 2020-11-16 18:39:12 +03:00
alexey-milovidov
7d7b19a201
Merge pull request #17046 from ClickHouse/fix-cfa-register-rax
Fix LLVM's libunwind in the case when CFA register is RAX
2020-11-16 18:24:33 +03:00
Nikolai Kochetov
c2f1873f77 Remove comments. 2020-11-16 18:11:55 +03:00
Nikolai Kochetov
e8e6461fa7 Move ActionsDAG to separate file. 2020-11-16 17:57:56 +03:00
alesapin
7b784fb925 Fix stateful with coverage test download script 2020-11-16 16:05:00 +03:00
alesapin
6759932c61 Remove accident changes 2020-11-16 15:49:08 +03:00
alesapin
f839742288 Add a test 2020-11-16 15:47:02 +03:00
alesapin
9f71f03be3 Fix DDL worker task execution on single replica 2020-11-16 15:34:12 +03:00
Nikita Mikhaylov
26c21c89ba
Merge pull request #16986 from myrrc/bugfix/ub-in-wide-int
Fixed wrong result in big integers (128, 256 bit) when casting from double to int64_t.
2020-11-16 14:33:39 +03:00
Nikita Mikhaylov
4d33e79cb4
Update ColumnDecimal.h 2020-11-16 14:31:52 +03:00
tavplubix
fe64082371
Merge pull request #15977 from TCeason/add_sync_user_privs_exception
throw exception when mysql sync user privs error.
2020-11-16 14:13:10 +03:00
tavplubix
3de32279ca
Update InterpreterCreateQuery.cpp 2020-11-16 14:03:27 +03:00
Alexander Tokmakov
8352e5d202 fix crash in CREATE AS 2020-11-16 13:14:12 +03:00
Nikolai Kochetov
00de84fbe3
Merge pull request #16610 from zhang2014/fix/ISSUES-16574
ISSUES-16574 try fix remote query failure when using 'if' suffix aggregate function
2020-11-16 12:41:14 +03:00
Nikolai Kochetov
684d649b70
Merge pull request #16928 from ClickHouse/fix-16580
Fix possible error Illegal type of argument for queries with ORDER BY.
2020-11-16 12:39:20 +03:00
alexey-milovidov
7ec83794b8
Merge pull request #17056 from ClickHouse/dependabot/pip/docs/tools/protobuf-3.14.0
Bump protobuf from 3.13.0 to 3.14.0 in /docs/tools
2020-11-16 12:04:39 +03:00
tavplubix
88de1b052c
Merge pull request #16048 from ClickHouse/materialized-view-check-stack-size
Fix possible stack overflow in materialized views.
2020-11-16 12:02:27 +03:00
dependabot-preview[bot]
faf0195d33
Bump protobuf from 3.13.0 to 3.14.0 in /docs/tools
Bumps [protobuf](https://github.com/protocolbuffers/protobuf) from 3.13.0 to 3.14.0.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/master/generate_changelog.py)
- [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.13.0...v3.14.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-11-16 06:16:31 +00:00
TCeason
45bacd6f74 Merge branch 'master' into add_sync_user_privs_exception 2020-11-16 12:59:44 +08:00
Alexander Tokmakov
5c6191f798 fix 2020-11-16 00:31:52 +03:00
alexey-milovidov
11f56186db
Merge pull request #17048 from azat/build-fix
Add missing <unique_ptr> for RadixSort.h
2020-11-16 00:15:54 +03:00
Azat Khuzhin
01ec7aca68 Add missing <unique_ptr> for RadixSort.h
Fails compiling quantile-t-digest.cpp test on:
- clang 11
- libstdc++
2020-11-15 23:08:45 +03:00
alexey-milovidov
0afa1b8fc4
Merge pull request #17044 from CurtizJ/remove-empty-parts-settings
Add setting remove_empty_parts
2020-11-15 23:06:44 +03:00
alexey-milovidov
c479580299
Merge pull request #17047 from traceon/patch-1
Fix ROCKSDB_ERROR value
2020-11-15 22:56:22 +03:00
Denis Glazachev
5c801c42c1
Fix ROCKSDB_ERROR value 2020-11-15 23:48:46 +04:00
Nikolai Kochetov
0a1ba8095e
Merge pull request #16992 from ClickHouse/try-fix-ci-5
Trying to fix the unimportant "Arcadia" checks in the CI.
2020-11-15 20:18:13 +03:00
alexey-milovidov
28d27c88a6
Merge pull request #17042 from atnartur/patch-1
Fix arrayAUC function header in documentation
2020-11-15 19:49:45 +03:00