Repository: trafficserver Updated Branches: refs/heads/master 2dbfeae15 -> 14635098e
TS-2982: Interim cache compile errors. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/14635098 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/14635098 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/14635098 Branch: refs/heads/master Commit: 14635098e981ab7b747b05a875a094e69c993186 Parents: 2dbfeae Author: Alan M. Carroll <[email protected]> Authored: Tue Aug 19 21:22:39 2014 -0500 Committer: Alan M. Carroll <[email protected]> Committed: Tue Aug 19 21:22:39 2014 -0500 ---------------------------------------------------------------------- CHANGES | 2 ++ iocore/cache/Cache.cc | 8 ++++---- iocore/cache/P_CacheVol.h | 17 ++++++++++------- 3 files changed, 16 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/14635098/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 3eb8828..a4f0f33 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 5.1.0 + *) [TS-2982] Interim cache compile errors. + *) [TS-2584] Remove assert for negatively cached transformed objects. *) [TS-3001] GlobalSign responds 403 when OCSP request posted without Host header http://git-wip-us.apache.org/repos/asf/trafficserver/blob/14635098/iocore/cache/Cache.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index 36c3012..f75fe0f 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -1824,7 +1824,7 @@ InterimCacheVol::handle_recover_from_data(int event, void *data) if (event == EVENT_IMMEDIATE) { if (header->magic != VOL_MAGIC || header->version.ink_major != CACHE_DB_MAJOR_VERSION) { - Warning("bad header in cache directory for '%s', clearing", hash_text); + Warning("bad header in cache directory for '%s', clearing", hash_text.get()); goto Lclear; } else if (header->sync_serial == 0) { io.aiocb.aio_buf = NULL; @@ -1848,7 +1848,7 @@ InterimCacheVol::handle_recover_from_data(int event, void *data) } else if (event == AIO_EVENT_DONE) { if ((size_t) io.aiocb.aio_nbytes != (size_t) io.aio_result) { - Warning("disk read error on recover '%s', clearing", hash_text); + Warning("disk read error on recover '%s', clearing", hash_text.get()); goto Lclear; } @@ -1860,7 +1860,7 @@ InterimCacheVol::handle_recover_from_data(int event, void *data) while (done < to_check) { Doc *doc = (Doc *) (s + done); if (doc->magic != DOC_MAGIC || doc->write_serial > header->write_serial) { - Warning("no valid directory found while recovering '%s', clearing", hash_text); + Warning("no valid directory found while recovering '%s', clearing", hash_text.get()); goto Lclear; } done += round_to_approx_size(doc->len); @@ -1967,7 +1967,7 @@ Ldone: { recover_pos += EVACUATION_SIZE; if (recover_pos < header->write_pos && (recover_pos + EVACUATION_SIZE >= header->write_pos)) { Debug("cache_init", "Head Pos: %" PRIu64 ", Rec Pos: %" PRIu64 ", Wrapped:%d", header->write_pos, recover_pos, recover_wrapped); - Warning("no valid directory found while recovering '%s', clearing", hash_text); + Warning("no valid directory found while recovering '%s', clearing", hash_text.get()); goto Lclear; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/14635098/iocore/cache/P_CacheVol.h ---------------------------------------------------------------------- diff --git a/iocore/cache/P_CacheVol.h b/iocore/cache/P_CacheVol.h index d8748a3..2c79635 100644 --- a/iocore/cache/P_CacheVol.h +++ b/iocore/cache/P_CacheVol.h @@ -337,7 +337,7 @@ struct MigrateToInterimCache struct InterimCacheVol: public Continuation { - char *hash_id; + ats_scoped_str hash_text; InterimVolHeaderFooter *header; off_t recover_pos; @@ -381,9 +381,12 @@ struct InterimCacheVol: public Continuation } void init(off_t s, off_t l, CacheDisk *interim, Vol *v, InterimVolHeaderFooter *hptr) { - const size_t hash_id_size = strlen(interim->path) + 32; - hash_id = (char *)ats_malloc(hash_id_size); - snprintf(hash_id, hash_id_size, "%s %" PRIu64 ":%" PRIu64 "", interim->path, s, l); + char* seed_str = interim->hash_base_string ? interim->hash_base_string : interim->path; + const size_t hash_seed_size = strlen(seed_str); + const size_t hash_text_size = hash_seed_size + 32; + + hash_text = static_cast<char *>(ats_malloc(hash_text_size)); + snprintf(hash_text, hash_text_size, "%s %" PRIu64 ":%" PRIu64 "", seed_str, s, l); skip = start = s; len = l; @@ -488,17 +491,17 @@ struct Vol: public Continuation } void set_migrate_in_progress(MigrateToInterimCache *m) { - uint32_t indx = m->key.word(3) % MIGRATE_BUCKETS; + uint32_t indx = m->key.slice32(3) % MIGRATE_BUCKETS; mig_hash[indx].enqueue(m); } void set_migrate_failed(MigrateToInterimCache *m) { - uint32_t indx = m->key.word(3) % MIGRATE_BUCKETS; + uint32_t indx = m->key.slice32(3) % MIGRATE_BUCKETS; mig_hash[indx].remove(m); } void set_migrate_done(MigrateToInterimCache *m) { - uint32_t indx = m->key.word(3) % MIGRATE_BUCKETS; + uint32_t indx = m->key.slice32(3) % MIGRATE_BUCKETS; mig_hash[indx].remove(m); history.remove_key(&m->key); }
