Skip to content

Commit 37620e2

Browse files
authored
Merge branch 'master' into better-exception-s3-globs-partitions
2 parents 8accf39 + d93eb86 commit 37620e2

File tree

1,343 files changed

+97247
-259261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,343 files changed

+97247
-259261
lines changed

.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ Checks: [
119119
'-readability-named-parameter',
120120
'-readability-redundant-declaration',
121121
'-readability-simplify-boolean-expr',
122-
'-readability-static-accessed-through-instance',
123122
'-readability-suspicious-call-argument',
124123
'-readability-uppercase-literal-suffix',
125124
'-readability-use-anyofallof',

.github/workflows/master.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ jobs:
2323
clear-repository: true # to ensure correct digests
2424
fetch-depth: 0 # to get version
2525
filter: tree:0
26+
- name: Merge sync PR
27+
run: |
28+
cd "$GITHUB_WORKSPACE/tests/ci"
29+
python3 sync_pr.py --merge || :
2630
- name: Python unit tests
2731
run: |
2832
cd "$GITHUB_WORKSPACE/tests/ci"
@@ -234,14 +238,15 @@ jobs:
234238
build_name: binary_riscv64
235239
data: ${{ needs.RunConfig.outputs.data }}
236240
checkout_depth: 0
237-
BuilderBinS390X:
238-
needs: [RunConfig, BuilderDebRelease]
239-
if: ${{ !failure() && !cancelled() }}
240-
uses: ./.github/workflows/reusable_build.yml
241-
with:
242-
build_name: binary_s390x
243-
data: ${{ needs.RunConfig.outputs.data }}
244-
checkout_depth: 0
241+
# disabled because s390x refused to build in the migration to OpenSSL
242+
# BuilderBinS390X:
243+
# needs: [RunConfig, BuilderDebRelease]
244+
# if: ${{ !failure() && !cancelled() }}
245+
# uses: ./.github/workflows/reusable_build.yml
246+
# with:
247+
# build_name: binary_s390x
248+
# data: ${{ needs.RunConfig.outputs.data }}
249+
# checkout_depth: 0
245250
############################################################################################
246251
##################################### Docker images #######################################
247252
############################################################################################
@@ -292,7 +297,7 @@ jobs:
292297
- BuilderBinFreeBSD
293298
- BuilderBinPPC64
294299
- BuilderBinRISCV64
295-
- BuilderBinS390X
300+
# - BuilderBinS390X # disabled because s390x refused to build in the migration to OpenSSL
296301
- BuilderBinAmd64Compat
297302
- BuilderBinAarch64V80Compat
298303
- BuilderBinClangTidy

.github/workflows/pull_request.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
${{secrets.ROBOT_CLICKHOUSE_SSH_KEY}}
8484
RCSK
8585
FastTest:
86-
needs: [RunConfig, StyleCheck]
86+
needs: [RunConfig, BuildDockers]
8787
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).jobs_data.jobs_to_do, 'Fast test') }}
8888
uses: ./.github/workflows/reusable_test.yml
8989
with:
@@ -97,7 +97,7 @@ jobs:
9797
# for main CI chain
9898
#
9999
Builds_1:
100-
needs: [RunConfig, FastTest]
100+
needs: [RunConfig, StyleCheck, FastTest]
101101
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Builds_1') }}
102102
# using callable wf (reusable_stage.yml) allows to group all nested jobs under a tab
103103
uses: ./.github/workflows/reusable_build_stage.yml
@@ -158,15 +158,24 @@ jobs:
158158
#
159159
FinishCheck:
160160
if: ${{ !failure() && !cancelled() }}
161-
needs: [Tests_1, Tests_2]
161+
needs: [Tests_1, Tests_2, Builds_1_Report, Builds_2_Report]
162162
runs-on: [self-hosted, style-checker]
163163
steps:
164164
- name: Check out repository code
165165
uses: ClickHouse/checkout@v1
166+
- name: Check sync status
167+
if: ${{ github.event_name == 'merge_group' }}
168+
run: |
169+
cd "$GITHUB_WORKSPACE/tests/ci"
170+
python3 sync_pr.py --status
166171
- name: Finish label
167172
run: |
168173
cd "$GITHUB_WORKSPACE/tests/ci"
169174
python3 finish_check.py
175+
- name: Auto merge if approved
176+
if: ${{ github.event_name != 'merge_group' }}
177+
run: |
178+
cd "$GITHUB_WORKSPACE/tests/ci"
170179
python3 merge_pr.py --check-approved
171180
172181

.gitmodules

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
[submodule "contrib/capnproto"]
2323
path = contrib/capnproto
2424
url = https://github.com/ClickHouse/capnproto
25-
[submodule "contrib/double-conversion"]
26-
path = contrib/double-conversion
27-
url = https://github.com/google/double-conversion
2825
[submodule "contrib/re2"]
2926
path = contrib/re2
3027
url = https://github.com/google/re2
@@ -176,9 +173,6 @@
176173
[submodule "contrib/libpq"]
177174
path = contrib/libpq
178175
url = https://github.com/ClickHouse/libpq
179-
[submodule "contrib/boringssl"]
180-
path = contrib/boringssl
181-
url = https://github.com/ClickHouse/boringssl
182176
[submodule "contrib/NuRaft"]
183177
path = contrib/NuRaft
184178
url = https://github.com/ClickHouse/NuRaft
@@ -278,9 +272,6 @@
278272
[submodule "contrib/crc32-s390x"]
279273
path = contrib/crc32-s390x
280274
url = https://github.com/linux-on-ibm-z/crc32-s390x
281-
[submodule "contrib/openssl"]
282-
path = contrib/openssl
283-
url = https://github.com/openssl/openssl
284275
[submodule "contrib/google-benchmark"]
285276
path = contrib/google-benchmark
286277
url = https://github.com/google/benchmark
@@ -326,6 +317,9 @@
326317
[submodule "contrib/crc32-vpmsum"]
327318
path = contrib/crc32-vpmsum
328319
url = https://github.com/antonblanchard/crc32-vpmsum.git
320+
[submodule "contrib/expected"]
321+
path = contrib/expected
322+
url = https://github.com/TartanLlama/expected
329323
[submodule "contrib/liburing"]
330324
path = contrib/liburing
331325
url = https://github.com/axboe/liburing
@@ -369,3 +363,12 @@
369363
[submodule "contrib/idna"]
370364
path = contrib/idna
371365
url = https://github.com/ada-url/idna.git
366+
[submodule "contrib/rust_vendor"]
367+
path = contrib/rust_vendor
368+
url = https://github.com/ClickHouse/rust_vendor.git
369+
[submodule "contrib/openssl"]
370+
path = contrib/openssl
371+
url = https://github.com/ClickHouse/openssl.git
372+
[submodule "contrib/double-conversion"]
373+
path = contrib/double-conversion
374+
url = https://github.com/ClickHouse/double-conversion.git

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,6 @@ endif ()
455455

456456
enable_testing() # Enable for tests without binary
457457

458-
option(ENABLE_OPENSSL "This option performs a build with OpenSSL. NOTE! This option is insecure and should never be used. By default, ClickHouse uses and only supports BoringSSL" OFF)
459-
460458
if (ARCH_S390X)
461459
set(ENABLE_OPENSSL_DYNAMIC_DEFAULT ON)
462460
else ()

base/base/scope_guard.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class [[nodiscard]] BasicScopeGuard
2929
requires std::is_convertible_v<G, F>
3030
constexpr BasicScopeGuard & operator=(BasicScopeGuard<G> && src) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved, cppcoreguidelines-noexcept-move-operations)
3131
{
32-
if (this != &src)
32+
if constexpr (std::is_same_v<G, F>)
3333
{
34-
invoke();
35-
function = src.release();
34+
if (this == &src)
35+
return *this;
3636
}
37+
invoke();
38+
function = src.release();
3739
return *this;
3840
}
3941

base/poco/Crypto/src/OpenSSLInitializer.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#include <openssl/conf.h>
2424
#endif
2525

26+
#if __has_feature(address_sanitizer)
27+
#include <sanitizer/lsan_interface.h>
28+
#endif
2629

2730
using Poco::RandomInputStream;
2831
using Poco::Thread;
@@ -67,21 +70,27 @@ void OpenSSLInitializer::initialize()
6770
SSL_library_init();
6871
SSL_load_error_strings();
6972
OpenSSL_add_all_algorithms();
70-
73+
7174
char seed[SEEDSIZE];
7275
RandomInputStream rnd;
7376
rnd.read(seed, sizeof(seed));
74-
RAND_seed(seed, SEEDSIZE);
75-
77+
{
78+
# if __has_feature(address_sanitizer)
79+
/// Leak sanitizer (part of address sanitizer) thinks that a few bytes of memory in OpenSSL are allocated during but never released.
80+
__lsan::ScopedDisabler lsan_disabler;
81+
#endif
82+
RAND_seed(seed, SEEDSIZE);
83+
}
84+
7685
int nMutexes = CRYPTO_num_locks();
7786
_mutexes = new Poco::FastMutex[nMutexes];
7887
CRYPTO_set_locking_callback(&OpenSSLInitializer::lock);
7988
// Not needed on Windows (see SF #110: random unhandled exceptions when linking with ssl).
8089
// https://sourceforge.net/p/poco/bugs/110/
8190
//
8291
// From http://www.openssl.org/docs/crypto/threads.html :
83-
// "If the application does not register such a callback using CRYPTO_THREADID_set_callback(),
84-
// then a default implementation is used - on Windows and BeOS this uses the system's
92+
// "If the application does not register such a callback using CRYPTO_THREADID_set_callback(),
93+
// then a default implementation is used - on Windows and BeOS this uses the system's
8594
// default thread identifying APIs"
8695
CRYPTO_set_id_callback(&OpenSSLInitializer::id);
8796
CRYPTO_set_dynlock_create_callback(&OpenSSLInitializer::dynlockCreate);
@@ -100,7 +109,7 @@ void OpenSSLInitializer::uninitialize()
100109
CRYPTO_set_locking_callback(0);
101110
CRYPTO_set_id_callback(0);
102111
delete [] _mutexes;
103-
112+
104113
CONF_modules_free();
105114
}
106115
}

base/poco/Foundation/src/pcre_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4835,7 +4835,7 @@ for (;; ptr++)
48354835
48364836
If the class contains characters outside the 0-255 range, a different
48374837
opcode is compiled. It may optionally have a bit map for characters < 256,
4838-
but those above are are explicitly listed afterwards. A flag byte tells
4838+
but those above are explicitly listed afterwards. A flag byte tells
48394839
whether the bitmap is present, and whether this is a negated class or not.
48404840
48414841
In JavaScript compatibility mode, an isolated ']' causes an error. In

base/poco/Net/include/Poco/Net/HTTPClientSession.h

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,19 @@ namespace Net
213213
Poco::Timespan getKeepAliveTimeout() const;
214214
/// Returns the connection timeout for HTTP connections.
215215

216+
void setKeepAliveMaxRequests(int max_requests);
217+
218+
int getKeepAliveMaxRequests() const;
219+
220+
int getKeepAliveRequest() const;
221+
222+
bool isKeepAliveExpired(double reliability = 1.0) const;
223+
/// Returns if the connection is expired with some margin as fraction of timeout as reliability
224+
225+
double getKeepAliveReliability() const;
226+
/// Returns the current fraction of keep alive timeout when connection is considered safe to use
227+
/// It helps to avoid situation when a client uses nearly expired connection and receives NoMessageException
228+
216229
virtual std::ostream & sendRequest(HTTPRequest & request);
217230
/// Sends the header for the given HTTP request to
218231
/// the server.
@@ -345,6 +358,8 @@ namespace Net
345358

346359
void assign(HTTPClientSession & session);
347360

361+
void setKeepAliveRequest(int request);
362+
348363
HTTPSessionFactory _proxySessionFactory;
349364
/// Factory to create HTTPClientSession to proxy.
350365
private:
@@ -353,6 +368,8 @@ namespace Net
353368
Poco::UInt16 _port;
354369
ProxyConfig _proxyConfig;
355370
Poco::Timespan _keepAliveTimeout;
371+
int _keepAliveCurrentRequest = 0;
372+
int _keepAliveMaxRequests = 1000;
356373
Poco::Timestamp _lastRequest;
357374
bool _reconnect;
358375
bool _mustReconnect;
@@ -361,6 +378,7 @@ namespace Net
361378
Poco::SharedPtr<std::ostream> _pRequestStream;
362379
Poco::SharedPtr<std::istream> _pResponseStream;
363380

381+
static const double _defaultKeepAliveReliabilityLevel;
364382
static ProxyConfig _globalProxyConfig;
365383

366384
HTTPClientSession(const HTTPClientSession &);
@@ -450,9 +468,19 @@ namespace Net
450468
return _lastRequest;
451469
}
452470

453-
inline void HTTPClientSession::setLastRequest(Poco::Timestamp time)
471+
inline double HTTPClientSession::getKeepAliveReliability() const
472+
{
473+
return _defaultKeepAliveReliabilityLevel;
474+
}
475+
476+
inline int HTTPClientSession::getKeepAliveMaxRequests() const
477+
{
478+
return _keepAliveMaxRequests;
479+
}
480+
481+
inline int HTTPClientSession::getKeepAliveRequest() const
454482
{
455-
_lastRequest = time;
483+
return _keepAliveCurrentRequest;
456484
}
457485

458486
}

base/poco/Net/include/Poco/Net/HTTPMessage.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ namespace Net
120120
/// The value is set to "Keep-Alive" if keepAlive is
121121
/// true, or to "Close" otherwise.
122122

123+
void setKeepAliveTimeout(int timeout, int max_requests);
124+
int getKeepAliveTimeout() const;
125+
int getKeepAliveMaxRequests() const;
126+
123127
bool getKeepAlive() const;
124128
/// Returns true if
125129
/// * the message has a Connection header field and its value is "Keep-Alive"

0 commit comments

Comments
 (0)