Skip to content

Commit eb5008f

Browse files
committed
Merge 'master' into ncb/splitbychar-test
2 parents 6925e4e + 806653a commit eb5008f

File tree

8 files changed

+24
-13
lines changed

8 files changed

+24
-13
lines changed

src/Common/ProfileEvents.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,8 @@ Event end() { return END; }
11351135

11361136
bool checkCPUOverload(Int64 os_cpu_busy_time_threshold, double min_ratio, double max_ratio, bool should_throw)
11371137
{
1138+
if ((max_ratio <= 0.0) || (max_ratio <= min_ratio))
1139+
return false;
11381140
double cpu_load = global_counters.getCPUOverload(os_cpu_busy_time_threshold);
11391141

11401142
if (cpu_load > DBL_EPSILON)

src/Compression/CompressedReadBufferBase.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "CompressedReadBufferBase.h"
1+
#include <Compression/CompressedReadBufferBase.h>
22

33
#include <bit>
44
#include <cstring>
@@ -179,8 +179,8 @@ size_t CompressedReadBufferBase::readCompressedData(size_t & size_decompressed,
179179

180180
UInt8 header_size = ICompressionCodec::getHeaderSize();
181181
own_compressed_buffer.resize(header_size + sizeof(Checksum));
182-
183182
compressed_in->readStrict(own_compressed_buffer.data(), sizeof(Checksum) + header_size);
183+
own_compressed_buffer_header_init = true;
184184

185185
readHeaderAndGetCodecAndSize(
186186
own_compressed_buffer.data() + sizeof(Checksum),
@@ -233,6 +233,7 @@ size_t CompressedReadBufferBase::readCompressedDataBlockForAsynchronous(size_t &
233233

234234
own_compressed_buffer.resize(header_size + sizeof(Checksum));
235235
compressed_in->readStrict(own_compressed_buffer.data(), sizeof(Checksum) + header_size);
236+
own_compressed_buffer_header_init = true;
236237

237238
readHeaderAndGetCodecAndSize(
238239
own_compressed_buffer.data() + sizeof(Checksum),
@@ -337,7 +338,9 @@ void CompressedReadBufferBase::addDiagnostics(Exception & e) const
337338
if (auto * seekable_in = dynamic_cast<SeekableReadBuffer *>(compressed_in))
338339
current_pos = seekable_in->tryGetPosition();
339340
UInt8 header_size = ICompressionCodec::getHeaderSize();
340-
String header_hex = hexString(own_compressed_buffer.data(), std::min(own_compressed_buffer.size(), sizeof(Checksum) + header_size));
341+
String header_hex = own_compressed_buffer_header_init ?
342+
hexString(own_compressed_buffer.data(), std::min(own_compressed_buffer.size(), sizeof(Checksum) + header_size)) :
343+
String("<uninitialized>"); // We do not print uninitialized memory because it's a security vulnerability and triggers msan
341344

342345
e.addMessage("While reading or decompressing {} (position: {}, typename: {}, compressed data header: {})",
343346
getFileNameFromReadBuffer(*compressed_in),

src/Compression/CompressedReadBufferBase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class CompressedReadBufferBase
2222

2323
/// If 'compressed_in' buffer has whole compressed block - then use it. Otherwise copy parts of data to 'own_compressed_buffer'.
2424
PODArray<char> own_compressed_buffer;
25+
bool own_compressed_buffer_header_init = false; // true if own_compressed_buffer header was initialized
2526
/// Points to memory, holding compressed block.
2627
char * compressed_buffer = nullptr;
2728

src/Core/Settings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6510,8 +6510,8 @@ File/S3 engines/table function will parse paths with '::' as `<archive> :: <file
65106510
DECLARE(Milliseconds, low_priority_query_wait_time_ms, 1000, R"(
65116511
When the query prioritization mechanism is employed (see setting `priority`), low-priority queries wait for higher-priority queries to finish. This setting specifies the duration of waiting.
65126512
)", BETA) \
6513-
DECLARE(Float, min_os_cpu_wait_time_ratio_to_throw, 2.0, "Min ratio between OS CPU wait (OSCPUWaitMicroseconds metric) and busy (OSCPUVirtualTimeMicroseconds metric) times to consider rejecting queries. Linear interpolation between min and max ratio is used to calculate the probability, the probability is 0 at this point.", 0) \
6514-
DECLARE(Float, max_os_cpu_wait_time_ratio_to_throw, 6.0, "Max ratio between OS CPU wait (OSCPUWaitMicroseconds metric) and busy (OSCPUVirtualTimeMicroseconds metric) times to consider rejecting queries. Linear interpolation between min and max ratio is used to calculate the probability, the probability is 1 at this point.", 0) \
6513+
DECLARE(Float, min_os_cpu_wait_time_ratio_to_throw, 0.0, "Min ratio between OS CPU wait (OSCPUWaitMicroseconds metric) and busy (OSCPUVirtualTimeMicroseconds metric) times to consider rejecting queries. Linear interpolation between min and max ratio is used to calculate the probability, the probability is 0 at this point.", 0) \
6514+
DECLARE(Float, max_os_cpu_wait_time_ratio_to_throw, 0.0, "Max ratio between OS CPU wait (OSCPUWaitMicroseconds metric) and busy (OSCPUVirtualTimeMicroseconds metric) times to consider rejecting queries. Linear interpolation between min and max ratio is used to calculate the probability, the probability is 1 at this point.", 0) \
65156515
\
65166516
/* ####################################################### */ \
65176517
/* ########### START OF EXPERIMENTAL FEATURES ############ */ \

src/Core/SettingsChangesHistory.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ const VersionToSettingsChangesMap & getSettingsChangesHistory()
7878
{"page_cache_lookahead_blocks", 16, 16, "Made this setting adjustable on a per-query level."},
7979
{"output_format_pretty_glue_chunks", "0", "auto", "A new setting to make Pretty formats prettier."},
8080
{"parallel_hash_join_threshold", 0, 100'000, "New setting"},
81+
{"min_os_cpu_wait_time_ratio_to_throw", 0, 0, "Setting values were changed and backported to 25.4"},
82+
{"max_os_cpu_wait_time_ratio_to_throw", 0, 0, "Setting values were changed and backported to 25.4"},
8183
{"make_distributed_plan", 0, 0, "New experimental setting."},
8284
{"execute_distributed_plan_locally", 0, 0, "New experimental setting."},
8385
{"default_shuffle_join_bucket_count", 8, 8, "New experimental setting."},
@@ -105,8 +107,8 @@ const VersionToSettingsChangesMap & getSettingsChangesHistory()
105107
{"cast_string_to_variant_use_inference", true, true, "New setting to enable/disable types inference during CAST from String to Variant"},
106108
{"distributed_cache_read_request_max_tries", 20, 20, "New setting"},
107109
{"query_condition_cache_store_conditions_as_plaintext", false, false, "New setting"},
108-
{"min_os_cpu_wait_time_ratio_to_throw", 0, 2, "New setting"},
109-
{"max_os_cpu_wait_time_ratio_to_throw", 0, 6, "New setting"},
110+
{"min_os_cpu_wait_time_ratio_to_throw", 0, 0, "New setting"},
111+
{"max_os_cpu_wait_time_ratio_to_throw", 0, 0, "New setting"},
110112
{"query_plan_merge_filter_into_join_condition", false, true, "Added new setting to merge filter into join condition"},
111113
{"use_local_cache_for_remote_storage", true, false, "Obsolete setting."},
112114
{"iceberg_timestamp_ms", 0, 0, "New setting."},

src/DataTypes/DataTypesDecimal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ inline UInt32 getDecimalScale(const DataTypeDecimal<T> & data_type)
130130

131131
template <typename FromDataType, typename ToDataType, typename ReturnType = void>
132132
requires (IsDataTypeDecimal<FromDataType> && IsDataTypeDecimal<ToDataType>)
133-
ReturnType convertDecimalsImpl(const typename FromDataType::FieldType & value, UInt32 scale_from, UInt32 scale_to, typename ToDataType::FieldType & result);
133+
ReturnType ALWAYS_INLINE convertDecimalsImpl(const typename FromDataType::FieldType & value, UInt32 scale_from, UInt32 scale_to, typename ToDataType::FieldType & result);
134134

135135
#define DISPATCH(FROM_DATA_TYPE, TO_DATA_TYPE) \
136-
extern template void convertDecimalsImpl<FROM_DATA_TYPE, TO_DATA_TYPE, void>(const typename FROM_DATA_TYPE::FieldType & value, UInt32 scale_from, UInt32 scale_to, typename TO_DATA_TYPE::FieldType & result); \
137-
extern template bool convertDecimalsImpl<FROM_DATA_TYPE, TO_DATA_TYPE, bool>(const typename FROM_DATA_TYPE::FieldType & value, UInt32 scale_from, UInt32 scale_to, typename TO_DATA_TYPE::FieldType & result);
136+
extern template ALWAYS_INLINE void convertDecimalsImpl<FROM_DATA_TYPE, TO_DATA_TYPE, void>(const typename FROM_DATA_TYPE::FieldType & value, UInt32 scale_from, UInt32 scale_to, typename TO_DATA_TYPE::FieldType & result); \
137+
extern template ALWAYS_INLINE bool convertDecimalsImpl<FROM_DATA_TYPE, TO_DATA_TYPE, bool>(const typename FROM_DATA_TYPE::FieldType & value, UInt32 scale_from, UInt32 scale_to, typename TO_DATA_TYPE::FieldType & result);
138138
#define INVOKE(X) FOR_EACH_DECIMAL_TYPE_PASS(DISPATCH, X)
139139
FOR_EACH_DECIMAL_TYPE(INVOKE);
140140
#undef INVOKE

tests/clickhouse-test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,10 @@ class MergeTreeSettingsRandomizer:
11791179

11801180

11811181
def replace_in_file(filename, what, with_what):
1182-
os.system(f"LC_ALL=C sed -i -e 's|{what}|{with_what}|g' {filename}")
1182+
with open(filename, "rb") as f:
1183+
data = f.read()
1184+
with open(filename, "wb") as f:
1185+
f.write(data.replace(what.encode(), with_what.encode()))
11831186

11841187

11851188
class TestResult:

tests/queries/0_stateless/01945_show_debug_warning.expect

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ expect eof
4444

4545
if { $Debug_type > 0} {
4646

47-
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_EXPECT_OPT --history_file=$history_file"
47+
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \${CLICKHOUSE_CLIENT_EXPECT_OPT/--no-warnings} --history_file=$history_file"
4848
expect "Warnings:"
4949
expect " * Server was built in debug mode. It will work slowly."
5050
expect ":) "
@@ -58,7 +58,7 @@ send -- "q\r"
5858
expect eof
5959
}
6060

61-
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \$CLICKHOUSE_CLIENT_EXPECT_OPT --max_memory_usage_for_all_queries=123 --history_file=$history_file"
61+
spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT_BINARY \${CLICKHOUSE_CLIENT_EXPECT_OPT/--no-warnings} --max_memory_usage_for_all_queries=123 --history_file=$history_file"
6262
expect "Warnings:"
6363
expect " * Obsolete setting"
6464
expect ":) "

0 commit comments

Comments
 (0)