trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jplev...@apache.org
Subject svn commit: r984874 - in /trafficserver/traffic/trunk/iocore/cache: Cache.cc CacheLink.cc CachePart.cc CacheRead.cc CacheWrite.cc P_CacheInternal.h
Date Thu, 12 Aug 2010 17:44:59 GMT
Author: jplevyak
Date: Thu Aug 12 17:44:58 2010
New Revision: 984874

URL: http://svn.apache.org/viewvc?rev=984874&view=rev
Log:
TS076: fix regression test associated with TS-76

Modified:
    trafficserver/traffic/trunk/iocore/cache/Cache.cc
    trafficserver/traffic/trunk/iocore/cache/CacheLink.cc
    trafficserver/traffic/trunk/iocore/cache/CachePart.cc
    trafficserver/traffic/trunk/iocore/cache/CacheRead.cc
    trafficserver/traffic/trunk/iocore/cache/CacheWrite.cc
    trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h

Modified: trafficserver/traffic/trunk/iocore/cache/Cache.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/Cache.cc?rev=984874&r1=984873&r2=984874&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/Cache.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/Cache.cc Thu Aug 12 17:44:58 2010
@@ -1953,7 +1953,7 @@ LmemHit:
 Action *
 Cache::lookup(Continuation *cont, CacheKey *key, CacheFragType type, char *hostname, int
host_len)
 {
-  if (!(CacheProcessor::cache_ready & type)) {
+  if (!CACHE_READY(type)) {
     cont->handleEvent(CACHE_EVENT_LOOKUP_FAILED, 0);
     return ACTION_RESULT_DONE;
   }
@@ -2075,7 +2075,7 @@ Cache::remove(Continuation *cont, CacheK
   NOWARN_UNUSED(user_agents);
   NOWARN_UNUSED(link);
 
-  if (!(CacheProcessor::cache_ready & type)) {
+  if (!CACHE_READY(type)) {
     if (cont)
       cont->handleEvent(CACHE_EVENT_REMOVE_FAILED, 0);
     return ACTION_RESULT_DONE;

Modified: trafficserver/traffic/trunk/iocore/cache/CacheLink.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CacheLink.cc?rev=984874&r1=984873&r2=984874&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CacheLink.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CacheLink.cc Thu Aug 12 17:44:58 2010
@@ -27,7 +27,7 @@ Action *
 Cache::link(Continuation * cont, CacheKey * from, CacheKey * to, CacheFragType type, char
*hostname, int host_len)
 {
 
-  if (!(CacheProcessor::cache_ready & type)) {
+  if (!CACHE_READY(type)) {
     cont->handleEvent(CACHE_EVENT_LINK_FAILED, 0);
     return ACTION_RESULT_DONE;
   }
@@ -77,7 +77,7 @@ Action *
 Cache::deref(Continuation * cont, CacheKey * key, CacheFragType type, char *hostname, int
host_len)
 {
 
-  if (!(CacheProcessor::cache_ready & type)) {
+  if (!CACHE_READY(type)) {
     cont->handleEvent(CACHE_EVENT_DEREF_FAILED, 0);
     return ACTION_RESULT_DONE;
   }

Modified: trafficserver/traffic/trunk/iocore/cache/CachePart.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CachePart.cc?rev=984874&r1=984873&r2=984874&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CachePart.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CachePart.cc Thu Aug 12 17:44:58 2010
@@ -32,7 +32,7 @@ Action *
 Cache::scan(Continuation * cont, char *hostname, int host_len, int KB_per_second)
 {
   Debug("cache_scan_truss", "inside scan");
-  if (!(CacheProcessor::cache_ready & CACHE_FRAG_TYPE_HTTP)) {
+  if (!CACHE_READY(CACHE_FRAG_TYPE_HTTP)) {
     cont->handleEvent(CACHE_EVENT_SCAN_FAILED, 0);
     return ACTION_RESULT_DONE;
   }

Modified: trafficserver/traffic/trunk/iocore/cache/CacheRead.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CacheRead.cc?rev=984874&r1=984873&r2=984874&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CacheRead.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CacheRead.cc Thu Aug 12 17:44:58 2010
@@ -32,7 +32,7 @@
 Action *
 Cache::open_read(Continuation * cont, CacheKey * key, CacheFragType type, char *hostname,
int host_len)
 {
-  if (!(CacheProcessor::cache_ready & type)) {
+  if (!CACHE_READY(type)) {
     cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }
@@ -93,7 +93,7 @@ Cache::open_read(Continuation * cont, Ca
                  CacheLookupHttpConfig * params, CacheFragType type, char *hostname, int
host_len)
 {
 
-  if (!(CacheProcessor::cache_ready & type)) {
+  if (!CACHE_READY(type)) {
     cont->handleEvent(CACHE_EVENT_OPEN_READ_FAILED, (void *) -ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }

Modified: trafficserver/traffic/trunk/iocore/cache/CacheWrite.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/CacheWrite.cc?rev=984874&r1=984873&r2=984874&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/CacheWrite.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/CacheWrite.cc Thu Aug 12 17:44:58 2010
@@ -192,11 +192,15 @@ CacheVC::handleWrite(int event, Event *e
     frag_len = 0;
   set_agg_write_in_progress();
   POP_HANDLER;
-  agg_len = round_to_approx_size(write_len + header_len + frag_len + sizeofDoc);
+  uint32 to_write = write_len + header_len + sizeofDoc;
+  if (to_write > MAX_FRAG_SIZE) {
+    write_len = MAX_FRAG_SIZE - header_len - sizeofDoc;
+    to_write = MAX_FRAG_SIZE;
+  }
+  agg_len = round_to_approx_size(to_write);
   part->agg_todo_size += agg_len;
-  ink_assert(agg_len <= AGG_SIZE);
   bool agg_error =
-    (agg_len > AGG_SIZE ||
+    (agg_len > AGG_SIZE || header_len + sizeofDoc > MAX_FRAG_SIZE ||
      (!f.readers && (part->agg_todo_size > cache_config_agg_write_backlog +
AGG_SIZE) && write_len));
 #ifdef CACHE_AGG_FAIL_RATE
   agg_error = agg_error || ((uint32) mutex->thread_holding->generator.random() <
@@ -215,6 +219,7 @@ CacheVC::handleWrite(int event, Event *e
       return EVENT_RETURN;
     return handleEvent(AIO_EVENT_DONE, 0);
   }
+  ink_assert(agg_len <= AGG_SIZE);
   if (f.evac_vector)
     part->agg.push(this);
   else
@@ -1592,7 +1597,7 @@ Cache::open_write(Continuation *cont, Ca
                   int options, time_t apin_in_cache, char *hostname, int host_len)
 {
 
-  if (!(CacheProcessor::cache_ready & frag_type)) {
+  if (!CACHE_READY(frag_type)) {
     cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }
@@ -1662,7 +1667,7 @@ Cache::open_write(Continuation *cont, Ca
 {
   NOWARN_UNUSED(key1);
 
-  if (!(CacheProcessor::cache_ready & type)) {
+  if (!CACHE_READY(type)) {
     cont->handleEvent(CACHE_EVENT_OPEN_WRITE_FAILED, (void *) -ECACHE_NOT_READY);
     return ACTION_RESULT_DONE;
   }

Modified: trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h?rev=984874&r1=984873&r2=984874&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h (original)
+++ trafficserver/traffic/trunk/iocore/cache/P_CacheInternal.h Thu Aug 12 17:44:58 2010
@@ -61,6 +61,8 @@ class EvacuationBlock;
 // retry read from writer delay
 #define WRITER_RETRY_DELAY  HRTIME_MSECONDS(50)
 
+#define CACHE_READY(_x) (CacheProcessor::cache_ready & (1 << (_x)))
+
 #ifndef CACHE_LOCK_FAIL_RATE
 #define CACHE_TRY_LOCK(_l, _m, _t) MUTEX_TRY_LOCK(_l, _m, _t)
 #else
@@ -1313,7 +1315,7 @@ CacheProcessor::IsCacheReady(CacheFragTy
 {
   if (IsCacheEnabled() != CACHE_INITIALIZED)
     return 0;
-  return (cache_ready & type);
+  return (cache_ready & (1 << type));
 }
 
 TS_INLINE Cache *



Mime
View raw message