Changeset ae8bf798b9af68dc0cd9559a4e9c8076b47575f1
- Timestamp:
- 11/18/09 20:00:24
(4 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
| r71ecd80 |
rae8bf79 |
|
| 30 | 30 | noitd.usage.h: noitd.8 |
|---|
| 31 | 31 | @echo " - creating $@" |
|---|
| 32 | | @$(NROFF) -mandoc ./noitd.8 | \ |
|---|
| | 32 | @$(NROFF) -man ./noitd.8 | \ |
|---|
| 33 | 33 | $(top_srcdir)/buildtools/xml2h NOITD_USAGE > $@ |
|---|
| 34 | 34 | |
|---|
| … | … | |
| 41 | 41 | stratcond.usage.h: stratcond.8 |
|---|
| 42 | 42 | @echo " - creating $@" |
|---|
| 43 | | @$(NROFF) -mandoc ./stratcond.8 | \ |
|---|
| | 43 | @$(NROFF) -man ./stratcond.8 | \ |
|---|
| 44 | 44 | $(top_srcdir)/buildtools/xml2h STRATCOND_USAGE > $@ |
|---|
| 45 | 45 | |
|---|
| r44ff396 |
rae8bf79 |
|
| 133 | 133 | } |
|---|
| 134 | 134 | |
|---|
| 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) |
|---|
| 137 | 137 | #else |
|---|
| 138 | 138 | #define portable_readdir_r readdir_r |
|---|
| r4f5da13 |
rae8bf79 |
|
| 484 | 484 | int i, row_count = 0, good = 0; |
|---|
| 485 | 485 | 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); |
|---|
| 488 | 490 | cq = get_conn_q_for_remote(NULL,NULL,sn->fqdn,sn->dsn); |
|---|
| 489 | 491 | i = 0; |
|---|
| … | … | |
| 496 | 498 | sleep(1); |
|---|
| 497 | 499 | } |
|---|
| 498 | | d = calloc(1, sizeof(*d)); |
|---|
| 499 | | GET_QUERY(check_loadall); |
|---|
| 500 | 500 | PG_EXEC(check_loadall); |
|---|
| 501 | 501 | row_count = PQntuples(d->res); |
|---|
| … | … | |
| 537 | 537 | free_params((ds_single_detail *)d); |
|---|
| 538 | 538 | free(d); |
|---|
| 539 | | release_conn_q(cq); |
|---|
| | 539 | if(cq) release_conn_q(cq); |
|---|
| 540 | 540 | return (void *)(vpsized_int)good; |
|---|
| 541 | 541 | } |
|---|
| … | … | |
| 1326 | 1326 | uuidinfo = vuuidinfo; |
|---|
| 1327 | 1327 | |
|---|
| 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)) { |
|---|
| 1331 | 1330 | /* we don't have dsn and we actually want it */ |
|---|
| 1332 | 1331 | pthread_mutex_lock(&storagenode_to_info_cache_lock); |
|---|
| 1333 | 1332 | if(noit_hash_retrieve(&storagenode_to_info_cache, |
|---|
| 1334 | | (void *)&storagenode_id, sizeof(int), &vinfo)) |
|---|
| | 1333 | (void *)&uuidinfo->storagenode_id, sizeof(int), |
|---|
| | 1334 | &vinfo)) |
|---|
| 1335 | 1335 | info = vinfo; |
|---|
| 1336 | 1336 | pthread_mutex_unlock(&storagenode_to_info_cache_lock); |
|---|
| … | … | |
| 1373 | 1373 | &storagenode_id, NULL, &fqdn, &dsn); |
|---|
| 1374 | 1374 | ij = interim_journal_get(remote, remote_cn, storagenode_id, fqdn); |
|---|
| | 1375 | noitL(noit_error, " %s -> %d/%s { fd: %d, path: %s }\n", uuid_str, storagenode_id, fqdn, |
|---|
| | 1376 | ij->fd, ij->filename); |
|---|
| 1375 | 1377 | } |
|---|
| 1376 | 1378 | } |
|---|
| … | … | |
| 1533 | 1535 | char path[PATH_MAX]; |
|---|
| 1534 | 1536 | DIR *root; |
|---|
| 1535 | | struct dirent de, *entry; |
|---|
| | 1537 | struct dirent *de, *entry; |
|---|
| 1536 | 1538 | int i = 0, cnt = 0; |
|---|
| 1537 | 1539 | char **entries; |
|---|
| | 1540 | int size = 0; |
|---|
| 1538 | 1541 | |
|---|
| 1539 | 1542 | snprintf(path, sizeof(path), "%s%s%s%s%s%s%s", basejpath, |
|---|
| … | … | |
| 1541 | 1544 | second ? "/" : "", second ? second : "", |
|---|
| 1542 | 1545 | 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); |
|---|
| 1543 | 1551 | root = opendir(path); |
|---|
| 1544 | 1552 | 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++; |
|---|
| 1546 | 1554 | closedir(root); |
|---|
| 1547 | 1555 | root = opendir(path); |
|---|
| 1548 | 1556 | if(!root) return; |
|---|
| 1549 | 1557 | 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) { |
|---|
| 1551 | 1559 | if(i < cnt) { |
|---|
| 1552 | 1560 | entries[i++] = strdup(entry->d_name); |
|---|
| … | … | |
| 1559 | 1567 | for(i=0; i<cnt; i++) { |
|---|
| 1560 | 1568 | 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]); |
|---|
| 1561 | 1571 | if(!first) |
|---|
| 1562 | 1572 | stratcon_datastore_sweep_journals_int(entries[i], NULL, NULL); |
|---|
| … | … | |
| 1609 | 1619 | noit_hash_store(&storagenode_to_info_cache, |
|---|
| 1610 | 1620 | (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 : ""); |
|---|
| 1611 | 1624 | } |
|---|
| 1612 | 1625 | } |
|---|
| … | … | |
| 1657 | 1670 | noit_hash_store(&uuid_to_info_cache, |
|---|
| 1658 | 1671 | 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); |
|---|
| 1659 | 1674 | loaded++; |
|---|
| 1660 | 1675 | if(!noit_hash_retrieve(&storagenode_to_info_cache, |
|---|
| … | … | |
| 1667 | 1682 | noit_hash_store(&storagenode_to_info_cache, |
|---|
| 1668 | 1683 | (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 : ""); |
|---|
| 1669 | 1687 | } |
|---|
| 1670 | 1688 | } |
|---|
| rd3656fe |
rae8bf79 |
|
| 439 | 439 | ctx->state = JLOG_STREAMER_WANT_CHKPT; /* falls through */ |
|---|
| 440 | 440 | 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)", |
|---|
| 442 | 443 | ctx->header.chkpt.log, ctx->header.chkpt.marker); |
|---|
| 443 | 444 | n_chkpt.log = htonl(ctx->header.chkpt.log); |
|---|