Commit Graph

1286 Commits

Author SHA1 Message Date
Alexander Tokmakov
fc77d53db1
Merge pull request #43009 from azat/fix-tsan
Fix TSan errors (correctly ignore _exit interception)
2022-11-07 22:20:53 +03:00
Alexander Tokmakov
b4ecbbf224
Update safeExit.cpp 2022-11-07 21:07:09 +03:00
Azat Khuzhin
d6bfbeb95f Fix TSan errors (correctly ignore _exit interception)
Because safeExit() does not includes header with defines, it does not
know about THREAD_SANITIZER.

And it also fixes Azure blob storage, actually everything is fine with
the sdk itself, the problem is only in TSan that intercepts _exit() and
report leak, even thoug that tread will be joined later.

Refs: #23056 (#23616)
Fixes: #38474
Closes: #42640
Fixes: #42638
Fixes: #34988
Cc: @alexey-milovidov, @tavplubix

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-07 16:10:35 +01:00
Amos Bird
4c2b3de93d
Fix msan error 2022-11-04 22:08:14 +08:00
Amos Bird
a89e847514
Fix getauxval for sanitizer builds 2022-11-04 22:08:13 +08:00
Suzy Wang
9560306cdb Update fix 2022-11-03 09:29:15 -07:00
Suzy Wang
80c4d27a89 reverse columnVector change and update new fix 2022-11-02 07:15:00 -07:00
Azat Khuzhin
4eeb7337ed Merge remote-tracking branch 'upstream/master' into build/shorten-64-to-32
Conflicts:
- src/Common/intExp.h
- src/Functions/DateTimeTransforms.h
- src/Functions/FunctionsConversion.h
2022-10-21 22:51:56 +02:00
Azat Khuzhin
1e739791a4 Fix type error in itoa (wrong static_cast<>)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-21 13:25:43 +02:00
Azat Khuzhin
0625a866f0 Add a note about incorrect wide_integer with Decimal
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-21 13:25:43 +02:00
Azat Khuzhin
7b28a80ad7 Fix -Wshorten-64-to-32 for amd64sse2 build
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-21 13:25:42 +02: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
Alexey Milovidov
445487e073 Merge branch 'master' into add-test-658 2022-10-20 23:55:15 +02:00
Sema Checherinda
52f57cd1ee
Merge pull request #42080 from azat/client-fuzzy-history
Avoid adding extra new line after using fuzzy history search
2022-10-12 10:50:26 +02:00
Alexey Milovidov
8a066b5eef Fix test 2022-10-11 01:28:36 +02:00
Alexander Tokmakov
ff03181d31
Update safeExit.cpp 2022-10-10 15:01:03 +03:00
Alexey Milovidov
69a3ddb5cb
Merge pull request #42128 from Algunenano/tsa_build
Fix build without TSA
2022-10-09 03:11:47 +03:00
Alexander Tokmakov
8b44e11430 fix 2022-10-08 16:10:46 +02:00
Alexander Tokmakov
4175f8cde6 abort instead of __builtin_unreachable in debug builds 2022-10-07 21:49:08 +02:00
Alexander Tokmakov
1a1a20587e
Update defines.h 2022-10-07 21:26:09 +03:00
Raúl Marín
5d9c4a39c0 Update comment 2022-10-07 14:06:28 +02:00
Raúl Marín
62599e3901 Simpler macro 2022-10-07 11:14:35 +02:00
Raúl Marín
6b0ad85640 Fix build without TSA 2022-10-06 16:26:48 +02:00
Azat Khuzhin
e9d4d15c0d Add more comments for skim/fzf compatibility
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-05 09:59:48 +02:00
Azat Khuzhin
6e7114128b Avoid adding extra new line after using fuzzy history search
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-05 09:59:48 +02:00
BoloniniD
55c79230b3 Merge branch 'master' of github.com:ClickHouse/ClickHouse into BLAKE3 2022-09-29 23:53:25 +03:00
Azat Khuzhin
8cc53a48ae clickhouse-client: tune fzf/sk options to be a real reverse search
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-09-26 15:09:37 +03:00
Azat Khuzhin
d0f14e1255 clickhouse-client: proper support of vfork() w/o dlsym() in musl
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-09-26 15:09:37 +03:00
Azat Khuzhin
aaa36e2b25 clickhouse-client: add support of sk (fzf-like in rust)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>
2022-09-26 15:09:37 +03:00
Azat Khuzhin
58b61d8207 clickhouse-client: add interactive history search with fzf-like utility
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-09-26 15:09:37 +03:00
Azat Khuzhin
6acdeb84be clickhouse-client: refactor editor execution
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-09-26 15:09:37 +03:00
Nikita Mikhaylov
e897816572
Evict stale DNS entries from cache in case of network errors (#41707) 2022-09-25 14:06:13 +02:00
BoloniniD
55fcb98f29 Merge branch 'master' of github.com:ClickHouse/ClickHouse into BLAKE3 2022-09-19 21:53:14 +03:00
BoloniniD
5b4fb4bf66
Merge branch 'master' into BLAKE3 2022-09-18 23:14:37 +03:00
Alexey Milovidov
5c75a7d661 Fix error 2022-09-18 09:20:48 +02:00
Alexey Milovidov
35cce03125 Remove dlopen 2022-09-17 03:02:34 +02:00
BoloniniD
452ef4435b Merge branch 'master' of github.com:ClickHouse/ClickHouse into BLAKE3 2022-09-16 20:05:56 +03:00
BoloniniD
0df426d329 Corrosion fixes + review fixes 2022-09-16 00:05:21 +03:00
Azat Khuzhin
569b4bb631 Add ability to automatically comment SQL queries in clickhouse-client/local
This is like Alt-# in readline, it is useful when you need to look
something else, and need to save current query/command somewhere, and
commented lin the history is a good option.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-09-12 21:57:21 +02:00
Alexey Milovidov
2aedd41023
Remove strange code (#40195)
* Remove strange code

* Even more code removal

* Fix style

* Remove even more code

* Simplify code by making it slower

* Attempt to do something

* Attempt to do something

* Well do something with this horrible trash

* Add a test
2022-09-12 16:29:23 +02:00
Alexey Milovidov
33635e015d Fix style 2022-09-11 06:11:02 +02:00
Alexey Milovidov
fa62c7e982 Fix half of trash 2022-09-10 04:08:16 +02:00
BoloniniD
e8bcbcd016
Merge branch 'master' into BLAKE3 2022-09-09 11:48:31 +03:00
BoloniniD
c08b41b611 Clean files and compatibility code 2022-09-08 09:34:59 +03:00
BoloniniD
069fbdd7c5 Fix broken builds 2022-09-05 20:56:03 +03:00
BoloniniD
69588bcebf Added statx to glibc_compatibility 2022-09-04 20:21:13 +03:00
Ilya Golshtein
74561b40ae stylecheck renewed 2022-09-02 17:42:18 +03:00
Antonio Andelic
e64436fef3 Fix typos with new codespell 2022-09-02 08:54:48 +00:00
BoloniniD
cba94e106f Remove posix_spawn for now, add execvpe impl 2022-09-01 20:36:47 +03:00
Robert Schulze
bfa67ffc8c
Update base/base/itoa.h
Co-authored-by: Antonio Andelic <antonio2368@users.noreply.github.com>
2022-09-01 10:31:34 +02:00
Robert Schulze
d43f4e6317
fix: typo 2022-08-31 10:57:27 +00:00
Robert Schulze
cedf75ed5e
Enable clang-tidy for headers
clang-tidy now also checks code in header files. Because the analyzer
finds tons of issues, activate the check only for directory "base/" (see
file ".clang-tidy"). All other directories, in particular "src/" are
left to future work.

While many findings were fixed, some were not (and suppressed instead).
Reasons for this include: a) the file is 1:1 copypaste of a 3rd-party
lib (e.g. pcg_extras.h) and fixing stuff would make upgrades/fixes more
difficult b) a fix would have broken lots of using code
2022-08-31 10:48:15 +00:00
BoloniniD
8e6dcf18df Add posix_spawn for posix_file_actions_ 2022-08-30 20:18:08 +03:00
BoloniniD
cb32fa4512 Add all posix_spawn_file_actions_ functions 2022-08-30 21:03:45 +03:00
Alexander Tokmakov
44c6c85f75
Merge pull request #40756 from ClickHouse/libuv_update
Merging #39398
2022-08-30 14:38:50 +03:00
Suzy Wang
cad4eeb891 Correct __dup3() to dup3() 2022-08-28 18:03:07 -07:00
BoloniniD
14216d1dc0 Move statx to glibc-compatibility 2022-08-28 16:40:10 +03:00
BoloniniD
d1e2267f58
Move statx to glibc-compatibility 2022-08-26 15:18:24 +03:00
BoloniniD
de45f7cf5d
Delete fstatat.c 2022-08-26 15:17:18 +03:00
BoloniniD
4ee1b52116 Move copy_file_range to glibc_compat 2022-08-25 20:59:52 +03:00
BoloniniD
78d00c3371 Add glibc symbols to glibc_compatibility 2022-08-24 21:30:48 +03:00
Alexey Milovidov
0252695c6e
Merge pull request #40224 from ClickHouse/alexey-milovidov-patch-4
Check what will be if I enable `concurrency-mt-unsafe` in `clang-tidy`
2022-08-22 23:12:01 +03: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
Suzy Wang
7a190f84c8 Remove weak_alias 2022-08-19 11:59:47 -07:00
Robert Schulze
77e64935e1
Reduce some usage of StringRef 2022-08-19 09:56:59 +00:00
Suzy Wang
1171ba9095 Add dup3() and inotify_init() from musl 1.2.3 2022-08-18 13:25:50 -07:00
Alexey Milovidov
dd96aee8d2
Update unaligned.h 2022-08-04 08:18:45 +03:00
Alexey Milovidov
6cc08afb72
Update unaligned.h 2022-08-04 01:58:08 +03:00
Alexey Milovidov
57e31cadfa
Update unaligned.h 2022-08-03 09:08:51 +03:00
HarryLeeIBM
cc73b53116 Fix Endian issue in SipHash for s390x 2022-07-29 13:21:50 -07:00
Robert Schulze
24c74da473
Merge pull request #39430 from azat/getauxval-fix
Fix LSan by fixing getauxval() (resubmit v4)
2022-07-25 10:43:09 +02:00
Azat Khuzhin
a4f9e1da5b Fix getauxval() by using procfs with fallback to environ
getauxval() from glibc-compatibility did not work always correctly:

- It does not work after setenv(), and this breaks vsyscalls,
  like sched_getcpu() [1] (and BaseDaemon.cpp always set TZ if timezone
  is defined, which is true for CI [2]).

  Also note, that fixing setenv() will not fix LSan,
  since the culprit is getauxval()

  [1]: https://bugzilla.redhat.com/show_bug.cgi?id=1163404
  [2]: ClickHouse#32928 (comment)

- Another think that is definitely broken is LSan (Leak Sanitizer), it
  relies on worked getauxval() but it does not work if __environ is not
  initialized yet (there is even a commit about this).

  And because of, at least, one leak had been introduced [3]:

    [3]: ClickHouse#33840

Fix this by using /proc/self/auxv with fallback to environ solution to
make it compatible with environment that does not allow reading from
auxv (or no procfs).

v2: add fallback to environ solution
v3: fix return value for __auxv_init_procfs()
(cherry picked from commit f187c3499a)
v4: more verbose message on errors, CI founds [1]:
    AUXV already has value (529267711)
    [1]: https://s3.amazonaws.com/clickhouse-test-reports/39103/2325f7e8442d1672ce5fb43b11039b6a8937e298/stress_test__memory__actions_.html
v5: break at AT_NULL
v6: ignore AT_IGNORE
v7: suppress TSan and remove superior check to avoid abort() in case of race
v8: proper suppressions (not inner function but itself)
Refs: #33957
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-25 01:22:04 +03:00
Robert Schulze
4333750985
Less usage of StringRef
... replaced by std::string_view, see #39262
2022-07-24 18:33:52 +00:00
Alexey Milovidov
72dda35108
Revert "[RFC] Fix LSan by fixing getauxval()" 2022-07-21 04:34:04 +03:00
Robert Schulze
7146685f9d
Merge pull request #39299 from azat/fix-lsan-v3
[RFC] Fix LSan by fixing getauxval()
2022-07-19 14:27:41 +02:00
Azat Khuzhin
f187c3499a Fix getauxval() by using procfs with fallback to environ
getauxval() from glibc-compatibility did not work always correctly:

- It does not work after setenv(), and this breaks vsyscalls,
  like sched_getcpu() [1] (and BaseDaemon.cpp always set TZ if timezone
  is defined, which is true for CI [2]).

  Also note, that fixing setenv() will not fix LSan,
  since the culprit is getauxval()

  [1]: https://bugzilla.redhat.com/show_bug.cgi?id=1163404
  [2]: ClickHouse#32928 (comment)

- Another think that is definitely broken is LSan (Leak Sanitizer), it
  relies on worked getauxval() but it does not work if __environ is not
  initialized yet (there is even a commit about this).

  And because of, at least, one leak had been introduced [3]:

    [3]: ClickHouse#33840

Fix this by using /proc/self/auxv with fallback to environ solution to
make it compatible with environment that does not allow reading from
auxv (or no procfs).

v2: add fallback to environ solution
v3: fix return value for __auxv_init_procfs()
Refs: #33957
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-18 16:49:49 +03:00
alesapin
00e5bdb84a Fix build clang-13 2022-07-18 12:44:58 +02:00
Robert Schulze
87197f8f60
Enable -Wdeprecated-dynamic-exception-spec 2022-07-13 13:49:40 +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
Alexander Tokmakov
c45482d6c6 disable instrumentation of sanitizer death callback 2022-07-07 22:10:12 +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
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
Robert Schulze
30f136867f
Fix build 2022-06-28 16:52:17 +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
Robert Schulze
5e28580f11
Fix some clang-tidy warnings in headers 2022-06-27 23:49:07 +02:00
Alexander Tokmakov
f4883f1f7e add some TSA aanotations 2022-06-27 22:48:27 +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
alesapin
0ae0cc54aa
Merge pull request #38106 from ClickHouse/tsan_less_flaky_tests
Some fixes for tests with tsan
2022-06-18 14:22:43 +02:00
Alexander Tokmakov
9cac78b498 make tests with tsan less flaky 2022-06-15 19:54:46 +02:00
Igor Nikonov
de273b043d Decimal: noexcept move constructor/assignment operator 2022-06-13 13:42:54 +00:00
Robert Schulze
1a0b5f33b3
More consistent use of platform macros
cmake/target.cmake defines macros for the supported platforms, this
commit changes predefined system macros to our own macros.

__linux__ --> OS_LINUX
__APPLE__ --> OS_DARWIN
__FreeBSD__ --> OS_FREEBSD
2022-06-10 10:22:31 +02:00
Alexey Milovidov
b5f48a7d3f Merge branch 'master' of github.com:ClickHouse/ClickHouse into llvm-14 2022-06-01 22:09:58 +02:00
Robert Schulze
249fe561f4
Fix build with -DENABLE_LIBRARIES=0 / -DENABLE_REPLXX=0
Replxx: When disabled via -DENABLE_LIBRARIES=0 or -DENABLE_REPLXX (the
latter was undocumented) the build broke because replxx symbols were
used since [0] in header LineReader.h. This header should in theory
stay clean of replxx but doesn't for efficiency reasons.

This change makes compilation of replxx mandatory. As replxx is quite
small, I guess this is okay. (The alternative is to litter the code
with ifdefs for non-replxx and a replxx paths.)

[0] https://github.com/ClickHouse/ClickHouse/pull/33201
2022-06-01 10:02:28 +02:00
Alexey Milovidov
bcbd6b802f Fix clang-tidy-14 2022-05-31 04:19:08 +02:00
Alexey Milovidov
11788c8129 Fix clang-tidy-14 2022-05-29 02:28:46 +02:00
Alexander Tokmakov
6bc68c0cbc Merge branch 'master' into fixes_for_transactions 2022-05-23 18:49:21 +02:00
Alexander Tokmakov
12bbb7de87 fix race on TID allocation 2022-05-20 12:41:44 +02:00
Robert Schulze
b475fbc9a7
Merge pull request #37300 from ClickHouse/cmake-cleanup-pt3
Various cmake cleanups
2022-05-20 10:02:36 +02:00
Robert Schulze
0c55ac76d2
A few clangtidy updates
Enable:

- bugprone-lambda-function-name: "Checks for attempts to get the name of
  a function from within a lambda expression. The name of a lambda is
  always something like operator(), which is almost never what was
  intended."

- bugprone-unhandled-self-assignment: "Finds user-defined copy
  assignment operators which do not protect the code against
  self-assignment either by checking self-assignment explicitly or using
  the copy-and-swap or the copy-and-move method.""

- hicpp-invalid-access-moved: "Warns if an object is used after it has
  been moved."

- hicpp-use-noexcept: "This check replaces deprecated dynamic exception
  specifications with the appropriate noexcept specification (introduced
  in C++11)"

- hicpp-use-override: "Adds override (introduced in C++11) to overridden
  virtual functions and removes virtual from those functions as it is
  not required."

- performance-type-promotion-in-math-fn: "Finds calls to C math library
  functions (from math.h or, in C++, cmath) with implicit float to
  double promotions."

Split up:

- cppcoreguidelines-*. Some of them may be useful (haven't checked in
  detail), therefore allow to toggle them individually.

Disable:

- linuxkernel-*. Obvious.
2022-05-17 20:56:57 +02:00
Robert Schulze
43945cea1b
Fixing some warnings 2022-05-16 20:59:27 +02:00
Robert Schulze
e3cfec5b09
Merge remote-tracking branch 'origin/master' into clangtidies 2022-05-16 10:12:50 +02:00
Robert Schulze
8117a1ce52
Don't leak suppression for -Wreserved-identifier out of header 2022-05-15 09:48:54 +02:00
Robert Schulze
1b81bb49b4
Enable clang-tidy modernize-deprecated-headers & hicpp-deprecated-headers
Official docs:

  Some headers from C library were deprecated in C++ and are no longer
  welcome in C++ codebases. Some have no effect in C++. For more details
  refer to the C++ 14 Standard [depr.c.headers] section. This check
  replaces C standard library headers with their C++ alternatives and
  removes redundant ones.
2022-05-09 08:23:33 +02:00
Robert Schulze
f866f8143d
Enable clang-tidy modernize-use-noexcept
Official docs:

  This check replaces deprecated dynamic exception specifications with
  the appropriate noexcept specification (introduced in C++11). By
  default this check will replace throw() with noexcept, and
  throw(<exception>[,...]) or throw(...) with noexcept(false).
2022-05-08 19:31:38 +02:00
Robert Schulze
3d3977bad3
Enable clang-tidy cert-err60-cpp
Official docs:

  This check flags all throw expressions where the exception object is
  not nothrow copy constructible.
2022-05-06 00:36:26 +02:00
mergify[bot]
64084b5e32
Merge branch 'master' into shared_ptr_helper3 2022-05-03 20:46:16 +00:00
Robert Schulze
ad0b3be79d
Replace uses of SFINAE by C++20 concepts
- enable_if is usually regarded as fragile and unreadable

- C++20 concepts are much easier to read and produce more expressive
  error messages
2022-05-02 09:23:53 +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
Alexey Milovidov
1ddb04b992
Merge pull request #36715 from amosbird/refactorbase
Reorganize source files so that base won't depend on Common
2022-04-30 09:40:58 +03:00
Amos Bird
4a5e4274f0
base should not depend on Common 2022-04-29 10:26:35 +08:00
mergify[bot]
20e2fa9b3f
Merge branch 'master' into dynamic-columns-9 2022-04-28 17:53:03 +00:00
mergify[bot]
01357b2e1a
Merge branch 'master' into speed-up-build 2022-04-22 04:34:27 +00:00
Maksim Kita
57444fc7d3
Merge pull request #36444 from rschu1ze/clang-tidy-fixes
Clang tidy fixes
2022-04-21 16:11:27 +02:00
mergify[bot]
9c75f83a0b
Merge branch 'master' into speed-up-build 2022-04-20 23:20:21 +00:00
Robert Schulze
b24ca8de52
Fix various clang-tidy warnings
When I tried to add cool new clang-tidy 14 warnings, I noticed that the
current clang-tidy settings already produce a ton of warnings. This
commit addresses many of these. Almost all of them were non-critical,
i.e. C vs. C++ style casts.
2022-04-20 10:29:05 +02:00
alesapin
dd2e085ae5
Merge pull request #36365 from ClickHouse/fix-memory-warning-at-server-startup
Fix error in sanity checks
2022-04-18 11:51:21 +02:00
Alexey Milovidov
9bab9077b2 Fix error in sanity checks 2022-04-18 03:39:56 +02:00
Alexey Milovidov
f046dd6642 Speed up build a little 2022-04-16 03:58:50 +02:00
Alexey Milovidov
ccdd0a60f7 Remove Arcadia 2022-04-16 00:28:56 +02:00
Anton Popov
6364b6f78f Merge remote-tracking branch 'upstream/master' into dynamic-columns-9 2022-04-08 15:05:51 +00:00
Anton Popov
3fce23357c fix insertion of complex json with nested arrays 2022-04-08 14:58:02 +00:00
Alexander Tokmakov
7f54e7b422 Merge branch 'master' into mvcc_prototype 2022-04-07 15:14:06 +02:00
Anton Popov
13cb564d1e
Merge pull request #35716 from kssenii/fix-local-logs-level
Fix send_logs_level for clickhouse local
2022-04-06 18:52:47 +02:00
kssenii
83488b2d13 Better 2022-04-05 14:48:26 +02:00
mergify[bot]
3183b61c74
Merge branch 'master' into mvcc_prototype 2022-03-31 12:27:09 +00:00
Alexander Tokmakov
287d858fda Merge branch 'master' into mvcc_prototype 2022-03-29 16:24:12 +02:00
alesapin
842c0b8ff0 Merge remote-tracking branch 'origin/startup-sanity-checks' into startup-sanity-checks 2022-03-29 14:29:33 +02:00
alesapin
ed2c461fe1 Merge branch 'master' into startup-sanity-checks 2022-03-29 14:09:20 +02:00
alesapin
b838a7dcb0 Remove outdated links from CI 2022-03-28 15:53:22 +02:00
Sergei Trifonov
85f2ed12e1 fix darwin build 2022-03-25 12:52:50 +01:00
alesapin
93d1b1d198 Merge branch 'master' into startup-sanity-checks 2022-03-24 11:17:06 +01:00
Sergei Trifonov
c7cf14e743 fix style and darwin build 2022-03-23 19:15:01 +01:00
Alexander Tokmakov
9702b5177d Merge branch 'master' into mvcc_prototype 2022-03-14 21:45:38 +01:00
Maksim Kita
e14cfd5dcd Fix clang-tidy warnings in Access folder 2022-03-14 18:17:35 +00:00
alesapin
96c0e9fddf Better cmake 2022-03-11 15:47:07 +01:00
Alexander Tokmakov
8acfb8d27f Merge branch 'master' into mvcc_prototype 2022-03-07 17:40:15 +01:00
alesapin
c5a456802f Fix build 2022-03-04 19:39:11 +01:00
alesapin
5416b567d5 Merge branch 'master' into standalone_keeper_build 2022-03-04 13:35:07 +01:00
alesapin
0eb7d28192 Building small keeper binary 2022-03-03 21:27:46 +01:00
Vladimir C
38cf9ca7c2
Merge pull request #35005 from vdimir/fixarm64/00092_obfuscator 2022-03-03 12:17:30 +01:00
Maksim Kita
7d90afb3b0
Merge pull request #34988 from azat/safe-exit
Fix signal-unsafe TSan report in client
2022-03-03 09:21:26 +01:00
vdimir
c89de91fd4
clickhouse obfuscator aarch64 fix 2022-03-02 21:31:40 +00:00
Azat Khuzhin
798da0c314 Introduce safeExit() helper (_exit() compatible with TSan)
v2: add missing defines.h header
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-03-02 22:17:17 +03:00
Maksim Kita
b1a956c5f1 clang-tidy check performance-move-const-arg fix 2022-03-02 18:15:27 +00:00
Alexander Tokmakov
aa6b9a2abc Merge branch 'master' into mvcc_prototype 2022-02-23 23:22:03 +03:00
Amos Bird
56197cf31e
Allow only to specify --log-file 2022-02-18 18:14:58 +08:00
Alexander Tokmakov
dae044f86b Merge branch 'master' into mvcc_prototype 2022-02-17 13:49:37 +03:00
Vladimir C
ddad064285
Merge pull request #34463 from vdimir/wide_integer_from_builtin_double_multiplier
Use `cpp_bin_float_double` in `set_multiplier` for `wide_integer_from_builtin` for aarch64
2022-02-15 15:24:20 +01:00
Sergei Trifonov
0f66743104 support determine available memory for FreeBSD 2022-02-15 13:59:00 +03:00
Alexander Tokmakov
1e4e569151 Merge branch 'master' into mvcc_prototype 2022-02-15 02:26:47 +03:00
Maksim Kita
70ffcb8e33
Merge pull request #34393 from kitaisreal/sort-added-equal-items-randomization
Sort added equal items ranges randomization
2022-02-14 16:41:19 +01:00
Vladimir C
ebd93d07e5
fix 2022-02-14 12:36:30 +01:00
Maksim Kita
e13a0bfb39 Enable randomization of sort only in debug 2022-02-13 15:10:44 +00:00
Maksim Kita
7cbf18ef59 Fixed tests 2022-02-13 15:10:44 +00:00
Maksim Kita
4a18e627ec Updated implementation 2022-02-13 15:10:44 +00:00
Maksim Kita
42792dec48 Simplified implementation 2022-02-13 15:10:44 +00:00
Maksim Kita
b536b27e15 Fixed tests 2022-02-13 15:10:44 +00:00
Maksim Kita
10293acafb Sort added equal items ranges randomization 2022-02-13 15:10:44 +00:00
kssenii
fecf7f3d08 May be fix test 01065_window_view_event_hop_watch_bounded.py 2022-02-12 18:24:09 +01:00
Vladimir C
d40275af4f
fix 2022-02-11 21:22:02 +01:00
vdimir
b17d27413e
Use cpp_bin_float_double_extended in wide_integer_from_builtin 2022-02-11 18:01:19 +01:00
Alexander Tokmakov
07e66e690d Merge branch 'master' into mvcc_prototype 2022-02-11 15:53:32 +03:00
vdimir
4b1325ba63
Try to use double in set_multiplier for wide_integer_from_builtin 2022-02-09 14:27:21 +01:00
alexey-milovidov
38d92d0507
Merge pull request #33996 from save-my-heart/fix/signal_pipe_buf_size
reduce signal_pipe_buf_size
2022-02-06 04:50:47 +03:00
Alexander Tokmakov
ca5f951558 Merge branch 'master' into mvcc_prototype 2022-02-03 18:56:44 +03:00
Sergei Trifonov
68bc456830
Merge pull request #34223 from azat/bump-fmt
Bump fmtlib from 7.0.0 to 8.1.1
2022-02-02 00:03:25 +03:00
alexey-milovidov
cafb19d7fb
Merge pull request #34114 from amosbird/replxxwithlexer
Combining our lexer with replxx for better multiple line editing
2022-02-01 16:32:25 +03:00
Azat Khuzhin
220ed206c1 logger_useful: implicitly convert fmt::basic_runtime for std::string ctor
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-02-01 14:30:03 +03: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
Alexander Tokmakov
2e4ae37d98 Merge branch 'master' into mvcc_prototype 2022-02-01 13:20:03 +03:00
Maksim Kita
8513f20cfd
Merge pull request #34145 from kitaisreal/bitset-sort-performance-check
pdqsort performance check
2022-01-31 12:35:13 +01:00
Maksim Kita
5ef83deaa6 Update sort to pdqsort 2022-01-30 19:49:48 +00:00
Amos Bird
ae16b362d3
Better case-insensitive completion 2022-01-30 19:50:24 +08:00
Amos Bird
bb34435928
Better code 2022-01-30 19:48:35 +08:00
Amos Bird
62e89a6445
Ignore case for history search and completion 2022-01-30 19:48:34 +08:00
Amos Bird
556cce9f3c
We need highlight to use Lexer 2022-01-30 19:48:34 +08:00
Amos Bird
54517753d7
Combining our lexer with replxx 2022-01-30 19:48:33 +08:00
save-my-heart
4894e93e05
Merge branch 'ClickHouse:master' into fix/signal_pipe_buf_size 2022-01-30 06:29:00 +08:00
Alexey Milovidov
7135ff448f Revert #33957 2022-01-30 01:09:15 +03:00
Alexander Tokmakov
fb9b2d5326 Merge branch 'master' into mvcc_prototype 2022-01-28 21:18:36 +03:00
tavplubix
b92958815a
Update LineReader.cpp 2022-01-28 13:38:36 +03:00
Vitaly Baranov
484743edff
Merge pull request #33201 from azat/client-interactive-suggest
Client interactive suggest (extract info from CREATE queries)
2022-01-28 16:30:16 +07:00
save-my-heart
cc3cbc6503 remove whitespace to pass style check 2022-01-26 23:05:07 +08:00
save-my-heart
62ba4833df fix dereference null pointer 2022-01-26 22:55:19 +08:00
save-my-heart
2c37b572d4 fix 2022-01-26 22:21:18 +08:00
save-my-heart
99c8736f00 fix build error on freebsd & aarch 2022-01-26 22:18:17 +08:00
Azat Khuzhin
0fe1f070fa Fix getauxval() in glibc-compatibility
getauxval() from glibc-compatibility did not work always correctly:

- it does not work after setenv(), and this breaks vsyscalls,
  like sched_getcpu() [1] (and BaseDaemon.cpp always set TZ if timezone
  is defined, which is true for CI [2]).

  [1]: https://bugzilla.redhat.com/show_bug.cgi?id=1163404
  [2]: https://github.com/ClickHouse/ClickHouse/pull/32928#issuecomment-1015762717

- another think that is definitely broken is LSan (Leak Sanitizer), it
  relies on worked getauxval() but it does not work if __environ is not
  initialized yet (there is even a commit about this).

  And because of, at least, one leak had been introduced [3]:

    [3]: https://github.com/ClickHouse/ClickHouse/pull/33840

Fix this by using /proc/self/auxv.

And let's see how many issues will LSan find...

I've verified this patch manually by printing AT_BASE and compared it
with output of LD_SHOW_AUXV.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-26 12:56:27 +03:00
save-my-heart
c1036f0b8e ensure signal_pipe_buf_size is <= PIPE_BUF 2022-01-25 22:43:44 +08:00
Maksim Kita
c1db61b4ed
Merge pull request #33946 from azat/build-cleanup
Remove MAKE_STATIC_LIBRARIES (in favor of USE_STATIC_LIBRARIES)
2022-01-24 23:42:04 +01:00
Azat Khuzhin
1acd644040 Add inplace merge for new completion words
This will allow:
- use addWords() everywhere
- remove that optimization for empty words case (initial load)
- and now we remove duplicates according to comparator

v2: replace parameter pack in addWords() with explicit Compare for both
cases (just pass default)
2022-01-24 22:59:18 +03:00
Azat Khuzhin
b9948155cd Remove extra copying for completion words
Return Replxx::completions_t over Words array, that way we avoids one
copying of std::string (although it breaks incapsulation).
2022-01-24 23:04:48 +03:00
Azat Khuzhin
4a0facd341 Remove MAKE_STATIC_LIBRARIES (in favor of USE_STATIC_LIBRARIES)
There is no more MAKE_*, so remove this alias.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-24 17:28:33 +03:00
Azat Khuzhin
37dbff7587 Revert glibc compatibility (via .symver) in favor of hermetic build (bundled libc)
This patch reverts glibc compatibility (via .symver) #29594,
in favor of hermetic build (that provides bundled libc version) #30011

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-24 16:03:56 +03:00
Alexander Tokmakov
0ea0a8ccc7 Merge branch 'master' into mvcc_prototype 2022-01-20 17:05:55 +03:00
Azat Khuzhin
e0e81b340d Fix w/o ODBC build 2022-01-20 10:02:02 +03:00
Azat Khuzhin
e3b140a387 Add alias library for fmt 2022-01-20 10:02:02 +03:00