Skip to content

Commit 99b3242

Browse files
authored
Merge pull request ClickHouse#88917 from ClickHouse/vdimir/issue_88900
Forbid setting temporary_files_buffer_size=0
2 parents 261ebda + 0cd4867 commit 99b3242

File tree

7 files changed

+12
-5
lines changed

7 files changed

+12
-5
lines changed

src/Core/Settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3202,7 +3202,7 @@ Possible values:
32023202
- NONE — No compression is applied.
32033203
)", 0) \
32043204
\
3205-
DECLARE(UInt64, temporary_files_buffer_size, DBMS_DEFAULT_BUFFER_SIZE, "Size of the buffer for temporary files writers. Larger buffer size means less system calls, but more memory consumption.", 0) \
3205+
DECLARE(NonZeroUInt64, temporary_files_buffer_size, DBMS_DEFAULT_BUFFER_SIZE, "Size of the buffer for temporary files writers. Larger buffer size means less system calls, but more memory consumption.", 0) \
32063206
DECLARE(UInt64, max_rows_to_transfer, 0, R"(
32073207
Maximum size (in rows) that can be passed to a remote server or saved in a
32083208
temporary table when the GLOBAL IN/JOIN section is executed.

src/Interpreters/JoinOperator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace Setting
4949
extern const SettingsUInt64 max_joined_block_size_rows;
5050
extern const SettingsUInt64 max_joined_block_size_bytes;
5151
extern const SettingsString temporary_files_codec;
52-
extern const SettingsUInt64 temporary_files_buffer_size;
52+
extern const SettingsNonZeroUInt64 temporary_files_buffer_size;
5353
extern const SettingsUInt64 join_output_by_rowlist_perkey_rows_threshold;
5454
extern const SettingsUInt64 join_to_sort_minimum_perkey_rows;
5555
extern const SettingsUInt64 join_to_sort_maximum_table_rows;
@@ -92,7 +92,7 @@ namespace QueryPlanSerializationSetting
9292
extern const QueryPlanSerializationSettingsUInt64 max_joined_block_size_rows;
9393
extern const QueryPlanSerializationSettingsUInt64 max_joined_block_size_bytes;
9494
extern const QueryPlanSerializationSettingsString temporary_files_codec;
95-
extern const QueryPlanSerializationSettingsUInt64 temporary_files_buffer_size;
95+
extern const QueryPlanSerializationSettingsNonZeroUInt64 temporary_files_buffer_size;
9696
extern const QueryPlanSerializationSettingsUInt64 join_output_by_rowlist_perkey_rows_threshold;
9797
extern const QueryPlanSerializationSettingsUInt64 join_to_sort_minimum_perkey_rows;
9898
extern const QueryPlanSerializationSettingsUInt64 join_to_sort_maximum_table_rows;

src/Interpreters/ProcessList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace Setting
5050
extern const SettingsBool replace_running_query;
5151
extern const SettingsMilliseconds replace_running_query_max_wait_ms;
5252
extern const SettingsString temporary_files_codec;
53-
extern const SettingsUInt64 temporary_files_buffer_size;
53+
extern const SettingsNonZeroUInt64 temporary_files_buffer_size;
5454
extern const SettingsOverflowMode timeout_overflow_mode;
5555
extern const SettingsBool trace_profile_events;
5656
extern const SettingsMilliseconds low_priority_query_wait_time_ms;

src/Processors/QueryPlan/QueryPlanSerializationSettings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace DB
7777
\
7878
DECLARE(UInt64, max_rows_in_set_to_optimize_join, 0, "Maximal size of the set to filter joined tables by each other's row sets before joining.", 0) \
7979
DECLARE(String, temporary_files_codec, "LZ4", "Sets compression codec for temporary files used in sorting and joining operations on disk.", 0) \
80-
DECLARE(UInt64, temporary_files_buffer_size, DBMS_DEFAULT_BUFFER_SIZE, "Size of the buffer for temporary files writers. Larger buffer size means less system calls, but more memory consumption.", 0) \
80+
DECLARE(NonZeroUInt64, temporary_files_buffer_size, DBMS_DEFAULT_BUFFER_SIZE, "Size of the buffer for temporary files writers. Larger buffer size means less system calls, but more memory consumption.", 0) \
8181
\
8282
DECLARE(Bool, collect_hash_table_stats_during_joins, true, "Enable collecting hash table statistics to optimize memory allocation", 0) \
8383
DECLARE(UInt64, max_size_to_preallocate_for_joins, 1'000'000'000'000, "For how many elements it is allowed to preallocate space in all hash tables in total before join", 0) \

tests/clickhouse-test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,7 @@ class SettingsRandomizer:
11701170
"use_skip_indexes_if_final": lambda: random.randint(0, 1),
11711171
"use_skip_indexes_on_data_read": lambda: random.randint(0, 1),
11721172
"optimize_rewrite_like_perfect_affix": lambda: random.randint(0, 1),
1173+
"temporary_files_buffer_size": lambda: random.randint(128, 2048),
11731174
# Use the new reader most of the time.
11741175
"input_format_parquet_use_native_reader_v3": lambda: min(1, random.randint(0, 5)),
11751176
"enable_lazy_columns_replication": lambda: random.randint(0, 1),

tests/queries/0_stateless/03701_temporary_files_buffer_size.reference

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CREATE TABLE t0 (c0 Int) ENGINE = Memory();
2+
INSERT INTO TABLE t0 (c0) VALUES (1);
3+
SELECT c0 FROM t0 GROUP BY c0
4+
SETTINGS max_bytes_before_external_group_by = 1
5+
, temporary_files_buffer_size = 0
6+
, group_by_two_level_threshold = 1; -- { clientError BAD_ARGUMENTS }

0 commit comments

Comments
 (0)