Author: zwoop
Date: Tue Jan 25 00:39:18 2011
New Revision: 1063082

URL: http://svn.apache.org/viewvc?rev=1063082&view=rev
Log:
TS-643 unable to purge objects on other servers in full cluster mode

Author: Zhao Yongming
Review and small cleanup changes: Leif

Modified:
    trafficserver/traffic/trunk/iocore/cache/Cache.cc
    trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h
    trafficserver/traffic/trunk/proxy/http/HttpSM.cc

Modified: trafficserver/traffic/trunk/iocore/cache/Cache.cc
URL: 
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/Cache.cc?rev=1063082&r1=1063081&r2=1063082&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/Cache.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/Cache.cc Tue Jan 25 00:39:18 2011
@@ -2150,25 +2150,11 @@ Cache::remove(Continuation *cont, CacheK
   else
     return &c->_action;
 }
-
-#ifdef NON_MODULAR
-Action *
-Cache::remove(Continuation *cont, CacheURL *url, CacheFragType type)
-{
-  INK_MD5 md5;
-  url->MD5_get(&md5);
-  int host_len = 0;
-  const char *hostname = url->host_get(&host_len);
-  return remove(cont, &md5, type, true, false, (char *) hostname, host_len);
-}
-#endif
-
 // CacheVConnection
 
 CacheVConnection::CacheVConnection()
-:VConnection(NULL)
-{
-}
+  : VConnection(NULL)
+{ }
 
 void
 cplist_init()
@@ -2544,6 +2530,7 @@ Cache::key_to_part(CacheKey *key, char *
   uint32_t h = (key->word(2) >> DIR_TAG_WIDTH) % PART_HASH_TABLE_SIZE;
   unsigned short *hash_table = hosttable->gen_host_rec.part_hash_table;
   CacheHostRecord *host_rec = &hosttable->gen_host_rec;
+
   if (hosttable->m_numEntries > 0 && host_len) {
     CacheHostResult res;
     hosttable->Match(hostname, host_len, &res);
@@ -2801,14 +2788,28 @@ CacheProcessor::open_write(Continuation 
 }
 
 //----------------------------------------------------------------------------
+// Note: this should not be called from from the cluster processor, or bad
+// recursion could occur. This is merely a convenience wrapper.
 Action *
 CacheProcessor::remove(Continuation *cont, URL *url, CacheFragType frag_type)
 {
+  INK_MD5 md5;
+  int len = 0;
+  const char *hostname;
+
+  url->MD5_get(&md5);
+  hostname = url->host_get(&len);
+
+  Debug("cache_remove", "[CacheProcessor::remove] Issuing cache delete for 
%s", url->string_get_ref());
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0) {
+    // Remove from cluster
+    return remove(cont, &md5, frag_type, true, false, const_cast<char 
*>(hostname), len);
   }
 #endif
-  return caches[frag_type]->remove(cont, url, frag_type);
+
+  // Remove from local cache only.
+  return caches[frag_type]->remove(cont, &md5, frag_type, true, false, 
const_cast<char*>(hostname), len);
 }
 
 #endif

Modified: trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h
URL: 
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h?rev=1063082&r1=1063081&r2=1063082&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h (original)
+++ trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h Tue Jan 25 
00:39:18 2011
@@ -974,7 +974,6 @@ struct Cache
   Action *open_write(Continuation *cont, URL *url, CacheHTTPHdr *request,
                      CacheHTTPInfo *old_info, time_t pin_in_cache = (time_t) 0,
                      CacheFragType type = CACHE_FRAG_TYPE_HTTP);
-  Action *remove(Continuation *cont, URL *url, CacheFragType type);
   static void generate_key(INK_MD5 *md5, URL *url, CacheHTTPHdr *request);
 #endif
 
@@ -1174,6 +1173,7 @@ TS_INLINE Action *
 CacheProcessor::remove(Continuation *cont, CacheKey *key, CacheFragType 
frag_type,
                        bool rm_user_agents, bool rm_link, char *hostname, int 
host_len)
 {
+  Debug("cache_remove", "[CacheProcessor::remove] Issuing cache delete for 
%u", cache_hash(*key));
 #ifdef CLUSTER_CACHE
   if (cache_clustering_enabled > 0) {
     ClusterMachine *m = cluster_machine_at_depth(cache_hash(*key));

Modified: trafficserver/traffic/trunk/proxy/http/HttpSM.cc
URL: 
http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpSM.cc?rev=1063082&r1=1063081&r2=1063082&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpSM.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpSM.cc Tue Jan 25 00:39:18 2011
@@ -3963,14 +3963,12 @@ HttpSM::do_cache_delete_all_alts(Continu
   ink_assert(md5a == md5b || t_state.txn_conf.maintain_pristine_host_hdr);
 #endif
 
-  Debug("http_seq", "[HttpSM::do_cache_update] Issuing cache delete for %s",
+  Debug("http_seq", "[HttpSM::do_cache_delete_all_alts] Issuing cache delete 
for %s",
         t_state.cache_info.lookup_url->string_get_ref());
 
   Action *cache_action_handle = NULL;
 
-  cache_action_handle = cacheProcessor.remove(cont,   // continuation
-                                              t_state.cache_info.lookup_url); 
// url
-
+  cache_action_handle = cacheProcessor.remove(cont, 
t_state.cache_info.lookup_url);
   if (cont != NULL) {
     if (cache_action_handle != ACTION_RESULT_DONE) {
       ink_assert(!pending_action);


Reply via email to