Repository navigation
Conversation
TimeSeries metric families and tagsTimeSeries metric families and tags
|
Workflow [PR], commit [fe7d43d] Summary: ✅
AI ReviewSummaryAdds deduplication caches for PR Metadata
Findings❌ Blockers
Tests
Final Verdict
LLVM Coverage ReportMeasured on commit fe7d43d.
Changed lines: Changed C/C++ lines covered: 412/421 (97.86%) · Uncovered code |
4dda726 to
89195ac
Compare
314216e to
376408c
Compare
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes38 object files changed (+232.92 KiB total), 1 added.
716 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 units600 translation units recompiled, 3760 s compile time in total, 599 of them have a recent master baseline. |
There was a problem hiding this comment.
Thanks @vitlibar for sharing this change. Here is one finding from a source-only review of the PR head.
Veridical.dev reviewed the change:
- Merge readiness — ⛔ Address the supported correctness finding before merging
- Correctness — 🟠 Needs work
- Security — Not assessed in this source-only pass
- Tests — 🟡 Add an A → B → A metric-family metadata regression
- Changed hunks with no finding — Not measured; the whole-review assessment did not complete
1 supported finding · source evidence attached
📝 Walkthrough
This PR adds bounded, expiring deduplication caches for the TimeSeries metric-family and tags targets. The sink filters recently written rows, marks them cached after a successful write, and clears the caches on truncation or through SYSTEM CLEAR TIME SERIES CACHES. It also adds settings and regression coverage for cache behavior.
| File | Change |
|---|---|
src/Storages/TimeSeries/TimeSeriesDeduplicationCache.cpp |
Hashes full rows, filters cached hashes, and manages capacity and expiration. |
src/Storages/TimeSeries/TimeSeriesSink.cpp |
Applies the caches to metric families and eligible tags, then marks successful writes. |
src/Storages/TimeSeries/TimeSeriesSettings.cpp |
Defines cache controls, including the default 3600-second metric-family expiration. |
tests/queries/0_stateless/05243_time_series_deduplication_caches.sql |
Covers repeated rows, changed descriptions, eviction, expiration, clearing, and disabled caches. |
🗺️ How the changes interact
flowchart TD
A[TimeSeries insert] --> B[TimeSeriesSink]
B --> C[Metric-family row]
B --> D[Tags row when eligible]
C --> E[Full-row hash cache]
D --> E
E --> F{Hash already written?}
F -->|Yes| G[Skip target write]
F -->|No| H[Write target row]
H --> I[Mark hash written]
J[Expiration or clear] --> E
Supported defects
| Severity | Where | Issue |
|---|---|---|
| 🟡 Medium | src/Storages/TimeSeries/TimeSeriesDeduplicationCache.cpp:79 |
A metric family's metadata changing A → B → A within the cache period suppresses the final A, leaving B as the latest stored description in the default target. |
Nonblocking observations
None included in this review.
Findings that were reported by other bots
The live discussion already covers same-insert duplicates at cache capacity, cache clearing during concurrent inserts, an access-control test, and documentation. Those are separate from the metadata reversion issue here and are not reposted.
🔬 How the supported defect was verified
TimeSeriesSink::consumeMetricFamilies gives the cache metric_family, type, unit, and help. The cache hashes all four columns and retains both the A and B hashes; when A returns, written_hashes.contains(hash) filters it out. The default metric-family target uses ReplacingMergeTree ORDER BY metric_family, and the expiration setting defaults to 3600 seconds. The added test covers a changed description but not a change back to an earlier description.
Review scope: source-only, incomplete whole-review assessment
The reviewed head was eca7fdc047075c00b0d3117bb44c1da77000830e (30 changed files / 892 added lines). This finding was checked independently against the saved source and the then-live discussion. The broader review stopped at its selection checkpoint; this is not a claim that every change was fully adjudicated. No target code was built or executed.
Reviewed by Veridical · AI-assisted source review · whole-review assessment incomplete · Veridical.dev · [email protected]
f56b232 to
d88370b
Compare
167c4de to
74d8ebc
Compare
74d8ebc to
067ed3e
Compare
1c6351e to
e7263d8
Compare
e7263d8 to
51f6d7e
Compare
|
📊 Cloud Performance Report ✅ AI verdict: This PR adds deduplication caches for inserts into TimeSeries tables, plus a SYSTEM DROP TIME SERIES CACHES statement, new settings, metrics and docs. None of this code runs in ClickBench or TPC-H queries. The only flagged query, ClickBench Q33 at -5.2% (1182 ms to 1121 ms), was already classed as no change because it falls inside master's normal variance band, and its CPU time barely moved. That result matches the diff, so this PR shows no performance effect on either benchmark. clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
The caches store hashes of the rows recently written to the metric families and tags tables, so the same rows aren't written with every insert. The tags table is deduplicated only if `store_min_time_and_max_time` is disabled. An entry expires a fixed time after the row was written, so any difference between a cache and its table disappears within the expiration period.
7fea5f6 to
fe7d43d
Compare
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. |
92d3e39
`master` took version 7 of `TimeSeries` for the deduplication caches (ClickHouse#121915), so the pinned timezone of the default recent samples partition key moves to version 8: `MIN_WITH_UTC_PARTITION_KEY = 8`, `LATEST = 8`, and the version history in `TimeSeriesVersion.h` and in the engine documentation gets both rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master's ClickHouse#121915 added deduplication caches for the metric families and tags tables and took TimeSeries version 7. Resolved on master's structure: - Version 7 stays master's deduplication caches; the separate "tags min max" target becomes version 8 (MIN_WITH_SEPARATE_TAGS_MIN_MAX = 8, LATEST = 8). - The active series cache (TimeSeriesActiveSeriesCache, tags_cache_max_series, tags_cache_ttl_seconds) is dropped in favour of master's tags deduplication cache, which does the same job. - The tags deduplication cache is now also used when min_time and max_time are kept in the "tags min max" table, which is what the split is for. checkTimeSeriesSettings and CREATE AS accept its settings from version 8. - TimeSeriesSink takes master's version and gets the "tags min max" pipeline again; the bounds are written for every block, also when the tags rows were skipped by the cache. - Tests: 05105 and 05239 tested the removed cache and are dropped; 05243 checks that a version 8 table deduplicates tags while its bounds still advance; 04612, 05237, test_external_tags, the gtest and the docs moved to version 8. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add deduplication caches for
TimeSeriesmetric families and tagsThe caches store hashes of the rows recently written to the metric families and tags tables, so the same rows aren't written with every insert. The tags table is deduplicated only if
store_min_time_and_max_timeis disabled.An entry expires a fixed time after the row was written, so any difference between a cache and its table disappears within the expiration period.
The caches exist for tables of version 7 and later. They are configured by the
*_deduplication_cache_max_entriesand*_deduplication_cache_expiration_secondssettings, and cleared byTRUNCATE TABLEand by the newSYSTEM CLEAR TIME SERIES CACHESstatement.Workflow [PR]
Sync PR [sync-upstream/pr/121915]
Version info
26.10.1.900-master(included in26.10and later)