httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r808220 - in /httpd/httpd/trunk/modules/cache: cache_util.c mod_cache.c
Date Wed, 26 Aug 2009 23:22:18 GMT
Author: minfrin
Date: Wed Aug 26 23:22:18 2009
New Revision: 808220

URL: http://svn.apache.org/viewvc?rev=808220&view=rev
Log:
Reintroduce an optimisation lost in some cut and paste. The cache lock
is removed as soon as we see an EOS, or is removed immediately if a
failure has occurred.

Modified:
    httpd/httpd/trunk/modules/cache/cache_util.c
    httpd/httpd/trunk/modules/cache/mod_cache.c

Modified: httpd/httpd/trunk/modules/cache/cache_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.c?rev=808220&r1=808219&r2=808220&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/cache_util.c (original)
+++ httpd/httpd/trunk/modules/cache/cache_util.c Wed Aug 26 23:22:18 2009
@@ -168,7 +168,7 @@
  * Try obtain a cache wide lock on the given cache key.
  *
  * If we return APR_SUCCESS, we obtained the lock, and we are clear to
- * proceed to the backend. If we return APR_EEXISTS, the the lock is
+ * proceed to the backend. If we return APR_EEXISTS, then the lock is
  * already locked, someone else has gone to refresh the backend data
  * already, so we must return stale data with a warning in the mean
  * time. If we return anything else, then something has gone pear
@@ -177,7 +177,7 @@
  * This lock is created from the request pool, meaning that should
  * something go wrong and the lock isn't deleted on return of the
  * request headers from the backend for whatever reason, at worst the
- * lock will be cleaned up when the request is dies or finishes.
+ * lock will be cleaned up when the request dies or finishes.
  *
  * If something goes truly bananas and the lock isn't deleted when the
  * request dies, the lock will be trashed when its max-age is reached,

Modified: httpd/httpd/trunk/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.c?rev=808220&r1=808219&r2=808220&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.c Wed Aug 26 23:22:18 2009
@@ -393,19 +393,14 @@
 
             /* give someone else the chance to cache the file */
             ap_cache_remove_lock(conf, r, cache->handle ?
-                    (char *)cache->handle->cache_obj->key : NULL, in);
+                    (char *)cache->handle->cache_obj->key : NULL, NULL);
         }
+        else {
+
+        	/* proactively remove the lock as soon as we see the eos bucket */
+            ap_cache_remove_lock(conf, r, cache->handle ?
+                    (char *)cache->handle->cache_obj->key : NULL, in);
 
-        /* proactively remove the lock as soon as we see the eos bucket */
-        for (e = APR_BRIGADE_FIRST(in);
-             e != APR_BRIGADE_SENTINEL(in);
-             e = APR_BUCKET_NEXT(e))
-        {
-            if (APR_BUCKET_IS_EOS(e)) {
-                ap_cache_remove_lock(conf, r, cache->handle ?
-                        (char *)cache->handle->cache_obj->key : NULL, in);
-                break;
-            }
         }
 
         return ap_pass_brigade(f->next, in);
@@ -595,7 +590,7 @@
 
         /* remove the lock file unconditionally */
         ap_cache_remove_lock(conf, r, cache->handle ?
-                (char *)cache->handle->cache_obj->key : NULL, in);
+                (char *)cache->handle->cache_obj->key : NULL, NULL);
 
         /* ship the data up the stack */
         return ap_pass_brigade(f->next, in);
@@ -698,7 +693,7 @@
         /* Caching layer declined the opportunity to cache the response */
         ap_remove_output_filter(f);
         ap_cache_remove_lock(conf, r, cache->handle ?
-                (char *)cache->handle->cache_obj->key : NULL, in);
+                (char *)cache->handle->cache_obj->key : NULL, NULL);
         return ap_pass_brigade(f->next, in);
     }
 
@@ -894,7 +889,7 @@
 
         /* let someone else attempt to cache */
         ap_cache_remove_lock(conf, r, cache->handle ?
-                (char *)cache->handle->cache_obj->key : NULL, in);
+                (char *)cache->handle->cache_obj->key : NULL, NULL);
 
         return ap_pass_brigade(f->next, bb);
     }
@@ -905,7 +900,7 @@
 
         ap_remove_output_filter(f);
         ap_cache_remove_lock(conf, r, cache->handle ?
-                (char *)cache->handle->cache_obj->key : NULL, in);
+                (char *)cache->handle->cache_obj->key : NULL, NULL);
         return ap_pass_brigade(f->next, in);
     }
 
@@ -915,21 +910,13 @@
                      "cache: store_body failed");
         ap_remove_output_filter(f);
         ap_cache_remove_lock(conf, r, cache->handle ?
-                (char *)cache->handle->cache_obj->key : NULL, in);
+                (char *)cache->handle->cache_obj->key : NULL, NULL);
         return ap_pass_brigade(f->next, in);
     }
 
     /* proactively remove the lock as soon as we see the eos bucket */
-    for (e = APR_BRIGADE_FIRST(in);
-         e != APR_BRIGADE_SENTINEL(in);
-         e = APR_BUCKET_NEXT(e))
-    {
-        if (APR_BUCKET_IS_EOS(e)) {
-            ap_cache_remove_lock(conf, r, cache->handle ?
-                    (char *)cache->handle->cache_obj->key : NULL, in);
-            break;
-        }
-    }
+    ap_cache_remove_lock(conf, r, cache->handle ?
+            (char *)cache->handle->cache_obj->key : NULL, in);
 
     return ap_pass_brigade(f->next, in);
 }



Mime
View raw message