ClickHouse/base
Azat Khuzhin ed70ed6f71 Introduce connection_no_wait setting for MySQL engine.
This will allow to avoid superfluous sleep during query execution, since
this not only not desired behavoiur, but also may hang the server, since
if you will execute enough queries that will use MySQL database but will
not allow enough connections (or your MySQL server is too slow) then you
may run out of threads in the global thread pool.

Also note that right now it is possible to get deadlock when the mysql
pool is full, consider the following scenario:

- you have m1 and m2 mysql tables
- you have q1 and q2 queries, bot queries join m1 and m2
- q1 allocated connection for m1 but cannot allocate connection for m2
- q2 allocated connection for m2 but cannot allocate connection for m1
- but to resolve the lock one should give up on the locking while it is not possible right now...

And then you got no free threads and this:

    # grep -h ^202 /proc/$(pgrep clickhouse-serv)/task/*/syscall  | cut -d' ' -f2 | sort | uniq -c | sort -nr | head
       1554 0x7ffb60b92fe8 # mutex in mysqlxx::PoolWithFailover::get
       1375 0x7ffb9f1c4748 # mutex in ::PoolEntryHelper::~PoolEntryHelper from DB::MultiplexedConnections::invalidateReplica
       1160 0x7ffb612918b8 # mutex in mysqlxx::PoolWithFailover::get
         42 0x7ffb9f057984 # mutex in ThreadPoolImpl<std::__1::thread>::worker

    *NOTE: 202 is a `futex` with WAIT*

(Went with `syscall` because debugging 10k+ threads is not easy, and
eventually it may TRAP)
2021-09-02 22:23:37 +03:00
..
bridge Merge ext into common 2021-06-16 23:28:41 +03:00
common BorrowedObjectPool fix style 2021-09-02 16:18:10 +03:00
daemon fix split build 2021-08-18 15:15:31 +03:00
glibc-compatibility Revert "Revert "less sys calls #2: make vdso work again"" 2021-08-25 14:19:20 +03:00
harmful fix 2021-01-20 14:12:33 +03:00
loggers Do not check writeRetry errors in OwnSplitChannel 2021-06-07 09:40:29 +03:00
mysqlxx Introduce connection_no_wait setting for MySQL engine. 2021-09-02 22:23:37 +03:00
pcg-random Fix warnings by PVS-Studio in some third-party code 2021-05-08 22:31:11 +03:00
readpassphrase readpassphrase mute recursion in macro expansion 2021-03-10 18:05:24 +03:00
widechar_width Follow Arcadia ya.make rules 2020-11-16 21:24:58 +03:00
CMakeLists.txt Fix split build finally 2021-03-12 21:12:34 +00:00
ya.make METR-41529 2021-06-21 22:31:42 +03:00