Changeset 9773c9f2c8f4413f348fed53ebb19681bfdfd074
- Timestamp:
- 02/03/10 22:39:30
(3 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1265236770 +0000
- git-parent:
[64c8a576fd9f20f60a5321197e4800e9ce80bb60]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1265236770 +0000
- Message:
if I don't know the remote_cn, it should return it to me should I pass in null
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r31fab75 |
r9773c9f |
|
| 120 | 120 | <mapchecktostoragenode><![CDATA[ |
|---|
| 121 | 121 | SELECT o_storage_node_id as storage_node_id, o_sid as sid, |
|---|
| 122 | | o_fqdn as fqdn, o_dsn as dsn |
|---|
| | 122 | o_fqdn as fqdn, o_dsn as dsn, o_noit as remote_cn |
|---|
| 123 | 123 | FROM stratcon.map_uuid_to_sid($1,$2) |
|---|
| 124 | 124 | ]]></mapchecktostoragenode> |
|---|
| r35d80a0 |
r9773c9f |
|
| 612 | 612 | continue; |
|---|
| 613 | 613 | |
|---|
| | 614 | noitL(noit_error, "stratcon_datastore_find <- (%d, %s)\n", node->sid, remote_cn); |
|---|
| 614 | 615 | cq = get_conn_q_for_remote(NULL, remote_cn, fqdn, dsn); |
|---|
| 615 | 616 | stratcon_database_connect(cq); |
|---|
| … | … | |
| 1301 | 1302 | char *fqdn = NULL; |
|---|
| 1302 | 1303 | char *dsn = NULL; |
|---|
| | 1304 | char *new_remote_cn = NULL; |
|---|
| 1303 | 1305 | int storagenode_id = 0, sid = 0; |
|---|
| 1304 | 1306 | if(!noit_hash_retrieve(&uuid_to_info_cache, uuid_str, strlen(uuid_str), |
|---|
| … | … | |
| 1310 | 1312 | |
|---|
| 1311 | 1313 | /* We can't do a database lookup without the remote_cn */ |
|---|
| 1312 | | if(!remote_cn) return -1; |
|---|
| | 1314 | if(!remote_cn) { |
|---|
| | 1315 | if(stratcon_datastore_get_enabled()) { |
|---|
| | 1316 | /* We have an authoritatively maintained cache, we don't do lookups */ |
|---|
| | 1317 | return -1; |
|---|
| | 1318 | } |
|---|
| | 1319 | else |
|---|
| | 1320 | remote_cn = "[[null]]"; |
|---|
| | 1321 | } |
|---|
| 1313 | 1322 | |
|---|
| 1314 | 1323 | d = calloc(1, sizeof(*d)); |
|---|
| … | … | |
| 1326 | 1335 | } |
|---|
| 1327 | 1336 | PG_GET_STR_COL(tmpint, 0, "sid"); |
|---|
| | 1337 | if(!tmpint) { |
|---|
| | 1338 | row_count = 0; |
|---|
| | 1339 | PQclear(d->res); |
|---|
| | 1340 | goto bad_row; |
|---|
| | 1341 | } |
|---|
| 1328 | 1342 | sid = atoi(tmpint); |
|---|
| 1329 | 1343 | PG_GET_STR_COL(tmpint, 0, "storage_node_id"); |
|---|
| … | … | |
| 1331 | 1345 | PG_GET_STR_COL(fqdn, 0, "fqdn"); |
|---|
| 1332 | 1346 | PG_GET_STR_COL(dsn, 0, "dsn"); |
|---|
| | 1347 | PG_GET_STR_COL(new_remote_cn, 0, "remote_cn"); |
|---|
| 1333 | 1348 | PQclear(d->res); |
|---|
| 1334 | 1349 | } |
|---|
| … | … | |
| 1337 | 1352 | free(d); |
|---|
| 1338 | 1353 | release_conn_q(cq); |
|---|
| 1339 | | if(row_count != 1) return -1; |
|---|
| | 1354 | if(row_count != 1) { |
|---|
| | 1355 | return -1; |
|---|
| | 1356 | } |
|---|
| 1340 | 1357 | /* Place in cache */ |
|---|
| 1341 | 1358 | if(fqdn) fqdn = strdup(fqdn); |
|---|
| … | … | |
| 1344 | 1361 | uuidinfo->uuid_str = strdup(uuid_str); |
|---|
| 1345 | 1362 | uuidinfo->storagenode_id = storagenode_id; |
|---|
| 1346 | | uuidinfo->remote_cn = strdup(remote_cn); |
|---|
| | 1363 | uuidinfo->remote_cn = strdup(new_remote_cn); |
|---|
| 1347 | 1364 | noit_hash_store(&uuid_to_info_cache, |
|---|
| 1348 | 1365 | uuidinfo->uuid_str, strlen(uuidinfo->uuid_str), uuidinfo); |
|---|