Commit Graph

106010 Commits

Author SHA1 Message Date
Nikolai Kochetov
b877c484d2
Merge pull request #45481 from ClickHouse/fix-deadlock-with-allow_asynchronous_read_from_io_pool_for_merge_tree
Fix possible deadlock with allow_asynchronous_read_from_io_pool_for_merge_tree in case of exception from ThreadPool::schedule
2023-01-21 12:05:34 +01:00
Nikolai Kochetov
ec1e2436cc
Merge pull request #45450 from ClickHouse/fix-disabled-two-level-agg
Fix disabled two-level aggregation from HTTP
2023-01-21 12:01:59 +01:00
Sema Checherinda
962894afc8
Merge pull request #44909 from CheSema/intersect-prev-part
Do not merge over a gap with outdated undeleted parts
2023-01-21 11:51:21 +01:00
Maksim Kita
47385a19e7 Remove unnecessary getTotalRowCount function calls 2023-01-21 11:27:07 +01:00
Anton Popov
41a199e175
Fix crash when ListObjects request fails (#45371) 2023-01-20 20:10:23 +01:00
Nikolai Kochetov
dcd84c152a Fix possible deadlock with allow_asynchronous_read_from_io_pool_for_merge_tree in case of exception from ThreadPool::schedule 2023-01-20 18:57:47 +00:00
Han Fei
4bbe90f6b4
Merge pull request #45473 from hanfei1991/hanfei/async-inserts-doc
update docs for async insert deduplication
2023-01-20 18:25:19 +01:00
Han Fei
18a397f8c9 address comments 2023-01-20 18:09:42 +01:00
Han Fei
449ace3373
Update docs/en/operations/settings/settings.md
Co-authored-by: Dan Roscigno <dan@roscigno.com>
2023-01-20 18:07:19 +01:00
Han Fei
9d87bd10ee
Update docs/en/operations/settings/settings.md
Co-authored-by: Dan Roscigno <dan@roscigno.com>
2023-01-20 18:07:08 +01:00
Han Fei
badfbcb3d8
Update docs/en/operations/settings/settings.md
Co-authored-by: Dan Roscigno <dan@roscigno.com>
2023-01-20 18:06:58 +01:00
Han Fei
e9c4cf46cd
Update docs/en/operations/settings/merge-tree-settings.md
Co-authored-by: Dan Roscigno <dan@roscigno.com>
2023-01-20 18:06:46 +01:00
Han Fei
9d254f7d87
Update docs/en/operations/settings/merge-tree-settings.md
Co-authored-by: Dan Roscigno <dan@roscigno.com>
2023-01-20 18:06:32 +01:00
Nikolay Degterinsky
c2ac4fece0 Add more retries to AST Fuzzer 2023-01-20 16:46:24 +00:00
robot-ch-test-poll4
2066581d8f
Merge pull request #45451 from evillique/default_granularity
Add default GRANULARITY argument for secondary indexes
2023-01-20 17:46:21 +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
Nikita Mikhaylov
9ab454366c Better test 2023-01-20 16:40:01 +01:00
Kseniia Sumarokova
01320da02b
Update BoundedReadBuffer.cpp 2023-01-20 16:25:02 +01:00
Nikolay Degterinsky
02142596fb Add docs 2023-01-20 15:22:13 +00:00
Antonio Andelic
136e4ec1b3
Merge pull request #45273 from azat/fix-test-log-level
Fix log level "Test" for send_logs_level in client
2023-01-20 15:36:05 +01:00
Alexander Tokmakov
ec5d7d0a3a
Update src/Functions/FunctionsConversion.h
Co-authored-by: Alexander Gololobov <440544+davenger@users.noreply.github.com>
2023-01-20 17:33:01 +03:00
Robert Schulze
b55c8ddd65
Merge pull request #45472 from ClickHouse/rs-duplicate-writing-guide
Don't duplicate writing guide, instead point to existing writing guide
2023-01-20 15:05:13 +01:00
Sema Checherinda
b76b612d23
fix typo 2023-01-20 14:55:58 +01:00
Nikolai Kochetov
039901b395 Fixing build 2023-01-20 13:49:50 +00:00
Han Fei
5fc4998f10 update docs for async insert deduplication 2023-01-20 14:42:11 +01:00
Robert Schulze
4ac17d71fa
Merge pull request #45470 from ClickHouse/rs-doc-typos
Fix typos
2023-01-20 14:39:27 +01:00
Robert Schulze
3b182e0fec
Don't duplicate writing guide, instead point to existing writing guide 2023-01-20 13:36:31 +00:00
Robert Schulze
3f2e4c8217
Fix typos 2023-01-20 13:20:25 +00:00
Robert Schulze
687f9c35a7
Merge pull request #45469 from ClickHouse/inv-idx-docs
Docs for inverted index
2023-01-20 14:17:58 +01:00
Sema Checherinda
02f22f04e8
fix typos 2023-01-20 13:35:23 +01:00
kssenii
8d20af8127 Fix 2023-01-20 13:34:23 +01:00
Robert Schulze
7e6d3163b1
Initial inverted index docs 2023-01-20 12:12:20 +00: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
Nikolai Kochetov
1e29993aef Fixing build 2023-01-20 11:55:20 +00:00
Maksim Kita
3e08a98f16
Merge pull request #45388 from azat/dict/remove-preallocate
Remove PREALLOCATE for HASHED/SPARSE_HASHED dictionaries
2023-01-20 14:51:25 +03:00
Anton Popov
9c0ba7c7ca
Merge pull request #45432 from CurtizJ/allow-json-extract-int-from-float
Allow to convert float stored in string field to integer in `JSONExtract`
2023-01-20 12:35:06 +01:00
Kseniia Sumarokova
c066b9bddd
Update SwapHelper.h 2023-01-20 12:19:19 +01:00
Maksim Kita
e067a55b78 Fixed tests 2023-01-20 12:19:16 +01:00
Sema Checherinda
09f3a5c599 add a comment, add a check, fix test 2023-01-20 12:10:31 +01:00
Maksim Kita
23e26032ca
Merge pull request #45399 from aalexfvk/alexfvk/mdb-21326_fix_system_dictionaries_when_dictionary_with_bad_structure
Fix select from system.dictionaries when there is dictionary with bad structure
2023-01-20 13:36:32 +03:00
Maksim Kita
758c8f2776
Merge branch 'master' into dict/remove-preallocate 2023-01-20 13:15:37 +03:00
Maksim Kita
e6ee5554d1 Fixed tests 2023-01-20 11:15:13 +01:00
Azat Khuzhin
1f9a65b875 Modernize InternalTextLogsQueue::getPriorityName()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-01-20 11:09:35 +01:00
Azat Khuzhin
fc276abadd Fix log level "Test" for send_logs_level in client
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-01-20 11:09:35 +01:00
Antonio Andelic
0ad37ad286
Merge pull request #45320 from stigsb/system_tables_volume_config
Add <storage_policy> config parameter for system logs
2023-01-20 10:27:57 +01:00
Robert Schulze
5ec6d89d43
Merge pull request #38667 from ClibMouse/ftsearch
Inverted Indices Implementation
2023-01-20 10:18:05 +01:00
SmitaRKulkarni
6aa63414db
Merge pull request #45072 from ClickHouse/43891_Disallow_concurrent_backups_and_restores
Added settings to disallow concurrent backups and restores
2023-01-20 09:17:20 +01:00
Aleksei Filatov
42549e89f2 [rev 2] Fix review notes 2023-01-20 09:37:49 +03:00
Nikolai Kochetov
3e00d18498 Merge branch 'master' into fix-disabled-two-level-agg 2023-01-19 20:54:04 +00:00
Nikolay Degterinsky
dd7fef11a2 Add default granularity 2023-01-19 20:52:38 +00:00