Commit Graph

5101 Commits

Author SHA1 Message Date
serxa
51da43d6cf fix try_shared_lock() in SharedMutex and CancelableSharedMutex 2023-01-24 14:36:07 +00:00
Robert Schulze
9ff2bfcbf5
Merge remote-tracking branch 'origin/master' into inv-index-cleanup
src/Interpreters/GinFilter.cpp
	src/Interpreters/InterpreterCreateQuery.cpp
	src/Storages/MergeTree/MergeTreeData.cpp
	src/Storages/MergeTree/MergeTreeDataPartWriterOnDisk.cpp
	src/Storages/MergeTree/MergeTreeIndexInverted.cpp
2023-01-24 10:09:42 +00:00
Alexander Tokmakov
c6910f39b9 fix 2023-01-24 01:11:58 +01:00
Alexander Tokmakov
414693feb2 fixes 2023-01-24 00:46:03 +01:00
Alexander Tokmakov
bb4c8e169f check number of parameters in format string 2023-01-23 23:16:16 +01:00
Alexander Tokmakov
3f6594f4c6 forbid old ctor of Exception 2023-01-23 22:18:05 +01:00
Alexander Tokmakov
70d1adfe4b
Better formatting for exception messages (#45449)
* save format string for NetException

* format exceptions

* format exceptions 2

* format exceptions 3

* format exceptions 4

* format exceptions 5

* format exceptions 6

* fix

* format exceptions 7

* format exceptions 8

* Update MergeTreeIndexGin.cpp

* Update AggregateFunctionMap.cpp

* Update AggregateFunctionMap.cpp

* fix
2023-01-24 00:13:58 +03:00
Alexey Milovidov
62a8de34cc
Merge pull request #44811 from azat/build/glibc2.36-fix
Fix ASan builds for glibc 2.36+
2023-01-23 23:57:20 +03:00
Robert Schulze
0ab7ae6c17
Merge pull request #43797 from ClickHouse/query-result-cache
Query result cache [experimental]
2023-01-23 19:54:35 +01:00
Kseniia Sumarokova
8ec39ab6f3
Merge pull request #45442 from kssenii/minor-changes
Minor improvements around reading from remote
2023-01-23 15:46:30 +01:00
Sergei Trifonov
0fbfa17863
Merge branch 'master' into cancellable-mutex-integration 2023-01-23 12:44:09 +01:00
Kseniia Sumarokova
c3d545b64a
Merge pull request #45489 from azat/build/queue-fwd-decl
Forward declaration of ConcurrentBoundedQueue in ThreadStatus
2023-01-22 20:23:05 +01:00
Robert Schulze
340f406553
Merge branch 'master' into query-result-cache 2023-01-22 13:21:36 +01:00
Robert Schulze
531e64dc39
Merge branch 'master' into inv-index-cleanup 2023-01-22 13:20:38 +01:00
Alexander Gololobov
91fb1eab8c
Merge pull request #45373 from ClickHouse/throttler-metrics
Add detailed profile events for throttling
2023-01-22 11:20:45 +01:00
Robert Schulze
97d1bed114
Merge branch 'master' into improve_week_day 2023-01-21 20:40:33 +01:00
Azat Khuzhin
2a8f116c18 Forward declaration of ConcurrentBoundedQueue in ThreadStatus
ThreadStatus is the header that recomplies almost all ClickHouse
modules.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-01-21 16:02:09 +01:00
Alexander Tokmakov
910d6dc0ce
Merge pull request #45342 from ClickHouse/exception_message_patterns
Save message format strings for DB::Exception
2023-01-20 18:46:52 +03:00
Azat Khuzhin
bdeb5514c5 Fix ASan builds for glibc 2.36+ (use RTLD_NEXT for ThreadFuzzer interceptors)
Recently I noticed that clickhouse compiled with ASan does not work with
newer glibc 2.36+, before I though that this was only about compiling
with old but using new, however that was not correct, ASan simply does
not work with glibc 2.36+.

Here is a simple reproducer [1]:

    $ cat > test-asan.cpp <<EOL
    #include <pthread.h>
    int main()
    {
        // something broken in ASan in interceptor for __pthread_mutex_lock
        // and only since glibc 2.36, and for pthread_mutex_lock everything is OK
        pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
        return __pthread_mutex_lock(&mutex);
    }
    EOL
    $ clang -g3 -o test-asan test-asan.cpp -fsanitize=address
    $ ./test-asan
    AddressSanitizer:DEADLYSIGNAL
    =================================================================
    ==15659==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x7fffffffccb0 sp 0x7fffffffcb98 T0)
    ==15659==Hint: pc points to the zero page.
    ==15659==The signal is caused by a READ memory access.
    ==15659==Hint: address points to the zero page.
        #0 0x0  (<unknown module>)
        #1 0x7ffff7cda28f  (/usr/lib/libc.so.6+0x2328f) (BuildId: 1e94beb079e278ac4f2c8bce1f53091548ea1584)

    AddressSanitizer can not provide additional info.
    SUMMARY: AddressSanitizer: SEGV (<unknown module>)
    ==15659==ABORTING

  [1]: https://gist.github.com/azat/af073e57a248e04488b21068643f079e

I've started observing glibc code, there was some changes in glibc, that
moves pthread functions out from libpthread.so.0 into libc.so.6
(somewhere between 2.31 and 2.35), but
the problem pops up only with 2.36, 2.35 works fine.

After this I've looked into changes between 2.35 and 2.36, and found
this patch [2] - "dlsym: Make RTLD_NEXT prefer default version
definition [BZ #14932]", that fixes this bug [3].

  [2]: https://sourceware.org/git/?p=glibc.git;a=commit;h=efa7936e4c91b1c260d03614bb26858fbb8a0204
  [3]: https://sourceware.org/bugzilla/show_bug.cgi?id=14932

The problem with using DL_LOOKUP_RETURN_NEWEST flag for RTLD_NEXT is
that it does not resolve hidden symbols (and __pthread_mutex_lock is
indeed hidden).

Here is a sample that will show the difference [4]:

    $ cat > test-dlsym.c <<EOL
    #define _GNU_SOURCE
    #include <dlfcn.h>
    #include <stdio.h>

    int main()
    {
        void *p = dlsym(RTLD_NEXT, "__pthread_mutex_lock");
        printf("__pthread_mutex_lock: %p (via RTLD_NEXT)\n", p);
        return 0;
    }
    EOL

    # glibc 2.35: __pthread_mutex_lock: 0x7ffff7e27f70 (via RTLD_NEXT)
    # glibc 2.36: __pthread_mutex_lock: (nil) (via RTLD_NEXT)

  [4]: https://gist.github.com/azat/3b5f2ae6011bef2ae86392cea7789eb7

But ThreadFuzzer uses internal symbols to wrap
pthread_mutex_lock/pthread_mutex_unlock, which are intercepted by ASan
and this leads to NULL dereference.

The fix was obvious - just use dlsym(RTLD_NEXT), however on older
glibc's this leads to endless recursion (see commits in the code). But
only for jemalloc [5], and even though sanitizers does not uses jemalloc
the code of ThreadFuzzer is generic and I don't want to guard it with
more preprocessors macros.

  [5]: https://gist.github.com/azat/588d9c72c1e70fc13ebe113197883aa2

So we have to use RTLD_NEXT only for ASan.

There is also one more interesting issue, if you will compile with clang
that itself had been compiled with newer libc (i.e. 2.36), you will get
the following error:

    $ podman run --privileged -v $PWD/.cmake-asan/programs:/root/bin -e PATH=/bin:/root/bin -e --rm -it ubuntu-dev-v3 clickhouse
    ==1==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)
    ...
    ==1==End of process memory map.
    AddressSanitizer: CHECK failed: sanitizer_common.cpp:53 "((0 && "unable to mmap")) != (0)" (0x0, 0x0) (tid=1)
        <empty stack>

The problem is that since GLIBC_2.31, `SIGSTKSZ` is a call to
`getconf(_SC_MINSIGSTKSZ)`, but older glibc does not have it, so `-1`
will be returned and used as `SIGSTKSZ` instead.

The workaround to disable alternative stack:

    $ podman run --privileged -v $PWD/.cmake-asan/programs:/root/bin -e PATH=/bin:/root/bin -e ASAN_OPTIONS=use_sigaltstack=0 --rm -it ubuntu-dev-v3 clickhouse client --version
    ClickHouse client version 22.13.1.1.

Fixes: #43426
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-01-20 13:09:13 +01:00
Robert Schulze
f8b446f517
Move method implementations (no other changes) 2023-01-20 10:57:16 +00:00
Robert Schulze
0653f86de9
Various cosmetic cleanups 2023-01-20 10:45:35 +00:00
Han Fei
8b29f8406b
Merge branch 'master' into hanfei/gwp-asan 2023-01-20 11:03:12 +01:00
Frank Chen
f867c4c206 Add an overriden fromCurrentException to simply the code 2023-01-20 16:43:10 +08:00
Frank Chen
be8ceeb4bb Save stack trace in part_log 2023-01-20 16:22:40 +08:00
Frank Chen
75191fd868 Catch exception raised by function object 2023-01-20 15:10:05 +08:00
Frank Chen
2fb49503da Make addAttribute exception safe 2023-01-20 15:09:46 +08:00
kssenii
4ce8950712 Minor changes 2023-01-19 17:53:10 +01:00
larryluogit
52ae33dba7
Merge branch 'master' into ftsearch 2023-01-19 11:34:11 -05:00
Sergei Trifonov
c443c1ece0
Merge branch 'master' into hanfei/async-cache 2023-01-18 00:19:49 +01:00
Robert Schulze
4f90824347
Merge remote-tracking branch 'origin/master' into query-result-cache 2023-01-17 22:49:53 +00:00
Alexander Tokmakov
5cd90c1a3e Merge branch 'master' into exception_message_patterns 2023-01-17 20:04:04 +01:00
Alexander Tokmakov
72e8615bec formatting of some exception messages 2023-01-17 20:03:56 +01:00
serxa
ce7e22b87b add detailed profile events for throttling 2023-01-17 18:29:24 +00:00
Alexander Tokmakov
8b13b85ea0
Merge pull request #44543 from ClickHouse/text_log_add_pattern
Add a column with a message pattern to text_log
2023-01-17 20:19:32 +03:00
Han Fei
8a74238fe0 improve 2023-01-17 15:47:52 +01:00
HarryLeeIBM
e7add8218f Addressed more review comments and ClangTidy errors 2023-01-17 06:29:13 -08:00
Vitaly Baranov
b13498d9ba
Merge pull request #45288 from vitlibar/fix-s3-requests-without-region
Fix s3 requests without region
2023-01-17 09:24:59 +01:00
Alexander Tokmakov
522686f78b less empty patterns 2023-01-17 01:19:44 +01:00
Alexander Tokmakov
870cfcc36a less fmt::runtime usages 2023-01-17 00:11:59 +01:00
Alexander Tokmakov
e7899825e6 save format strings for DB::Exceptions 2023-01-16 23:20:33 +01:00
Kseniia Sumarokova
d859976fbd
Merge pull request #45250 from ClickHouse/43188_Record_startup_time_in_profileevents
Record server startup time in ProfileEvents
2023-01-16 12:20:37 +01:00
Alexander Tokmakov
9ad6e1b129
Update logger_useful.h 2023-01-16 14:09:55 +03:00
Vitaly Baranov
e435edb4ab Make checkObjectExists() easier. 2023-01-16 10:06:20 +01:00
Robert Schulze
099e30ef2a
Merge remote-tracking branch 'origin/master' into query-result-cache 2023-01-16 08:04:49 +00:00
Vitaly Baranov
21b8aaeb8b Stop using HeadObject requests in S3
because they don't work well with endpoints without explicit region.
2023-01-15 20:28:11 +01:00
Robert Schulze
bd41c74ddf
Various test, code and docs fixups 2023-01-15 13:47:34 +00:00
Alexander Tokmakov
d857d62a03 remove another set of macros 2023-01-13 20:34:31 +01:00
Alexander Tokmakov
2d7773fccc Merge branch 'master' into text_log_add_pattern 2023-01-13 20:33:46 +01:00
Han Fei
7feb9b7f6f Merge branch 'master' into hanfei/gwp-asan 2023-01-13 20:26:34 +01:00
Han Fei
214830c569 enable gwp_asan by option 2023-01-13 15:22:14 +01:00
Robert Schulze
4ea836b87e
Revert "Revert "update function DAYOFWEEK and add new function WEEKDAY for mysql/spark compatiability""
This reverts commit e37f572c34.
2023-01-13 14:00:16 +00:00
Smita Kulkarni
a0fe26f506 Addressed review comments and updated name to ServerStartupMilliseconds - Record server startup time in ProfileEvents 2023-01-13 14:38:54 +01:00
Smita Kulkarni
cf5cb0da97 Record server startup time in ProfileEvents
Implementation:
* Added ProfileEvents::ServerStartupTime.
* Recorded time from start of main till listening to sockets.
Testing:
* Added a test 02532_profileevents_server_startup_time.sql
2023-01-13 13:47:54 +01:00
Robert Schulze
9779d034eb
Merge pull request #45144 from ClibMouse/crc-power-fix
Changes to support the CRC32 in PowerPC.
2023-01-13 11:24:18 +01:00
serxa
693489a8ad review fixes 2023-01-12 15:51:04 +00:00
Sergei Trifonov
12d8543578
Merge branch 'master' into cancellable-mutex-integration 2023-01-12 16:03:49 +01:00
Han Fei
f5e736e240 introduce llvm/gwp-asan 2023-01-12 15:00:26 +01:00
serxa
0841809a9c fix special builds 2023-01-12 01:30:42 +00:00
MeenaRenganathan22
28d5c3cf7f Addressed the review comments 2023-01-11 17:00:10 -08:00
HarryLeeIBM
6d576cf157 Added more documentation 2023-01-11 13:40:20 -08:00
MeenaRenganathan22
5fa5ae8099 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into crc-power-fix 2023-01-11 09:31:41 -08:00
Robert Schulze
9bb1e31369
Merge pull request #44860 from bigo-sg/improve_week_day
update function DAYOFWEEK and add new function WEEKDAY for mysql/spark compatiability
2023-01-11 13:58:45 +01:00
serxa
c0f529600d fix darwin build 2023-01-11 12:23:33 +00:00
MeenaRenganathan22
25c94dfa83 Changes to support the CRC32 in PowerPC to address the WeakHash collision issue. Update the reference to support the hash values based on the specific platform 2023-01-10 21:20:13 -08:00
serxa
da4e9c9430 fix SharedMutex build 2023-01-10 16:35:46 +00:00
HarryLeeIBM
bc48b17817 Addressed more review comments. 2023-01-10 08:26:27 -08:00
Robert Schulze
0c3b034887
Merge remote-tracking branch 'origin/master' into query-result-cache 2023-01-10 09:02:41 +00:00
serxa
6f31c5094d Merge branch 'cancellable-mutex' of github.com:ClickHouse/ClickHouse into cancellable-mutex 2023-01-10 01:27:11 +00:00
serxa
0f80ad6e06 make style-check happy 2023-01-10 01:26:59 +00:00
Sergei Trifonov
b4961a6253
Merge branch 'master' into cancellable-mutex 2023-01-10 02:20:42 +01:00
Robert Schulze
ad4884b394
Fix review comments, pt. I 2023-01-09 21:42:51 +00:00
serxa
ae56ac1b56 add TSA support 2023-01-09 16:46:07 +00:00
serxa
534db794c1 more review fixes 2023-01-09 15:05:41 +00:00
serxa
88c3c2946b review fixes + split into files 2023-01-09 14:58:44 +00:00
taiyang-li
a8da7b4c20 change as request 2023-01-09 20:39:46 +08:00
taiyang-li
4bc2c61406 change as request 2023-01-09 20:37:16 +08:00
Kseniia Sumarokova
b22b51213f
Merge pull request #44868 from kssenii/improve-async-buffer-from-remote
Small perf improvement for async buffer from remote
2023-01-09 13:31:15 +01:00
taiyang-li
20c7c0b1ef change as request 2023-01-09 18:21:31 +08:00
Sergei Trifonov
a4470dd1b2
Update src/Common/Threading.cpp
Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>
2023-01-09 09:01:44 +01:00
Sergei Trifonov
81d2ea30ba
Merge branch 'master' into cancellable-mutex-integration 2023-01-07 19:37:46 +01:00
Sergei Trifonov
a3b81778cd
Merge branch 'master' into cancellable-mutex 2023-01-07 19:34:19 +01:00
Anton Popov
1f32ffedf8
Merge pull request #43221 from ClickHouse/refactoring-ip-types
Replace domain IP types (IPv4, IPv6) with native
2023-01-07 12:01:21 +01:00
serxa
9c51ed6865 fix tests 2023-01-07 00:32:49 +00:00
serxa
705c8f01af fix tests 2023-01-07 00:31:53 +00:00
serxa
15bb127b01 replace every std::shared_mutex with DB::FastSharedMutex 2023-01-06 23:35:38 +00:00
serxa
a6958fff45 git-apply PR #44924 up to commit c65573d 2023-01-06 23:04:10 +00:00
Sergei Trifonov
c65573dd7e
Merge branch 'master' into cancellable-mutex 2023-01-06 23:52:35 +01:00
serxa
00b2c96ce8 fix special builds 2023-01-06 22:48:19 +00:00
Robert Schulze
45dbcf88e5
Merge remote-tracking branch 'origin/master' into query-result-cache 2023-01-06 20:42:48 +00:00
kssenii
81070907a2 Better time watch 2023-01-06 18:44:48 +01:00
Kseniia Sumarokova
573d3283b0
Merge pull request #44327 from kssenii/use-new-named-collections-code-2
Replace old named collections code with new (from #43147) part 2
2023-01-06 13:06:26 +01:00
serxa
d217136ede review fixes 2023-01-05 20:41:36 +00:00
Yakov Olkhovskiy
1be48f706b
Merge pull request #43706 from ClibMouse/s390x_crc32
s390x weakhash32 support
2023-01-05 14:45:20 -05:00
Sergei Trifonov
3f87e6cd77
Update src/Common/Threading.h
Co-authored-by: Igor Nikonov <954088+devcrafter@users.noreply.github.com>
2023-01-05 15:27:51 +01:00
Sergei Trifonov
985dff1dbf
Update src/Common/tests/gtest_threading.cpp
Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>
2023-01-05 15:27:32 +01:00
Sergei Trifonov
c507d7ecef
Update src/Common/tests/gtest_threading.cpp
Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>
2023-01-05 15:27:21 +01:00
Ilya Yatsishin
0a60fe6e60
Merge pull request #44895 from Algunenano/ignore_label_issues_on_hwmon
Ignore hwmon sensors on label read issues
2023-01-05 12:43:37 +01:00
serxa
abf63d0c33 cleanup 2023-01-05 00:26:28 +00:00
serxa
c4e896f73a cleanup 2023-01-05 00:23:10 +00:00
Sergei Trifonov
5d5cf7d5b0
Merge branch 'master' into cancellable-mutex 2023-01-05 00:50:38 +01:00