Commit Graph

15953 Commits

Author SHA1 Message Date
Nikolai Kochetov
61d8f880cd Rename some files. 2021-07-26 19:48:25 +03:00
Raúl Marín
61a90fa935 Use individual mutex to manage the collector_thread 2021-07-26 17:51:10 +02:00
Nikolai Kochetov
9b5a816b43 Merge branch 'master' into output-streams-to-processors 2021-07-26 18:03:11 +03:00
Alexander Tokmakov
304c367912 fix groupUniqArray 2021-07-26 17:57:49 +03:00
Nikolai Kochetov
0eb563dc1b Fix more tests. 2021-07-26 17:47:29 +03:00
Alexander Tokmakov
5c9f69ea17 fix parameters with combinators 2021-07-26 17:37:47 +03:00
Kseniia Sumarokova
5c5cb5d0d6
Update src/Storages/StorageSQLite.h
Co-authored-by: Vladimir <vdimir@yandex-team.ru>
2021-07-26 14:26:06 +03:00
Amos Bird
623faf47e4
Make sure table is readonly when restarting fails. 2021-07-26 19:21:14 +08:00
Amos Bird
50e53035c9
Remove unneeded mutex during connection draining 2021-07-26 19:15:45 +08:00
Nikolai Kochetov
fa1c223269 Fix some tests. 2021-07-26 13:08:40 +03:00
mergify[bot]
2929cf3ba8
Merge branch 'master' into system_zookeeper_log 2021-07-26 08:40:55 +00:00
kssenii
f3129b80f9 Fix sqlite attach 2021-07-26 07:20:41 +00:00
Vitaly Baranov
4862e9f80d
Merge pull request #26733 from vitlibar/support-multiple-keys
Support multiple keys for encrypted disk
2021-07-26 10:19:50 +03:00
Vitaly Baranov
5a55cf3437
Merge pull request #26780 from vitlibar/new-function-current-roles
Add new functions currentRoles(), enabledRoles(), defaultRoles().
2021-07-26 10:01:45 +03:00
ryzuo
0e742487f1 Remove unnecessary emtpy argument check for nth_value as code review suggested 2021-07-26 13:31:45 +08:00
alexey-milovidov
00a0bbd405
Merge pull request #26789 from ClickHouse/silent-rocksdb-logs
Less verbose RocksDB logs #26252
2021-07-26 06:46:09 +03:00
alexey-milovidov
7b76bfc719
Merge pull request #26318 from amosbird/connectionpoolfactory
Connection pool cache
2021-07-26 06:45:03 +03:00
Alexey Milovidov
b6fdb395c2 Less verbose RocksDB logs #26252 2021-07-25 23:09:50 +03:00
Alexey Milovidov
8b4c49d931 Fix test 2021-07-25 22:09:42 +03:00
Maksim Kita
197bda1ff1 Heredoc updated tests 2021-07-25 22:01:25 +03:00
Alexey Milovidov
eba787ec57 Fix trash 2021-07-25 07:50:16 +03:00
Alexey Milovidov
650cbd2484 GraphiteMergeTree: respect timezone for rounding #5098 2021-07-25 04:27:40 +03:00
Alexey Milovidov
eab53d7a82 Fix trash 2021-07-25 04:13:22 +03:00
alexey-milovidov
22fa1efacb
Merge pull request #26777 from ClickHouse/bolonini-read-from-file
Merging #25960 (Bolonini/read_from_file)
2021-07-25 01:33:34 +03:00
Alexey Milovidov
2f2dce399a Fix style 2021-07-25 01:26:21 +03:00
Alexey Milovidov
1c432d505a Fix style 2021-07-25 01:25:48 +03:00
Vitaly Baranov
51f882d8cc Support multiple keys for encrypted disk. Display error message if the key is probably wrong. 2021-07-24 23:45:12 +03:00
Vitaly Baranov
22728cbca0 Add new functions currentRoles(), enabledRoles(), defaultRoles(). 2021-07-24 23:20:40 +03:00
Vitaly Baranov
7b4e5f8e21
Merge pull request #26759 from vitlibar/changing-default-roles-affects-new-sessions
Changing default roles affects new sessions only.
2021-07-24 23:15:14 +03:00
Alexey Milovidov
215505b985 Remove unused error code 2021-07-24 19:51:56 +03:00
Alexey Milovidov
774f6d2617 Allow to read file descriptor multiple times in File storage 2021-07-24 19:50:03 +03:00
Alexey Milovidov
456801ccb8 Merge branch 'pipe_reading' of github.com:BoloniniD/ClickHouse into bolonini-read-from-file 2021-07-24 19:24:22 +03:00
alexey-milovidov
d3127d6265
Merge pull request #26731 from vdimir/fix-async-drain-connection-uaf
Fix use after free in AsyncDrain connection from S3Cluster
2021-07-24 18:55:03 +03:00
alexey-milovidov
0318a089a0
Merge pull request #26740 from Cas-pian/grant_by_replace
remove uncessary Exception
2021-07-24 18:54:11 +03:00
alexey-milovidov
967fe89917
Merge pull request #26730 from vitlibar/set-profile-applies-constraints-too
SET PROFILE applies constraints too.
2021-07-24 18:53:36 +03:00
Alexey Milovidov
3f4cfb67bd Fix conversion between DateTime and String in Protobuf 2021-07-24 18:29:19 +03:00
Alexey Milovidov
d6c1593b22 Correct read of Date and UInt16 as DateTime in Arrow format 2021-07-24 17:36:21 +03:00
BoloniniD
2fa02061b7 Fix parallel reads 2021-07-24 15:31:35 +03:00
alexey-milovidov
039bb1cc5e
Merge pull request #26720 from azat/part_log-fix-event_time_microseconds
Fix event_time_microseconds for REMOVE_PART in system.part_log
2021-07-24 15:09:37 +03:00
Alexey Milovidov
68df1b4564 Remove awful code by unresponsive developers 2021-07-24 14:56:29 +03:00
Alexey Milovidov
5e8a22c45c Remove more trash 2021-07-24 14:49:42 +03:00
Alexey Milovidov
01ab23b907 Remove another trash 2021-07-24 14:46:00 +03:00
Alexey Milovidov
2b03d54e94 Fix half of trash 2021-07-24 14:38:42 +03:00
alexey-milovidov
70ca77b342
Merge pull request #26768 from ClickHouse/opened-file-cache
Experiment with sharing file descriptors
2021-07-24 13:08:03 +03:00
Amos Bird
2ba6ef1487
Better implementation 2021-07-24 18:02:51 +08:00
alexey-milovidov
dab9cfb9c9
Merge pull request #26713 from ClickHouse/remove-more-and--more-streams
Remove more streams.
2021-07-24 02:24:10 +03:00
Alexey Milovidov
0a4e26e682 Experiment with sharing file descriptors 2021-07-24 01:50:14 +03:00
BoloniniD
07c57edbfc Merge branch 'master' of github.com:ClickHouse/ClickHouse into pipe_reading 2021-07-23 23:39:38 +03:00
Vitaly Baranov
249ccd879e SET PROFILE applies constraints too. 2021-07-23 23:28:55 +03:00
Vitaly Baranov
db97921b5b Changing default roles affects new sessions only. 2021-07-23 23:23:14 +03:00
Vitaly Baranov
c68c74634d
Merge pull request #26707 from vitlibar/fix-set-role
Fix SET ROLE
2021-07-23 23:16:15 +03:00
Nikolai Kochetov
9c92f43359 Update storages. 2021-07-23 22:33:59 +03:00
Caspian
421e59b9f5 rm whitespace 2021-07-23 23:12:30 +08:00
Nikolai Kochetov
2dc5c89b66 Update Storage::write 2021-07-23 17:25:35 +03:00
Caspian
e724e972fe remove uncessary Exception 2021-07-23 21:37:55 +08:00
Maksim Kita
73ab70af1e
Merge pull request #26738 from excitoon/patch-9
Fixed wrong error message in `S3Common`
2021-07-23 16:21:24 +03:00
Maksim Kita
f6f8bea689
Merge pull request #26671 from kitaisreal/mysql-dictionaries-support-for-custom-query
Lexer introduce heredoc
2021-07-23 16:20:54 +03:00
Maksim Kita
6e2d992dce
Merge pull request #26719 from kitaisreal/compile-aggregate-functions-profile-events-fix
Compile aggregate functions profile events fix
2021-07-23 16:17:57 +03:00
Vladimir Chebotarev
eb2defb098
Fixed wrong error message in S3Common. 2021-07-23 15:36:19 +03:00
Vitaly Baranov
67d4da224a
Merge pull request #26384 from Cas-pian/grant_by_replace
add grant by replace support
2021-07-23 14:40:47 +03:00
Raúl Marín
383c982715 CH local: Treat localhost:port as a remote database 2021-07-23 13:16:35 +02:00
Nikolai Kochetov
52cc98e9c7
Update MergeJoin.cpp 2021-07-23 13:55:28 +03:00
Nikolai Kochetov
80e0e24448 Fix unit test and style. 2021-07-23 12:29:53 +03:00
Maksim Kita
e961de3ea0 Fixed build 2021-07-23 11:15:29 +03:00
vdimir
dccc379d39
Fix use after free in AsyncDrain connection from S3Cluster 2021-07-23 10:40:03 +03:00
Vitaly Baranov
19d5a6ab2f
Merge pull request #26714 from vitlibar/new-function-current-profiles
New functions currentProfiles(), enabledProfiles(), defaultProfiles().
2021-07-23 09:10:29 +03:00
Maksim Kita
42201d3e30 Fixed code review issues 2021-07-23 01:03:44 +03:00
Azat Khuzhin
00e2083421 Fix event_time_microseconds for REMOVE_PART in system.part_log 2021-07-23 00:59:08 +03:00
Maksim Kita
1fea19846b Compile aggregate functions profile events fix 2021-07-23 00:43:31 +03:00
Maksim Kita
46fd046f11 Setting min_count_to_compile_aggregate_expression fix 2021-07-23 00:22:04 +03:00
Maksim Kita
222915c275 Fixed code review issues 2021-07-23 00:07:22 +03:00
Alexander Kuzmenkov
9465e5d191
Merge pull request #26701 from ClickHouse/aku/window-debug
more debug checks for window functions
2021-07-22 23:09:29 +03:00
Vitaly Baranov
7afcc65060 Add new functions currentProfiles(), enabledProfiles(), defaultProfiles(). 2021-07-22 22:20:53 +03:00
Nikolai Kochetov
3c17a62686
Merge pull request #26590 from ClickHouse/remove-some-more-streams
Remove some streams.
2021-07-22 21:28:50 +03:00
Nicolae Vartolomei
f35e6eee19 Avoid deleting old parts from FS on shutdown for replicated engine
This was introduced in https://github.com/ClickHouse/ClickHouse/pull/8602.
The idea was to avoid data re-appearing in ClickHouse after DROP/DETACH
PARTITION. This problem was only present in MergeTree engine and I don't
understand why we need to do the same in ReplicatedMergeTree.

For ReplicatedMergeTree the state of truth is stored in ZK, deleting
things from filesystem just introduces inconsistencies and this is the
main source for errors like "No active replica has part X or covering
part".

The resulting problem is fixed by
https://github.com/ClickHouse/ClickHouse/pull/25820, but in my opinion
we would better avoid introducing the ZK/FS inconsistency in the first
place.

When does this inconsistency appear? Often the sequence is like this:

0. Write 2 parts to ZK [all_0_0_0, all_1_1_0]
1. A merge gets scheduled
2. New part replaces old parts [new: all_0_1_1, old: all_0_0_0, all_1_1_0]
3. Replica gets shutdown and old parts are removed from filesystem
4. Replica comes back online, metadata about all parts is still stored in ZK for this new replica.
5. Other replica after cleanup thread runs will have only [all_0_1_1] in
   ZK
5. User triggers a DROP_RANGE after a while (drop range is for all_0_1_9999*)
6. Each replica deletes from ZK only [all_0_1_1]. The replica that got
   restarted uses its in-memory state to choose nodes to delete from ZK.
7. Restart the replica again. It will now think that there are 2 parts
   that it lost and needs to fetch them [all_0_0_0, all_1_1_0].

`clearOldPartsAndRemoveFromZK` which is triggered from cleanup thread
runs cleanup sequence correctly, it first removes things from ZK and
then from filesystem. I don't see much benefit of triggering it on
shutdown and would rather have it called only from a single place.

---

This is a very, very edge case situation but it proves that the current
"fix" (https://github.com/ClickHouse/ClickHouse/pull/25820) isn't
complete.

```
create table test(
    v UInt64
)
engine=ReplicatedMergeTree('/clickhouse/test', 'one')
order by v
settings old_parts_lifetime = 30;

create table test2(
    v UInt64
)
engine=ReplicatedMergeTree('/clickhouse/test', 'two')
order by v
settings old_parts_lifetime = 30;

create table test3(
    v UInt64
)
engine=ReplicatedMergeTree('/clickhouse/test', 'three')
order by v
settings old_parts_lifetime = 30;

insert into table test values (1), (2), (3);
insert into table test values (4);

optimize table test final;

detach table test;
detach table test2;

alter table test3 drop partition tuple();

attach table test;
attach table test2;
```

```
(CONNECTED [localhost:9181]) /> ls /clickhouse/test/replicas/one/parts
all_0_0_0
all_1_1_0
(CONNECTED [localhost:9181]) /> ls /clickhouse/test/replicas/two/parts
all_0_0_0
all_1_1_0
(CONNECTED [localhost:9181]) /> ls /clickhouse/test/replicas/three/parts
```

```
detach table test;
attach table test;
```

`test` will now figure out that parts exist only in ZK and will issue `GET_PART`
after first removing parts from ZK.

`test2` will receive fetch for unknown parts and will trigger part checks itself.
Because `test` doesn't have the parts anymore in ZK `test2` will mark them as LostForever.
It will also not insert empty parts, because the partition is empty.

`test` is left with `GET_PART` in the queue and stuck.

```
SELECT
    table,
    type,
    replica_name,
    new_part_name,
    last_exception
FROM system.replication_queue

Query id: 74c5aa00-048d-4bc1-a2ea-6f69501c11a0

Row 1:
──────
table:          test
type:           GET_PART
replica_name:   one
new_part_name:  all_0_0_0
last_exception: Code: 234. DB::Exception: No active replica has part all_0_0_0 or covering part. (NO_REPLICA_HAS_PART) (version 21.9.1.1)

Row 2:
──────
table:          test
type:           GET_PART
replica_name:   one
new_part_name:  all_1_1_0
last_exception: Code: 234. DB::Exception: No active replica has part all_1_1_0 or covering part. (NO_REPLICA_HAS_PART) (version 21.9.1.1)
```
2021-07-22 17:48:16 +01:00
ryzuo
4d36d54c81 Update the implementaion of nth_value
Make nth_value for nullable values for out of frame rows, as the same
fashion as lagInFrame just does.
2021-07-23 00:34:08 +08:00
Nikolai Kochetov
f56a45155f Merge branch 'master' into remove-more-and--more-streams 2021-07-22 19:10:39 +03:00
Nikolai Kochetov
fd754430eb Remove more streams. 2021-07-22 19:05:52 +03:00
Vitaly Baranov
9117e12a9b Substitute profiles in reversive order. 2021-07-22 18:50:22 +03:00
alexey-milovidov
3f5016a617
Merge pull request #26410 from mathalex/master
Add queryID and initialQueryID functions
2021-07-22 18:28:38 +03:00
Vitaly Baranov
d0412994a2 Fix SET ROLE. 2021-07-22 17:41:52 +03:00
Maksim Kita
e08fc94137
Merge pull request #26678 from CurtizJ/minor-bugfix
Minor bugfix
2021-07-22 15:54:24 +03:00
alexey-milovidov
c3206f6c85
Merge pull request #26470 from ClickHouse/fix-flaky-test-20
Fix flaky test `distributed_ddl_output_mode`
2021-07-22 15:32:22 +03:00
Alexander Kuzmenkov
19ee914e90 more debug checks for window functions 2021-07-22 15:17:49 +03:00
Alexander Kuzmenkov
60ca9990e5
Merge pull request #26668 from ClickHouse/aku/window-materialize
materialize all columns in window transform
2021-07-22 13:42:36 +03:00
Nikolai Kochetov
3ed3f7a9f7 Fix integration tests. 2021-07-22 13:38:22 +03:00
feihengye
6230ad0160
#26640 change kafka engine max consumers from 16 to physical cpu cores (#26642)
Co-authored-by: jhonye <jhonye@tencent.com>
2021-07-22 11:54:08 +03:00
Nikolai Kochetov
5ffd99dfd4
Merge pull request #25674 from amosbird/distributedreturnconnection
Drain connection asynchronously
2021-07-22 11:04:49 +03:00
ryzuo
94d4fb9dfc Cleanup the incomplete fix of nullability return value of lagInFrame/leadInFrame 2021-07-22 10:37:29 +08:00
ryzuo
df9ec5655c Add missing test back in 01591_window_function 2021-07-22 10:30:10 +08:00
ryzuo
4eb053a303 Implementaion of window function nth_value.
1. Implemented the window function nth_value
2. Make the return type of lag/lead, and nth_value functions to be
ColumnNullable, thus the returned value can be null if it is out
of frame.
2021-07-22 10:19:19 +08:00
Alexey Milovidov
49dac9a46f Move code to .cpp 2021-07-22 03:38:28 +03:00
alexey-milovidov
f9581893d8
Merge pull request #26658 from azat/skip_unavailable_shards-excessive-attempts
Fix excessive connect attempts with skip_unavailable_shards
2021-07-22 02:12:32 +03:00
Denny Crane
1eb71713de
copypaste error 2021-07-21 16:26:45 -03:00
Anton Popov
a36c387e4e fix iterating over list 2021-07-21 21:47:20 +03:00
Vladimir
576b407804
Support conditions in JOIN ON section (#24420)
* Try to enforce table identification in CollectJoinOnKeysMatcher

* Support filtering conditions in JOIN ON for HashJoin

* Correct handle non equi join

* Update test 00878_join_unexpected_results

* Join on filters calculated as one row before join

* Do not lookup key in hash join if condition for row is not hold

* better

* Support filtering conditions in JOIN ON for MergeJoin

* Support Nullable mask in JOIN ON section

* Fix style in Interpreters/TableJoin.cpp

* Change return type of getColumnAsMask in join_common to ColumnPtr

* Handle Nullable(Nothing) type in JOIN ON section, add test cases

* Fix type cast JoinCommon::getColumnAsMask

* Check type if conditions in JOIN ON section, support functions

* Update tests with JOIN ON

* Style changes, add comments for conditions in JOIN ON section

* Add test cases for join on condtions

* JOIN ON key1 = key2 AND (cond1 OR cond2)

* Remove CollectJoinOnKeysVisitor has_join_keys

* Add test cases for join on nullable/lc conditions

* Fix style

* Change error code 48 to 403 in join on tests

* Fix whitespace
2021-07-21 20:03:33 +03:00
Nikolai Kochetov
f38de35b14 Rename some constants. 2021-07-21 19:13:17 +03:00
Caspian
eab4cb3cdc use new syntax, update docs 2021-07-21 23:08:38 +08:00
Maksim Kita
49983883cc Added tests 2021-07-21 16:41:45 +03:00
Alexander Kuzmenkov
7f0fec6d5d materialize all columns in window transform 2021-07-21 16:06:50 +03:00