Commit Graph

55969 Commits

Author SHA1 Message Date
Azat Khuzhin
b0a80af888 Reduce lock contention for multiple layers of the Buffer engine
Otherwise you can see something like this for the following query:

    ```sql
    WITH
        arrayMap(x -> demangle(addressToSymbol(x)), s.trace) AS trace_array,
        arrayStringConcat(trace_array, '\n') AS trace_string
    SELECT
        p.thread_id,
        p.query_id,
        p.query,
        trace_string
    FROM
    (
        SELECT
            query_id,
            query,
            arrayJoin(thread_ids) AS thread_id
        FROM system.processes
    ) AS p
    INNER JOIN system.stack_trace AS s ON p.thread_id = s.thread_id
    ORDER BY p.query_id ASC
    SETTINGS enable_global_with_statement = 0, allow_introspection_functions = 1
    FORMAT PrettyCompactNoEscapes
    ```

Lots of the following:

    ```sql
    INSERT INTO buffer (...) VALUES

    __lll_lock_wait
    pthread_mutex_lock
    std::__1::mutex::lock()
    DB::StorageBuffer::reschedule()
    DB::BufferBlockOutputStream::write(DB::Block const&)
    ```

That will wait one of this:

    ```
    INSERT INTO buffer (...) VALUES

    ...
    DB::PushingToViewsBlockOutputStream::write(DB::Block const&)
    DB::AddingDefaultBlockOutputStream::write(DB::Block const&)
    DB::SquashingBlockOutputStream::finalize()
    DB::SquashingBlockOutputStream::writeSuffix()
    DB::PushingToViewsBlockOutputStream::writeSuffix()
    DB::StorageBuffer::writeBlockToDestination(DB::Block const&, std::__1::shared_ptr<DB::IStorage>)
    DB::StorageBuffer::flushBuffer(DB::StorageBuffer::Buffer&, bool, bool, bool)
    ```

P.S. we cannot simply unlock the buffer during flushing, see comments in
the code
2021-01-21 22:09:24 +03:00
Alexey Milovidov
cc160813ce Add a test 2021-01-21 21:44:48 +03:00
Alexey Milovidov
bb56daf026 Fix build 2021-01-21 21:42:26 +03:00
Alexey Milovidov
3d931df276 Fix buffer overflow in Uber H3 library 2021-01-21 21:40:14 +03:00
Azat Khuzhin
82e7e7d9cb Fix constant folding for expressions depends from subqueries result
Do not use subquery result, when value is unknown, for constant folding.

v2: fix simple subqueries, fixes 00597_push_down_predicate.
v3:
- use identity over introducing yet another cast analog (as suggested by @akuzm)
- simpler suitable_for_const_folding check
v4: use identity(cast()) since only cast() can provide corrent type (for
data types that does not have it's own type, i.e. DateTime)
v5: do not optimize consts if only_analyze isset, regardless the block
content
2021-01-21 21:26:50 +03:00
Azat Khuzhin
ea7528b853 identity: mark it as non suitable for constant folding 2021-01-21 21:22:23 +03:00
Azat Khuzhin
82f6c642ae identity: simple functions in oneline (coding style) 2021-01-21 21:22:23 +03:00
Azat Khuzhin
44011061b5 Add missing DROP TABLE at the beginning of 01268_mv_scalars test 2021-01-21 21:22:23 +03:00
Azat Khuzhin
95c9e57ec1 Add 01600_parts_types_metrics 2021-01-21 21:17:01 +03:00
Azat Khuzhin
974f0daeb9 Add set database_atomic_wait_for_drop_and_detach_synchronously=1 for 01600_parts_states_metrics
Without this setting the test will pass only when the table will be
actually removed by the background worker of the Atomic engine.

In CI this is not required since
database_atomic_wait_for_drop_and_detach_synchronously is set explicitly
in via tests/users.d.
2021-01-21 21:17:01 +03:00
Azat Khuzhin
926b0ddc59 Rename 01600_count_of_parts_metrics to 01600_parts_states_metrics 2021-01-21 21:17:00 +03:00
Azat Khuzhin
cb951c2116 Add metrics for MergeTree parts types
- PartsWide
- PartsCompact
- PartsInMemory
2021-01-21 21:17:00 +03:00
Azat Khuzhin
c68f7cd5b1 Measure time that spend during flush of the Buffer to the underlying 2021-01-21 21:11:39 +03:00
Azat Khuzhin
2c42600cf9 Add log message with elapsed time while pushing to view
Since right now theses queries are not logged and there is no way to
determine the time that it takes.

Proper fix will be to account them in system.processes (and all other
places), but this is not that easy.
2021-01-21 21:09:23 +03:00
Nikita Mikhaylov
dca0cbf4eb
Merge pull request #19313 from nikitamikhaylov/another-race-cache-dictionary
Fixed race between copy-constructor and addQueryAccessInfo
2021-01-21 21:02:36 +03:00
Nikita Mikhaylov
b93732e441
Merge pull request #18788 from hexiaoting/map_functions
Introduce mapContains, mapKeys, mapValues functions for Map data type
2021-01-21 21:02:03 +03:00
Alexander Kuzmenkov
eb7b87ee8d update tests 2021-01-21 21:01:32 +03:00
Nikita Mikhaylov
e8a9768bd0
Update map.cpp 2021-01-21 20:47:57 +03:00
Yatsishin Ilya
a623084eb0 Merge remote-tracking branch 'origin' into sqlancer-rename 2021-01-21 20:36:52 +03:00
Mikhail Filimonov
fb98e3f8dc
Allow docker to be executed with arbitrary uid 2021-01-21 18:25:09 +01:00
Ildus Kurbangaliev
86db47de27 fix assert call 2021-01-21 22:23:49 +05:00
Alexander Gololobov
0a155ee2f1 Fix IDisk::open parameters to match posix open 2021-01-21 19:38:13 +03:00
kssenii
c1702f34ee Add factories info into system.query_log 2021-01-21 15:46:37 +00:00
Alexander Kuzmenkov
36a42a1f96 update tests 2021-01-21 18:30:51 +03:00
Mikhail Filimonov
066fbfff0e
librdkafka support for arm64 2021-01-21 16:04:55 +01:00
tavplubix
600862f4a2
Better logging in MySQLHandler 2021-01-21 18:00:58 +03:00
Yatsishin Ilya
4ac080b2ca SQLancer binary changed its name 2021-01-21 17:53:28 +03:00
Alexander Kuzmenkov
ec8ff21526 Reconnect after client errors 2021-01-21 17:28:46 +03:00
vdimir
06d0252e76
Use IDataType::insertDefaultInto for inserting default values in join 2021-01-21 17:23:58 +03:00
alexey-milovidov
062f00aa5d
Merge pull request #19290 from azat/dist-broken-on-EOF-fix
Do not mark file for distributed send as broken on EOF
2021-01-21 17:00:36 +03:00
alexey-milovidov
669e55f5e0
Merge pull request #19318 from qoega/issue-template-sanitizer
Add Sanitizer report issue template
2021-01-21 16:51:45 +03:00
vdimir
2f11fdf4df
Fix default value in join types with non-zero default (close #18197) 2021-01-21 16:49:44 +03:00
Alexey Milovidov
3b2a87b57e Update SECURITY.md (outdated long time ago) 2021-01-21 16:48:28 +03:00
Alexey Milovidov
375db8ce7e Update reference 2021-01-21 16:42:47 +03:00
tavplubix
0ef00bc4a6
Merge pull request #19023 from sevirov/sevirov-DOCSUP-4966-add_multiword_data_types
DOCSUP-4966: Add some multiword data types
2021-01-21 16:07:25 +03:00
tavplubix
ac50b1b231
Update StorageMaterializedView.cpp 2021-01-21 15:57:18 +03:00
Nikita Mikhaylov
3634e87d16
Merge pull request #19090 from ka1bi4/romanzhukov-DOCSUP-5272-translation
DOCSUP-5272: Edit and translate to RU: primary key in create table statement.
2021-01-21 15:35:22 +03:00
Anton Popov
ac3de63a71 fix several cases, while reading subcolumns 2021-01-21 15:34:11 +03:00
alexey-milovidov
7370335f87
Merge pull request #19339 from ClickHouse/fix-ipv4-formatting
Fix bad formatting of IPv4 addresses
2021-01-21 15:20:24 +03:00
Alexey Milovidov
56012402e2 Fix potential nullptr dereference in table function VALUES 2021-01-21 15:19:00 +03:00
alexey-milovidov
08dc5ebfa7
Merge pull request #19343 from ucasFL/sleep
fix sleep with infinite input
2021-01-21 15:04:30 +03:00
Alexey Milovidov
4968f1733e Annotations for DateLUT 2021-01-21 15:01:24 +03:00
Ildus Kurbangaliev
47a0f4e162 Add tuple argument support for argMin and argMax 2021-01-21 16:47:51 +05:00
Alexey Milovidov
2cd04e8923 Fix UBSan report in arraySum 2021-01-21 14:43:33 +03:00
alesapin
7f32926a21 Fix race condition in TestKeeperHandler on session finish 2021-01-21 14:37:20 +03:00
alesapin
fe6b964b32 Revert "Revert "Auto version update to [21.2.1.1] [54446]""
This reverts commit 42f63e14b5.
2021-01-21 12:39:46 +03:00
flynn
e75b116466
Rewrite sum(if()) and sumIf to countIf in special cases (#17041)
Co-authored-by: vdimir <vdimir@yandex-team.ru>
2021-01-21 12:01:35 +03:00
Nikolai Kochetov
af7dca7bb7 Update perftest. 2021-01-21 11:54:56 +03:00
Nikolai Kochetov
9ae3628b66 Fix test. 2021-01-21 11:49:40 +03:00
Nikolai Kochetov
0d20b4575d Fix test. 2021-01-21 11:41:32 +03:00