Changeset e5e4b416e07adf6285bb5140316e5624a8f44224
- Timestamp:
- 10/21/09 14:22:06
(4 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1256134926 +0000
- git-parent:
[f0400f824c10ceac576427c5023429506384cd8a]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1256134926 +0000
- Message:
fix varset fetching
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rdfd06d8 |
re5e4b41 |
|
| 42 | 42 | \i sprocs/noit.metric_text_archive_log_changes.sql |
|---|
| 43 | 43 | \i sprocs/noit.update_metric_summary_fulltext.sql |
|---|
| | 44 | \i sprocs/noit.update_check_currently.sql |
|---|
| | 45 | \i sprocs/noit.update_mns_via_check_currently.sql |
|---|
| 44 | 46 | \i sprocs/noit.update_mns_via_check_tag.sql |
|---|
| 45 | 47 | \i sprocs/noit.update_mns_via_metric_tag.sql |
|---|
| … | … | |
| 51 | 53 | \i sprocs/stratcon.init_metric_numeric_rollup_5m.sql |
|---|
| 52 | 54 | \i sprocs/stratcon.map_uuid_to_sid.sql |
|---|
| 53 | | \i sprocs/stratcon.metric_name_summary_tsvector.sql |
|---|
| 54 | 55 | \i sprocs/stratcon.window_robust_derive.sql |
|---|
| 55 | 56 | \i sprocs/stratcon.update_config.sql |
|---|
| | 57 | \i sprocs/stratcon.rollup_metric_numeric_5m.sql |
|---|
| | 58 | \i sprocs/stratcon.metric_name_summary_compile_fts_data.sql |
|---|
| | 59 | |
|---|
| 56 | 60 | \i sprocs/prism.add_graph_tags.sql |
|---|
| 57 | 61 | \i sprocs/prism.add_tags.sql |
|---|
| rdfd06d8 |
re5e4b41 |
|
| 13 | 13 | end if; |
|---|
| 14 | 14 | |
|---|
| 15 | | return query select * from stratcon._fetch_varset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods); |
|---|
| | 15 | return query select * from stratcon.fetch_varset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods); |
|---|
| 16 | 16 | end |
|---|
| 17 | 17 | $BODY$ |
|---|
| … | … | |
| 20 | 20 | GRANT EXECUTE ON FUNCTION stratcon.fetch_varset(uuid, text, timestamp with time zone, timestamp with time zone, integer) TO stratcon; |
|---|
| 21 | 21 | |
|---|
| 22 | | -- Function: stratcon._fetch_varset(integer, text, timestamp with time zone, timestamp with time zone, integer) |
|---|
| | 22 | -- Function: stratcon.fetch_varset(integer, text, timestamp with time zone, timestamp with time zone, integer) |
|---|
| 23 | 23 | |
|---|
| 24 | | CREATE OR REPLACE FUNCTION stratcon._fetch_varset(in_sid integer, in_name text, in_start_time timestamp with time zone, in_end_time timestamp with time zone, in_hopeful_nperiods integer) |
|---|
| | 24 | CREATE OR REPLACE FUNCTION stratcon.fetch_varset(in_sid integer, in_name text, in_start_time timestamp with time zone, in_end_time timestamp with time zone, in_hopeful_nperiods integer) |
|---|
| 25 | 25 | RETURNS SETOF noit.metric_text_changelog AS |
|---|
| 26 | 26 | $BODY$declare |
|---|
| … | … | |
| 30 | 30 | v_start_text text; |
|---|
| 31 | 31 | v_next_text text; |
|---|
| | 32 | v_prev_text boolean; |
|---|
| 32 | 33 | v_end_adj timestamptz; |
|---|
| 33 | 34 | v_change_row noit.metric_text_changelog%rowtype; |
|---|
| 34 | 35 | begin |
|---|
| 35 | 36 | -- Map out uuid to an sid. |
|---|
| | 37 | v_prev_text := false; |
|---|
| 36 | 38 | v_sid := in_sid; |
|---|
| 37 | 39 | |
|---|
| … | … | |
| 87 | 89 | order by whence asc |
|---|
| 88 | 90 | loop |
|---|
| | 91 | |
|---|
| 89 | 92 | v_next_text := v_change_row.value; |
|---|
| 90 | | if v_change_row.value is not null and |
|---|
| 91 | | v_start_text != v_change_row.value then |
|---|
| | 93 | if v_change_row.value is not null and not v_prev_text and |
|---|
| | 94 | (v_start_text is null or v_start_text <> v_change_row.value) then |
|---|
| 92 | 95 | v_change_row.value := coalesce(v_start_text, '[unset]') || ' -> ' || coalesce(v_change_row.value, '[unset]'); |
|---|
| 93 | 96 | else |
|---|
| 94 | | v_change_row.value := v_start_text; |
|---|
| | 97 | v_change_row.value := coalesce(v_change_row.value, '[unset]'); |
|---|
| 95 | 98 | end if; |
|---|
| 96 | | if v_next_text is not null then |
|---|
| | 99 | if v_start_text is null and v_next_text is not null then |
|---|
| 97 | 100 | v_start_text := v_next_text; |
|---|
| 98 | 101 | end if; |
|---|
| | 102 | v_prev_text := true; |
|---|
| 99 | 103 | return next v_change_row; |
|---|
| 100 | 104 | end loop; |
|---|
| … | … | |
| 115 | 119 | LANGUAGE 'plpgsql' SECURITY DEFINER; |
|---|
| 116 | 120 | |
|---|
| 117 | | GRANT EXECUTE ON FUNCTION stratcon._fetch_varset(integer, text, timestamp with time zone, timestamp with time zone, integer) TO stratcon; |
|---|
| | 121 | GRANT EXECUTE ON FUNCTION stratcon.fetch_varset(integer, text, timestamp with time zone, timestamp with time zone, integer) TO stratcon; |
|---|
| 118 | 122 | |
|---|