Commit Graph

655 Commits

Author SHA1 Message Date
Antonio Andelic
e64436fef3 Fix typos with new codespell 2022-09-02 08:54:48 +00:00
Frank Chen
9d63cbe811 Merge 'origin/master' into tracing_context_propagation to resolve conflicts 2022-09-01 23:18:59 +08:00
Robert Schulze
7a4978e600
docs: mention where else shortcuts are used 2022-08-30 17:00:25 +00:00
Robert Schulze
413a5759e1
style: eliminate some newlines
Co-authored-by: Nikolay Degterinsky <43110995+evillique@users.noreply.github.com>
2022-08-30 17:00:20 +00:00
Robert Schulze
9baf0d745a
feat: make last command available in clickhouse-client interactive mode 2022-08-30 16:59:14 +00:00
Frank Chen
92f7ca3616 Move TracingContextOnThread::current() out of class for simplicity
Signed-off-by: Frank Chen <frank.chen021@outlook.com>
2022-08-25 20:23:56 +08:00
Frank Chen
bb00dcc19b Remove using namespace from header
Signed-off-by: Frank Chen <frank.chen021@outlook.com>
2022-08-25 20:20:13 +08:00
Frank Chen
99c37ce6c6
Merge branch 'master' into tracing_context_propagation 2022-08-25 10:07:16 +08:00
Frank Chen
cd19366b44 Move classes into DB::OpenTelemetry namespace 2022-08-24 16:41:40 +08:00
Robert Schulze
e8b3f56733
Limit suppression to a specific warning 2022-08-21 18:24:17 +00:00
Alexey Milovidov
74e1f4dc61 Fix clang-tidy 2022-08-20 17:09:20 +02:00
Frank Chen
a3b6ad2a65
Merge branch 'master' into tracing_context_propagation 2022-08-18 20:59:07 +08:00
Alexander Tokmakov
a9c6a883dc
Merge pull request #40158 from ClickHouse/make_tests_less_flaky
Set sync_request_timeout to 10 to avoid reconnections in tests
2022-08-12 22:08:53 +03:00
Alexander Tokmakov
0395dca7be set sync_request_timeout to 10 to avoid reconnections in tests 2022-08-12 15:30:46 +02:00
Nikita Taranov
17956cb668
Extend protocol with query parameters (#39906) 2022-08-12 14:28:35 +02:00
Yakov Olkhovskiy
1680be19ca some refactoring 2022-08-03 16:36:52 -04:00
Yakov Olkhovskiy
2e34b384c1 update tcp protocol, add quota_key 2022-08-03 15:44:08 -04:00
Frank Chen
1c9b462c80 Merge remote-tracking branch 'origin/master' into tracing_context_propagation 2022-08-02 20:18:22 +08:00
Frank Chen
7d8a8f26cd Fix build check 2022-08-02 13:31:36 +08:00
Frank Chen
40c6e4c0d6 Merge remote-tracking branch 'origin/master' into tracing_context_propagation 2022-08-02 10:02:09 +08:00
Anton Popov
942f056ce5 fix redirecting of logs to stdout in client 2022-07-29 19:10:23 +00:00
alesapin
2dfb547847
Merge pull request #39054 from SmitaRKulkarni/add-option-for-outfile-to-print-stdout
Add an option to INTO OUTFILE to also print details to standard output.
2022-07-27 13:51:38 +02:00
Vladimir Chebotaryov
f32d9c5539
Uppercase ROWS, GROUPS, RANGE in queries with windows. (#39410) 2022-07-25 22:53:53 +02:00
mergify[bot]
0933dd7904
Merge branch 'master' into add-option-for-outfile-to-print-stdout 2022-07-23 19:50:10 +00:00
Alexander Tokmakov
bed2206ae9
Merge pull request #39460 from ClickHouse/remove_some_dead_and_commented_code
Remove some dead and commented code
2022-07-22 13:24:34 +03:00
Alexander Tokmakov
a8da5d96fc remove some dead and commented code 2022-07-21 15:05:48 +02:00
Vitaly Baranov
8873d16afe Fix interactive client with older server after https://github.com/ClickHouse/ClickHouse/pull/38970 2022-07-20 11:51:55 +02:00
Sergei Trifonov
499818751e
Merge pull request #39280 from ClickHouse/avg-cpu-progress
fix cpu usage metric in client
2022-07-19 15:17:44 +02:00
Smita Kulkarni
e165e68386 Addressed review comment
- updated creating ForkWriteBuffer in ClientBase to avoid duplication
2022-07-18 18:12:13 +02:00
Sergei Trifonov
8a5286ea4c fix cpu usage metric in client 2022-07-16 00:27:26 +02: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
Smita Kulkarni
1dc2187f9c Addressed review comments
Implementation:
- Added a new buffer ForkWriteBuffer takes a vector of WriteBuffer and writes data to all of them. It uses the buffer of the first element as its buffer and copies data from first buffer to all the other buffers
Testing:
- Updated tests/queries/0_stateless/02346_into_outfile_and_stdout.sh
Documentation:
- Updated the english documentation for SELECT.. INTO OUTFILE with AND STDOUT.
2022-07-14 22:47:38 +02:00
Anton Popov
79e1d39211 do not color logs on client if redirected to file 2022-07-14 19:33:53 +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
Smita Kulkarni
c7967fb721 Add an option to INTO OUTFILE to also print details to standard output.
Implementation:
- Added a bool to ASTQueryWithOutput & patched the usage in ClientBase.
- Added a new buffer TeeWriteBuffer which extends from WriteBufferFromFile (used to write data to the file) and has WriteBufferFromFileDescriptor (used to write data to stdout). The WriteBufferFromFileDescriptor uses the same buffer as TeeWriteBuffer.
- Added a new bool select_into_outfile_and_stdout in ClientBase to enable/disable progress rendering.

Testing:
 - Added a test tests/queries/0_stateless/02346_into_outfile_and_stdout.sh

Documentation:
- Updated the english documentation for the new option in SELECT.
2022-07-09 10:12:46 +02:00
Frank Chen
c2ae762a5a Fix tests 2022-07-09 13:59:11 +08:00
Frank Chen
da57a993e4 Fix CI 2022-07-09 13:43:10 +08:00
Frank Chen
93dc109e36 Fix code 2022-07-07 17:44:19 +08:00
Frank Chen
57a7e4a7c9 Remove old API reference 2022-07-07 17:42:35 +08:00
Nikolay Degterinsky
fcb6cfb6df Fix style issues 2022-07-07 08:31:55 +00:00
Nikolay Degterinsky
573b81965a Fix style 2022-07-07 02:20:25 +00:00
Nikolay Degterinsky
0c783800c8 Better 2022-07-07 01:47:33 +00:00
Nikolay Degterinsky
653e7cbeaf Add compression level 2022-07-06 14:15:24 +00:00
kssenii
ac8a794780 Client -i file 2022-07-04 15:40:23 +02: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
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
kssenii
5dd1bb2fd8 improvements for getFileSize 2022-06-20 15:22:56 +02: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