timescaledb icon indicating copy to clipboard operation
timescaledb copied to clipboard

Fix error in show_chunks

Open nikkhils opened this issue 4 months ago • 7 comments

If "created_after/before" is used with a "time" type partitioning column then show_chunks was not showing appropriate list due to a mismatch in the comparison of the "creation_time" metadata (which is stored as a timestamptz) with the internally converted epoch based input argument value. This is now fixed by not doing the unnecessary conversion into the internal format for cases where it's not needed.

Fixes #6611

nikkhils avatar Feb 08 '24 13:02 nikkhils

@akuzm, @svenklemm: please review this pull request.

Powered by pull-review

github-actions[bot] avatar Feb 08 '24 13:02 github-actions[bot]

Codecov Report

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

Project coverage is 80.96%. Comparing base (59f50f2) to head (799ee65). Report is 62 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6617      +/-   ##
==========================================
+ Coverage   80.06%   80.96%   +0.89%     
==========================================
  Files         190      191       +1     
  Lines       37181    36356     -825     
  Branches     9450     9435      -15     
==========================================
- Hits        29770    29436     -334     
- Misses       2997     3168     +171     
+ Partials     4414     3752     -662     

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

codecov[bot] avatar Feb 08 '24 14:02 codecov[bot]

Does this also fix add_compression_policy() with the compress_created_before argument?

kevcenteno avatar Feb 11 '24 20:02 kevcenteno

add_compression_policy

@kevcenteno the add_compression_policy API takes in an interval only as input. I believe the handling for that is good enough. Did you see any issues with it in your testing?

nikkhils avatar Feb 13 '24 14:02 nikkhils

@nikkhils I did see the same issue with the add_compression_policy when using the compress_created_before argument; that is, chunks were immediately being compressed without satisfying the interval:

Given SELECT add_compression_policy('cpu', compress_created_before => INTERVAL '3 hours');

Expect A chunk that was created 1 hour ago to not be compressed

Actual The chunk that was created 1 hour ago is compressed

This lead me to discovering the show_chunks issue. In both cases, I used an interval.

kevcenteno avatar Feb 13 '24 14:02 kevcenteno

@nikkhils I did see the same issue with the add_compression_policy when using the compress_created_before argument; that is, chunks were immediately being compressed without satisfying the interval:

Given SELECT add_compression_policy('cpu', compress_created_before => INTERVAL '3 hours');

Expect A chunk that was created 1 hour ago to not be compressed

Actual The chunk that was created 1 hour ago is compressed

This lead me to discovering the show_chunks issue. In both cases, I used an interval.

@kevcenteno right. So, the compression policy job calls show_chunks underneath. Since this PR now fixes show_chunks, the issue with the add_compression_policy is also fixed now. Thanks for the report!

nikkhils avatar Feb 15 '24 08:02 nikkhils

@nikkhils I suspected as much, but thank you for verifying!

kevcenteno avatar Feb 15 '24 14:02 kevcenteno