Updated Branches: refs/heads/master 44fe5296e -> 354fbc267
TS-2384: Regression in key-lookup code between 4.0.x and 4.1.x Revert "TS-302: Fix HTTPCacheAlt to use INK_MD5 directly instead of arrays of uin32_t. Simplify methods because of this." This reverts commit c40c601c9167c4937f972daf7825821e527a5f67. This breaks cache keys on certain builds. It's not clear why, but we should remove this from 4.1.x so that we can have a stable release. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/354fbc26 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/354fbc26 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/354fbc26 Branch: refs/heads/master Commit: 354fbc267e2bc2d522ac2d96a7b3b8b5b06fb438 Parents: 44fe529 Author: Phil Sorber <[email protected]> Authored: Sun Nov 24 16:50:03 2013 -0700 Committer: Phil Sorber <[email protected]> Committed: Thu Dec 5 14:58:02 2013 -0700 ---------------------------------------------------------------------- CHANGES | 2 ++ proxy/hdrs/HTTP.cc | 17 ++++++++++++++--- proxy/hdrs/HTTP.h | 44 ++++++++++++++++++++++++++++++++++++-------- 3 files changed, 52 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/354fbc26/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 363b915..a11ebca 100644 --- a/CHANGES +++ b/CHANGES @@ -61,6 +61,8 @@ Changes with Apache Traffic Server 4.2.0 *) [TS-2348] Rename tstop to traffic_top. + *) [TS-2384] Fix regression in key-lookup code between 4.0.x and 4.1.x + *) [TS-2340] Fix TextLogObject log rolling. Author: bettydramit <[email protected]> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/354fbc26/proxy/hdrs/HTTP.cc ---------------------------------------------------------------------- diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc index 18c6813..6ecaf35 100644 --- a/proxy/hdrs/HTTP.cc +++ b/proxy/hdrs/HTTP.cc @@ -1693,11 +1693,18 @@ ClassAllocator<HTTPCacheAlt> httpCacheAltAllocator("httpCacheAltAllocator"); HTTPCacheAlt::HTTPCacheAlt(): m_magic(CACHE_ALT_MAGIC_ALIVE), m_writeable(1), m_unmarshal_len(-1), -m_id(-1), m_rid(-1), m_object_key(), m_object_size(0), m_request_hdr(), +m_id(-1), m_rid(-1), m_request_hdr(), m_response_hdr(), m_request_sent_time(0), m_response_received_time(0), m_frag_offset_count(0), m_frag_offsets(0), m_ext_buffer(NULL) { + + m_object_key[0] = 0; + m_object_key[1] = 0; + m_object_key[2] = 0; + m_object_key[3] = 0; + m_object_size[0] = 0; + m_object_size[1] = 0; } void @@ -1726,8 +1733,12 @@ HTTPCacheAlt::copy(HTTPCacheAlt *to_copy) m_unmarshal_len = to_copy->m_unmarshal_len; m_id = to_copy->m_id; m_rid = to_copy->m_rid; - m_object_key = to_copy->m_object_key; - m_object_size = to_copy->m_object_size; + m_object_key[0] = to_copy->m_object_key[0]; + m_object_key[1] = to_copy->m_object_key[1]; + m_object_key[2] = to_copy->m_object_key[2]; + m_object_key[3] = to_copy->m_object_key[3]; + m_object_size[0] = to_copy->m_object_size[0]; + m_object_size[1] = to_copy->m_object_size[1]; if (to_copy->m_request_hdr.valid()) { m_request_hdr.copy(&to_copy->m_request_hdr); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/354fbc26/proxy/hdrs/HTTP.h ---------------------------------------------------------------------- diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h index 91b684d..45a59bf 100644 --- a/proxy/hdrs/HTTP.h +++ b/proxy/hdrs/HTTP.h @@ -1307,8 +1307,8 @@ struct HTTPCacheAlt int32_t m_id; int32_t m_rid; - INK_MD5 m_object_key; - int64_t m_object_size; + int32_t m_object_key[4]; + int32_t m_object_size[2]; HTTPHdr m_request_hdr; HTTPHdr m_response_hdr; @@ -1447,37 +1447,65 @@ HTTPInfo::operator =(const HTTPInfo & m) inline INK_MD5 HTTPInfo::object_key_get() { - return m_alt->m_object_key; + INK_MD5 val; + int32_t* pi = reinterpret_cast<int32_t*>(&val); + + pi[0] = m_alt->m_object_key[0]; + pi[1] = m_alt->m_object_key[1]; + pi[2] = m_alt->m_object_key[2]; + pi[3] = m_alt->m_object_key[3]; + + return val; } inline void HTTPInfo::object_key_get(INK_MD5 *md5) { - *md5 = m_alt->m_object_key; + int32_t* pi = reinterpret_cast<int32_t*>(md5); + pi[0] = m_alt->m_object_key[0]; + pi[1] = m_alt->m_object_key[1]; + pi[2] = m_alt->m_object_key[2]; + pi[3] = m_alt->m_object_key[3]; } inline bool HTTPInfo::compare_object_key(const INK_MD5 *md5) { - return m_alt->m_object_key == *md5; + int32_t const* pi = reinterpret_cast<int32_t const*>(md5); + return ((m_alt->m_object_key[0] == pi[0]) && + (m_alt->m_object_key[1] == pi[1]) && + (m_alt->m_object_key[2] == pi[2]) && + (m_alt->m_object_key[3] == pi[3]) + ); } inline int64_t HTTPInfo::object_size_get() { - return m_alt->m_object_size; + int64_t val; + int32_t* pi = reinterpret_cast<int32_t*>(&val); + + pi[0] = m_alt->m_object_size[0]; + pi[1] = m_alt->m_object_size[1]; + return val; } inline void HTTPInfo::object_key_set(INK_MD5 & md5) { - m_alt->m_object_key = md5; + int32_t* pi = reinterpret_cast<int32_t*>(&md5); + m_alt->m_object_key[0] = pi[0]; + m_alt->m_object_key[1] = pi[1]; + m_alt->m_object_key[2] = pi[2]; + m_alt->m_object_key[3] = pi[3]; } inline void HTTPInfo::object_size_set(int64_t size) { - m_alt->m_object_size = size; + int32_t* pi = reinterpret_cast<int32_t*>(&size); + m_alt->m_object_size[0] = pi[0]; + m_alt->m_object_size[1] = pi[1]; } inline HTTPInfo::FragOffset*
