Commit Graph

182 Commits

Author SHA1 Message Date
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
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
kssenii
dc73042d62 Better error messafe 2022-06-24 01:05:33 +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
Anton Kozlov
e9d645168e Renamed ODBCConnectionFactory to ODBCPooledConntionFactory 2022-06-01 09:00:39 +00:00
Anton Kozlov
3576625647 CLICKHOUSE-2131 Add an option to disable connection pooling in ODBC bridge 2022-05-31 16:26:08 +00:00
Amos Bird
4a5e4274f0
base should not depend on Common 2022-04-29 10:26:35 +08:00
alesapin
e790a73081 Simplify strip for new packages 2022-03-23 15:14:30 +01:00
Mikhail f. Shiryaev
1d362796df
Fix strip bug 2022-03-22 11:10:02 +01:00
Mikhail f. Shiryaev
fa2a9bb9aa
Separate BUILD_STRIPPED_BINARIES_PREFIX to option and parameter 2022-03-22 11:10:02 +01:00
alesapin
e53578910b Add ability to strip binaries in cmake 2022-03-10 22:23:28 +01:00
kssenii
92d2cff045 Fix 2022-02-25 16:04:11 +01:00
Azat Khuzhin
bedf208cbd Use fmt::runtime() for LOG_* for non constexpr
Here is oneliner:

    $ gg 'LOG_\(DEBUG\|TRACE\|INFO\|TEST\|WARNING\|ERROR\|FATAL\)([^,]*, [a-zA-Z]' -- :*.cpp :*.h | cut -d: -f1 | sort -u | xargs -r sed -E -i 's#(LOG_[A-Z]*)\(([^,]*), ([A-Za-z][^,)]*)#\1(\2, fmt::runtime(\3)#'

Note, that I tried to do this with coccinelle (tool for semantic
patchin), but it cannot parse C++:

    $ cat fmt.cocci
    @@
    expression log;
    expression var;
    @@

    -LOG_DEBUG(log, var)
    +LOG_DEBUG(log, fmt::runtime(var))

I've also tried to use some macros/templates magic to do this implicitly
in logger_useful.h, but I failed to do so, and apparently it is not
possible for now.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>

v2: manual fixes
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-02-01 14:30:03 +03:00
Azat Khuzhin
e0e81b340d Fix w/o ODBC build 2022-01-20 10:02:02 +03:00
Azat Khuzhin
b51bbde713 Remove unbundled odbc support 2022-01-20 10:01:59 +03:00
Azat Khuzhin
887af0a7e9 Remove unbundled nanodbc support 2022-01-20 10:01:59 +03:00
Nicolae Vartolomei
50e6f729d1 Try ping connection on unexpected errors
Workaround for
https://www.postgresql.org/message-id/CAC5UznEsaG75-Q89z4Ypz1q48UT7O%2B1U7drUPt6Xs%2Bma9_hEGQ%40mail.gmail.com
2022-01-05 16:26:28 +00:00
Alexey Milovidov
d4debd115d Remove unused code 2021-12-24 15:37:40 +03:00
avogar
f0a0c70528 Fix tests 2021-11-22 15:21:15 +03:00
Nikolai Kochetov
a08c98d760 Move some files. 2021-10-16 17:03:50 +03:00
Nikolai Kochetov
41dc195b34 Fix build. 2021-10-15 13:15:14 +03:00
Nikolai Kochetov
03a7f24fa3 Fix build. 2021-10-15 11:14:15 +03:00
Nikolai Kochetov
ab28c6c855 Remove BlockInputStream interfaces. 2021-10-14 13:25:43 +03:00
Nikolai Kochetov
b5bc385391
Update programs/odbc-bridge/ODBCBlockOutputStream.cpp
Co-authored-by: Kruglov Pavel <48961922+Avogar@users.noreply.github.com>
2021-10-13 12:50:20 +03:00
Nikolai Kochetov
6b95b706f1
Update programs/odbc-bridge/ODBCBlockInputStream.cpp
Co-authored-by: Kruglov Pavel <48961922+Avogar@users.noreply.github.com>
2021-10-13 12:49:59 +03:00
Nikolai Kochetov
ec18340351 Remove streams from formats. 2021-10-11 19:11:50 +03:00
Alexey Milovidov
fe6b7c77c7 Rename "common" to "base" 2021-10-02 10:13:14 +03:00
Kseniia Sumarokova
27132d56f6
Update ODBCConnectionFactory.h 2021-09-29 16:18:24 +03:00
kssenii
58fa0ac13c A little better 2021-09-29 10:23:44 +00:00
kssenii
ba839a4af3 Fix 2021-09-29 09:43:58 +00:00
Maksim Kita
1a6c2c78c8
Merge pull request #28298 from kitaisreal/odbc-connection-holder-fix-dangling-reference
ODBC connection holder fix dangling reference
2021-08-28 15:28:23 +03:00
Maksim Kita
07d7cda2b0 ODBC connection holder fix dangling reference 2021-08-28 14:11:25 +03:00
kssenii
0b66581de2 Fix build 2021-08-25 21:51:43 +00:00
kssenii
0ec716292c Postgres ON CONFLICT 2021-08-24 12:37:32 +00:00
Kseniia Sumarokova
9d02af7d8b
Merge pull request #25676 from sand6255/MaterializeMySQL-Support-Enum-Data-Type
MaterializeMySQL: support ENUM data type
2021-06-28 19:15:00 +03:00
Storozhuk Kostiantyn
4a3145f586 Materialize my sql support enum data type
* Implemented Enum for MaterializeMySQL
2021-06-25 16:42:25 +08:00
kssenii
c0732ddc12 Fix datetime with timezone 2021-06-21 08:22:12 +00:00
alexey-milovidov
04be5437d9
Merge pull request #25296 from abyss7/http-issues
Add settings for HTTP header limitations
2021-06-17 01:50:48 +03:00
Maksim Kita
67e9b85951 Merge ext into common 2021-06-16 23:28:41 +03:00
Ivan Lezhankin
ba08a580f8 Add test 2021-06-16 17:33:14 +03:00
Ivan Lezhankin
b182d87d9c Add settings for HTTP header limitations 2021-06-15 17:33:46 +03:00
kssenii
bd39c9fdd1 Better way 2021-06-07 18:56:46 +00:00
kssenii
ba56465a99 Fix 2021-06-07 12:15:24 +00:00
Alexey Milovidov
47a4c101b9 Merge branch 'master' into normalize-bigint 2021-05-08 16:41:15 +03:00
kssenii
912878ad7f Review fixes 2021-05-07 12:05:34 +00:00
kssenii
93dce29a0a Correct odbc 2021-05-07 10:37:11 +00:00
Alexey Milovidov
8f01af62d9 Merge branch 'master' into normalize-bigint 2021-04-25 06:57:44 +03:00
alexey-milovidov
723c8c10be
Merge pull request #23217 from kssenii/default-q
Use double quote identifier in odbc as default in case of error
2021-04-18 03:18:49 +03:00
kssenii
0853b4d1ea Add exception message 2021-04-17 15:16:26 +00:00
kssenii
a31e6606c1 Fix 2021-04-17 10:40:48 +00:00
kssenii
5dc2dfa437 Fix 2021-04-17 09:00:58 +00:00
Maksim Kita
98b7274b51 Fixed pool in ODBC bridge 2021-04-13 23:15:22 +03:00
alexey-milovidov
fc08501a0d
Update ColumnInfoHandler.cpp 2021-04-13 01:55:14 +03:00
alexey-milovidov
30e6c3be41
Update ColumnInfoHandler.cpp 2021-04-13 01:53:00 +03:00
kssenii
7a287e6fe9 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into nanodbc 2021-04-11 21:36:08 +00:00
Ivan
495c6e03aa
Replace all Context references with std::weak_ptr (#22297)
* Replace all Context references with std::weak_ptr

* Fix shared context captured by value

* Fix build

* Fix Context with named sessions

* Fix copy context

* Fix gcc build

* Merge with master and fix build

* Fix gcc-9 build
2021-04-11 02:33:54 +03:00
kssenii
834f29f84f Fix build 2021-04-07 17:11:09 +00:00
kssenii
7a89948801 Fix 2021-04-07 07:16:50 +00:00
kssenii
4419a430cb Less dependencies 2021-04-06 20:15:32 +00:00
kssenii
0b39480d51 Better 2021-04-06 20:01:23 +00:00
kssenii
5a143a4d12 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into nanodbc 2021-04-06 16:50:13 +00:00
kssenii
7c162d30b7 Tiny fix 2021-04-02 21:35:16 +00:00
kssenii
cb845731b0 Add connection pools 2021-03-31 12:41:12 +00:00
kssenii
3dadb2db94 Fix build 2021-03-31 08:42:57 +00:00
kssenii
b3e5f5d8c6 Add support for datetime64 and Decimal* for odbc storage 2021-03-26 21:26:49 +00:00
kssenii
30445ca889 Fix build 2021-03-24 18:23:12 +00:00
kssenii
5aaf240dfd Fix style 2021-03-24 12:32:58 +00:00
kssenii
ef35804bbc Fix case when there is no db_name in connection_string 2021-03-24 12:27:46 +00:00
kssenii
c81ab04e8f Switch to nanodbc 2021-03-22 12:37:05 +00:00
kssenii
34dea63248 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into library-bridge 2021-03-17 13:32:43 +00:00
alexey-milovidov
d02726bcac
Merge pull request #9404 from Enmk/DateTime64_extended_range
Date time64 extended range
2021-03-17 11:06:03 +03:00
Alexey Milovidov
eadf0248d0 Build fixes 2021-03-16 14:07:53 +03:00
Nikita Mikhaylov
1f92c8ce58 parallel formatting everywhere 2021-03-15 14:51:24 +03:00
kssenii
5d953a4b86 Better 2021-03-12 21:48:52 +00:00
kssenii
9e9bf2bb75 Common base for bridges part 3 2021-03-07 13:55:40 +00:00
Azat Khuzhin
5d36ceaaee Fix WriteBufferFromHTTPServerResponse usage in odbc-bridge 2021-02-20 10:15:38 +03:00
Ivan
414f470c79
Make Poco HTTP Server zero-copy again (#19516)
* Refactoring: part 1

* Refactoring: part 2

* Handle request using ReadBuffer interface

* Struggles with ReadBuffer's

* Fix URI parsing

* Implement parsing of multipart/form-data

* Check HTTP_LENGTH_REQUIRED before eof() or will hang

* Fix HTTPChunkedReadBuffer

* Fix build and style

* Fix test

* Resist double-eof

* Fix arcadian build
2021-02-19 15:51:26 +03:00
Alexey Milovidov
093108bf81 Normalize BigInt implementation 2021-01-27 03:54:57 +03:00
Nikita Mikhailov
c5f92e5096 better formatfactory 2020-12-30 06:07:30 +03:00
Nikita Mikhailov
dcfbe782c6 Merge branch 'master' of github.com:ClickHouse/ClickHouse into parallel-parsing-input-format 2020-12-23 05:20:22 +03:00
Denis Glazachev
ea7e94f3eb Use 127.0.0.1 as a default listen-host for ODBC bridge 2020-12-21 03:26:31 +04:00
Nikita Mikhailov
6a55e018e4 Merge branch 'master' of github.com:ClickHouse/ClickHouse into parallel-parsing-input-format 2020-12-18 02:25:32 +03:00
Nikolai Kochetov
d96ca3fb8d Fixing build. 2020-12-16 20:11:32 +03:00
Nikita Mikhaylov
161c921dba fix build 2020-12-15 00:56:47 +03:00
Nikita Mikhaylov
82888b5c4d fix build 2020-12-15 00:56:47 +03:00
alexey-milovidov
0c831e1204
Merge pull request #17301 from ClickHouse/odbc-minor-changes
Minor changes for ODBC storage
2020-11-29 21:23:20 +03:00
alexey-milovidov
8eccf680d8
Update ODBCBlockInputStream.cpp 2020-11-26 07:11:34 +03:00
Vitaly Baranov
3c85165e60 Redirect stderr, stdout for clickhouse-odbc-bridge to files. 2020-11-24 17:55:02 +03:00
Alexey Milovidov
77c963dec5 Minor changed for ODBC storage 2020-11-23 13:32:56 +03:00
Alexander Tokmakov
62ff00ee8b use WriteBuffer in formatAST(...) 2020-11-09 19:05:40 +03:00
alexey-milovidov
4e03daac76
Update CMakeLists.txt 2020-11-08 01:19:50 +03:00
alexey-milovidov
d5a51ddbbf
Update CMakeLists.txt 2020-11-04 23:44:43 +03:00
Alexey Milovidov
1520b6aa2a Take out odbc-bridge from clickhouse bundle 2020-10-29 08:27:55 +03:00
Alexey Milovidov
a7b5db912c odbc-bridge: two libraries less 2020-10-29 06:42:49 +03:00
Alexey Milovidov
2e0a979e3a Fix inconsistency in FormatFactory 2020-10-29 06:39:43 +03:00
myrrc
3953ed485b added sub-tables in report, replaced some USE_ -> ENABLE_ for
consistency
2020-09-18 16:09:22 +03:00
Vasily Nemkov
3973a17530
MySql datatypes dateTime64 and decimal (#11512) 2020-09-09 15:18:02 +03:00
Vitaly Baranov
90dd31fef1 Fix crash in SchemaAllowedHandler. 2020-08-29 15:53:15 +03:00
Vitaly Baranov
4733504b51 Don't split dictionary source's table name into schema and table name itself
if ODBC driver doesn't support schema.
2020-07-06 23:41:39 +03:00
Ivan Blinkov
45d1ca2567 merge master 2020-06-24 00:18:16 +03:00