Repository navigation
chore(dev): cap ClickHouse system log retention at 3 days - #3594
Conversation
The dev ClickHouse config enables system log tables with no TTL, so dev volumes grow without bound (one stack reached 22G of system logs).
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Additional context: grazes a critical path (9 lines in Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
| <query_log> | ||
| <database>system</database> | ||
| <table>query_log</table> | ||
| <ttl>event_date + INTERVAL 3 DAY DELETE</ttl> |
There was a problem hiding this comment.
🔵 minor — The 3-day TTL also applies to the documented Docker Compose deployment, not just dev
The root docker-compose.yml mounts this same file (line 123, data in .volumes/ch_data). DEPLOY.md ("All-in-one Docker Compose Stack") tells people to run that file with docker compose up -d and gives production advice for it. So self-hosters who pull this change silently drop to 3 days of system.query_log, trace_log, part_log and the rest. On their first restart ClickHouse also renames their existing tables to *_0. Those tables are never cleaned up, so they keep growing on disk, and their history is no longer in the table they query. That is the same user-facing concern the PR gives for leaving docker/hyperdx/clickhouseConfig.xml alone. Fix options: give the dev, CI and e2e compose files their own TTL settings (for example a config.d/ drop-in that only they mount) and leave the root docker-compose.yml unchanged. Otherwise, treat this as a user-facing change: add a changeset or release note covering the retention change and the _0 cleanup step.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
PR Review
1 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 1 minor 1 posted as inline comment(s) on the changed lines. Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. This is a dev/test-only change to 🔵 P3 nitpicks (4)
Reviewers (6): correctness, data-migrations, reliability, maintainability, project-standards, testing. Testing gaps: No automated test asserts these TTLs, which is appropriate for throwaway dev infra; validation is manual (start the pinned image on a fresh volume and confirm No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 463 passed • 1 skipped • 1119s
Tests ran across 4 shards in parallel. |
Summary
Adds a 3-day TTL to the ClickHouse system log tables in the dev config (
docker/clickhouse/local/config.xml). Without one, these tables grow without bound in dev volumes.query_log,metric_log,asynchronous_metric_log,processors_profile_log,part_log,trace_log,query_thread_log,query_views_log:event_date + INTERVAL 3 DAY DELETEopentelemetry_span_log: the same TTL onfinish_date, set inside its custom<engine>clauseThe all-in-one image config (
docker/hyperdx/clickhouseConfig.xml) is unchanged.Existing dev volumes keep their old data in renamed
<table>_0tables until you drop them or wipe.volumes/.How to reproduce
SELECT name, engine_full FROM system.tables WHERE database = 'system' AND name LIKE '%_log'. The tables above showTTL ... + toIntervalDay(3); onmainthey have no TTL.🤖 Generated with Claude Code