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
Fix crash with create_distributed_hypertable #1988
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkindahl
requested review from
pmwkaa,
WireBaron and
gayyappan
and removed request for
a team
June 12, 2020 12:42
gayyappan
reviewed
Jun 12, 2020
svenklemm
reviewed
Jun 13, 2020
mkindahl
force-pushed
the
invalid_dimension_crash
branch
from
June 15, 2020 05:34
a40ea83
to
33f4725
Compare
Codecov Report
@@ Coverage Diff @@
## master #1988 +/- ##
===========================================
+ Coverage 10.91% 90.17% +79.25%
===========================================
Files 205 211 +6
Lines 30185 33501 +3316
===========================================
+ Hits 3296 30209 +26913
+ Misses 26889 3292 -23597
Continue to review full report at Codecov.
|
erimatnor
reviewed
Jun 15, 2020
erimatnor
reviewed
Jun 15, 2020
mkindahl
changed the title
Read space dim info before checking partitioning
Fix crash with create_distributed_hypertable
Jun 16, 2020
mkindahl
force-pushed
the
invalid_dimension_crash
branch
2 times, most recently
from
June 16, 2020 10:27
5581a05
to
83e007c
Compare
erimatnor
approved these changes
Jun 16, 2020
gayyappan
approved these changes
Jun 16, 2020
Function `ts_hypertable_create_from_info` will error if the hypertable already exists unless the if-not-exists flag is not set. If we reach this point, either if-not-exists-flag was set or the hypertable did not exist and was created above. In `ts_hypertable_create_from_info`, a call to `ts_dimension_info_validate` with `space_dim_info` will be made if (and only if) the table did not exist. The function does not only validate the dimension, it also set `dimension_id` field. If the table already existed, `created` will be false and the `dimension_id` will be set to the invalid OID, which means that `ts_hypertable_check_partitioning` will crash since it it expect a proper OID to be passed. This commit fixes that by checking if the hypertable exists prior to calling `ts_hypertable_create_from_info` in `ts_hypertable_create_internal` and aborting with an error if the hypertable already exists. Fixes timescale#1987
mkindahl
force-pushed
the
invalid_dimension_crash
branch
from
June 17, 2020 05:27
83e007c
to
898d155
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Function
ts_hypertable_create_from_info
will error if the hypertablealready exists unless the if-not-exists flag is not set. If we reach
this point, either if-not-exists-flag was set or the hypertable did not
exist and was created above.
In
ts_hypertable_create_from_info
, a call tots_dimension_info_validate
withspace_dim_info
will be made if (andonly if) the table did not exist. The function does not only validate
the dimension, it also set
dimension_id
field.If the table already existed,
created
will be false and thedimension_id
will be set to the invalid OID, which means thatts_hypertable_check_partitioning
will crash since it it expect aproper OID to be passed.
This commit fixes that by checking if the hypertable exists prior to
calling
ts_hypertable_create_from_info
ints_hypertable_create_internal
and aborting with an error if thehypertable already exists.
Fixes #1987