]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport r1306409 from trunk:
authorRuediger Pluem <rpluem@apache.org>
Wed, 15 Aug 2012 10:35:21 +0000 (10:35 +0000)
committerRuediger Pluem <rpluem@apache.org>
Wed, 15 Aug 2012 10:35:21 +0000 (10:35 +0000)
* Add the forcerecovery balancer parameter that determines if recovery for
  balancer workers without considering the retry value of workers is enforced.
  There might be cases where an already overloaded backend can get into deeper
  trouble if the recovery of all workers is enforced without considering the
  retry parameter of each worker

Submitted by: rpluem
Reviewed by: rpluem, sf, rjung

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1373320 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
docs/manual/mod/mod_proxy.xml
include/ap_mmn.h
modules/proxy/mod_proxy.c
modules/proxy/mod_proxy.h
modules/proxy/mod_proxy_balancer.c
modules/proxy/proxy_util.c

diff --git a/CHANGES b/CHANGES
index c6928d8492ab376a549fc80ce4738bd0318cacd5..03a5084cc8a829cbb06f9a097dad19c2edc91332 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -22,6 +22,9 @@ Changes with Apache 2.2.23
   *) core: Fix building against PCRE 8.30 by switching from the obsolete
      pcre_info() to pcre_fullinfo(). PR 52623 [Ruediger Pluem, Rainer Jung]
 
+  *) mod_proxy: Add the forcerecovery balancer parameter that determines if
+     recovery for balancer workers is enforced. [Ruediger Pluem]
+
 Changes with Apache 2.2.22
 
   *) SECURITY: CVE-2011-3368 (cve.mitre.org)
diff --git a/STATUS b/STATUS
index 3c4af40dcb15503793dfc72ac8523de84d02a54f..69304fbb3cc3ff5dbc323cb7cec1363020f849eb 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -93,16 +93,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * mod_proxy: Add the forcerecovery balancer parameter that determines if
-     recovery for balancer workers is enforced.
-    Trunk version of patch:
-       http://svn.apache.org/viewvc?rev=1306409&view=rev
-    Backport version for 2.2.x of patch:
-       http://people.apache.org/~rpluem/patches/forcerecovery_2.2.diff
-    +1: rpluem, sf, rjung
-    sf notes: The docs should get a compatibility note once it is clear
-              in which 2.2.x version it gets introduced.
-
   * mod_dumpio: Return an error code from a previous input filter
     PR 52914
     Trunk patch: http://svn.apache.org/viewvc?rev=1301111&view=rev
index 0577b69378353849346e798f8fa4a5a8e0e7dc56..6969dfcd021838341213eafa71923f1ec7001e36 100644 (file)
@@ -1005,6 +1005,16 @@ expressions</description>
         in the list. Worker recovery behaves the same as other worker errors.
         Available with Apache HTTP Server 2.2.17 and later.
     </td></tr>
+    <tr><td>forcerecovery</td>
+        <td>On</td>
+        <td>Force the immediate recovery of all workers without considering the
+        retry parameter of the workers if all workers of a balancer are
+        in error state. There might be cases where an already overloaded backend
+        can get into deeper trouble if the recovery of all workers is enforced
+        without considering the retry parameter of each worker. In this case
+        set to <code>Off</code>.
+        Available with Apache HTTP Server 2.2.23 and later.
+    </td></tr>
     
     </table>
     <p>A sample balancer setup</p>
index bee9853a4a5408b2c130346eb42c6f80afd2d59c..f8ebeb7fae4598dde185cc2976e569f9ed273129 100644 (file)
  *                      altered in 2.2.18.  Add ap_unescape_url_keep2f_ex().
  * 20051115.29 (2.2.21) add max_ranges to core_dir_config
  * 20051115.30 (2.2.21) add ap_set_accept_ranges()
+ * 20051115.31 (2.2.23) Add forcerecovery to proxy_balancer_shared struct
  */
 
 #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */
 #ifndef MODULE_MAGIC_NUMBER_MAJOR
 #define MODULE_MAGIC_NUMBER_MAJOR 20051115
 #endif
-#define MODULE_MAGIC_NUMBER_MINOR 30                    /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 31                    /* 0...n */
 
 /**
  * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
index fb9ff39dd32760b975df0a39e48828c08df3fbb3..8f8b61914e573673dc4b0806fcd888ebf8cd5a66 100644 (file)
@@ -387,6 +387,14 @@ static const char *set_balancer_param(proxy_server_conf *conf,
         }
 
     }
+    else if (!strcasecmp(key, "forcerecovery")) {
+        if (!strcasecmp(val, "on"))
+            balancer->forcerecovery = 1;
+        else if (!strcasecmp(val, "off"))
+            balancer->forcerecovery = 0;
+        else
+            return "forcerecovery must be On|Off";
+    }
     else {
         return "unknown Balancer parameter";
     }
index 97bb8c68a9f24336f7a8b8fcad79f45ba35608c9..759ae4a66ef4d77e20aa662c740f67079fa9b8a9 100644 (file)
@@ -388,6 +388,7 @@ struct proxy_balancer {
     int             scolonsep;  /* true if ';' seps sticky session paths */
 
     apr_array_header_t *errstatuses; /* statuses to force members into error */
+    int forcerecovery; /* Force recovery if all workers are in error state */
 };
 
 struct proxy_balancer_method {
index 90f3d086edd9caa2402ff720b5464e65d283fb2d..f757670a5b71d1c72ebec8c7a383f126a65e76d7 100644 (file)
@@ -417,7 +417,7 @@ static void force_recovery(proxy_balancer *balancer, server_rec *s)
             }
         }
     }
-    if (!ok) {
+    if (!ok && balancer->forcerecovery) {
         /* If all workers are in error state force the recovery.
          */
         worker = (proxy_worker *)balancer->workers->elts;
index a86c63d42fd04cf86e58f18c13591cf5f8fd5f47..c64b0db5b1ad7c3604a96a604184273ae9f15cf8 100644 (file)
@@ -1313,6 +1313,8 @@ PROXY_DECLARE(const char *) ap_proxy_add_balancer(proxy_balancer **balancer,
     (*balancer)->name = uri;
     (*balancer)->lbmethod = lbmethod;
     (*balancer)->workers = apr_array_make(p, 5, sizeof(proxy_worker));
+
+    (*balancer)->forcerecovery = 1;
     /* XXX Is this a right place to create mutex */
 #if APR_HAS_THREADS
     if (apr_thread_mutex_create(&((*balancer)->mutex),