Skip to content

Instantly share code, notes, and snippets.

@tom-clickhouse
Last active December 28, 2023 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tom-clickhouse/9fa07e8a54acde9dfaa0a296f001ab93 to your computer and use it in GitHub Desktop.
Save tom-clickhouse/9fa07e8a54acde9dfaa0a296f001ab93 to your computer and use it in GitHub Desktop.
Observe async insert errors during buffer flushes
WITH
'default' AS db_name,
'upclick_metrics' AS table_name,
10 as last_x_minutes
SELECT
DENSE_RANK() OVER(ORDER BY hostName()) AS n,
max(event_time) AS flush,
status,
exception,
any(query_id) AS query_id
FROM
clusterAllReplicas(default, system.asynchronous_insert_log)
WHERE
status <> 'Ok'
AND database = db_name AND table = table_name
AND event_time > now() - toIntervalMinute(last_x_minutes)
GROUP BY hostName(), status, exception
ORDER BY
hostName(), flush DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment