Skip to content

Commit f2e0356

Browse files
committed
fix: update sampler cron command on re-install (Ralph1 P2)
Running ash-install.sql on an existing install with a v1.0/v1.1 sampler job now updates the cron command to include statement_timeout. Skips if already updated or pg_cron not installed.
1 parent f859e70 commit f2e0356

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

sql/ash-install.sql

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,3 +2856,18 @@ begin
28562856
end;
28572857
$$;
28582858

2859+
2860+
-- If upgrading an existing install, update the sampler cron command to include
2861+
-- statement_timeout (observer-effect protection). New installs via ash.start()
2862+
-- already use the updated command.
2863+
do $$
2864+
begin
2865+
if exists (select from cron.job where jobname = 'ash_sampler') then
2866+
update cron.job
2867+
set command = 'set statement_timeout = ''500ms''; select ash.take_sample()'
2868+
where jobname = 'ash_sampler'
2869+
and command <> 'set statement_timeout = ''500ms''; select ash.take_sample()';
2870+
end if;
2871+
exception when others then
2872+
null; -- pg_cron not installed, skip
2873+
end $$;

0 commit comments

Comments
 (0)