Commit Graph

2660 Commits

Author SHA1 Message Date
Azat Khuzhin
4f41d21626 Fix leaking of logger in clickhouse-disks
CI found [1]:

    Direct leak of 256 byte(s) in 1 object(s) allocated from:
        0 0xd8cb88d in operator new(unsigned long) (/usr/bin/clickhouse+0xd8cb88d) (BuildId: 7a3fd7b485701220)
        1 0xde8943e in DB::DisksApp::main() build_docker/../programs/disks/DisksApp.cpp:157:41
        2 0x38dca887 in Poco::Util::Application::run() build_docker/../contrib/poco/Util/src/Application.cpp:334:8
        3 0xde8d72c in mainEntryClickHouseDisks(int, char**) build_docker/../programs/disks/DisksApp.cpp:219:20
        4 0xd8cf47f in main build_docker/../programs/main.cpp:445:12
        5 0x7f060ddce082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)

  CI: https://s3.amazonaws.com/clickhouse-test-reports/39299/37b4b52c12698e711aa931f10aec3909bca287b6/integration_tests__asan__actions__[2/3].html

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-18 12:35:53 +03:00
Vitaly Baranov
6bf7bffbeb Correct the list of always accessible system tables. 2022-07-15 15:44:29 +02:00
Vitaly Baranov
fbb2e14d54 Add new table function viewIfPermitted(). 2022-07-15 15:44:29 +02:00
Vitaly Baranov
c85b2b5732 Add option enabling that SELECT from the system database requires grant. 2022-07-15 15:44:25 +02:00
Robert Schulze
62149111d3
Fix build 2022-07-14 14:36:31 +00:00
Robert Schulze
1a7727a254
Prefix overridden add_executable() command with "clickhouse_"
A simple HelloWorld program with zero includes except iostream triggers
a build of ca. 2000 source files. The reason is that ClickHouse's
top-level CMakeLists.txt overrides "add_executable()" to link all
binaries against "clickhouse_new_delete". This links against
"clickhouse_common_io", which in turn has lots of 3rd party library
dependencies ... Without linking "clickhouse_new_delete", the number of
compiled files for "HelloWorld" goes down to ca. 70.

As an example, the self-extracting-executable needs none of its current
dependencies but other programs may also benefit.

In order to restore access to the original "add_executable()", the
overriding version is now prefixed. There is precedence for a
"clickhouse_" prefix (as opposed to "ch_"), for example
"clickhouse_split_debug_symbols". In general prefixing makes sense also
because overriding CMake commands relies on undocumented behavior and is
considered not-so-great practice (*).

(*) https://crascit.com/2018/09/14/do-not-redefine-cmake-commands/
2022-07-11 19:36:18 +02:00
Antonio Andelic
37f799550b
Merge pull request #38072 from lingpeng0314/master
Add Keeper related monitoring data
2022-07-10 09:39:57 +02:00
Nikita Mikhaylov
a44157d81d
Allow globs in keys for clickhouse-extract-from-config tool (#38966) 2022-07-08 16:13:32 +02:00
Alexey Milovidov
1f2266e45f
Merge pull request #38619 from ClickHouse/filimonov-clickhouse-su
Fix exception messages in clickhouse su
2022-07-05 07:11:20 +03:00
Mikhail f. Shiryaev
7a58a8c19b
Merge pull request #38647 from ClickHouse/clickhouse-diagnostics
Clickhouse diagnostics
2022-07-04 12:14:33 +02:00
Mikhail f. Shiryaev
446ead1af4
Fix typos issues it clickhouse-diagnostics 2022-07-04 10:59:39 +02:00
Mikhail f. Shiryaev
664d43e348
Add disabling tag no_docker to some go tests 2022-07-04 10:59:39 +02:00
lingpeng0314
cca94f01ae add function tryGetKeeperDispatcher for context
- to make sure other case will get error if dispatcher not initialized
2022-07-04 13:35:08 +08:00
Mikhail f. Shiryaev
3513b41683
Fix linter issue 2022-07-01 11:43:14 +02:00
Mikhail f. Shiryaev
1553f67809
Can set version in Makefile 2022-07-01 11:43:13 +02:00
Mikhail f. Shiryaev
a70cda9670
Create a path for clickhouse-diagnostics installation 2022-07-01 11:43:12 +02:00
Mikhail f. Shiryaev
51556704e0
Rename module to reflect the current state 2022-07-01 11:43:11 +02:00
Mikhail f. Shiryaev
9531bbf497
Move clickhouse-diagnostics to programs 2022-07-01 11:43:07 +02:00
Robert Schulze
59236d60c9
Merge pull request #38654 from ClickHouse/better-naming-for-split-debug-symbols
Better naming for stuff related to splitted debug symbols
2022-07-01 09:28:41 +02:00
lingpeng0314
03a5ce542d Remove Exception in getKeeperDispatcher
- to handle the nil case by caller
2022-07-01 11:27:40 +08:00
Robert Schulze
bb358617e1
Better naming for stuff related to splitted debug symbols
The previous name was slightly misleading, e.g. it is not about
"intalling stripped binaries" but about splitting debug symbols from the
binary.
2022-06-30 23:41:27 +02:00
Yakov Olkhovskiy
dd132d1beb
Merge pull request #38447 from ClickHouse/utility-self-extracting
Compress clickhouse executable
2022-06-30 13:18:40 -04:00
Nikita Mikhaylov
e66114984c
Update programs/su/clickhouse-su.cpp 2022-06-30 12:44:59 +02:00
Nikita Mikhaylov
b2cc6787ee
Update programs/su/clickhouse-su.cpp 2022-06-30 12:44:30 +02:00
filimonov
3949480ed3
Fix exception messages in clickhouse su
Fix exception messages in
2022-06-30 11:38:05 +02:00
Yakov Olkhovskiy
78ea290789 add remove command 2022-06-29 06:47:21 -04:00
Yakov Olkhovskiy
5d36994c4d self-extracting requires utils (uses utils/self-extracting-executable/compressor) 2022-06-27 11:41:23 -04:00
Alexander Tokmakov
7c37079a96 Merge branch 'master' into deprecate_ordinary_database 2022-06-27 14:46:59 +02:00
mergify[bot]
4e5fd226c8
Merge branch 'master' into utility-self-extracting 2022-06-27 12:26:16 +00:00
Yakov Olkhovskiy
8ce6b8226d
Update CMakeLists.txt 2022-06-27 08:25:21 -04:00
Yakov Olkhovskiy
39ea5ffdcb compress clickhouse executable, new target 'self-extracted' is added 2022-06-27 01:36:27 -04:00
Alexey Milovidov
b89f01438e Lower mutex scope 2022-06-25 03:05:55 +02:00
Kseniia Sumarokova
e1823f4c0a
Merge pull request #38364 from kssenii/better-error-message-in-dbc
Better error message for failed odbc query
2022-06-24 18:30:54 +02:00
Alexander Tokmakov
31dcc7634e Merge branch 'master' into deprecate_ordinary_database 2022-06-24 18:16:07 +02:00
kssenii
dc73042d62 Better error messafe 2022-06-24 01:05:33 +02:00
Alexander Gololobov
50438a4b05 Fixed uninitialized optional 2022-06-23 23:55:21 +02:00
Alexander Tokmakov
dbf2763788 automatically convert system database to Atomic 2022-06-23 21:38:43 +02:00
Alexander Gololobov
02f3921c69 Added --recursive to clickhouse-disks list 2022-06-23 20:39:20 +02:00
Kseniia Sumarokova
b844c36a9d
Merge pull request #38150 from kssenii/clickhouse-disks-fixes
Some fixes for clickhouse-disks
2022-06-23 10:21:44 +02:00
Kseniia Sumarokova
3f83d2f8b3
Update ICommand.cpp 2022-06-22 13:00:48 +02:00
Alexey Milovidov
ba05b3edab
Merge pull request #38197 from ClickHouse/play-charts
Add primitive charting capabilities
2022-06-22 06:42:05 +03:00
Robert Schulze
0d80874d40
Merge pull request #38068 from ClickHouse/clang-tsa
Support for Clang Thread Safety Analysis (TSA)
2022-06-21 20:19:33 +02:00
kssenii
47a118beab More fixes 2022-06-21 16:40:22 +02:00
mergify[bot]
5b24939369
Merge branch 'master' into play-charts 2022-06-21 14:20:52 +00:00
Alexey Milovidov
7e9a3796e9 Fix wrong docs 2022-06-21 00:09:55 +02:00
Robert Schulze
55b39e709d
Merge remote-tracking branch 'origin/master' into clang-tsa 2022-06-20 16:39:32 +02:00
Robert Schulze
5a4f21c50f
Support for Clang Thread Safety Analysis (TSA)
- TSA is a static analyzer build by Google which finds race conditions
  and deadlocks at compile time.

- It works by associating a shared member variable with a
  synchronization primitive that protects it. The compiler can then
  check at each access if proper locking happened before. A good
  introduction are [0] and [1].

- TSA requires some help by the programmer via annotations. Luckily,
  LLVM's libcxx already has annotations for std::mutex, std::lock_guard,
  std::shared_mutex and std::scoped_lock. This commit enables them
  (--> contrib/libcxx-cmake/CMakeLists.txt).

- Further, this commit adds convenience macros for the low-level
  annotations for use in ClickHouse (--> base/defines.h). For
  demonstration, they are leveraged in a few places.

- As we compile with "-Wall -Wextra -Weverything", the required compiler
  flag "-Wthread-safety-analysis" was already enabled. Negative checks
  are an experimental feature of TSA and disabled
  (--> cmake/warnings.cmake). Compile times did not increase noticeably.

- TSA is used in a few places with simple locking. I tried TSA also
  where locking is more complex. The problem was usually that it is
  unclear which data is protected by which lock :-(. But there was
  definitely some weird code where locking looked broken. So there is
  some potential to find bugs.

*** Limitations of TSA besides the ones listed in [1]:

- The programmer needs to know which lock protects which piece of shared
  data. This is not always easy for large classes.

- Two synchronization primitives used in ClickHouse are not annotated in
  libcxx:
  (1) std::unique_lock: A releaseable lock handle often together with
      std::condition_variable, e.g. in solve producer-consumer problems.
  (2) std::recursive_mutex: A re-entrant mutex variant. Its usage can be
      considered a design flaw + typically it is slower than a standard
      mutex. In this commit, one std::recursive_mutex was converted to
      std::mutex and annotated with TSA.

- For free-standing functions (e.g. helper functions) which are passed
  shared data members, it can be tricky to specify the associated lock.
  This is because the annotations use the normal C++ rules for symbol
  resolution.

[0] https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
[1] https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/42958.pdf
2022-06-20 16:13:25 +02:00
mergify[bot]
f3264e50ec
Merge branch 'master' into play-charts 2022-06-20 14:01:47 +00:00
mergify[bot]
2d25daf64d
Merge branch 'master' into clickhouse-disks-fixes 2022-06-20 11:20:59 +00:00
Kseniia Sumarokova
a756b4be27
Merge pull request #37391 from azat/insert-profile-events-fix
Send profile events for INSERT queries (previously only SELECT was supported)
2022-06-20 12:16:29 +02:00