Changeset f4a87edf072c4d9193702519dea7eba52fcb73ff

Show
Ignore:
Timestamp:
12/24/09 14:49:13 (4 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1261666153 +0000
git-parent:

[9eeace24af3f59a0bb51a448c5b6cf0713cc1d20]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1261666153 +0000
Message:

refs #226

This implements the change, but does not improve upon the stratcon config.
The stratcon config is still inserted with 0.0.0.0 as the remote_address
and now furthers the underachievement by using "" as the common name.

This should be fixed as a part of this ticket as well.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/sprocs/stratcon.update_config.sql

    r4bd41da rf4a87ed  
    33-- 
    44 
    5 CREATE FUNCTION stratcon.update_config(v_remote_address_in inet, v_node_type_in text, v_whence_in timestamp with time zone, v_config_in xml) RETURNS void 
     5CREATE FUNCTION stratcon.update_config(v_remote_address_in inet, v_remote_cn_in text, v_node_type_in text, v_whence_in timestamp with time zone, v_config_in xml) RETURNS void 
    66    AS $$ 
    77DECLARE 
     
    99BEGIN 
    1010    select config into v_config from stratcon.current_node_config 
    11      where remote_address = v_remote_address_in 
     11     where remote_cn = v_remote_cn_in 
    1212       and node_type = v_node_type_in; 
    1313    IF FOUND THEN 
     
    1616        END IF; 
    1717        delete from stratcon.current_node_config 
    18               where remote_address = v_remote_address_in 
     18              where remote_cn = v_remote_cn_in 
    1919                and node_type = v_node_type_in; 
    2020    END IF; 
    2121    insert into stratcon.current_node_config 
    22                 (remote_address, node_type, whence, config) 
    23          values (v_remote_address_in, v_node_type_in, v_whence_in, v_config_in); 
     22                (remote_cn, remote_address, node_type, whence, config) 
     23         values (v_remote_cn_in, v_remote_address_in, v_node_type_in, v_whence_in, v_config_in); 
    2424    insert into stratcon.current_node_config_changelog 
    25                 (remote_address, node_type, whence, config) 
    26          values (v_remote_address_in, v_node_type_in, v_whence_in, v_config_in); 
     25                (remote_cn, remote_address, node_type, whence, config) 
     26         values (v_remote_cn_in, v_remote_address_in, v_node_type_in, v_whence_in, v_config_in); 
    2727END 
    2828$$ 
     
    3131; 
    3232 
    33 ALTER FUNCTION stratcon.update_config(v_remote_address_in inet, v_node_type_in text, v_whence_in timestamp with time zone, v_config_in xml) OWNER TO reconnoiter; 
     33ALTER FUNCTION stratcon.update_config(v_remote_address_in inet, v_remote_cn_in text, v_node_type_in text, v_whence_in timestamp with time zone, v_config_in xml) OWNER TO reconnoiter; 
    3434 
    35 GRANT EXECUTE ON FUNCTION stratcon.update_config(inet, text, timestamp with time zone, xml) TO stratcon; 
     35GRANT EXECUTE ON FUNCTION stratcon.update_config(inet, text, text, timestamp with time zone, xml) TO stratcon; 
    3636 
  • sql/tables/stratcon.current_node_config.sql

    ra34bc12 rf4a87ed  
    2020 
    2121CREATE TABLE current_node_config ( 
     22    remote_cn text NOT NULL, 
     23    node_type text NOT NULL, 
    2224    remote_address inet NOT NULL, 
    23     node_type text NOT NULL, 
    2425    whence timestamp with time zone NOT NULL, 
    2526    config xml NOT NULL 
     
    3435 
    3536ALTER TABLE ONLY current_node_config 
    36     ADD CONSTRAINT current_node_config_pkey PRIMARY KEY (remote_address, node_type); 
    37  
     37    ADD CONSTRAINT current_node_config_pkey PRIMARY KEY (remote_cn, node_type); 
    3838 
    3939-- 
  • sql/tables/stratcon.current_node_config_changelog.sql

    r4bd41da rf4a87ed  
    11CREATE TABLE stratcon.current_node_config_changelog ( 
     2    remote_cn text NOT NULL, 
     3    node_type text NOT NULL, 
    24    remote_address inet NOT NULL, 
    3     node_type text NOT NULL, 
    45    whence timestamp with time zone NOT NULL, 
    56    config xml NOT NULL 
     
    1415 
    1516ALTER TABLE ONLY stratcon.current_node_config_changelog 
    16     ADD CONSTRAINT current_node_config_changelog_pkey PRIMARY KEY (remote_address, node_type, whence); 
     17    ADD CONSTRAINT current_node_config_changelog_pkey PRIMARY KEY (remote_cn, node_type, whence); 
    1718 
    1819-- 
  • src/stratcon.conf.in

    r7afb4e3 rf4a87ed  
    149149      <config><![CDATA[ 
    150150        SELECT stratcon.update_config 
    151                ($1, $2,  
    152                 'epoch'::timestamptz + ($3 || ' seconds')::interval, 
    153                 $4
     151               ($1, $2, $3, 
     152                'epoch'::timestamptz + ($4 || ' seconds')::interval, 
     153                $5
    154154      ]]></config> 
    155155    </statements> 
  • src/stratcon_datastore.c

    r21e7357 rf4a87ed  
    695695      case 'n': 
    696696        DECLARE_PARAM_STR(raddr, strlen(raddr)); 
     697        DECLARE_PARAM_STR(remote_cn, strlen(remote_cn)); 
    697698        DECLARE_PARAM_STR("noitd",5); /* node_type */ 
    698699        PROCESS_NEXT_FIELD(token,len); 
     
    10531054  buff = mmap(NULL, len, PROT_READ, MAP_PRIVATE, ij->fd, 0); 
    10541055  if(buff == (void *)-1) { 
    1055     noitL(noit_error, "mmap(%d, %d)(%s) => %s\n", len, ij->fd, 
     1056    noitL(noit_error, "mmap(%d, %d)(%s) => %s\n", (int)len, ij->fd, 
    10561057          ij->filename, strerror(errno)); 
    10571058    assert(buff != (void *)-1); 
     
    15001501    snprintf(time_as_str, sizeof(time_as_str), "%lu", (long unsigned int)time(NULL)); 
    15011502    DECLARE_PARAM_STR("0.0.0.0", 7); 
     1503    DECLARE_PARAM_STR("", 0); 
    15021504    DECLARE_PARAM_STR("stratcond", 9); 
    15031505    DECLARE_PARAM_STR(time_as_str, strlen(time_as_str));