timescaledb icon indicating copy to clipboard operation
timescaledb copied to clipboard

Fix policy refresh window too small

Open fabriziomello opened this issue 9 months ago • 1 comments

When adding a CAgg refresh policy using start_offset => '2 months' and end_offset => '0 months' was failing because the policy refresh window is too small and it should cover at least two buckets in the valid time range of timestamptz.

The problem was when calculating the bucket width for the variable bucket size (like months) we're assuming 31 days for each month but when converting the end offset to integer using interval_to_int64 we use 30 days per month. Fixed it by aligning the variable bucket size calculation to also use 30 days.

Disable-check: force-changelog-file

fabriziomello avatar May 03 '24 19:05 fabriziomello

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.00%. Comparing base (59f50f2) to head (7939a78). Report is 142 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6885      +/-   ##
==========================================
+ Coverage   80.06%   81.00%   +0.94%     
==========================================
  Files         190      198       +8     
  Lines       37181    37286     +105     
  Branches     9450     9734     +284     
==========================================
+ Hits        29770    30205     +435     
- Misses       2997     3189     +192     
+ Partials     4414     3892     -522     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 03 '24 19:05 codecov[bot]

Automated backport to 2.14.x not done: cherry-pick failed.

Git status

HEAD detached at origin/2.14.x
You are currently cherry-picking commit d8057c432.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   tsl/test/expected/exp_cagg_monthly.out
	modified:   tsl/test/sql/exp_cagg_monthly.sql

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   tsl/src/bgw_policy/continuous_aggregate_api.c


Job log

timescale-automation avatar May 06 '24 06:05 timescale-automation