Changeset 9773c9f2c8f4413f348fed53ebb19681bfdfd074

Show
Ignore:
Timestamp:
02/03/10 22:39:30 (5 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
  • src/stratcon.conf.in

    r31fab75 r9773c9f  
    120120      <mapchecktostoragenode><![CDATA[ 
    121121        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 
    123123          FROM stratcon.map_uuid_to_sid($1,$2) 
    124124      ]]></mapchecktostoragenode> 
  • src/stratcon_datastore.c

    r35d80a0 r9773c9f  
    612612      continue; 
    613613 
     614    noitL(noit_error, "stratcon_datastore_find <- (%d, %s)\n", node->sid, remote_cn); 
    614615    cq = get_conn_q_for_remote(NULL, remote_cn, fqdn, dsn); 
    615616    stratcon_database_connect(cq); 
     
    13011302  char *fqdn = NULL; 
    13021303  char *dsn = NULL; 
     1304  char *new_remote_cn = NULL; 
    13031305  int storagenode_id = 0, sid = 0; 
    13041306  if(!noit_hash_retrieve(&uuid_to_info_cache, uuid_str, strlen(uuid_str), 
     
    13101312 
    13111313    /* 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    } 
    13131322 
    13141323    d = calloc(1, sizeof(*d)); 
     
    13261335      } 
    13271336      PG_GET_STR_COL(tmpint, 0, "sid"); 
     1337      if(!tmpint) { 
     1338        row_count = 0; 
     1339        PQclear(d->res); 
     1340        goto bad_row; 
     1341      } 
    13281342      sid = atoi(tmpint); 
    13291343      PG_GET_STR_COL(tmpint, 0, "storage_node_id"); 
     
    13311345      PG_GET_STR_COL(fqdn, 0, "fqdn"); 
    13321346      PG_GET_STR_COL(dsn, 0, "dsn"); 
     1347      PG_GET_STR_COL(new_remote_cn, 0, "remote_cn"); 
    13331348      PQclear(d->res); 
    13341349    } 
     
    13371352    free(d); 
    13381353    release_conn_q(cq); 
    1339     if(row_count != 1) return -1; 
     1354    if(row_count != 1) { 
     1355      return -1; 
     1356    } 
    13401357    /* Place in cache */ 
    13411358    if(fqdn) fqdn = strdup(fqdn); 
     
    13441361    uuidinfo->uuid_str = strdup(uuid_str); 
    13451362    uuidinfo->storagenode_id = storagenode_id; 
    1346     uuidinfo->remote_cn = strdup(remote_cn); 
     1363    uuidinfo->remote_cn = strdup(new_remote_cn); 
    13471364    noit_hash_store(&uuid_to_info_cache, 
    13481365                    uuidinfo->uuid_str, strlen(uuidinfo->uuid_str), uuidinfo);