Changeset 8c44e3b0e275f77a5f98f49c8b0ae180976694e9

Show
Ignore:
Timestamp:
08/11/08 20:58:43 (6 years ago)
Author:
Denish Patel <denish@omniti.com>
git-committer:
Denish Patel <denish@omniti.com> 1218488323 +0000
git-parent:

[3ffe15436e254e460f92adff5bc83d4b076ac5f6]

git-author:
Denish Patel <denish@omniti.com> 1218488323 +0000
Message:

dump stratcon schema

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/reconnoiter_ddl_dump.sql

    r4aae95d r8c44e3b  
    2121 
    2222SET default_with_oids = false; 
     23 
     24-- 
     25-- Name: current_metric_text; Type: TABLE; Schema: stratcon; Owner: -; Tablespace:  
     26-- 
     27 
     28CREATE TABLE current_metric_text ( 
     29    sid integer NOT NULL, 
     30    whence timestamp with time zone NOT NULL, 
     31    name text NOT NULL, 
     32    value text 
     33); 
     34 
    2335 
    2436-- 
     
    309321  for window in 
    310322    select atablename, aperiod, anperiods 
    311     from (select aperiod, iv/isec as anperiods, atablename, 
     323    from (select aperiod, round(iv/isec) ::integer as anperiods, atablename, 
    312324                 abs(case when iv/isec - in_hopeful_nperiods < 0 
    313325                          then 10 * (in_hopeful_nperiods - iv/isec) 
     
    366378declare 
    367379  v_sid int; 
     380  v_record stratcon.rollup_matrix_numeric_5m%rowtype; 
    368381begin 
    369   select sid into v_sid from stratcon.map_uuid_to_sid where id = in_check
     382  select sid into v_sid from stratcon.map_uuid_to_sid where id = in_uuid
    370383  if not found then 
    371384    return; 
    372385  end if; 
    373386 
    374   return query select * from stratcon.fetch_dataset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods, derive); 
     387    for v_record in  select sid, name, rollup_time, count_rows, avg_value from stratcon.fetch_dataset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods, derive) loop 
     388    return next v_record;  
     389    end loop; 
     390 
     391--  return query select sid, name, rollup_time, count_rows, avg_value from stratcon.fetch_dataset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods, derive); 
     392  return; 
    375393end 
    376394$$ 
     
    662680IF TG_OP = 'INSERT' THEN 
    663681 
    664      SELECT value FROM  stratcon.loading_dock_metric_text_s WHERE sid = NEW.sid AND name = NEW.name  
    665          AND WHENCE = (SELECT max(whence) FROM stratcon.loading_dock_metric_text_s_change_log  
    666                          WHERE WHENCE <> NEW.WHENCE and sid=NEW.sid and name=NEW.name ) 
    667      INTO v_oldvalue; 
    668  
    669     IF v_oldvalue IS DISTINCT FROM NEW.value THEN 
    670  
    671         INSERT INTO stratcon.loading_dock_metric_text_s_change_log (sid,whence,name,value) 
    672             VALUES (NEW.sid, NEW.whence, NEW.name, NEW.value);  
    673     END IF; 
     682             SELECT value FROM  stratcon.loading_dock_metric_text_s WHERE sid = NEW.sid AND name = NEW.name 
     683                 AND WHENCE = (SELECT max(whence) FROM stratcon.loading_dock_metric_text_s_change_log 
     684                                 WHERE WHENCE <> NEW.WHENCE and sid=NEW.sid and name=NEW.name ) 
     685                     INTO v_oldvalue; 
     686 
     687                    IF v_oldvalue IS DISTINCT FROM NEW.value THEN 
     688 
     689                        INSERT INTO stratcon.loading_dock_metric_text_s_change_log (sid,whence,name,value) 
     690                            VALUES (NEW.sid, NEW.whence, NEW.name, NEW.value); 
     691                        DELETE FROM stratcon.current_metric_text 
     692                                WHERE sid = NEW.sid and name = NEW.name; 
     693                        INSERT INTO stratcon.current_metric_text (sid,whence,name,value) 
     694                                VALUES (NEW.sid, NEW.whence, NEW.name, NEW.value); 
     695                    END IF; 
     696 
    674697 
    675698SELECT sid,metric_name FROM stratcon.metric_name_summary WHERE sid=NEW.sid  and metric_name=NEW.name 
     
    14151438 
    14161439-- 
     1440-- Name: current_metric_text_pkey; Type: CONSTRAINT; Schema: stratcon; Owner: -; Tablespace:  
     1441-- 
     1442 
     1443ALTER TABLE ONLY current_metric_text 
     1444    ADD CONSTRAINT current_metric_text_pkey PRIMARY KEY (sid, name); 
     1445 
     1446 
     1447-- 
    14171448-- Name: current_node_config_changelog_pkey; Type: CONSTRAINT; Schema: stratcon; Owner: -; Tablespace:  
    14181449--