Changeset 30843e711d79e7e70d0c0e014c94bba11cb0b642

Show
Ignore:
Timestamp:
10/25/09 00:15:48 (4 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1256429748 +0000
git-parent:

[7009b029e1b54b90126ad1242c59edb399cf0492]

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

fix bugs -- all appears to work as expected now

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/crontab

    r8699626 r30843e7  
    11#rollup jobs 
    2 * * * * * /opt/pgsql835/bin/psql -d reconnoiter -U stratcon -c "select stratcon.rollup_metric_numeric('5m');" >/tmp/rollup_5.log 2>&1 
    3 00,10,20,30,40,50 * * * * /opt/pgsql835/bin/psql -d reconnoiter -U stratcon -c "select stratcon.rollup_metric_numeric('20m');" >/tmp/rollup_20.log 2>&1 
    4 04,19,34,49 * * * * /opt/pgsql835/bin/psql -d reconnoiter -U stratcon -c "select stratcon.rollup_metric_numeric('30m');" >/tmp/rollup_60.log 2>&1 
    5 07,37 * * * * /opt/pgsql835/bin/psql -d reconnoiter -U stratcon -c "select stratcon.rollup_metric_numeric('1hour');" >/tmp/rollup_60.log 2>&1 
    6 15,45 0,4,8,12,16,20 * * * /opt/pgsql835/bin/psql -d reconnoiter -U stratcon -c "select stratcon.rollup_metric_numeric('4hour');" >/tmp/rollup_240.log 2>&1 
    7 30,50 0 * * * /opt/pgsql835/bin/psql -d reconnoiter -U stratcon -c "select stratcon.rollup_metric_numeric('1day');" >/tmp/rollup_1440.log 2>&1 
     2* * * * * /opt/pgsql835/bin/psql -d reconnoiter -U stratcon -c "select stratcon.rollup_metric_numeric(rollup) from metric_numeric_rollup_config order by seconds asc;" >/tmp/rollup.log 2>&1 
    83#cleanup jobs 
    94#01 00 * * * /opt/pgsql835/bin/psql -d reconnoiter -U reconnoiter -c "select stratcon.archive_part_maint('stratcon.loading_dock_metric_numeric_archive');" 1>/dev/null 
  • sql/sprocs/stratcon.rollup_metric_numeric.sql

    r7009b02 r30843e7  
    55    v_conf          RECORD; 
    66    v_sql           TEXT; 
     7    v_current_whence TIMESTAMPTZ; 
    78    v_min_whence    TIMESTAMPTZ; 
    8     v_max_rollup    TIMESTAMPTZ; 
    99    v_whence        TIMESTAMPTZ; 
    1010    v_taskid        INTEGER; 
     
    4040    END IF; 
    4141 
     42   v_current_whence := 'epoch'::timestamptz + '1 second'::INTERVAL * v_conf.seconds * floor(extract( epoch FROM now() ) / v_conf.seconds); 
     43 
    4244    LOOP 
    4345        IF v_i > 12 THEN 
     46            perform pg_advisory_unlock(43191, v_taskid); 
    4447            RETURN 1; 
    4548        END IF; 
    4649 
    47         SELECT MIN(whence) FROM metric_numeric_rollup_queue WHERE "interval" = in_roll INTO v_min_whence; 
     50        SELECT MIN(whence) FROM metric_numeric_rollup_queue 
     51         WHERE "interval" = in_roll and whence < v_current_whence INTO v_min_whence; 
    4852        EXIT WHEN NOT FOUND OR v_min_whence IS NULL; 
    4953 
    50         v_sql := 'SELECT MAX(rollup_time) FROM metric_numeric_rollup_' || in_roll; 
    51         EXECUTE v_sql INTO v_max_rollup; 
    52  
    5354        -- now() in following query is just a placeholder to get named field (use_whence) in temprec. 
    54         FOR v_temprec IN SELECT *, now() as use_whence FROM noit.metric_numeric_rollup_config WHERE dependent_on = in_roll LOOP 
     55        FOR v_temprec IN SELECT *, v_min_whence as use_whence 
     56                           FROM noit.metric_numeric_rollup_config WHERE dependent_on = in_roll 
     57        LOOP 
    5558            -- Following formula gives equivalent of date_trunc(..) but working on basically any unit - like "10 minutes" 
    5659            -- The unit has to be given in seconds, AND provided as v_temprec.seconds 
    57             v_temprec.use_whence := 'epoch'::timestamptz + '1 second'::INTERVAL * v_temprec.seconds * floor(extract( epoch FROM now() ) / v_temprec.seconds); 
     60            v_temprec.use_whence := 'epoch'::timestamptz + '1 second'::INTERVAL * v_temprec.seconds * floor(extract( epoch FROM v_temprec.use_whence ) / v_temprec.seconds); 
    5861 
    5962RAISE NOTICE '(%,%)',v_temprec.rollup, v_temprec.use_whence;  
     
    120123 
    121124        v_min_whence := NULL; 
    122         v_max_rollup := NULL; 
    123  
    124125    END LOOP; 
    125126 
  • sql/tables/noit.metric_numeric_rollup_config.sql

    rbd7ae6b r30843e7  
    4242 
    4343 
     44REVOKE ALL ON TABLE metric_numeric_rollup_config FROM PUBLIC; 
     45REVOKE ALL ON TABLE metric_numeric_rollup_config FROM prism; 
     46GRANT SELECT ON TABLE metric_numeric_rollup_config TO stratcon; 
     47 
    4448-- 
    4549-- PostgreSQL database dump complete 
  • src/stratcon_datastore.c

    r47a77d0 r30843e7  
    7373 
    7474static noit_log_stream_t ds_err = NULL; 
     75static noit_log_stream_t ds_deb = NULL; 
    7576static noit_log_stream_t ingest_err = NULL; 
    7677 
     
    241242  } 
    242243  pthread_mutex_unlock(&cq->pool->lock); 
    243   noitL(noit_debug, "[%p] release %s [%s]\n", (void *)pthread_self(), 
     244  noitL(ds_deb, "[%p] release %s [%s]\n", (void *)pthread_self(), 
    244245        putback ? "to pool" : "and destroy", cq->pool->queue_name); 
    245246  pthread_cond_signal(&cq->pool->cv); 
     
    289290  } 
    290291  if(old_cnt != new_cnt) 
    291     noitL(noit_debug, "reduced db pool %d -> %d [%s]\n", old_cnt, new_cnt, 
     292    noitL(ds_deb, "reduced db pool %d -> %d [%s]\n", old_cnt, new_cnt, 
    292293          pool->queue_name); 
    293294} 
     
    356357  conn_q *cq; 
    357358  cpool = get_conn_pool_for_remote(remote_str, remote_cn, fqdn); 
    358   noitL(noit_debug, "[%p] requesting [%s]\n", (void *)pthread_self(), 
     359  noitL(ds_deb, "[%p] requesting [%s]\n", (void *)pthread_self(), 
    359360        cpool->queue_name); 
    360361  pthread_mutex_lock(&cpool->lock); 
     
    371372  } 
    372373  if(cpool->in_pool + cpool->outstanding >= cpool->max_allocated) { 
    373     noitL(noit_debug, "[%p] over-subscribed, waiting [%s]\n", 
     374    noitL(ds_deb, "[%p] over-subscribed, waiting [%s]\n", 
    374375          (void *)pthread_self(), cpool->queue_name); 
    375376    pthread_cond_wait(&cpool->cv, &cpool->lock); 
    376     noitL(noit_debug, "[%p] waking up and trying again [%s]\n", 
     377    noitL(ds_deb, "[%p] waking up and trying again [%s]\n", 
    377378          (void *)pthread_self(), cpool->queue_name); 
    378379    goto again; 
     
    10251026  cq = get_conn_q_for_remote(ij->remote_str, ij->remote_cn, 
    10261027                             ij->fqdn, dsn); 
    1027   noitL(noit_debug, "stratcon_datastore_asynch_execute[%s,%s,%s]\n", 
     1028  noitL(ds_deb, "stratcon_datastore_asynch_execute[%s,%s,%s]\n", 
    10281029        ij->remote_str, ij->remote_cn, ij->fqdn); 
    10291030 full_monty: 
     
    10971098  if(mask & EVENTER_ASYNCH_CLEANUP) return 0; 
    10981099 
    1099   noitL(noit_debug, "Syncing journal sets...\n"); 
     1100  noitL(ds_deb, "Syncing journal sets...\n"); 
    11001101  while(noit_hash_next(syncset->ws, &iter, &k, &klen, &vij)) { 
    11011102    eventer_t ingest; 
    11021103    ij = vij; 
    1103     noitL(noit_debug, "Syncing journal set [%s,%s,%s]\n", 
     1104    noitL(ds_deb, "Syncing journal set [%s,%s,%s]\n", 
    11041105          ij->remote_str, ij->remote_cn, ij->fqdn); 
    11051106    fsync(ij->fd); 
     
    16131614  pthread_mutex_init(&storagenode_to_info_cache_lock, NULL); 
    16141615  ds_err = noit_log_stream_find("error/datastore"); 
     1616  ds_deb = noit_log_stream_find("debug/datastore"); 
    16151617  ingest_err = noit_log_stream_find("error/ingest"); 
    16161618  if(!ds_err) ds_err = noit_error;