Commit Graph

1127 Commits

Author SHA1 Message Date
Robert Schulze
9c066e964d
Less use of CH-specific bit_cast()
Converted usage of CH-custom bit_cast to std::bit_cast if possible, i.e.
when
  sizeof(From) == sizeof(To).
(The CH-custom bit_cast is able to deal with sizeof(From) != sizeof(To).)

Motivation for this came from #42847 where it is not clear how the
internal bit_cast should behave on big endian systems, so we better
avoid that situation as much as possible.
2022-11-04 15:52:48 +00:00
Kseniia Sumarokova
6ada8e9e39
Update src/Databases/PostgreSQL/DatabasePostgreSQL.cpp
Co-authored-by: Nikolay Degterinsky <43110995+evillique@users.noreply.github.com>
2022-11-04 13:37:10 +01:00
kssenii
c9b4bc66b5 Fiux 2022-11-04 12:19:30 +01:00
Vitaly Baranov
c2cc2ccc99 Make as_table_function a child of ASTCreateQuery (to help writing visitors). 2022-10-31 10:50:33 +01:00
Azat Khuzhin
4e76629aaf Fixes for -Wshorten-64-to-32
- lots of static_cast
- add safe_cast
- types adjustments
  - config
  - IStorage::read/watch
  - ...
- some TODO's (to convert types in future)

P.S. That was quite a journey...

v2: fixes after rebase
v3: fix conflicts after #42308 merged
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-21 13:25:19 +02:00
Alexander Tokmakov
4b371bd20c fix 2022-10-10 16:38:35 +02:00
Alexander Tokmakov
fa1134f299 Merge branch 'master' into fix_loading_dependencies 2022-10-10 16:30:52 +02:00
Alexander Tokmakov
4175f8cde6 abort instead of __builtin_unreachable in debug builds 2022-10-07 21:49:08 +02:00
Alexander Tokmakov
014784a9ca Merge branch 'master' into fix_loading_dependencies 2022-10-07 18:58:11 +02:00
Alexander Tokmakov
690ec74bf2 better handling for expressions in dictGet 2022-10-05 20:58:27 +02:00
Robert Schulze
cc92a2d174
Merge branch 'master' into generated-file-cleanup 2022-09-30 09:56:31 +02:00
Nikita Mikhaylov
afe6c99e7d
Update DatabaseReplicated.cpp 2022-09-29 13:23:14 +02:00
Nikita Mikhaylov
ab97c60118 Done 2022-09-29 11:00:23 +00:00
Robert Schulze
fd86829824
Consolidate config_core.h into config.h
Less duplication, less confusion ...
2022-09-28 13:31:57 +00:00
Nikita Mikhaylov
bf4d675830
Fix backward incompatibility in Replicated database creation (#41875) 2022-09-28 13:22:19 +02:00
Alexander Tokmakov
922834ccde minor fixes 2022-09-26 19:31:08 +02:00
Frank Chen
a999212082 Update test cases to support both Replicated and non-Replicated database engine
Signed-off-by: Frank Chen <frank.chen021@outlook.com>
2022-09-24 11:34:42 +08:00
Alexander Tokmakov
65474830ac make tryEnqueueReplicatedDDL virtual 2022-09-16 16:25:32 +02:00
Alexander Tokmakov
03c193ccca fix ON CLUSTER with Replicated database cluster 2022-09-15 21:15:57 +02:00
Alexander Tokmakov
fc73134145 fix race between DROP and short form of ATTACH 2022-09-14 18:03:36 +02:00
Alexey Milovidov
05d0f48d17
Merge pull request #41173 from ClickHouse/remove-some-methods
Remove some methods
2022-09-11 07:19:52 +03:00
Alexey Milovidov
fd235919aa Remove some methods 2022-09-10 05:04:40 +02:00
Alexey Milovidov
4301b362ab Fix strange code in DatabaseReplicated 2022-09-10 02:34:37 +02:00
Kseniia Sumarokova
c5c48e44ea
Merge branch 'master' into fix-mysql-timeouts 2022-08-29 19:33:29 +02:00
kssenii
0a6c4b9265 Fix 2022-08-29 16:20:53 +02:00
alesapin
4f9faab924 Fix benign race in database replicated worker 2022-08-28 15:07:29 +02:00
Barum Rho
a61827fb78 Convert SQLite int8 column to ClickHouse int64
SQLite int8 column uses 64 bit integers.
2022-08-25 16:15:50 -04:00
Alexander Tokmakov
629690c32b fix "incorrect replica identifier" 2022-08-18 16:13:27 +02:00
Alexander Tokmakov
caa270b72a
Merge pull request #39933 from ClickHouse/auto_convert_ordinary_to_atomic
Add flag that enables automatic conversion from Ordinary to Atomic
2022-08-17 12:40:49 +03:00
Nikita Mikhaylov
a7c3f23dfb
Merge branch 'master' into auto_convert_ordinary_to_atomic 2022-08-17 00:38:25 +02:00
Alexander Tokmakov
832d7c6e7c Merge branch 'master' into replicated_database_improvements 2022-08-16 15:49:13 +02:00
Alexander Tokmakov
6f5a7c3bf7 fix a bug with symlinks detection 2022-08-15 12:30:47 +02:00
Alexander Tokmakov
848511affb take permanently detached tables into account 2022-08-08 16:06:08 +02:00
Alexander Tokmakov
624ccd5206 fix 2022-08-03 15:33:55 +02:00
Alexander Tokmakov
1a059035b8 fix logical error on connection loss 2022-08-03 14:13:01 +02:00
Alexander Tokmakov
bc10725f02 fix 2022-08-01 20:26:43 +02:00
Alexander Tokmakov
a11fad1561 fix 2022-07-29 20:41:23 +02:00
Alexander Tokmakov
6f88065cc1 check metadata consistency 2022-07-29 18:33:16 +02:00
Alexander Tokmakov
24725b5f95 fix synchronous queries 2022-07-27 19:15:00 +02:00
Alexander Tokmakov
5ca5a3697f better exception message for incorrect zk path 2022-07-22 18:41:41 +02:00
Alexander Tokmakov
df39af23a1 fix 2022-07-21 20:32:33 +02:00
Alexander Tokmakov
6e77155dc8 fix 2022-07-20 23:11:35 +02:00
Alexander Tokmakov
e295fd5090 Merge branch 'master' into replicated_database_improvements 2022-07-20 12:49:18 +02:00
Alexander Tokmakov
1fff3b24b8
Merge pull request #39337 from ClickHouse/minor_fix_for_ordinary_database
Do not start on unexpected Ordinary metadata
2022-07-19 13:30:56 +03:00
Kseniia Sumarokova
f168e0c5d0
Merge pull request #39272 from kssenii/fixes-for-materialized-pg
Fix segfault in materialised postgresql
2022-07-19 11:56:10 +02:00
Alexander Tokmakov
23312164bf do not start on unexpected Ordinary metadata 2022-07-18 17:05:03 +02:00
Alexander Tokmakov
966a59e617
Merge pull request #39315 from ClickHouse/tavplubix-patch-1
Update exception message
2022-07-18 15:16:49 +03:00
Kseniia Sumarokova
eb23491957
Merge branch 'master' into fixes-for-materialized-pg 2022-07-18 12:00:58 +02:00
Alexander Tokmakov
a193276737
Update DatabaseOnDisk.cpp 2022-07-18 12:50:49 +03:00
Kseniia Sumarokova
4b11a718cb
Update fetchPostgreSQLTableStructure.cpp 2022-07-17 11:55:34 +02:00
kssenii
9bba55110c Fix 2022-07-16 12:44:47 +02:00
kssenii
9f1d6814fc Fix 2022-07-15 18:01:54 +02:00
Alexander Tokmakov
388872550a Merge branch 'master' into replicated_database_improvements 2022-07-06 19:54:53 +02:00
kssenii
cfff7c4c28 Merge master 2022-07-04 14:13:26 +02:00
Alexander Tokmakov
2e073b5cff Merge branch 'master' into replicated_database_improvements 2022-07-04 13:53:47 +02:00
Vitaly Baranov
cadb496894
Merge pull request #38537 from vitlibar/backup-improvements-8
Backup Improvements 8
2022-07-01 11:20:46 +02:00
Vitaly Baranov
e367d96964 Fix style. 2022-06-30 15:10:33 +02:00
Vitaly Baranov
aa97bf5125 Improve handling predefined databases and tables. 2022-06-30 08:37:17 +02:00
Vitaly Baranov
7689e0c36f Improve gathering metadata for backup - part 6. 2022-06-30 08:37:17 +02:00
Vitaly Baranov
44db346fea Improve gathering metadata for backup - part 3. 2022-06-30 08:37:17 +02:00
Vitaly Baranov
461a31f237 Improve gathering metadata for backup - part 2. 2022-06-30 08:37:17 +02:00
Vitaly Baranov
64b51a3772 Improve gathering metadata for backup. 2022-06-30 08:37:17 +02:00
alesapin
62e7a89f26 Proper fix for ipv4/ipv6 conversion error 2022-06-29 17:53:08 +02:00
Alexander Tokmakov
894acf0c5c fix tests 2022-06-29 16:27:21 +02:00
Alexander Tokmakov
c6c22409a2 Merge branch 'master' into replicated_database_improvements 2022-06-29 14:38:07 +02:00
Alexander Tokmakov
c3573532c0
Merge pull request #38487 from ClickHouse/add_some_tsa_annotations
Add some TSA annotations
2022-06-29 13:57:10 +03:00
Alexander Tokmakov
ceb66ade4b
Merge pull request #38335 from ClickHouse/deprecate_ordinary_database
Deprecate Ordinary database and old *MergeTree syntax
2022-06-29 13:42:59 +03:00
Robert Schulze
bb441faa42
Merge pull request #38491 from ClickHouse/clang-tidy-in-branches
Fix some clang-tidy warnings in headers
2022-06-29 10:22:04 +02:00
Robert Schulze
f692ead6ad
Don't use std::unique_lock unless we have to
Replace where possible by std::lock_guard which is more light-weight.
2022-06-28 19:19:06 +00:00
Alexander Tokmakov
4f54abf67f better names for macros 2022-06-28 16:27:18 +02:00
Robert Schulze
c22038d48b
More clang-tidy fixes 2022-06-28 11:50:05 +00:00
Alexander Tokmakov
851534c9f7 Merge branch 'master' into deprecate_ordinary_database 2022-06-27 23:47:49 +02:00
Alexander Tokmakov
f4883f1f7e add some TSA aanotations 2022-06-27 22:48:27 +02:00
Alexander Tokmakov
88dbbcb15d fix tests 2022-06-27 16:10:00 +02:00
Alexander Tokmakov
7c37079a96 Merge branch 'master' into deprecate_ordinary_database 2022-06-27 14:46:59 +02:00
kssenii
2c5aeaaa1a Add auto close for postgres connection 2022-06-27 13:46:52 +02:00
mergify[bot]
f63c959679
Merge branch 'master' into cleanup_garbage_in_store_dir 2022-06-26 13:35:10 +00:00
Kseniia Sumarokova
0d626982ee
Merge pull request #38369 from kssenii/fix-pg-compatibility
Fix postgres database engine possible incompatibility on upgrade
2022-06-25 11:18:46 +02:00
kssenii
a88ae9ca99 Review fix 2022-06-24 19:48:38 +02:00
Kseniia Sumarokova
d52dc32010
Update fetchPostgreSQLTableStructure.cpp 2022-06-24 19:31:41 +02:00
Alexander Tokmakov
379fecf7f9 try suppress failures with MaterializedPostgreSQL 2022-06-24 17:15:15 +02:00
kssenii
6cb1d60883 Fix 2022-06-24 03:24:54 +02:00
kssenii
a3823c67ee Fix 2022-06-24 02:44:22 +02:00
Alexander Tokmakov
74f38710a8 Merge branch 'master' into cleanup_garbage_in_store_dir 2022-06-23 21:43:28 +02:00
Alexander Tokmakov
dbf2763788 automatically convert system database to Atomic 2022-06-23 21:38:43 +02:00
Alexander Tokmakov
2c5a88faba deprecate Ordinary database 2022-06-23 10:20:14 +02:00
Alexander Tokmakov
ed8341025b make code less bad 2022-06-22 18:31:42 +02:00
Alexander Tokmakov
dc1f596326 fix 2022-06-22 00:50:16 +02:00
Alexander Tokmakov
8288b9fe60 fixes 2022-06-21 18:47:55 +02:00
Alexander Tokmakov
f3ea8ad745 support CREATE EMPTY AS SELECT 2022-06-21 15:03:58 +02:00
Alexander Tokmakov
ba0fcec993 add background cleanup of store/ subdirs 2022-06-21 12:35:47 +02:00
Vitaly Baranov
a6fc0dea4e Fix clang-tidy more. 2022-06-20 11:04:37 +02:00
Vitaly Baranov
8a7c970ce0 Fix style. 2022-06-19 15:58:26 +02:00
Vitaly Baranov
c2c35fad82 Refactoring of the code getting create table queries for backup. 2022-06-15 20:32:35 +02:00
Vitaly Baranov
1198e86295 Fix storing temporary tables and skipping system tables while making a backup. 2022-06-15 20:32:34 +02:00
Vitaly Baranov
6590f82ec4 Fix tryGetCreateTableQuery() for system tables. 2022-06-15 20:32:34 +02:00
Vitaly Baranov
491ab58b3f Remove IF NOT EXISTS before storing create query in DatabaseMemory. 2022-06-15 20:32:34 +02:00
Vitaly Baranov
b2323991d6 BACKUP DATABASE now stores inner tables of matviews only if the corresponding matviews are stored. 2022-06-15 20:32:34 +02:00
Vitaly Baranov
6877b8f864 Fix renaming visitor. 2022-06-15 20:32:34 +02:00
Vitaly Baranov
592f568f83 Move backup/restore code to storages and databases - part 2. 2022-06-15 20:32:31 +02:00
Vitaly Baranov
724bc4dc57 Move backup/restore code to storages and databases - part 1. 2022-06-15 20:28:43 +02:00
kssenii
69cd3a2b10 Fix 2022-05-31 14:20:31 +02:00
Alexey Milovidov
c50791dd3b Fix clang-tidy-14, part 1 2022-05-27 22:52:14 +02:00
Alexander Tokmakov
281027e490 do not fail to start if replica seems dropped 2022-05-13 20:05:39 +02:00
Alexander Tokmakov
c806869040 fix sync database replica 2022-05-06 18:37:20 +02:00
Vitaly Baranov
dd51265218
Merge pull request #36864 from vitlibar/backup-improvements-4
Backup improvements
2022-05-05 15:37:51 +02:00
Robert Schulze
5dc06e6537
Fix build, pt. IV 2022-05-04 12:01:29 +02:00
Robert Schulze
45c0ec44b0
Fix build, pt. II 2022-05-04 10:15:25 +02:00
Vitaly Baranov
409edfd3fa Rework RestoreCoordination: make restore deterministic. 2022-05-03 11:01:44 +02:00
Robert Schulze
330212e0f4
Remove inherited create() method + disallow copying
The original motivation for this commit was that shared_ptr_helper used
std::shared_ptr<>() which does two heap allocations instead of
make_shared<>() which does a single allocation. Turned out that
1. the affected code (--> Storages/) is not on a hot path (rendering the
performance argument moot ...)
2. yet copying Storage objects is potentially dangerous and was
   previously allowed.

Hence, this change

- removes shared_ptr_helper and as a result all inherited create() methods,

- instead, Storage objects are now created using make_shared<>() by the
  caller (for that to work, many constructors had to be made public), and

- all Storage classes were marked as noncopyable using boost::noncopyable.

In sum, we are (likely) not making things faster but the code becomes
cleaner and harder to misuse.
2022-05-02 08:46:52 +02:00
Nikita Mikhaylov
93a65463d0
Added SYSTEM SYNC DATABASE query (#35944) 2022-05-01 15:40:18 +02:00
Amos Bird
4a5e4274f0
base should not depend on Common 2022-04-29 10:26:35 +08:00
Vitaly Baranov
641a5f5e35
Merge pull request #36198 from vitlibar/backup-improvements-3
Backup for replicated tables and other improvements
2022-04-28 09:23:53 +02:00
alesapin
92296484e7
Merge pull request #36348 from rschu1ze/erase_if3
Replace remove-erase idiom by C++20 erase()/erase_if()
2022-04-25 23:34:18 +02:00
Vitaly Baranov
129eca7307 CREATE queries generated by RESTORE command is now considered as internal. 2022-04-25 16:34:34 +02:00
Vitaly Baranov
68a020ecea Implement BACKUP/RESTORE ON CLUSTER. 2022-04-25 16:34:33 +02:00
tavplubix
2c54381520
Merge pull request #36200 from ClickHouse/fix_create_as_replicated_default_args
Fix CREATE AS for ReplicatedMergeTree with default arguments
2022-04-20 12:01:13 +03:00
Robert Schulze
b6d7367538
Merge remote-tracking branch 'origin/master' into erase_if3
Conflicts:
- Interpreters/ActionsDAG.cpp
2022-04-20 10:02:59 +02:00
Antonio Andelic
bbb0be6a44
Merge pull request #36402 from rschu1ze/clang-tidy-contains
Activate clang-tidy warning "readability-container-contains"
2022-04-20 08:15:46 +02:00
xiedeyantu
89d0c30f38
Fix the repeated call of func to get the table when drop table (#36248) 2022-04-19 13:51:51 +02:00
Robert Schulze
118e94523c
Activate clang-tidy warning "readability-container-contains"
This check suggests replacing <Container>.count() by
<Container>.contains() which is more speaking and in case of
multimaps/multisets also faster.
2022-04-18 23:53:11 +02:00
Alexey Milovidov
242919eddd Remove abbreviation 2022-04-18 01:02:49 +02:00
Robert Schulze
1e1df8e101
Replace remove-erase idiom by C++20 erase()/erase_if()
- makes the code less verbose while being as efficient
2022-04-17 12:04:47 +02:00
Alexander Tokmakov
819eac6297 fix 2022-04-14 14:48:24 +02:00
Alexander Tokmakov
40fea2b833 do not unfold {uuid} macro 2022-04-13 16:51:59 +02:00
Alexander Tokmakov
f2c4f88295 avoid moving replicated tables to Ordinary db 2022-04-13 14:38:20 +02:00
Raúl Marín
6e346a7fc3 Support atomic replace under OSX 2022-04-11 14:32:55 +02:00
tavplubix
2894672ecc
Update DatabaseReplicatedWorker.cpp 2022-04-08 22:12:57 +03:00
Alexander Tokmakov
7f54e7b422 Merge branch 'master' into mvcc_prototype 2022-04-07 15:14:06 +02:00
Alexander Tokmakov
37a06eec1a fixes 2022-04-05 17:36:53 +02:00
Alexander Tokmakov
4e9ec5dc2f make some replicated DDL faster 2022-04-05 00:51:48 +02:00
Alexander Tokmakov
5a50ad9de3 Merge branch 'master' into mvcc_prototype 2022-03-31 11:35:04 +02:00
Kruglov Pavel
771f34d793
Merge pull request #35691 from Avogar/fix-matview
Fix creating materialized view with subquery after server restart
2022-03-30 14:57:14 +02:00
Antonio Andelic
9990abb76a Use compile-time check for Exception messages, fix wrong messages 2022-03-29 13:16:11 +00:00
avogar
36ea9ef11f Fix creating materialized view with subquery after server restart 2022-03-28 19:52:10 +00:00
Alexander Tokmakov
208b242188 Merge branch 'master' into mvcc_prototype 2022-03-28 19:58:06 +02:00
Nikita Mikhaylov
64f79f0c69
Added an ability to specify cluster secret in replicated database (#35333) 2022-03-25 00:14:26 +01:00
Alexander Tokmakov
3c762f566d Merge branch 'master' into mvcc_prototype 2022-03-21 20:16:29 +01:00
Alexander Tokmakov
9e05b12d2c Merge branch 'master' into mvcc_prototype 2022-03-20 22:42:26 +01:00
Vitaly Baranov
ce25afb2e9 Storages and databases are hollow by default now. 2022-03-20 20:02:15 +01:00
Vitaly Baranov
5a883c6b5a Fixed checking access rights while producing backup, add IStorage::hasHollowBackup(). 2022-03-20 20:01:54 +01:00
kssenii
1b06a2033e Support uuid 2022-03-18 12:24:50 +01:00
Alexander Tokmakov
4b3e13a4fe Merge branch 'master' into mvcc_prototype 2022-03-16 21:06:19 +01:00
Kseniia Sumarokova
b4e03eda8b
Update DatabasePostgreSQL.cpp 2022-03-16 01:04:40 +01:00
kssenii
3a784fe611 Fix 2022-03-16 00:52:51 +01:00
Alexander Tokmakov
9702b5177d Merge branch 'master' into mvcc_prototype 2022-03-14 21:45:38 +01:00
Maksim Kita
1d674123a9 Fix clang-tidy warnings in Databases, DataTypes, Dictionaries folders 2022-03-14 18:17:35 +00:00
Maksim Kita
ad6b3693e1
Merge pull request #35123 from zhanghuajieHIT/fix_build_fail_with_gcc
fix build fail with gcc
2022-03-14 10:36:15 +01:00
zhanghuajie
53a8987b3b fix build fail with gcc --fix warnings without disabling some parameters 2022-03-11 21:59:19 +08:00
kssenii
3cd1da1e11 Fix 2022-03-10 11:11:59 +01:00