Configuration check function for custom actions #2895
Labels
bgw
The background worker subsystem, including the scheduler
breaks-api
Anything that breaks existing public APIs
ui/ux
Milestone
Background
a custom action is added using
add_job
or altered usingalter_job
and there is a problem with the configuration, it will not generate an error until the job executes. This applies both to custom action types and to native action types.For example, prior to #2689, the following would not generate an error despite the fact that the configuration is missing a
mat_hypertable_id
field.The same applies if you use a bad type for one of the fields in the configuration:
This was fixed in #2689 by adding hard-coded checks to the native actions, but there is no similar checking available for custom actions. One option is to add custom check functions similar to how it was done in #2681, but it might be necessary to add other extensions to the custom action API to better support integrity of the custom actions.
Specification
A check function is added to the jobs that accepts a
JSONB
structure being the configuration. The function is expected to raise an error for any issues in the configuration, and do nothing if the configuration is good.Function
add_job
Extend the
add_job
function with one extra parametercheck_config
being the procedure to execute for checking the configuration.Parameters
Return Value
The job id as an integer
Function
alter_job
Extend the
alter_job
function with a new parametercheck_config
. If defined, the check function will be executed after the job configuration has been updated.Parameters
Return value
A tuple with the columns below.
Public view
timescaledb_information.jobs
Two new columns are added last, which are read from the internal table
bgw_job
Internal table
bgw_job
Two new colums are added (last) for each job
Internal check functions for existing policies
The following functions are added for the current policies.
_timescaledb_internal.policy_retention_check
_timescaledb_internal.policy_reorder_check
_timescaledb_internal.policy_compression_check
_timescaledb_internal.policy_refresh_continuous_aggregate_check
The text was updated successfully, but these errors were encountered: