Commit Graph

145903 Commits

Author SHA1 Message Date
Alexey Milovidov
3d67e6b127
Merge pull request #65928 from ClickHouse/follow-up-to-65046
Follow up to #65046
2024-07-02 03:27:08 +00:00
Alexey Milovidov
f627e89637
Merge pull request #65950 from nathanclevenger/patch-1
Fixed documentation typos
2024-07-02 03:17:00 +00:00
taiyang-li
13c3bab624 update doc 2024-07-02 09:54:37 +08:00
Alexey Milovidov
8a8b6a881b
Merge pull request #58970 from ClickHouse/dont-optimize-trivial-insert-select
Disable `optimize_trivial_insert_select` by default
2024-07-02 01:33:23 +00:00
Michael Kolupaev
a5ada16719 Use -Og instead of -O0 for debug builds 2024-07-02 01:11:44 +00:00
Alexey Milovidov
78185fb4a1
Merge pull request #65938 from azat/mysql-client-TLS-retries
Fix possible issues with MySQL client protocol TLS connections
2024-07-01 20:36:14 +00:00
Nathan Clevenger
7a5bf2fc24
Fixed types
Replaced RabbitMQ with NATS
2024-07-01 15:14:37 -05:00
Raúl Marín
447c0db2bc Fix SettingsChangesHistory 24.7 2024-07-01 20:11:19 +02:00
Smita Kulkarni
ac648a1fe3 Fix build 2024-07-01 19:41:45 +02:00
Azat Khuzhin
ef24f51789 Fix handling of SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE with zero timeout
Previously if you were using socket without timeout it wasn't able to
handle SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE, and even though sockets
without timeouts is an odd thing (but it is possible - [1]), it still
may be possible somewhere.

  [1]: https://github.com/ClickHouse/ClickHouse/pull/65917

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2024-07-01 19:33:39 +02:00
Alexey Milovidov
1e549751c7
Merge pull request #65937 from ClickHouse/auto/v24.5.4.49-stable
Update version_date.tsv and changelogs after v24.5.4.49-stable
2024-07-01 16:56:03 +00:00
Azat Khuzhin
9c7db6711b Fix possible issues with MySQL client protocol TLS connections
Occasionally, 02479_mysql_connect_to_self fails on CI [1].

  [1]: https://github.com/ClickHouse/ClickHouse/issues/50911

The problem was indeed query profiler and EINTR, but not in a way you
may think.

For such failures you may see the following trace in trace_log:

    contrib/openssl/crypto/bio/bss_sock.c:127::sock_read
    contrib/openssl/crypto/bio/bio_meth.c:121::bread_conv
    contrib/openssl/crypto/bio/bio_lib.c:285::bio_read_intern
    contrib/openssl/crypto/bio/bio_lib.c:311::BIO_read
    contrib/openssl/ssl/record/methods/tls_common.c:398::tls_default_read_n
    contrib/openssl/ssl/record/methods/tls_common.c:575::tls_get_more_records
    contrib/openssl/ssl/record/methods/tls_common.c:1122::tls_read_record
    contrib/openssl/ssl/record/rec_layer_s3.c:645::ssl3_read_bytes
    contrib/openssl/ssl/s3_lib.c:4527::ssl3_read_internal
    contrib/openssl/ssl/s3_lib.c:4551::ssl3_read
    contrib/openssl/ssl/ssl_lib.c:2343::ssl_read_internal
    contrib/openssl/ssl/ssl_lib.c:2357::SSL_read
    contrib/mariadb-connector-c/libmariadb/secure/openssl.c:729::ma_tls_read
    contrib/mariadb-connector-c/libmariadb/ma_tls.c:90::ma_pvio_tls_read
    contrib/mariadb-connector-c/libmariadb/ma_pvio.c:250::ma_pvio_read
    contrib/mariadb-connector-c/libmariadb/ma_pvio.c:297::ma_pvio_cache_read
    contrib/mariadb-connector-c/libmariadb/ma_net.c:373::ma_real_read
    contrib/mariadb-connector-c/libmariadb/ma_net.c:427::ma_net_read
    contrib/mariadb-connector-c/libmariadb/mariadb_lib.c:192::ma_net_safe_read
    contrib/mariadb-connector-c/libmariadb/mariadb_lib.c:2138::mthd_my_read_query_result
    contrib/mariadb-connector-c/libmariadb/mariadb_lib.c:2212::mysql_real_query
    src/Common/mysqlxx/Query.cpp:56::mysqlxx::Query::executeImpl()
    src/Common/mysqlxx/Query.cpp:73::mysqlxx::Query::use()
    src/Processors/Sources/MySQLSource.cpp:50::DB::MySQLSource::Connection::Connection()

After which the connection will fail with:

    Code: 1000. DB::Exception: Received from localhost:9000. DB::Exception: mysqlxx::ConnectionLost: Lost connection to MySQL server during query (127.0.0.1:9004). (POCO_EXCEPTION)

But, if you will take a look at ma_tls_read() you will see that it has
proper retries for SSL_ERROR_WANT_READ (and EINTR is just a special case
of it), but still, for some reason it fails.

And the reason is the units of the read/write timeout, ma_tls_read()
calls poll(read_timeout) in case of SSL_ERROR_WANT_READ, but, it
incorrectly assume that the timeout is in milliseconds, but that timeout
was in seconds, this bug had been fixed in [2], and now it works like a
charm!

  [2]: https://github.com/ClickHouse/mariadb-connector-c/pull/17

I've verified it with patching openssl library:

    diff --git a/crypto/bio/bss_sock.c b/crypto/bio/bss_sock.c
    index 82f7be85ae..3d2f3926a0 100644
    --- a/crypto/bio/bss_sock.c
    +++ b/crypto/bio/bss_sock.c
    @@ -124,7 +124,24 @@ static int sock_read(BIO *b, char *out, int outl)
                 ret = ktls_read_record(b->num, out, outl);
             else
     # endif
    -            ret = readsocket(b->num, out, outl);
    +        {
    +            static int i = 0;
    +            static int j = 0;
    +            if (!(++j % 5))
    +            {
    +                fprintf(stderr, "sock_read: inject EAGAIN with ret=0\n");
    +                ret = 0;
    +                errno = EAGAIN;
    +            }
    +            else if (!(++i % 3))
    +            {
    +                fprintf(stderr, "sock_read: inject EAGAIN with ret=-1\n");
    +                ret = -1;
    +                errno = EAGAIN;
    +            }
    +            else
    +                ret = readsocket(b->num, out, outl);
    +        }
             BIO_clear_retry_flags(b);
             if (ret <= 0) {
                 if (BIO_sock_should_retry(ret))

And before this patch (well, not the patch itself, but the referenced
patch in mariadb-connector-c) if you will pass read_write_timeout=1 it
will fail:

    SELECT * FROM mysql('127.0.0.1:9004', system, one, 'default', '', SETTINGS connect_timeout = 100, connection_wait_timeout = 100, read_write_timeout=1)
    Code: 1000. DB::Exception: Received from localhost:9000. DB::Exception: mysqlxx::ConnectionLost: Lost connection to MySQL server during query (127.0.0.1:9004). (POCO_EXCEPTION)

But after, it always works:

    $ ch benchmark -c10 -q "SELECT * FROM mysql('127.0.0.1:9004', system, one, 'default', '', SETTINGS connection_pool_size=1, connect_timeout = 100, connection_wait_timeout = 100, read_write_timeout=1)"
    ^CStopping launch of queries. SIGINT received.

    Queries executed: 478.

    localhost:9000, queries: 478, QPS: 120.171, RPS: 120.171, MiB/s: 0.001, result RPS: 120.171, result MiB/s: 0.001.

    0.000%          0.014 sec.
    10.000%         0.058 sec.
    20.000%         0.065 sec.
    30.000%         0.073 sec.
    40.000%         0.079 sec.
    50.000%         0.087 sec.
    60.000%         0.089 sec.
    70.000%         0.091 sec.
    80.000%         0.095 sec.
    90.000%         0.100 sec.
    95.000%         0.102 sec.
    99.000%         0.105 sec.
    99.900%         0.140 sec.
    99.990%         0.140 sec.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2024-07-01 18:39:43 +02:00
Anton Popov
e439921d37 slightly better 2024-07-01 15:31:32 +00:00
robot-clickhouse
46ed186250 Update version_date.tsv and changelogs after v24.5.4.49-stable 2024-07-01 15:05:48 +00:00
kssenii
5541461b99 Fix time of writing to _log table 2024-07-01 16:04:43 +02:00
Nikita Mikhaylov
00b030be3e Better 2024-07-01 13:41:03 +00:00
kssenii
5e7a8245c4 Fix memory leak 2024-07-01 15:40:49 +02:00
Nikita Mikhaylov
63b031479c
Merge pull request #65908 from ClickHouse/alexey-milovidov-patch-8
Update CHANGELOG.md
2024-07-01 13:27:59 +00:00
Antonio Andelic
7361407ea5 Fix test 2024-07-01 15:25:00 +02:00
Azat Khuzhin
4f2a0e8eeb Fix possible issues with MySQL server protocol TLS connections
The problem here is that retries (in SecureSocketImpl.cpp::mustRetry())
relies on non-zero socket timeout, but MySQL handler does not set
timeouts for the socket (like other does), and this leads to a problem
when OpenSSL returns SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE, the
connection will be simply terminated.

I've played with this patch, by hacking the openssl sources:

    diff --git a/crypto/bio/bss_sock.c b/crypto/bio/bss_sock.c
    index 82f7be85ae..a399291ff4 100644
    --- a/crypto/bio/bss_sock.c
    +++ b/crypto/bio/bss_sock.c
    @@ -124,7 +125,18 @@ static int sock_read(BIO *b, char *out, int outl)
                 ret = ktls_read_record(b->num, out, outl);
             else
     # endif
    -            ret = readsocket(b->num, out, outl);
    +        {
    +            /* pthread_kill(pthread_self(), SIGUSR1); */
    +            static int i = 0;
    +            if (!(++i % 2))
    +            {
    +                fprintf(stderr, "sock_read: inject EAGAIN\n");
    +                ret = -1;
    +                errno = EAGAIN;
    +            }
    +            else
    +                ret = readsocket(b->num, out, outl);
    +        }
             BIO_clear_retry_flags(b);
             if (ret <= 0) {
                 if (BIO_sock_should_retry(ret))

And after this patch this succeed without errors:

    ch benchmark -c10 -q "SELECT * FROM mysql('127.0.0.1:9004', system, one, 'default', '', SETTINGS connection_pool_size=1, connect_timeout = 100, connection_wait_timeout = 100)"

Note, that this also fixes the timeouts for plain (non-TLS) connections

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2024-07-01 15:22:33 +02:00
Antonio Andelic
1a95259182 Add extra profiling helpers for Keeper 2024-07-01 15:17:41 +02:00
Nikolai Kochetov
5a6e6d3c5d
Merge pull request #65771 from kitaisreal/postgresql-source-support-cancel-query
PostgreSQL source support cancel query
2024-07-01 10:17:01 +00:00
Anton Kozlov
b1b9aaf2ec Add support for x509 SubjectAltName identification 2024-07-01 09:47:28 +00:00
vdimir
632ad5156d
Merge branch 'master' into fix_rocksdb_ttl 2024-07-01 11:01:08 +02:00
robot-clickhouse
0ad049d2e5 Update version_date.tsv and changelogs after v24.6.1.4423-stable 2024-07-01 08:55:11 +00:00
Alexey Milovidov
5b50726e2b
Update CHANGELOG.md 2024-07-01 10:34:32 +02:00
Igor Nikonov
6b3750ff83 Clean up 2024-07-01 08:28:54 +00:00
taiyang-li
bb8fc59d7c update doc 2024-07-01 15:36:08 +08:00
taiyang-li
4fcafde610 allow empty arguments for concat 2024-07-01 15:29:32 +08:00
Antonio Andelic
50c1121c6a
Merge pull request #65735 from ClickHouse/fix-keeper-session-close-bug
Fix bug with session closing in Keeper
2024-07-01 07:12:33 +00:00
Antonio Andelic
43bd12f86b
Merge pull request #65819 from ClickHouse/keeper-respect-cgroup-cpu
Respect cgroup CPU limit in Keeper
2024-07-01 06:57:43 +00:00
Duc Canh Le
047dcfb806 fix undefined LOGICAL_ERROR
Signed-off-by: Duc Canh Le <duccanh.le@ahrefs.com>
2024-07-01 04:39:53 +00:00
Alexey Milovidov
7f0f0d6257
Merge pull request #65855 from kevisong/patch-1
Update mergetree.md bullet points structure
2024-07-01 04:37:35 +00:00
Alexey Milovidov
bf4c856739
Merge pull request #65874 from ClickHouse/changelog-24.6
Add changelog for release 24.6
2024-07-01 03:05:58 +00:00
Alexey Milovidov
770e637f9b Add changelog for release 24.6 2024-07-01 03:51:45 +02:00
Igor Nikonov
71b0ab94be Merge remote-tracking branch 'origin/master' into pr-local-plan 2024-06-30 20:54:42 +00:00
Igor Nikonov
37fbf905dd Use only local snapshot for in order coordinator 2024-06-30 20:33:43 +00:00
Alexey Milovidov
1eac2abf8f Fix test 2024-06-30 20:58:00 +02:00
Alexey Milovidov
97311bd51f Merge branch 'master' of github.com:ClickHouse/ClickHouse into dont-optimize-trivial-insert-select 2024-06-30 20:56:54 +02:00
Alexey Milovidov
20f39c64ec
Merge pull request #65866 from ClickHouse/alexey-milovidov-patch-8
Update CHANGELOG.md
2024-06-30 18:55:46 +00:00
Igor Nikonov
2fcca61fe9
Merge pull request #65769 from ClickHouse/fix-progress-bar-read-in-order
Fix: progress bar for read in order queries
2024-06-30 18:07:13 +00:00
Alexey Milovidov
5a1125418b
Update CHANGELOG.md 2024-06-30 19:24:03 +02:00
Alexey Milovidov
06d0f2fd5d Merge branch 'master' into dont-optimize-trivial-insert-select 2024-06-30 18:52:28 +02:00
Alexey Milovidov
2bca1963a7
Merge pull request #65562 from ClickHouse/maybe-fix-test
Maybe fix test `00763_lock_buffer_long.sh`
2024-06-30 16:49:36 +00:00
Alexey Milovidov
8ead887bc4
Merge pull request #65865 from ClickHouse/update-easy-tasks-list
Update the list of easy tasks
2024-06-30 16:48:57 +00:00
Alexey Milovidov
586866ee3a
Merge pull request #65697 from ClickHouse/local-memory-limit
Add memory limit by default in `clickhouse-local`
2024-06-30 16:42:53 +00:00
Alexey Milovidov
d7dae3328f Update the list of easy tasks 2024-06-30 18:03:51 +02:00
Robert Schulze
32d628ac69
Merge pull request #65737 from cw5121/patch-1
Fix and prevent compatibility settings from becoming not effective
2024-06-30 13:38:34 +00:00
Robert Schulze
c72ce5be8a
Merge remote-tracking branch 'ClickHouse/master' into patch-1 2024-06-30 08:55:58 +00:00
Robert Schulze
235133aa5c
Move code from header to source file 2024-06-30 08:50:28 +00:00