Skip to content

Cap refresh start when hypertable has tiered data - #9811

Open
kpan2034 wants to merge 5 commits into
timescale:mainfrom
kpan2034:cap-invals-at-chunk-min
Open

Cap refresh start when hypertable has tiered data#9811
kpan2034 wants to merge 5 commits into
timescale:mainfrom
kpan2034:cap-invals-at-chunk-min

Conversation

@kpan2034

@kpan2034 kpan2034 commented May 13, 2026

Copy link
Copy Markdown
Member

Currently during a refresh, we process the ranges before the earliest chunk in the hypertable as well. This can lead to potential missing data when tiered data is present but tiered reads are disabled during the refresh.

By capping the refresh range at the start of the earliest chunk, any invalidations before the earliest chunk are no longer processed and removed. Thus, in a subsequent refresh, if tiered data reads are enabled, that data would be materialized in the CAgg.

We only need to do this when the hypertable has tiered data. Any new tiered data will either have been processed before tiering (since it exists in some chunk) or will be inserted after this refresh (which will generate invalidations).

We also cap the refresh start when generating batches for an incremental refresh.

@kpan2034 kpan2034 self-assigned this May 13, 2026
@kpan2034
kpan2034 force-pushed the cap-invals-at-chunk-min branch from 0ef8281 to 3e5c07d Compare May 27, 2026 14:28
@vineethapai vineethapai added this to the v2.28.0 milestone Jun 1, 2026
@kpan2034
kpan2034 force-pushed the cap-invals-at-chunk-min branch from 3e5c07d to 221041a Compare June 5, 2026 20:33
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
tsl/src/continuous_aggs/invalidation.c 81.25% 1 Missing and 2 partials ⚠️
tsl/src/continuous_aggs/refresh.c 77.77% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@kpan2034
kpan2034 force-pushed the cap-invals-at-chunk-min branch from 221041a to fbd5fcd Compare June 5, 2026 21:13
@kpan2034
kpan2034 marked this pull request as ready for review June 5, 2026 21:13
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

@melihmutlu, @natalya-aksman: please review this pull request.

Powered by pull-review

@kpan2034
kpan2034 force-pushed the cap-invals-at-chunk-min branch from fbd5fcd to 1ed30b3 Compare June 5, 2026 21:20
@kpan2034 kpan2034 changed the title Cap refresh range start at dimension minimum Cap refresh start when hypertable has tiered data Jun 5, 2026
@kpan2034
kpan2034 force-pushed the cap-invals-at-chunk-min branch from 1ed30b3 to 3ddfbf5 Compare June 5, 2026 21:23
@kpan2034
kpan2034 requested review from pnthao and removed request for natalya-aksman June 5, 2026 21:24
Comment thread tsl/src/continuous_aggs/invalidation.c Outdated
@kpan2034
kpan2034 force-pushed the cap-invals-at-chunk-min branch 4 times, most recently from 6d40793 to ff7856d Compare June 10, 2026 23:43
Comment thread tsl/test/expected/cagg_refresh_tiered.out
Comment thread src/dimension_slice.c
Comment thread tsl/src/continuous_aggs/invalidation.c
@philkra philkra modified the milestones: v2.28.0, v2.28.1, 2.28.2 Jun 15, 2026
@kpan2034 kpan2034 modified the milestones: v2.28.2, v2.29.0 Jun 29, 2026
kpan2034 added 2 commits July 1, 2026 09:46
Currently during a refresh, we process the ranges before the earliest
chunk in the hypertable as well. This can lead to potential missing data
when tiered data is present but tiered reads are disabled during the
refresh.

By capping the refresh range at the start of the earliest chunk, any
invalidations before the earliest chunk are no longer processed and
removed. Thus, in a subsequent refresh, if tiered data reads are
enabled, that data would be materialized in the CAgg.

We only need to do this when the hypertable has tiered data. Any new
tiered data will either have been processed before tiering (since it
exists in some chunk) or will be inserted after this refresh (which will
generate invalidations).
Capping is done incorrectly when the OSM chunk is the earliest chunk.
kpan2034 added 3 commits July 1, 2026 09:46
Incremental batch generation would generate batches considering tiered
data ranges, even if tiered reads are disabled. This can lead to
invalid batches since we cap the refresh start to the earliest chunk in
the hypertable during the refresh.
@kpan2034
kpan2034 force-pushed the cap-invals-at-chunk-min branch from 71d94c6 to 321f063 Compare July 1, 2026 15:46
@philkra philkra removed this from the v2.29.0 milestone Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants