Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assume custom time type range is same as bigint #2544

Merged
merged 3 commits into from
Oct 15, 2020

Conversation

erimatnor
Copy link
Contributor

The database must know the valid time range of a custom time type,
similar to how it knows the time ranges of officially supported time
types. However, the only way to "know" the valid time range of a
custom time type is to assume it is the same as the one of a supported
time type.

A previous commit tried to make such assumptions by finding an
appropriate cast from the custom time type to a supported time
type. However, this fails in case there are multiple casts available
that each could return a different type and range.

This change restricts the choice of valid time ranges to only that of
the bigint time type.

Fixes #2523

@codecov
Copy link

codecov bot commented Oct 14, 2020

Codecov Report

Merging #2544 into master will increase coverage by 0.13%.
The diff coverage is 97.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2544      +/-   ##
==========================================
+ Coverage   90.06%   90.20%   +0.13%     
==========================================
  Files         212      212              
  Lines       34228    34148      -80     
==========================================
- Hits        30829    30802      -27     
+ Misses       3399     3346      -53     
Impacted Files Coverage Δ
src/bgw/job.c 95.07% <ø> (ø)
src/catalog.h 100.00% <ø> (ø)
src/utils.h 71.42% <ø> (ø)
tsl/src/continuous_aggs/insert.c 85.71% <ø> (-0.11%) ⬇️
src/utils.c 79.11% <80.00%> (-0.94%) ⬇️
src/dimension.c 95.41% <100.00%> (ø)
src/time_utils.c 97.43% <100.00%> (-0.03%) ⬇️
tsl/src/continuous_aggs/create.c 96.90% <100.00%> (-0.02%) ⬇️
tsl/src/continuous_aggs/invalidation.c 98.10% <100.00%> (-0.09%) ⬇️
tsl/src/continuous_aggs/invalidation_threshold.c 63.63% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e33a72a...571b2c1. Read the comment docs.

@erimatnor erimatnor force-pushed the fix-custom-time-types branch 2 times, most recently from 6ce70f2 to e530418 Compare October 14, 2020 14:35
@erimatnor erimatnor marked this pull request as ready for review October 14, 2020 15:01
@erimatnor erimatnor requested a review from a team as a code owner October 14, 2020 15:01
@erimatnor erimatnor requested review from pmwkaa, k-rus, svenklemm, mkindahl, WireBaron and a team and removed request for a team October 14, 2020 15:01
@erimatnor erimatnor force-pushed the fix-custom-time-types branch 2 times, most recently from 258ebc8 to 9a46609 Compare October 14, 2020 16:07
@erimatnor
Copy link
Contributor Author

There's an extra commit attached to this PR, which enhances functions for saturating subtraction and addition. Strictly, this could also be a separate PR if people feel strongly about this.

src/dimension.c Outdated Show resolved Hide resolved
src/time_utils.c Outdated Show resolved Hide resolved
src/time_utils.c Outdated Show resolved Hide resolved
src/time_utils.c Outdated Show resolved Hide resolved
src/time_utils.h Outdated Show resolved Hide resolved
The database must know the valid time range of a custom time type,
similar to how it knows the time ranges of officially supported time
types. However, the only way to "know" the valid time range of a
custom time type is to assume it is the same as the one of a supported
time type.

A previous commit tried to make such assumptions by finding an
appropriate cast from the custom time type to a supported time
type. However, this fails in case there are multiple casts available
that each could return a different type and range.

This change restricts the choice of valid time ranges to only that of
the bigint time type.

Fixes timescale#2523
Fix a check for a compatible chunk time interval type when creating a
hypertable with a custom time type.

Previously, the check allowed `Interval` type intervals for any
dimension type that is not an integer type, including custom time
types. The check is now changed so that it only accepts an `Interval`
for timestamp and date type dimensions.

A number of related error messages are also cleaned up so that they
are more consistent and conform to the error style guide.
The functions for saturating addition and subtraction of time values
assumed positive intervals as input. This change generalizes the code
to also handle negative intervals being added or subtracted.
@erimatnor erimatnor merged commit 5564ad8 into timescale:master Oct 15, 2020
@erimatnor erimatnor deleted the fix-custom-time-types branch October 15, 2020 16:58
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request Oct 20, 2020
This release candidate contains bugfixes since the previous release candidate.

**Minor Features**
* timescale#2520 Support non-transactional distibuted_exec

**Bugfixes**
* timescale#2307 Overflow handling for refresh policy with integer time
* timescale#2503 Remove error for correct bootstrap of data node
* timescale#2507 Fix validation logic when adding a new data node
* timescale#2510 Fix outer join qual propagation
* timescale#2514 Lock dimension slices when creating new chunk
* timescale#2515 Add if_attached argument to detach_data_node()
* timescale#2517 Fix member access within misaligned address in chunk_update_colstats
* timescale#2525 Fix index creation on hypertables with dropped columns
* timescale#2543 Pass correct status to lock_job
* timescale#2544 Assume custom time type range is same as bigint
* timescale#2563 Fix DecompressChunk path generation
* timescale#2564 Improve continuous aggregate datatype handling
* timescale#2568 Change use of ssl_dir GUC
* timescale#2571 Make errors and messages conform to style guide
@svenklemm svenklemm mentioned this pull request Oct 20, 2020
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request Oct 20, 2020
This release candidate contains bugfixes since the previous release candidate.

**Minor Features**
* timescale#2520 Support non-transactional distibuted_exec

**Bugfixes**
* timescale#2307 Overflow handling for refresh policy with integer time
* timescale#2503 Remove error for correct bootstrap of data node
* timescale#2507 Fix validation logic when adding a new data node
* timescale#2510 Fix outer join qual propagation
* timescale#2514 Lock dimension slices when creating new chunk
* timescale#2515 Add if_attached argument to detach_data_node()
* timescale#2517 Fix member access within misaligned address in chunk_update_colstats
* timescale#2525 Fix index creation on hypertables with dropped columns
* timescale#2543 Pass correct status to lock_job
* timescale#2544 Assume custom time type range is same as bigint
* timescale#2563 Fix DecompressChunk path generation
* timescale#2564 Improve continuous aggregate datatype handling
* timescale#2568 Change use of ssl_dir GUC
* timescale#2571 Make errors and messages conform to style guide
* timescale#2577 Exclude compressed chunks from ANALYZE/VACUUM
svenklemm added a commit to svenklemm/timescaledb that referenced this pull request Oct 20, 2020
This release candidate contains bugfixes since the previous release candidate.

**Minor Features**
* timescale#2520 Support non-transactional distibuted_exec

**Bugfixes**
* timescale#2307 Overflow handling for refresh policy with integer time
* timescale#2503 Remove error for correct bootstrap of data node
* timescale#2507 Fix validation logic when adding a new data node
* timescale#2510 Fix outer join qual propagation
* timescale#2514 Lock dimension slices when creating new chunk
* timescale#2515 Add if_attached argument to detach_data_node()
* timescale#2517 Fix member access within misaligned address in chunk_update_colstats
* timescale#2525 Fix index creation on hypertables with dropped columns
* timescale#2543 Pass correct status to lock_job
* timescale#2544 Assume custom time type range is same as bigint
* timescale#2563 Fix DecompressChunk path generation
* timescale#2564 Improve continuous aggregate datatype handling
* timescale#2568 Change use of ssl_dir GUC
* timescale#2571 Make errors and messages conform to style guide
* timescale#2577 Exclude compressed chunks from ANALYZE/VACUUM
svenklemm added a commit that referenced this pull request Oct 20, 2020
This release candidate contains bugfixes since the previous release candidate.

**Minor Features**
* #2520 Support non-transactional distibuted_exec

**Bugfixes**
* #2307 Overflow handling for refresh policy with integer time
* #2503 Remove error for correct bootstrap of data node
* #2507 Fix validation logic when adding a new data node
* #2510 Fix outer join qual propagation
* #2514 Lock dimension slices when creating new chunk
* #2515 Add if_attached argument to detach_data_node()
* #2517 Fix member access within misaligned address in chunk_update_colstats
* #2525 Fix index creation on hypertables with dropped columns
* #2543 Pass correct status to lock_job
* #2544 Assume custom time type range is same as bigint
* #2563 Fix DecompressChunk path generation
* #2564 Improve continuous aggregate datatype handling
* #2568 Change use of ssl_dir GUC
* #2571 Make errors and messages conform to style guide
* #2577 Exclude compressed chunks from ANALYZE/VACUUM
svenklemm added a commit that referenced this pull request Oct 20, 2020
This release candidate contains bugfixes since the previous release candidate.

**Minor Features**
* #2520 Support non-transactional distibuted_exec

**Bugfixes**
* #2307 Overflow handling for refresh policy with integer time
* #2503 Remove error for correct bootstrap of data node
* #2507 Fix validation logic when adding a new data node
* #2510 Fix outer join qual propagation
* #2514 Lock dimension slices when creating new chunk
* #2515 Add if_attached argument to detach_data_node()
* #2517 Fix member access within misaligned address in chunk_update_colstats
* #2525 Fix index creation on hypertables with dropped columns
* #2543 Pass correct status to lock_job
* #2544 Assume custom time type range is same as bigint
* #2563 Fix DecompressChunk path generation
* #2564 Improve continuous aggregate datatype handling
* #2568 Change use of ssl_dir GUC
* #2571 Make errors and messages conform to style guide
* #2577 Exclude compressed chunks from ANALYZE/VACUUM
svenklemm added a commit that referenced this pull request Oct 20, 2020
This release candidate contains bugfixes since the previous release candidate.

**Minor Features**
* #2520 Support non-transactional distibuted_exec

**Bugfixes**
* #2307 Overflow handling for refresh policy with integer time
* #2503 Remove error for correct bootstrap of data node
* #2507 Fix validation logic when adding a new data node
* #2510 Fix outer join qual propagation
* #2514 Lock dimension slices when creating new chunk
* #2515 Add if_attached argument to detach_data_node()
* #2517 Fix member access within misaligned address in chunk_update_colstats
* #2525 Fix index creation on hypertables with dropped columns
* #2543 Pass correct status to lock_job
* #2544 Assume custom time type range is same as bigint
* #2563 Fix DecompressChunk path generation
* #2564 Improve continuous aggregate datatype handling
* #2568 Change use of ssl_dir GUC
* #2571 Make errors and messages conform to style guide
* #2577 Exclude compressed chunks from ANALYZE/VACUUM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom time types broken for hypertables in master
4 participants