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
Set status for backend in background jobs #2850
Conversation
cdd8cbc
to
7382ac5
Compare
7382ac5
to
41cfabd
Compare
7a7000d
to
ca9b055
Compare
Codecov Report
@@ Coverage Diff @@
## master #2850 +/- ##
==========================================
+ Coverage 90.09% 90.23% +0.14%
==========================================
Files 212 212
Lines 34775 34738 -37
==========================================
+ Hits 31330 31346 +16
+ Misses 3445 3392 -53
Continue to review full report at Codecov.
|
tsl/src/bgw_policy/job.c
Outdated
query = makeStringInfo(); | ||
appendStringInfo(query, | ||
"CALL %s.%s()", | ||
NameStr(job->fd.proc_schema), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need quotes? in case if name contains spaces, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is just user viewed output, not something that is used for execution, but changed it anyway since it looks nicer.
"CALL %s.%s()", | ||
NameStr(job->fd.proc_schema), | ||
NameStr(job->fd.proc_name)); | ||
pgstat_report_activity(STATE_RUNNING, query->data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs a test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added one. I actually wanted to add a more elaborate test that shows what statement is being executed inside a custom procedure, but that proved to be difficult.
6436aba
to
f7581fa
Compare
The status of background workers is recorded in PostgreSQL using the function `pgstat_record_activity` which allow the status of the background worker to be inspected using the `status` field in `pg_stat_activity`. This is used by the TimescaleDB `job_stats` view to show if a job is running, scheduled, or paused. However, the activity was never recorded in the code and hence the field was always NULL. Since this was the default for the `job_status` field of `timescaledb_information.job_stats` it would always show as `Scheduled`. This commit fixes this by adding calls to `pgstat_record_activity` at suitable locations. Fixes timescale#2831
f7581fa
to
5dd0a95
Compare
This maintenance release contains bugfixes since the 2.0.2 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Bugfixes** * timescale#2850 Set status for backend in background jobs * timescale#2883 Fix join qual propagation for nested joins * timescale#2884 Add GUC to control join qual propagation * timescale#2885 Fix compressed chunk check when disabling compression * timescale#2908 Fix changing column type of clustered hypertables **Thanks** * @zeeshanshabbir93 for reporting an issue with joins * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status * @zeeshanshabbir93 for reporting the issue with full outer joins
This maintenance release contains bugfixes since the 2.0.2 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Bugfixes** * timescale#2850 Set status for backend in background jobs * timescale#2883 Fix join qual propagation for nested joins * timescale#2884 Add GUC to control join qual propagation * timescale#2885 Fix compressed chunk check when disabling compression * timescale#2908 Fix changing column type of clustered hypertables * timescale#2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.2 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Bugfixes** * #2850 Set status for backend in background jobs * #2883 Fix join qual propagation for nested joins * #2884 Add GUC to control join qual propagation * #2885 Fix compressed chunk check when disabling compression * #2908 Fix changing column type of clustered hypertables * #2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.2 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * timescale#2926 Optimize cagg refresh for small invalidations **Bugfixes** * timescale#2850 Set status for backend in background jobs * timescale#2883 Fix join qual propagation for nested joins * timescale#2884 Add GUC to control join qual propagation * timescale#2885 Fix compressed chunk check when disabling compression * timescale#2908 Fix changing column type of clustered hypertables * timescale#2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.1 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * timescale#2926 Optimize cagg refresh for small invalidations **Bugfixes** * timescale#2850 Set status for backend in background jobs * timescale#2883 Fix join qual propagation for nested joins * timescale#2884 Add GUC to control join qual propagation * timescale#2885 Fix compressed chunk check when disabling compression * timescale#2908 Fix changing column type of clustered hypertables * timescale#2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.1 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * timescale#2926 Optimize cagg refresh for small invalidations **Bugfixes** * timescale#2850 Set status for backend in background jobs * timescale#2883 Fix join qual propagation for nested joins * timescale#2884 Add GUC to control join qual propagation * timescale#2885 Fix compressed chunk check when disabling compression * timescale#2908 Fix changing column type of clustered hypertables * timescale#2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.1 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * #2926 Optimize cagg refresh for small invalidations **Bugfixes** * #2850 Set status for backend in background jobs * #2883 Fix join qual propagation for nested joins * #2884 Add GUC to control join qual propagation * #2885 Fix compressed chunk check when disabling compression * #2908 Fix changing column type of clustered hypertables * #2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.1 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * #2926 Optimize cagg refresh for small invalidations **Bugfixes** * #2850 Set status for backend in background jobs * #2883 Fix join qual propagation for nested joins * #2884 Add GUC to control join qual propagation * #2885 Fix compressed chunk check when disabling compression * #2908 Fix changing column type of clustered hypertables * #2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.1 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * #2926 Optimize cagg refresh for small invalidations **Bugfixes** * #2850 Set status for backend in background jobs * #2883 Fix join qual propagation for nested joins * #2884 Add GUC to control join qual propagation * #2885 Fix compressed chunk check when disabling compression * #2908 Fix changing column type of clustered hypertables * #2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.1 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * timescale#2926 Optimize cagg refresh for small invalidations **Bugfixes** * timescale#2850 Set status for backend in background jobs * timescale#2883 Fix join qual propagation for nested joins * timescale#2884 Add GUC to control join qual propagation * timescale#2885 Fix compressed chunk check when disabling compression * timescale#2908 Fix changing column type of clustered hypertables * timescale#2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.1 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * timescale#2926 Optimize cagg refresh for small invalidations **Bugfixes** * timescale#2850 Set status for backend in background jobs * timescale#2883 Fix join qual propagation for nested joins * timescale#2884 Add GUC to control join qual propagation * timescale#2885 Fix compressed chunk check when disabling compression * timescale#2908 Fix changing column type of clustered hypertables * timescale#2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.1 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * #2926 Optimize cagg refresh for small invalidations **Bugfixes** * #2850 Set status for backend in background jobs * #2883 Fix join qual propagation for nested joins * #2884 Add GUC to control join qual propagation * #2885 Fix compressed chunk check when disabling compression * #2908 Fix changing column type of clustered hypertables * #2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.1 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * timescale#2926 Optimize cagg refresh for small invalidations **Bugfixes** * timescale#2850 Set status for backend in background jobs * timescale#2883 Fix join qual propagation for nested joins * timescale#2884 Add GUC to control join qual propagation * timescale#2885 Fix compressed chunk check when disabling compression * timescale#2908 Fix changing column type of clustered hypertables * timescale#2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
This maintenance release contains bugfixes since the 2.0.1 release. We deem it high priority for upgrading. The bug fixes in this release address issues with joins, the status of background jobs, and disabling compression. It also includes enhancements to continuous aggregates, including improved validation of policies and optimizations for faster refreshes when there are a lot of invalidations. **Minor features** * #2926 Optimize cagg refresh for small invalidations **Bugfixes** * #2850 Set status for backend in background jobs * #2883 Fix join qual propagation for nested joins * #2884 Add GUC to control join qual propagation * #2885 Fix compressed chunk check when disabling compression * #2908 Fix changing column type of clustered hypertables * #2942 Validate continuous aggregate policy **Thanks** * @zeeshanshabbir93 for reporting the issue with full outer joins * @Antiarchitect for reporting the issue with slow refreshes of * @diego-hermida for reporting the issue about being unable to disable compression * @mtin for reporting the issue about wrong job status
The status of background workers is recorded using
pgstat_record_activity
which allow the status of the worker to beinspected using the
status
field inpg_stat_activity
. This is usedby the
timescaledb_information.job_stats
view to show if a job isrunning, scheduled, or paused.
However, the activity was never recorded in the code and hence the
field was always NULL. Since this was the default for the
job_status
field of
timescaledb_information.job_stats
it would always show asScheduled
.This commit fixes this by adding calls to
pgstat_record_activity
andsuitable locations and also add a default of
Undefined
for thejob_status
field to capture missing calls ofpgstat_record_activity
. This is more of a precaution and is unlikelyto ever show.
Fixes #2831