Changeset f742d08aaeb3c301edc5154efacc2a58e5dfff82
- Timestamp:
- 10/19/09 16:19:40
(4 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1255969180 +0000
- git-parent:
[cc568bba655ac2820520a6c1131e25839dfe0379]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1255969180 +0000
- Message:
OMG data loads, refs #150
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r5360a1e |
rf742d08 |
|
| 104 | 104 | ]]></mapallchecks> |
|---|
| 105 | 105 | <mapchecktostoragenode><![CDATA[ |
|---|
| 106 | | SELECT o_storage_node_id as storage_node_id, o_sid as sid, o_fqdn as fqdn, o_dsn as dsn from stratcon.map_uuid_to_sid($1,$2) |
|---|
| | 106 | SELECT o_storage_node_id as storage_node_id, o_sid as sid, |
|---|
| | 107 | o_fqdn as fqdn, o_dsn as dsn |
|---|
| | 108 | FROM stratcon.map_uuid_to_sid($1,$2) |
|---|
| 107 | 109 | ]]></mapchecktostoragenode> |
|---|
| 108 | 110 | <check><![CDATA[ |
|---|
| 109 | | INSERT INTO stratcon.loading_dock_check_s |
|---|
| | 111 | INSERT INTO check_archive |
|---|
| 110 | 112 | (remote_address, whence, sid, id, target, module, name) |
|---|
| 111 | 113 | VALUES ($1, 'epoch'::timestamptz + ($2 || ' seconds')::interval, |
|---|
| 112 | | stratcon.generate_sid_from_id($3), $3, $4, $5, $6) |
|---|
| | 114 | $3, $4, $5, $6, $7) |
|---|
| 113 | 115 | ]]></check> |
|---|
| 114 | 116 | <status><![CDATA[ |
|---|
| 115 | | INSERT INTO stratcon.loading_dock_status_archive_%Y%m |
|---|
| 116 | | ( whence,sid, state, availability, |
|---|
| 117 | | duration, status) |
|---|
| | 117 | INSERT INTO check_status_archive |
|---|
| | 118 | (whence, sid, state, availability, duration, status) |
|---|
| 118 | 119 | VALUES ('epoch'::timestamptz + ($1 || ' seconds')::interval, |
|---|
| 119 | | stratcon.generate_sid_from_id($2), $3, $4, $5, $6) |
|---|
| | 120 | $2, $3, $4, $5, $6) |
|---|
| 120 | 121 | ]]></status> |
|---|
| 121 | 122 | <metric_numeric><![CDATA[ |
|---|
| 122 | | INSERT INTO stratcon.loading_dock_metric_numeric_archive_%Y%m |
|---|
| | 123 | INSERT INTO metric_numeric_archive |
|---|
| 123 | 124 | (whence, sid, name, value) |
|---|
| 124 | | VALUES ( 'epoch'::timestamptz + ($1 || ' seconds')::interval, |
|---|
| 125 | | stratcon.generate_sid_from_id($2), $3, $4) |
|---|
| | 125 | VALUES ('epoch'::timestamptz + ($1 || ' seconds')::interval, |
|---|
| | 126 | $2, $3, $4) |
|---|
| 126 | 127 | ]]></metric_numeric> |
|---|
| 127 | 128 | <metric_text><![CDATA[ |
|---|
| 128 | | INSERT INTO stratcon.loading_dock_metric_text_archive_%Y%m |
|---|
| | 129 | INSERT INTO metric_text_archive |
|---|
| 129 | 130 | ( whence, sid, name,value) |
|---|
| 130 | 131 | VALUES ('epoch'::timestamptz + ($1 || ' seconds')::interval, |
|---|
| 131 | | stratcon.generate_sid_from_id($2), $3, $4) |
|---|
| | 132 | $2, $3, $4) |
|---|
| 132 | 133 | ]]></metric_text> |
|---|
| 133 | 134 | <config><![CDATA[ |
|---|
| rcc568bb |
rf742d08 |
|
| 160 | 160 | |
|---|
| 161 | 161 | static int stratcon_database_connect(conn_q *cq); |
|---|
| | 162 | static int uuid_to_sid(const char *uuid_str_in, const char *remote_cn); |
|---|
| 162 | 163 | |
|---|
| 163 | 164 | static void |
|---|
| … | … | |
| 575 | 576 | } |
|---|
| 576 | 577 | execute_outcome_t |
|---|
| 577 | | stratcon_datastore_execute(conn_q *cq, const char *r, ds_line_detail *d) { |
|---|
| 578 | | int type, len; |
|---|
| | 578 | stratcon_datastore_execute(conn_q *cq, const char *r, const char *remote_cn, |
|---|
| | 579 | ds_line_detail *d) { |
|---|
| | 580 | int type, len, sid; |
|---|
| 579 | 581 | char *final_buff; |
|---|
| 580 | 582 | uLong final_len, actual_final_len; |
|---|
| … | … | |
| 658 | 660 | d->whence = (time_t)strtoul(token, NULL, 10); |
|---|
| 659 | 661 | PROCESS_NEXT_FIELD(token, len); |
|---|
| | 662 | sid = uuid_to_sid(token, remote_cn); |
|---|
| | 663 | if(sid == 0) goto bad_row; |
|---|
| | 664 | DECLARE_PARAM_INT(sid); /* sid */ |
|---|
| 660 | 665 | DECLARE_PARAM_STR(token,len); /* uuid */ |
|---|
| 661 | 666 | PROCESS_NEXT_FIELD(token, len); |
|---|
| … | … | |
| 671 | 676 | d->whence = (time_t)strtoul(token, NULL, 10); |
|---|
| 672 | 677 | PROCESS_NEXT_FIELD(token, len); |
|---|
| 673 | | DECLARE_PARAM_STR(token,len); /* uuid */ |
|---|
| | 678 | sid = uuid_to_sid(token, remote_cn); |
|---|
| | 679 | if(sid == 0) goto bad_row; |
|---|
| | 680 | DECLARE_PARAM_INT(sid); /* sid */ |
|---|
| 674 | 681 | PROCESS_NEXT_FIELD(token, len); |
|---|
| 675 | 682 | DECLARE_PARAM_STR(token,len); /* name */ |
|---|
| … | … | |
| 684 | 691 | d->whence = (time_t)strtoul(token, NULL, 10); |
|---|
| 685 | 692 | PROCESS_NEXT_FIELD(token, len); |
|---|
| 686 | | DECLARE_PARAM_STR(token,len); /* uuid */ |
|---|
| | 693 | sid = uuid_to_sid(token, remote_cn); |
|---|
| | 694 | if(sid == 0) goto bad_row; |
|---|
| | 695 | DECLARE_PARAM_INT(sid); /* sid */ |
|---|
| 687 | 696 | PROCESS_NEXT_FIELD(token, len); |
|---|
| 688 | 697 | DECLARE_PARAM_STR(token,len); /* state */ |
|---|
| … | … | |
| 1012 | 1021 | continue; |
|---|
| 1013 | 1022 | } |
|---|
| 1014 | | rv = stratcon_datastore_execute(cq, cq->remote_str, current); |
|---|
| | 1023 | rv = stratcon_datastore_execute(cq, cq->remote_str, cq->remote_cn, |
|---|
| | 1024 | current); |
|---|
| 1015 | 1025 | switch(rv) { |
|---|
| 1016 | 1026 | case DS_EXEC_SUCCESS: |
|---|
| … | … | |
| 1228 | 1238 | if(sid_out) *sid_out = uuidinfo->sid; |
|---|
| 1229 | 1239 | } |
|---|
| | 1240 | static int |
|---|
| | 1241 | uuid_to_sid(const char *uuid_str_in, const char *remote_cn) { |
|---|
| | 1242 | char uuid_str[UUID_STR_LEN+1]; |
|---|
| | 1243 | int sid = 0; |
|---|
| | 1244 | strlcpy(uuid_str, uuid_str_in, sizeof(uuid_str)); |
|---|
| | 1245 | storage_node_quick_lookup(uuid_str, remote_cn, &sid, NULL, NULL, NULL); |
|---|
| | 1246 | return sid; |
|---|
| | 1247 | } |
|---|
| 1230 | 1248 | static void |
|---|
| 1231 | 1249 | stratcon_datastore_journal(struct sockaddr *remote, |
|---|