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

Fix crash in add_job when given NULL interval #2683

Merged
merged 1 commit into from Nov 26, 2020

Conversation

erimatnor
Copy link
Contributor

@erimatnor erimatnor commented Nov 25, 2020

This change fixes a crash in add_job when given an NULL
schedule interval as input. In addition, the following improvements
have been implemented for all job API functions:

  • Validation of input parameters, specifically NULL checks
  • Improved error messages for clarity and consistency
  • Tests for bad input arguments

@erimatnor erimatnor added the bug label Nov 25, 2020
@erimatnor erimatnor force-pushed the fix-add-job-crash branch 2 times, most recently from cdf5e7f to 6d90ffe Compare November 25, 2020 20:13
@erimatnor erimatnor marked this pull request as ready for review November 25, 2020 21:12
@erimatnor erimatnor requested a review from a team as a code owner November 25, 2020 21:12
@erimatnor erimatnor requested review from pmwkaa, k-rus, gayyappan, svenklemm and mkindahl and removed request for a team and pmwkaa November 25, 2020 21:12
Copy link
Contributor

@k-rus k-rus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I highly recommend to fix error messages that they are not focused just on functions, since procedures are also allowed.
See also a comment about code copies.

tsl/src/bgw_policy/job_api.c Outdated Show resolved Hide resolved
tsl/src/bgw_policy/job_api.c Outdated Show resolved Hide resolved
SELECT add_job(NULL, '1h');
ERROR: function cannot be NULL
SELECT add_job('invalid_func', '1h');
ERROR: function "invalid_func" does not exist at character 16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be a procedure too, so it is better to not focus just on function. For example, user call add_job for a procedure, but misspelled the name, then the error message can be interpreted as it is required to have a function, not a procedure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a PostgreSQL error so there is nothing we can do about it. I guess all errors are legacy (focusing on function) since procedures was a recent addition to PostgreSQL.

@codecov
Copy link

codecov bot commented Nov 26, 2020

Codecov Report

Merging #2683 (c56a249) into master (79b7f4b) will increase coverage by 0.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2683      +/-   ##
==========================================
+ Coverage   90.01%   90.13%   +0.12%     
==========================================
  Files         212      212              
  Lines       34432    34391      -41     
==========================================
+ Hits        30993    30999       +6     
+ Misses       3439     3392      -47     
Impacted Files Coverage Δ
tsl/src/bgw_policy/job_api.c 94.79% <100.00%> (+1.68%) ⬆️
src/loader/bgw_message_queue.c 84.51% <0.00%> (-2.59%) ⬇️
src/import/planner.c 70.30% <0.00%> (+11.12%) ⬆️

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 d971d4f...c56a249. Read the comment docs.

@erimatnor erimatnor force-pushed the fix-add-job-crash branch 4 times, most recently from 405f6b9 to 11a8cf4 Compare November 26, 2020 15:53
This change fixes a crash in `add_job` when given an NULL schedule
interval as input. In addition, the following improvements have been
implemented for all job API functions:

* Validation of input parameters, specifically NULL checks
* Improved error messages for clarity and consistency
* Tests for bad input arguments
@erimatnor erimatnor merged commit 196f6dc into timescale:master Nov 26, 2020
@erimatnor erimatnor deleted the fix-add-job-crash branch November 26, 2020 16:51
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 2, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
@mkindahl mkindahl mentioned this pull request Dec 2, 2020
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 2, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 2, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It adds checks of
configuration, adds support for gapfill on distributed tables, and
improvements to compression for distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 2, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It adds checks of
configuration, adds support for gapfill on distributed tables, and
improvements to compression for distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 2, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It adds checks of
configuration, adds support for gapfill on distributed tables, and
improvements to compression for distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, and contains improvements to
compression for distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view
* timescale#2662 Save compression metadata settings on access node
* timescale#2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
* timescale#2698 Improve memory handling for remote COPY
* timescale#2555 Set metadata for chunks compressed before 2.0
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, contains improvements to the memory
handling for large COPY, and contains improvements to compression for
distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view
* timescale#2662 Save compression metadata settings on access node
* timescale#2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
* timescale#2698 Improve memory handling for remote COPY
* timescale#2555 Set metadata for chunks compressed before 2.0
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, contains improvements to the memory
handling for large COPY, and contains improvements to compression for
distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view
* timescale#2662 Save compression metadata settings on access node
* timescale#2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
* timescale#2698 Improve memory handling for remote COPY
* timescale#2555 Set metadata for chunks compressed before 2.0
mkindahl added a commit that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, contains improvements to the memory
handling for large COPY, and contains improvements to compression for
distributed hypertables.

**Minor Features**
* #2689 Check configuration in alter_job and add_job
* #2696 Support gapfill on distributed hypertable
* #2468 Show more information in get_git_commit
* #2678 Include user actions into job stats view
* #2664 Fix support for complex aggregate expression
* #2672 Add hypertable to continuous aggregates view
* #2662 Save compression metadata settings on access node
* #2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* #2688 Fix crash for concurrent drop and compress chunk
* #2666 Fix timeout handling in async library
* #2683 Fix crash in add_job when given NULL interval
* #2698 Improve memory handling for remote COPY
* #2555 Set metadata for chunks compressed before 2.0
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, contains improvements to the memory
handling for large COPY, and contains improvements to compression for
distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view
* timescale#2662 Save compression metadata settings on access node
* timescale#2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
* timescale#2698 Improve memory handling for remote COPY
* timescale#2555 Set metadata for chunks compressed before 2.0
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, contains improvements to the memory
handling for large COPY, and contains improvements to compression for
distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view
* timescale#2662 Save compression metadata settings on access node
* timescale#2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
* timescale#2698 Improve memory handling for remote COPY
* timescale#2555 Set metadata for chunks compressed before 2.0
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, contains improvements to the memory
handling for large COPY, and contains improvements to compression for
distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view
* timescale#2662 Save compression metadata settings on access node
* timescale#2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
* timescale#2698 Improve memory handling for remote COPY
* timescale#2555 Set metadata for chunks compressed before 2.0
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, contains improvements to the memory
handling for large COPY, and contains improvements to compression for
distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view
* timescale#2662 Save compression metadata settings on access node
* timescale#2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
* timescale#2698 Improve memory handling for remote COPY
* timescale#2555 Set metadata for chunks compressed before 2.0
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, contains improvements to the memory
handling for large COPY, and contains improvements to compression for
distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view
* timescale#2662 Save compression metadata settings on access node
* timescale#2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
* timescale#2698 Improve memory handling for remote COPY
* timescale#2555 Set metadata for chunks compressed before 2.0
mkindahl added a commit to mkindahl/timescaledb that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, contains improvements to the memory
handling for large COPY, and contains improvements to compression for
distributed hypertables.

**Minor Features**
* timescale#2689 Check configuration in alter_job and add_job
* timescale#2696 Support gapfill on distributed hypertable
* timescale#2468 Show more information in get_git_commit
* timescale#2678 Include user actions into job stats view
* timescale#2664 Fix support for complex aggregate expression
* timescale#2672 Add hypertable to continuous aggregates view
* timescale#2662 Save compression metadata settings on access node
* timescale#2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* timescale#2688 Fix crash for concurrent drop and compress chunk
* timescale#2666 Fix timeout handling in async library
* timescale#2683 Fix crash in add_job when given NULL interval
* timescale#2698 Improve memory handling for remote COPY
* timescale#2555 Set metadata for chunks compressed before 2.0
mkindahl added a commit that referenced this pull request Dec 3, 2020
This release candidate contains bugfixes since the previous release
candidate, as well as additional minor features. It improves
validation of configuration changes for background jobs, adds support
for gapfill on distributed tables, contains improvements to the memory
handling for large COPY, and contains improvements to compression for
distributed hypertables.

**Minor Features**
* #2689 Check configuration in alter_job and add_job
* #2696 Support gapfill on distributed hypertable
* #2468 Show more information in get_git_commit
* #2678 Include user actions into job stats view
* #2664 Fix support for complex aggregate expression
* #2672 Add hypertable to continuous aggregates view
* #2662 Save compression metadata settings on access node
* #2707 Introduce additional db for data node bootstrapping

**Bugfixes**
* #2688 Fix crash for concurrent drop and compress chunk
* #2666 Fix timeout handling in async library
* #2683 Fix crash in add_job when given NULL interval
* #2698 Improve memory handling for remote COPY
* #2555 Set metadata for chunks compressed before 2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants