Repository navigation
Conversation
A restarted server began with an empty cache, so the first inserts wrote every time series again. The table now reads the tags table into the cache during startup, up to the cache capacity.
|
Workflow [PR], commit [911d38a] Summary: ❌
AI ReviewSummaryThe PR fills the Findings❌ Blockers
Tests
Final Verdict❌ Block. Preserve the latest-row invariant during bounded prewarming and add the regression above. |
|
A robot was over-eager. Dropped into draft. |
The prewarm query keeps distinct series, and the remembered age stays inside the range steady_clock can subtract. Startup waits for the tags table by name.
Each timed repetition detaches the table, attaches it, and inserts the stored series, so the insert starts from a fresh cache.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes4 object files changed (+73.69 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units23 translation units recompiled, 128 s compile time in total, 23 of them have a recent master baseline. |
…s-tags-cache-prewarm
…s-tags-cache-prewarm
The startup read stops after one row per cache entry, one byte per cache byte, or ten seconds. Overflow mode is `break`. An internal process list entry applies the row and byte limits.
A loader thread has no thread group. `ProcessList::insert` requires one. The prewarm attaches a group with `ThreadGroupSwitcher` and restores the caller group.
…s-tags-cache-prewarm # Conflicts: # src/Storages/StorageTimeSeries.cpp
…s-tags-cache-prewarm
| /// `LIMIT` then applies to distinct rows, so repeated rows of one series do not fill the cache. | ||
| select_query->distinct = true; | ||
| select_query->setExpression(ASTSelectQuery::Expression::LIMIT_LENGTH, make_intrusive<ASTLiteral>(static_cast<UInt64>(max_entries))); |
There was a problem hiding this comment.
❌ Blocker: Preserve the latest row for each key when prewarming
DISTINCT removes identical rows, but does not choose the latest row for an id. With a custom id expression, different tag rows can share a key; this LIMIT can retain an older row and omit the current one. addWrittenRows then treats that older value as current, so a subsequent insert changing the tags back to it is silently skipped. This violates the cache's existing latest-row-per-key contract and changes query results.
Reproduced with the PR-head fast-test binary: use tags_deduplication_cache_size_bytes = 144, TAGS INNER COLUMNS (id UInt64 DEFAULT sipHash64(metric_name)), and ReplacingMergeTree ORDER BY (metric_name, id) SETTINGS index_granularity = 1. With optimize_on_insert = 0, insert ('m', {'job':'A'}) and ('m', {'job':'B'}) together, then detach/attach and insert A again. SELECT ... FINAL still returns B, and the physical tags count stays at two. After OPTIMIZE ... FINAL removes the old A row, another insert of A is still skipped and only B remains. Clearing the cache makes the same insert correctly produce A.
Please seed only rows known to represent the current value for their key, or conservatively exclude keys for which that cannot be established within the read budget. Add regression coverage for a bounded prewarm over multiple stored values of one key.
PromQL Compliance ReportBaseline: S3 master
Extended support (upstream engine tests): native-histogram exclusions: 149; excluded assertions: 248; upstream Note: Prometheus compliance score is unchanged vs baseline. |
Since ClickHouse#128261 a PR that changes only performance tests runs the Iceberg jobs on the changed tests only, so often no query is measured on both servers (the Iceberg rewrite refuses every changed test, only partial queries, or a skipped test). Then analyze_queries crashed: query-run-metric-names.tsv is empty, so its scalar subquery throws INCORRECT_RESULT_OF_SCALAR_SUBQUERY, and the per-query loop never creates analyze/commands.txt and analyze/query-metric-stats.tsv. The denorm file was never written, report() stopped at its first read, before it wrote all-query-metrics.tsv and the other comparison files, the check said "Errors while building the report." instead of the per-test errors, and "Insert historical data" failed with FileNotFoundError. Create the two files before the loop, the same way confirm_changes already does for its own files, and take any(n) from the names file: an aggregate without GROUP BY returns one row, [] for an empty file and the only row otherwise. The Total ratio of a report with no compared query is the neutral 1x instead of nan, as for a test whose changes are all demoted. A run with compared queries writes the same files as before. Validated by replaying compare.sh (stage=analyze_queries) in the performance-comparison image on the CI artifacts of ClickHouse#101273, ClickHouse#113575 and ClickHouse#126132 (before: the CI errors; after: an empty errors.log, and "20 errors" with the Iceberg rewrite hint for ClickHouse#101273), and on a MergeTree job of ClickHouse#101273 (same analysis and report files). Related: ClickHouse#101273 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A restarted server begins with an empty tags deduplication cache, so the server reinserted every series again, while also drastically reducing insert performance while it hydrated its cache.
StorageTimeSeriesnow reads the tags table into the cache during startup, up to the cache capacity.The client time is one call that detaches, attaches, and inserts 10,000 series, so the prewarm offsets the faster insert. The insert CPU time and tag misses cover only the re-insert, with an empty cache before the prewarm and a filled cache after it.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
The
TimeSeriestags deduplication cache is filled from the tags table when the table starts, so a restarted server does not degrade on write performance when initially filling its cache.Workflow [PR]
Sync PR [sync-upstream/pr/126132]