You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2015/06/15 18:28:10 UTC

[5/6] trafficserver git commit: TS-3580; Apply the cache generation number in ICP

TS-3580; Apply the cache generation number in ICP

In the ICP support, use the current cache generation number to
access cache objects. Note that at this point we cannot tell whether
the cache generation has been overridden for a specific object; we
can only use the global configuration.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/9f71421a
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/9f71421a
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/9f71421a

Branch: refs/heads/master
Commit: 9f71421a15e1a8ee51fd00782947535764a60672
Parents: 7ff2d61
Author: James Peach <jp...@apache.org>
Authored: Mon May 4 20:25:00 2015 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Jun 15 09:16:00 2015 -0700

----------------------------------------------------------------------
 proxy/ICP.cc       | 5 +++--
 proxy/ICP.h        | 6 ++++++
 proxy/ICPConfig.cc | 2 ++
 3 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9f71421a/proxy/ICP.cc
----------------------------------------------------------------------
diff --git a/proxy/ICP.cc b/proxy/ICP.cc
index b3affe4..89232a8 100644
--- a/proxy/ICP.cc
+++ b/proxy/ICP.cc
@@ -454,12 +454,13 @@ ICPPeerReadCont::ICPPeerQueryCont(int /* event ATS_UNUSED */, Event * /* e ATS_U
   SET_HANDLER((ICPPeerReadContHandler)&ICPPeerReadCont::ICPPeerQueryEvent);
   if (_state->_rICPmsg->un.query.URL && *_state->_rICPmsg->un.query.URL) {
     HttpCacheKey key;
+    ICPConfigData *cfg = _ICPpr->GetConfig()->globalConfig();
 
-    Cache::generate_key(&key, &_state->_cachelookupURL); // XXX choose a cache generation number ...
+    Cache::generate_key(&key, &_state->_cachelookupURL, cfg->ICPCacheGeneration());
     _state->_queryResult = ~CACHE_EVENT_LOOKUP_FAILED;
     _start_time = ink_get_hrtime();
 
-    if (pluginFreshnessCalcFunc && _ICPpr->GetConfig()->globalConfig()->ICPStaleLookup()) {
+    if (pluginFreshnessCalcFunc && cfg->ICPStaleLookup()) {
       //////////////////////////////////////////////////////////////
       // Note: _cache_lookup_local is ignored in this case, since
       //       cache clustering is not used with stale lookup.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9f71421a/proxy/ICP.h
----------------------------------------------------------------------
diff --git a/proxy/ICP.h b/proxy/ICP.h
index 321c666..076b305 100644
--- a/proxy/ICP.h
+++ b/proxy/ICP.h
@@ -288,6 +288,11 @@ public:
   {
     return _default_reply_port;
   }
+  inline cache_generation_t
+  ICPCacheGeneration() const
+  {
+    return _cache_generation;
+  }
 
 private:
   //---------------------------------------------------------
@@ -302,6 +307,7 @@ private:
   int _stale_lookup;
   int _reply_to_unknown_peer;
   int _default_reply_port;
+  int64_t _cache_generation;
 };
 
 //----------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9f71421a/proxy/ICPConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc
index 7f4979b..cd56050 100644
--- a/proxy/ICPConfig.cc
+++ b/proxy/ICPConfig.cc
@@ -392,6 +392,8 @@ ICPConfiguration::ICPConfiguration() : _icp_config_callouts(0)
   ICP_EstablishStaticConfigInteger(_icp_cdata_current->_stale_lookup, "proxy.config.icp.stale_icp_enabled");
   ICP_EstablishStaticConfigInteger(_icp_cdata_current->_reply_to_unknown_peer, "proxy.config.icp.reply_to_unknown_peer");
   ICP_EstablishStaticConfigInteger(_icp_cdata_current->_default_reply_port, "proxy.config.icp.default_reply_port");
+  REC_EstablishStaticConfigInteger(_icp_cdata_current->_cache_generation, "proxy.config.http.cache.generation");
+
   UpdateGlobalConfig(); // sync working copy with current
 
   //**********************************************************