Changeset ae8bf798b9af68dc0cd9559a4e9c8076b47575f1

Show
Ignore:
Timestamp:
11/18/09 20:00:24 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1258574424 +0000
git-parent:

[f8b58d6bc1f33a57d7e2f8079b5b8f5b30e7fabb]

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

Fix readdir on solaris and a bug in fetching the fqdn for storage nodes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/man/Makefile.in

    r71ecd80 rae8bf79  
    3030noitd.usage.h:  noitd.8 
    3131        @echo " - creating $@" 
    32         @$(NROFF)  -mandoc ./noitd.8 | \ 
     32        @$(NROFF)  -man ./noitd.8 | \ 
    3333                $(top_srcdir)/buildtools/xml2h NOITD_USAGE > $@ 
    3434 
     
    4141stratcond.usage.h:      stratcond.8 
    4242        @echo " - creating $@" 
    43         @$(NROFF)  -mandoc ./stratcond.8 | \ 
     43        @$(NROFF)  -man ./stratcond.8 | \ 
    4444                $(top_srcdir)/buildtools/xml2h STRATCOND_USAGE > $@ 
    4545 
  • src/noit_defines.h

    r44ff396 rae8bf79  
    133133} 
    134134 
    135 #if defined(__sun) 
    136 #define portable_readdir_r(a,b,c) ((*c) = readdir_r(a,b)
     135#if defined(__sun) && !defined(_POSIX_PTHREAD_SEMANTICS) 
     136#define portable_readdir_r(a,b,c) (((*c) = readdir_r(a,b)) != NULL
    137137#else 
    138138#define portable_readdir_r readdir_r 
  • src/stratcon_datastore.c

    r4f5da13 rae8bf79  
    484484  int i, row_count = 0, good = 0; 
    485485  char buff[1024]; 
    486   conn_q *cq; 
    487  
     486  conn_q *cq = NULL; 
     487 
     488  d = calloc(1, sizeof(*d)); 
     489  GET_QUERY(check_loadall); 
    488490  cq = get_conn_q_for_remote(NULL,NULL,sn->fqdn,sn->dsn); 
    489491  i = 0; 
     
    496498    sleep(1); 
    497499  } 
    498   d = calloc(1, sizeof(*d)); 
    499   GET_QUERY(check_loadall); 
    500500  PG_EXEC(check_loadall); 
    501501  row_count = PQntuples(d->res); 
     
    537537  free_params((ds_single_detail *)d); 
    538538  free(d); 
    539   release_conn_q(cq); 
     539  if(cq) release_conn_q(cq); 
    540540  return (void *)(vpsized_int)good; 
    541541} 
     
    13261326    uuidinfo = vuuidinfo; 
    13271327 
    1328   if(storagenode_id) { 
    1329     if(uuidinfo && 
    1330        ((!dsn && dsn_out) || (!fqdn && fqdn_out))) { 
     1328  if(uuidinfo && uuidinfo->storagenode_id) { 
     1329    if((!dsn && dsn_out) || (!fqdn && fqdn_out)) { 
    13311330      /* we don't have dsn and we actually want it */ 
    13321331      pthread_mutex_lock(&storagenode_to_info_cache_lock); 
    13331332      if(noit_hash_retrieve(&storagenode_to_info_cache, 
    1334                             (void *)&storagenode_id, sizeof(int), &vinfo)) 
     1333                            (void *)&uuidinfo->storagenode_id, sizeof(int), 
     1334                            &vinfo)) 
    13351335        info = vinfo; 
    13361336      pthread_mutex_unlock(&storagenode_to_info_cache_lock); 
     
    13731373                                    &storagenode_id, NULL, &fqdn, &dsn); 
    13741374          ij = interim_journal_get(remote, remote_cn, storagenode_id, fqdn); 
     1375noitL(noit_error, " %s -> %d/%s { fd: %d, path: %s }\n", uuid_str, storagenode_id, fqdn, 
     1376      ij->fd, ij->filename); 
    13751377        } 
    13761378      } 
     
    15331535  char path[PATH_MAX]; 
    15341536  DIR *root; 
    1535   struct dirent de, *entry; 
     1537  struct dirent *de, *entry; 
    15361538  int i = 0, cnt = 0; 
    15371539  char **entries; 
     1540  int size = 0; 
    15381541 
    15391542  snprintf(path, sizeof(path), "%s%s%s%s%s%s%s", basejpath, 
     
    15411544           second ? "/" : "", second ? second : "", 
    15421545           third ? "/" : "", third ? third : ""); 
     1546#ifdef _PC_NAME_MAX 
     1547  size = pathconf(path, _PC_NAME_MAX); 
     1548#endif 
     1549  size = MIN(size, PATH_MAX + 128); 
     1550  de = alloca(size); 
    15431551  root = opendir(path); 
    15441552  if(!root) return; 
    1545   while(portable_readdir_r(root, &de, &entry) == 0 && entry != NULL) cnt++; 
     1553  while(portable_readdir_r(root, de, &entry) != 0 && entry != NULL) cnt++; 
    15461554  closedir(root); 
    15471555  root = opendir(path); 
    15481556  if(!root) return; 
    15491557  entries = malloc(sizeof(*entries) * cnt); 
    1550   while(portable_readdir_r(root, &de, &entry) == 0 && entry != NULL) { 
     1558  while(portable_readdir_r(root, de, &entry) != 0 && entry != NULL) { 
    15511559    if(i < cnt) { 
    15521560      entries[i++] = strdup(entry->d_name); 
     
    15591567  for(i=0; i<cnt; i++) { 
    15601568    if(!strcmp(entries[i], ".") || !strcmp(entries[i], "..")) continue; 
     1569    noitL(ds_deb, "Processing L%d entry '%s'\n", 
     1570          third ? 4 : second ? 3 : first ? 2 : 1, entries[i]); 
    15611571    if(!first) 
    15621572      stratcon_datastore_sweep_journals_int(entries[i], NULL, NULL); 
     
    16091619      noit_hash_store(&storagenode_to_info_cache, 
    16101620                      (void *)&info->storagenode_id, sizeof(int), info); 
     1621      noitL(ds_deb, "SN[%d] -> { fqdn: '%s', dsn: '%s' }\n", 
     1622            info->storagenode_id, 
     1623            info->fqdn ? info->fqdn : "", info->dsn ? info->dsn : ""); 
    16111624    } 
    16121625  } 
     
    16571670    noit_hash_store(&uuid_to_info_cache, 
    16581671                    uuidinfo->uuid_str, strlen(uuidinfo->uuid_str), uuidinfo); 
     1672    noitL(ds_deb, "CHECK[%s] -> { remote_cn: '%s', storagenode_id: '%d' }\n", 
     1673          uuidinfo->uuid_str, uuidinfo->remote_cn, uuidinfo->storagenode_id); 
    16591674    loaded++; 
    16601675    if(!noit_hash_retrieve(&storagenode_to_info_cache, 
     
    16671682      noit_hash_store(&storagenode_to_info_cache, 
    16681683                      (void *)&info->storagenode_id, sizeof(int), info); 
     1684      noitL(ds_deb, "SN[%d] -> { fqdn: '%s', dsn: '%s' }\n", 
     1685            info->storagenode_id, 
     1686            info->fqdn ? info->fqdn : "", info->dsn ? info->dsn : ""); 
    16691687    } 
    16701688  } 
  • src/stratcon_jlog_streamer.c

    rd3656fe rae8bf79  
    439439        ctx->state = JLOG_STREAMER_WANT_CHKPT; /* falls through */ 
    440440      case JLOG_STREAMER_WANT_CHKPT: 
    441         noitL(noit_debug, "Pushing checkpoint: [%u/%u]\n", 
     441        noitL(noit_debug, "Pushing checkpoint [%s]: [%u/%u]\n", 
     442              nctx->remote_cn ? nctx->remote_cn : "(null)", 
    442443              ctx->header.chkpt.log, ctx->header.chkpt.marker); 
    443444        n_chkpt.log = htonl(ctx->header.chkpt.log);