You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2014/07/06 23:55:03 UTC

svn commit: r1608302 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS modules/cache/cache_storage.c

Author: covener
Date: Sun Jul  6 21:55:03 2014
New Revision: 1608302

URL: http://svn.apache.org/r1608302
Log:
   * mod_cache: Don't remove stale cache entries that cannot be conditionally
     revalidated. This prevents the thundring herd protection from serving
     stale during a revalidation. Reverts most of r572626 which is also gone
     from later branches.   PR 50317.

Submitted By: covener, jkaluza, rpluem
Reviewed By: covener, jkaluza, ylavic

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=1608302&r1=1608301&r2=1608302&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Sun Jul  6 21:55:03 2014
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.28
 
+  *) mod_cache: Don't remove stale cache entries that cannot be conditionally
+    revalidated. This prevents the thundring herd protection from serving
+    stale responses during a revalidation. PR 50317.
+    [Eric Covener, Jan Kaluza,  Ruediger Pluem]
 
   *) core: Increase TCP_DEFER_ACCEPT socket option to from 1 to 30 seconds. 
      PR 41270. [Dean Gaudet <dean arctic org>]

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=1608302&r1=1608301&r2=1608302&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Sun Jul  6 21:55:03 2014
@@ -99,15 +99,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * mod_cache: Don't remove stale cache entries that cannot be conditionally
-     revalidated. This prevents the thundring herd protection from serving
-     stale during a revalidation. Reverts most of r572626 which is also gone
-     from later branches.   PR 50317.
-     trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1023398
-     2.2.x patch: http://people.apache.org/~covener/patches/httpd-2.2.x-thunder.diff 
-         (+ CHANGES)
-     +1: covener, jkaluza, ylavic
-
    * mod_rewrite: Support session cookies with the CO= flag when later parameters
      are used.  The doc for this implied the feature had been backported for
      quite some time.  PR56014

Modified: httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c?rev=1608302&r1=1608301&r2=1608302&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c (original)
+++ httpd/httpd/branches/2.2.x/modules/cache/cache_storage.c Sun Jul  6 21:55:03 2014
@@ -281,6 +281,7 @@ int cache_select(request_rec *r)
                 /* Make response into a conditional */
                 cache->stale_headers = apr_table_copy(r->pool,
                                                       r->headers_in);
+                cache->stale_handle = h;
 
                 /* We can only revalidate with our own conditionals: remove the
                  * conditions from the original request.
@@ -291,12 +292,6 @@ int cache_select(request_rec *r)
                 apr_table_unset(r->headers_in, "If-Range");
                 apr_table_unset(r->headers_in, "If-Unmodified-Since");
 
-                /*
-                 * Do not do Range requests with our own conditionals: If
-                 * we get 304 the Range does not matter and otherwise the
-                 * entity changed and we want to have the complete entity
-                 */
-                apr_table_unset(r->headers_in, "Range");
 
                 etag = apr_table_get(h->resp_hdrs, "ETag");
                 lastmod = apr_table_get(h->resp_hdrs, "Last-Modified");
@@ -314,23 +309,13 @@ int cache_select(request_rec *r)
                         apr_table_set(r->headers_in, "If-Modified-Since",
                                       lastmod);
                     }
-                    cache->stale_handle = h;
-                }
-                else {
-                    int irv;
-
                     /*
-                     * The copy isn't fresh enough, but we cannot revalidate.
-                     * So it is the same case as if there had not been a cached
-                     * entry at all. Thus delete the entry from cache.
+                     * Do not do Range requests with our own conditionals: If
+                     * we get 304 the Range does not matter and otherwise the
+                     * entity changed and we want to have the complete entity
                      */
-                    irv = cache->provider->remove_url(h, r->pool);
-                    if (irv != OK) {
-                        ap_log_error(APLOG_MARK, APLOG_DEBUG, irv, r->server,
-                                     "cache: attempt to remove url from cache unsuccessful.");
-                    }
+                    apr_table_unset(r->headers_in, "Range");
                 }
-
                 return DECLINED;
             }