Skip to content

Commit d534843

Browse files
committed
Use a fixed call string for the telemetry job in TSS recording
The bgw entrypoint records the executed job's call string via the ts_stat_statements hook after a successful run. The telemetry job has no real procedure behind its proc_schema/proc_name pair, so the lookup failed with "function or procedure ... does not exist" whenever ts_stat_statements was active. Use a fixed synthetic call string for the telemetry job instead.
1 parent 277e80b commit d534843

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

.unreleased/pr_9744

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes: #9744 Use a fixed call string for the telemetry job in ts_stat_statements recording

src/bgw/job.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,20 @@ ts_bgw_job_entrypoint(PG_FUNCTION_ARGS)
12671267

12681268
if (!job_failed && ts_is_tss_enabled() && scheduler_test_hook == NULL)
12691269
{
1270-
const char *stmt = ts_bgw_job_function_call_string(job);
1270+
const char *stmt;
1271+
#ifdef USE_TELEMETRY
1272+
/*
1273+
* The telemetry job has no real procedure backing its
1274+
* proc_schema/proc_name pair, so looking up its funcid would fail.
1275+
* Use a fixed synthetic call string instead.
1276+
*/
1277+
if (ts_is_telemetry_job(job))
1278+
{
1279+
stmt = "CALL _timescaledb_functions.policy_telemetry()";
1280+
}
1281+
else
1282+
#endif
1283+
stmt = ts_bgw_job_function_call_string(job);
12711284
ts_end_tss_store_callback(stmt, -1, (int) strlen(stmt), 0, 0);
12721285
}
12731286

0 commit comments

Comments
 (0)