Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support of deprecated ClickHouse versions older 22.1 #72

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions ch_tools/chadmin/internal/diagnostics/diagnose.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
ClickhouseUsersConfig,
)
from ch_tools.common.dbaas import DbaasConfig
from ch_tools.common.utils import version_ge

from ..utils import clickhouse_client
from .data import DiagnosticsData, add_command, add_query, execute_query
Expand Down Expand Up @@ -131,11 +130,6 @@ def diagnose(ctx: Context, output_format: str, normalize_queries: bool) -> None:
format_=OutputFormat.Vertical,
section="Replication",
),
]
)

if version_ge(version, "21.3"):
tasks.append(
add_query(
diagnostics,
"Replicated fetches",
Expand All @@ -144,7 +138,8 @@ def diagnose(ctx: Context, output_format: str, normalize_queries: bool) -> None:
format_=OutputFormat.Vertical,
section="Replication",
),
)
]
)

tasks.extend(
[
Expand Down
50 changes: 1 addition & 49 deletions ch_tools/chadmin/internal/diagnostics/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,9 @@
formatReadableSize(memory_usage) AS "memory usage",
user,
multiIf(empty(client_name), http_user_agent, concat(client_name, ' ', toString(client_version_major), '.', toString(client_version_minor), '.', toString(client_version_patch))) AS client,
{% if version_ge('21.3') -%}
thread_ids,
{% endif -%}
{% if version_ge('21.8') -%}
ProfileEvents,
Settings
{% else -%}
ProfileEvents.Names,
ProfileEvents.Values,
Settings.Names,
Settings.Values
{% endif -%}
FROM system.processes
ORDER BY elapsed DESC
"""
Expand All @@ -320,9 +311,7 @@
query_start_time,
query_duration_ms,
query_id,
{% if version_ge('21.3') -%}
query_kind,
{% endif -%}
is_initial_query,
{% if normalize_queries -%}
normalizeQuery(query) AS normalized_query,
Expand All @@ -339,7 +328,6 @@
initial_user,
multiIf(empty(client_name), http_user_agent, concat(client_name, ' ', toString(client_version_major), '.', toString(client_version_minor), '.', toString(client_version_patch))) AS client,
client_hostname,
{% if version_ge('21.3') -%}
databases,
tables,
columns,
Expand All @@ -353,16 +341,8 @@
used_storages,
used_table_functions,
thread_ids,
{% endif -%}
{% if version_ge('21.8') -%}
ProfileEvents,
Settings
{% else -%}
ProfileEvents.Names,
ProfileEvents.Values,
Settings.Names,
Settings.Values
{% endif -%}
FROM system.query_log
WHERE type != 'QueryStart'
AND event_date >= today() - 1
Expand All @@ -380,9 +360,7 @@
query_start_time,
query_duration_ms,
query_id,
{% if version_ge('21.3') -%}
query_kind,
{% endif -%}
is_initial_query,
{% if normalize_queries -%}
normalizeQuery(query) AS normalized_query,
Expand All @@ -399,7 +377,6 @@
initial_user,
multiIf(empty(client_name), http_user_agent, concat(client_name, ' ', toString(client_version_major), '.', toString(client_version_minor), '.', toString(client_version_patch))) AS client,
client_hostname,
{% if version_ge('21.3') -%}
databases,
tables,
columns,
Expand All @@ -413,16 +390,8 @@
used_storages,
used_table_functions,
thread_ids,
{% endif -%}
{% if version_ge('21.8') -%}
ProfileEvents,
Settings
{% else -%}
ProfileEvents.Names,
ProfileEvents.Values,
Settings.Names,
Settings.Values
{% endif -%}
FROM system.query_log
WHERE type != 'QueryStart'
AND event_date >= today() - 1
Expand All @@ -440,9 +409,7 @@
query_start_time,
query_duration_ms,
query_id,
{% if version_ge('21.3') -%}
query_kind,
{% endif -%}
is_initial_query,
{% if normalize_queries -%}
normalizeQuery(query) AS normalized_query,
Expand All @@ -459,7 +426,6 @@
initial_user,
multiIf(empty(client_name), http_user_agent, concat(client_name, ' ', toString(client_version_major), '.', toString(client_version_minor), '.', toString(client_version_patch))) AS client,
client_hostname,
{% if version_ge('21.3') -%}
databases,
tables,
columns,
Expand All @@ -473,16 +439,8 @@
used_storages,
used_table_functions,
thread_ids,
{% endif -%}
{% if version_ge('21.8') -%}
ProfileEvents,
Settings
{% else -%}
ProfileEvents.Names,
ProfileEvents.Values,
Settings.Names,
Settings.Values
{% endif -%}
FROM system.query_log
WHERE type != 'QueryStart'
AND event_date >= today() - 1
Expand All @@ -497,9 +455,7 @@
# language=clickhouse
r"""
SELECT
{% if version_ge('21.8') -%}
thread_name,
{% endif -%}
min(thread_id) AS min_thread_id,
count() AS threads,
'\n' || arrayStringConcat(
Expand All @@ -510,11 +466,7 @@
arrayMap(x -> demangle(addressToSymbol(x)), trace)),
'\n') AS trace
FROM system.stack_trace
GROUP BY
{% if version_ge('21.8') -%}
thread_name,
{% endif -%}
trace
GROUP BY thread_name, trace
ORDER BY min_thread_id
"""
)
Expand Down
8 changes: 0 additions & 8 deletions ch_tools/chadmin/internal/part.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def list_parts(
delete_ttl_info_max,
move_ttl_info.expression,
move_ttl_info.min,
{% if version_ge('21.8') -%}
move_ttl_info.max,
default_compression_codec,
recompression_ttl_info.expression,
Expand All @@ -62,9 +61,6 @@ def list_parts(
rows_where_ttl_info.min,
rows_where_ttl_info.max,
projections
{% else -%}
move_ttl_info.max
{% endif -%}
FROM system.parts
{% if database -%}
WHERE database {{ format_str_match(database) }}
Expand Down Expand Up @@ -289,18 +285,14 @@ def list_part_log(
SELECT
event_time,
event_type,
{% if version_ge('21.8') -%}
merge_reason,
{% endif -%}
duration_ms,
database,
table,
partition_id,
part_name,
{% if version_ge('21.8') -%}
part_type,
disk_name,
{% endif -%}
rows,
size_in_bytes,
merged_from,
Expand Down